From 1407a818f056ce706c4b1d5242dbc115f8cc1653 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Thu, 23 Feb 2023 21:48:51 +0200 Subject: [PATCH] Fix jdk cross-compilation --- flake.nix | 4 ++-- jdk.nix | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 jdk.nix diff --git a/flake.nix b/flake.nix index 324048c..c1ba270 100644 --- a/flake.nix +++ b/flake.nix @@ -7,8 +7,8 @@ outputs = { flake-utils, nixpkgs, ... }: let overlay = final: prev: rec { - jdk-openhab = final.jdk11; - openhab = final.callPackage ./openhab.nix { inherit jdk-openhab; }; + jdk-openhab = final.callPackage ./jdk.nix {}; + openhab = final.callPackage ./openhab.nix { }; openhab-addons = final.callPackage ./openhab-addons.nix {}; }; pkgs = system: import nixpkgs { inherit system; overlays = [ overlay ]; }; diff --git a/jdk.nix b/jdk.nix new file mode 100644 index 0000000..d4d4126 --- /dev/null +++ b/jdk.nix @@ -0,0 +1,18 @@ +{ buildPlatform, hostPlatform, jdk11, which, zip, buildPackages }: + +if buildPlatform == hostPlatform +then jdk11 +else (jdk11.override { + # libIDL does not compile in cross-compile scenarios. + enableGnome2 = false; +}).overrideAttrs (old: { + # lol, nixpkgs can’t get pkgs right + # AUTOCONF = "${autoconf}/bin/autoconf"; + nativeBuildInputs = old.nativeBuildInputs ++ [ which zip ]; + depsBuildBuild = with buildPackages; [ stdenv.cc autoconf ]; + configureFlags = old.configureFlags ++ [ + "--with-jtreg=no" + "--disable-hotspot-gtest" + "--with-build-jdk=${buildPackages.jdk11}" + ]; +})