From 602efddc24de418c96f03e3d5af4f39a1845da3a Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Sun, 4 Nov 2018 22:17:29 +0100 Subject: [PATCH 1/8] xorg.libX11: fix cross --- pkgs/servers/x11/xorg/overrides.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 8f4c251335a..94e19d92117 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -1,5 +1,5 @@ { abiCompat ? null, - stdenv, makeWrapper, lib, fetchurl, fetchpatch, + stdenv, makeWrapper, lib, fetchurl, fetchpatch, buildPackages, automake, autoconf, libtool, intltool, mtdev, libevdev, libinput, python, freetype, tradcpp, fontconfig, @@ -98,6 +98,7 @@ self: super: outputs = [ "out" "dev" "man" ]; configureFlags = attrs.configureFlags or [] ++ malloc0ReturnsNullCrossFlag; + depsBuildBuild = [ buildPackages.stdenv.cc ]; preConfigure = '' sed 's,^as_dummy.*,as_dummy="\$PATH",' -i configure ''; From 2d0fad757ab26d943c1f0f4edf078c6cd8670861 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Sun, 4 Nov 2018 22:16:49 +0100 Subject: [PATCH 2/8] xorg: generate python into nativeBuildInputs --- pkgs/servers/x11/xorg/default.nix | 10 ++++---- .../x11/xorg/generate-expr-from-tarballs.pl | 24 +++++++++++++++++-- pkgs/servers/x11/xorg/overrides.nix | 7 +----- pkgs/top-level/all-packages.nix | 1 - 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix index ccf0dfe9034..1f953e89ec8 100644 --- a/pkgs/servers/x11/xorg/default.nix +++ b/pkgs/servers/x11/xorg/default.nix @@ -1248,7 +1248,7 @@ lib.makeScope newScope (self: with self; { meta.platforms = stdenv.lib.platforms.unix; }) {}; - libxcb = callPackage ({ stdenv, pkgconfig, fetchurl, libxslt, libpthreadstubs, python, libXau, xcbproto, libXdmcp }: stdenv.mkDerivation { + libxcb = callPackage ({ stdenv, pkgconfig, fetchurl, libxslt, libpthreadstubs, libXau, xcbproto, libXdmcp, python }: stdenv.mkDerivation { name = "libxcb-1.13.1"; builder = ./builder.sh; src = fetchurl { @@ -1256,8 +1256,8 @@ lib.makeScope newScope (self: with self; { sha256 = "1i27lvrcsygims1pddpl5c4qqs6z715lm12ax0n3vx0igapvg7x8"; }; hardeningDisable = [ "bindnow" "relro" ]; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ libxslt libpthreadstubs python libXau xcbproto libXdmcp ]; + nativeBuildInputs = [ pkgconfig python ]; + buildInputs = [ libxslt libpthreadstubs libXau xcbproto libXdmcp ]; meta.platforms = stdenv.lib.platforms.unix; }) {}; @@ -1594,8 +1594,8 @@ lib.makeScope newScope (self: with self; { sha256 = "1qdxw9syhbvswiqj5dvj278lrmfhs81apzmvx6205s4vcqg7563v"; }; hardeningDisable = [ "bindnow" "relro" ]; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ python ]; + nativeBuildInputs = [ pkgconfig python ]; + buildInputs = [ ]; meta.platforms = stdenv.lib.platforms.unix; }) {}; diff --git a/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl b/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl index 701a8984ada..aba45a21534 100755 --- a/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl +++ b/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl @@ -23,6 +23,7 @@ my %pkgURLs; my %pkgHashes; my %pkgNames; my %pkgRequires; +my %pkgNativeRequires; my %pcMap; @@ -106,6 +107,7 @@ while (<>) { my $provides = `find $pkgDir -name "*.pc.in"`; my @provides2 = split '\n', $provides; my @requires = (); + my @nativeRequires = (); foreach my $pcFile (@provides2) { my $pc = $pcFile; @@ -163,7 +165,7 @@ while (<>) { } if ($file =~ /AM_PATH_PYTHON/) { - push @requires, "python"; + push @nativeRequires, "python"; } if ($file =~ /AC_PATH_PROG\(FCCACHE/) { @@ -230,7 +232,9 @@ while (<>) { push @requires, "gperf", "m4", "xproto" if $pkg =~ /xcbutil/; print "REQUIRES $pkg => @requires\n"; + print "NATIVE_REQUIRES $pkg => @nativeRequires\n"; $pkgRequires{$pkg} = \@requires; + $pkgNativeRequires{$pkg} = \@nativeRequires; print "done\n"; } @@ -255,6 +259,20 @@ EOF foreach my $pkg (sort (keys %pkgURLs)) { print "$pkg\n"; + my %nativeRequires = (); + my @nativeBuildInputs; + foreach my $req (sort @{$pkgNativeRequires{$pkg}}) { + if (defined $pcMap{$req}) { + # Some packages have .pc that depends on itself. + next if $pcMap{$req} eq $pkg; + if (!defined $nativeRequires{$pcMap{$req}}) { + push @nativeBuildInputs, $pcMap{$req}; + $nativeRequires{$pcMap{$req}} = 1; + } + } else { + print " NOT FOUND: $req\n"; + } + } my %requires = (); my @buildInputs; foreach my $req (sort @{$pkgRequires{$pkg}}) { @@ -270,9 +288,11 @@ foreach my $pkg (sort (keys %pkgURLs)) { } } + my $nativeBuildInputsStr = join "", map { $_ . " " } @nativeBuildInputs; my $buildInputsStr = join "", map { $_ . " " } @buildInputs; my @arguments = @buildInputs; + push @arguments, @nativeBuildInputs; unshift @arguments, "stdenv", "pkgconfig", "fetchurl"; my $argumentsStr = join ", ", @arguments; @@ -290,7 +310,7 @@ foreach my $pkg (sort (keys %pkgURLs)) { sha256 = "$pkgHashes{$pkg}"; }; hardeningDisable = [ "bindnow" "relro" ]; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkgconfig $nativeBuildInputsStr]; buildInputs = [ $buildInputsStr];$extraAttrsStr meta.platforms = stdenv.lib.platforms.unix; }) {}; diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 94e19d92117..46dcdcd9225 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -2,7 +2,7 @@ stdenv, makeWrapper, lib, fetchurl, fetchpatch, buildPackages, automake, autoconf, libtool, intltool, mtdev, libevdev, libinput, - python, freetype, tradcpp, fontconfig, + freetype, tradcpp, fontconfig, libGL, spice-protocol, zlib, libGLU, dbus, libunwind, libdrm, mesa_noglu, udev, bootstrap_cmds, bison, flex, clangStdenv, autoreconfHook, mcpp, epoxy, openssl, pkgconfig, llvm_6, @@ -85,15 +85,10 @@ self: super: }); libxcb = super.libxcb.overrideAttrs (attrs: { - nativeBuildInputs = attrs.nativeBuildInputs ++ [ python ]; configureFlags = [ "--enable-xkb" "--enable-xinput" ]; outputs = [ "out" "dev" "man" "doc" ]; }); - xcbproto = super.xcbproto.overrideAttrs (attrs: { - nativeBuildInputs = attrs.nativeBuildInputs ++ [ python ]; - }); - libX11 = super.libX11.overrideAttrs (attrs: { outputs = [ "out" "dev" "man" ]; configureFlags = attrs.configureFlags or [] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7104b05f26e..31e65c19001 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13941,7 +13941,6 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa; inherit (darwin.apple_sdk.libs) Xplugin; bootstrap_cmds = if stdenv.isDarwin then darwin.bootstrap_cmds else null; - python = python2; # Incompatible with Python 3x udev = if stdenv.isLinux then udev else null; libdrm = if stdenv.isLinux then libdrm else null; abiCompat = config.xorg.abiCompat # `config` because we have no `xorg.override` From b7893a700daf186492a8ba0b3ee77856ae9fcbea Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Thu, 29 Nov 2018 03:37:26 +0100 Subject: [PATCH 3/8] xorg.libXv: fix cross --- pkgs/servers/x11/xorg/overrides.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 46dcdcd9225..afcf2708ac0 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -245,6 +245,8 @@ self: super: libXv = super.libXv.overrideAttrs (attrs: { outputs = [ "out" "dev" "devdoc" ]; + configureFlags = attrs.configureFlags or [] + ++ malloc0ReturnsNullCrossFlag; }); libXvMC = super.libXvMC.overrideAttrs (attrs: { From 9111012f7f543bbe5ba06e92105da9c85d086fc4 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Thu, 29 Nov 2018 03:46:20 +0100 Subject: [PATCH 4/8] luaPackages.luasocket: fix cross --- pkgs/top-level/lua-packages.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index 8d141d7e7c6..8a93f5dff5b 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -596,7 +596,7 @@ let }; patchPhase = stdenv.lib.optionalString stdenv.isDarwin '' - substituteInPlace src/makefile --replace gcc cc \ + substituteInPlace src/makefile \ --replace 10.3 10.5 ''; @@ -604,6 +604,8 @@ let makeFlagsArray=( LUAV=${lua.luaversion} PLAT=${platformString} + CC=''${CC} + LD=''${CC} prefix=$out ); ''; From adaffa3c0107f38753a32e31985ea7be04c5b8b7 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Thu, 29 Nov 2018 04:58:17 +0100 Subject: [PATCH 5/8] cups: fix cross --- pkgs/misc/cups/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix index 38ad73d0160..227886e126f 100644 --- a/pkgs/misc/cups/default.nix +++ b/pkgs/misc/cups/default.nix @@ -60,7 +60,9 @@ stdenv.mkDerivation rec { ++ optional (libpaper != null) "--enable-libpaper" ++ optional stdenv.isDarwin "--disable-launchd"; + # AR has to be an absolute path preConfigure = '' + export AR="${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar" configureFlagsArray+=( # Put just lib/* and locale into $lib; this didn't work directly. # lib/cups is moved back to $out in postInstall. From b014cdd2928c37ad68149428a7d5b87962ea1c22 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Thu, 29 Nov 2018 05:50:02 +0100 Subject: [PATCH 6/8] ssmtp: fix cross --- pkgs/tools/networking/ssmtp/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/tools/networking/ssmtp/default.nix b/pkgs/tools/networking/ssmtp/default.nix index 24e96491f9d..4c906812f64 100644 --- a/pkgs/tools/networking/ssmtp/default.nix +++ b/pkgs/tools/networking/ssmtp/default.nix @@ -26,6 +26,8 @@ stdenv.mkDerivation { sed -e '/INSTALLED_CONFIGURATION_FILE/d' \ -e 's|/lib/sendmail|$(TMPDIR)/sendmail|' \ -i Makefile + substituteInPlace Makefile \ + --replace '$(INSTALL) -s' '$(INSTALL) -s --strip-program $(STRIP)' ''; installFlags = "etcdir=$(out)/etc"; From 06f9b4769b3ee74cd74e915a457b9ce690e019d6 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Thu, 29 Nov 2018 12:51:31 +0100 Subject: [PATCH 7/8] fribidi: fix cross --- pkgs/development/libraries/fribidi/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/fribidi/default.nix b/pkgs/development/libraries/fribidi/default.nix index 08b0a87e3e2..b60f4be245e 100644 --- a/pkgs/development/libraries/fribidi/default.nix +++ b/pkgs/development/libraries/fribidi/default.nix @@ -1,5 +1,6 @@ { stdenv , fetchurl +, fetchpatch , meson , ninja @@ -21,6 +22,13 @@ stdenv.mkDerivation rec { sha256 = "1kp4b1hpx2ky20ixgy2xhj5iygfl7ps5k9kglh1z5i7mhykg4r3a"; }; + patches = [ + (fetchpatch { + url = "https://github.com/fribidi/fribidi/pull/88.patch"; + sha256 = "1n4l6333vhbxfckwg101flmvq6bbygg66fjp69ddcjqaqb6gh9k9"; + }) + ]; + postPatch = '' patchShebangs test ''; From 694b4d29e1d0e4c86d497da437a3eed90910a7db Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Thu, 29 Nov 2018 13:06:12 +0100 Subject: [PATCH 8/8] ilmbase: fix cross --- .../development/libraries/ilmbase/cross.patch | 35 +++++++++++++++++++ .../development/libraries/ilmbase/default.nix | 7 ++-- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/libraries/ilmbase/cross.patch diff --git a/pkgs/development/libraries/ilmbase/cross.patch b/pkgs/development/libraries/ilmbase/cross.patch new file mode 100644 index 00000000000..207a440a0d8 --- /dev/null +++ b/pkgs/development/libraries/ilmbase/cross.patch @@ -0,0 +1,35 @@ +From: Helmut Grohne <> +Subject: compile build tools with the build architecture compiler + +Patch-Source: https://github.com/openexr/openexr/issues/221 + +Index: ilmbase-2.2.0/configure.ac +=================================================================== +--- ilmbase-2.2.0.orig/configure.ac ++++ ilmbase-2.2.0/configure.ac +@@ -28,6 +28,7 @@ + AC_PROG_LN_S + AC_PROG_LIBTOOL + AC_PROG_MAKE_SET ++AX_PROG_CXX_FOR_BUILD + + dnl + dnl PKGCONFIG preparations +Index: ilmbase-2.2.0/Half/Makefile.am +=================================================================== +--- ilmbase-2.2.0.orig/Half/Makefile.am ++++ ilmbase-2.2.0/Half/Makefile.am +@@ -17,9 +17,11 @@ + + CLEANFILES = eLut eLut.h toFloat toFloat.h + +-eLut_SOURCES = eLut.cpp ++eLut$(EXEEXT): eLut.cpp ++ $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ + +-toFloat_SOURCES = toFloat.cpp ++toFloat$(EXEEXT): toFloat.cpp ++ $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ + + eLut.h: eLut + ./eLut > eLut.h diff --git a/pkgs/development/libraries/ilmbase/default.nix b/pkgs/development/libraries/ilmbase/default.nix index 3989e941b6b..98370f52e18 100644 --- a/pkgs/development/libraries/ilmbase/default.nix +++ b/pkgs/development/libraries/ilmbase/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, automake, autoconf, libtool, which }: +{ stdenv, fetchurl, buildPackages, automake, autoconf, libtool, which }: stdenv.mkDerivation rec { name = "ilmbase-${version}"; @@ -16,11 +16,12 @@ stdenv.mkDerivation rec { ./bootstrap ''; - buildInputs = [ automake autoconf libtool which ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + nativeBuildInputs = [ automake autoconf libtool which ]; NIX_CFLAGS_LINK = [ "-pthread" ]; - patches = [ ./bootstrap.patch ]; + patches = [ ./bootstrap.patch ./cross.patch ]; # fails 1 out of 1 tests with # "lt-ImathTest: testBoxAlgo.cpp:892: void {anonymous}::boxMatrixTransform(): Assertion `b21 == b2' failed"