From a23be78ef2788798429e939a97defdbba945bc53 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Thu, 4 Jan 2018 13:25:13 -0600 Subject: [PATCH 1/5] at: cross-compilation fixes * move bison/flex to nativeBuildInputs * add patch to avoid use of undocumented glibc macro * fix use of 'install -s' to avoid invoking 'strip' directly --- pkgs/tools/system/at/default.nix | 15 +++++++++++---- pkgs/tools/system/at/install.patch | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/system/at/default.nix b/pkgs/tools/system/at/default.nix index cc4ccdd40f0..eda2197b9f6 100644 --- a/pkgs/tools/system/at/default.nix +++ b/pkgs/tools/system/at/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv, bison, flex, pam +{ stdenv, fetchurl, fetchpatch, bison, flex, pam , sendmailPath ? "/run/wrappers/bin/sendmail" , atWrapperPath ? "/run/wrappers/bin/at" }: @@ -13,10 +13,17 @@ stdenv.mkDerivation rec { sha256 = "1fgsrqpx0r6qcjxmlsqnwilydhfxn976c870mjc0n1bkmcy94w88"; }; - patches = [ ./install.patch ]; + patches = [ + ./install.patch + (fetchpatch { + url = "https://raw.githubusercontent.com/riscv/riscv-poky/master/meta/recipes-extended/at/at/0001-remove-glibc-assumption.patch"; + sha256 = "1rk4hskp0c1jqkanzdxf873i6jgki3xhrm609fsam8an8sl1njnm"; + }) + ]; - buildInputs = - [ bison flex pam ]; + nativeBuildInputs = [ bison flex ]; + + buildInputs = [ pam ]; preConfigure = '' diff --git a/pkgs/tools/system/at/install.patch b/pkgs/tools/system/at/install.patch index 35be4af875a..41a35a78953 100644 --- a/pkgs/tools/system/at/install.patch +++ b/pkgs/tools/system/at/install.patch @@ -20,7 +20,7 @@ + $(INSTALL) -m 755 -d $(IROOT)$(sbindir) + $(INSTALL) -m 755 -d $(IROOT)$(docdir) + $(INSTALL) -m 755 -d $(IROOT)$(atdocdir) -+ $(INSTALL) -m 0755 -s at $(IROOT)$(bindir) ++ $(INSTALL) -m 0755 at $(IROOT)$(bindir) $(LN_S) -f at $(IROOT)$(bindir)/atq $(LN_S) -f at $(IROOT)$(bindir)/atrm - $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir) @@ -34,7 +34,7 @@ + $(INSTALL) -d -m 755 $(IROOT)$(man1dir) + $(INSTALL) -d -m 755 $(IROOT)$(man5dir) + $(INSTALL) -d -m 755 $(IROOT)$(man8dir) -+ $(INSTALL) -m 755 -s atd $(IROOT)$(sbindir) ++ $(INSTALL) -m 755 atd $(IROOT)$(sbindir) + $(INSTALL) -m 755 atrun $(IROOT)$(sbindir) + $(INSTALL) -m 644 at.1 $(IROOT)$(man1dir)/ cd $(IROOT)$(man1dir) && $(LN_S) -f at.1 atq.1 && $(LN_S) -f at.1 batch.1 && $(LN_S) -f at.1 atrm.1 From 7c992cb7af09b1d108ea48683b887506c0c50dc7 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Thu, 4 Jan 2018 13:15:35 -0600 Subject: [PATCH 2/5] bsdiff: fix 'cc' usage --- pkgs/tools/compression/bsdiff/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/compression/bsdiff/default.nix b/pkgs/tools/compression/bsdiff/default.nix index 1d693f781e6..095bd5f7d9a 100644 --- a/pkgs/tools/compression/bsdiff/default.nix +++ b/pkgs/tools/compression/bsdiff/default.nix @@ -13,8 +13,8 @@ stdenv.mkDerivation rec { patches = [ ./include-systypes.patch ]; buildPhase = '' - cc -O3 -lbz2 bspatch.c -o bspatch - cc -O3 -lbz2 bsdiff.c -o bsdiff + $CC -O3 -lbz2 bspatch.c -o bspatch + $CC -O3 -lbz2 bsdiff.c -o bsdiff ''; installPhase = '' From 681555c11c75337462703c5a2f936fd28ff82e20 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Thu, 4 Jan 2018 10:57:24 -0600 Subject: [PATCH 3/5] lua-5: isMingw -> isMinGW --- pkgs/development/interpreters/lua-5/5.2.nix | 6 +++--- pkgs/development/interpreters/lua-5/5.3.nix | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix index 43e289cd369..0cdc4770a98 100644 --- a/pkgs/development/interpreters/lua-5/5.2.nix +++ b/pkgs/development/interpreters/lua-5/5.2.nix @@ -57,7 +57,7 @@ stdenv.mkDerivation rec { ''; crossAttrs = let - inherit (hostPlatform) isDarwin isMingw; + inherit (hostPlatform) isDarwin isMinGW; in { configurePhase = '' makeFlagsArray=( @@ -65,10 +65,10 @@ stdenv.mkDerivation rec { INSTALL_MAN=$out/share/man/man1 V=${luaversion} R=${version} - ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin '' + ${if isMinGW then "mingw" else stdenv.lib.optionalString isDarwin '' ''} ) - '' + stdenv.lib.optionalString isMingw '' + '' + stdenv.lib.optionalString isMinGW '' installFlagsArray=( TO_BIN="lua.exe luac.exe" TO_LIB="liblua.a lua52.dll" diff --git a/pkgs/development/interpreters/lua-5/5.3.nix b/pkgs/development/interpreters/lua-5/5.3.nix index a512a251313..ad1dfa8823c 100644 --- a/pkgs/development/interpreters/lua-5/5.3.nix +++ b/pkgs/development/interpreters/lua-5/5.3.nix @@ -56,7 +56,7 @@ stdenv.mkDerivation rec { ''; crossAttrs = let - inherit (hostPlatform) isDarwin isMingw; + inherit (hostPlatform) isDarwin isMinGW; in { configurePhase = '' makeFlagsArray=( @@ -64,10 +64,10 @@ stdenv.mkDerivation rec { INSTALL_MAN=$out/share/man/man1 V=${luaversion} R=${version} - ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin '' + ${if isMinGW then "mingw" else stdenv.lib.optionalString isDarwin '' ''} ) - '' + stdenv.lib.optionalString isMingw '' + '' + stdenv.lib.optionalString isMinGW '' installFlagsArray=( TO_BIN="lua.exe luac.exe" TO_LIB="liblua.a lua52.dll" From bef09dcca11163f030608eaa2577ce9f52a8324b Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Tue, 17 Oct 2017 17:05:19 -0400 Subject: [PATCH 4/5] krb5: Allow cross-compilation --- pkgs/development/libraries/kerberos/krb5.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix index 101c3aca07d..98073b7bbdc 100644 --- a/pkgs/development/libraries/kerberos/krb5.nix +++ b/pkgs/development/libraries/kerberos/krb5.nix @@ -22,7 +22,12 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" ]; configureFlags = [ "--with-tcl=no" "--localstatedir=/var/lib"] - ++ optional stdenv.isFreeBSD ''WARN_CFLAGS=""''; + ++ optional stdenv.isFreeBSD ''WARN_CFLAGS=""'' + ++ optionals (stdenv.buildPlatform != stdenv.hostPlatform) + [ "krb5_cv_attr_constructor_destructor=yes,yes" + "ac_cv_func_regcomp=yes" + "ac_cv_printf_positional=yes" + ]; nativeBuildInputs = [ pkgconfig perl ] ++ optional (!libOnly) yacc From 6db707fe7e0b65afb9c306b798e1aeae743f1b51 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 27 Oct 2017 17:13:21 -0400 Subject: [PATCH 5/5] pkgconfig: Enable cross-compilation (cherry picked from commit 91fdb2f9caf5ce14acb87f3b877216aeb2590e7e) --- pkgs/development/tools/misc/pkgconfig/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/misc/pkgconfig/default.nix b/pkgs/development/tools/misc/pkgconfig/default.nix index 5be42855a9c..7cfd78a39a2 100644 --- a/pkgs/development/tools/misc/pkgconfig/default.nix +++ b/pkgs/development/tools/misc/pkgconfig/default.nix @@ -24,7 +24,15 @@ stdenv.mkDerivation rec { buildInputs = optional (stdenv.isCygwin || stdenv.isDarwin || stdenv.isSunOS) libiconv; configureFlags = [ "--with-internal-glib" ] - ++ optional (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ]; + ++ optional (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ] + # Can't run these tests while cross-compiling + ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) + [ "glib_cv_stack_grows=no" + "glib_cv_uscore=no" + "ac_cv_func_posix_getpwuid_r=yes" + "ac_cv_func_posix_getgrgid_r=yes" + ]; + postInstall = ''rm -f "$out"/bin/*-pkg-config''; # clean the duplicate file