summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-02-26 07:42:21 -0500
committerShea Levy <shea@shealevy.com>2018-02-26 07:42:21 -0500
commit044c65bd06e969411f2771e093cf89fd42bbbaf5 (patch)
tree388a232f73fb499e2df08728cd46e602d0fb66db /pkgs
parent4f08b0fbac17c201216abbd776ce3bb292ed4946 (diff)
parent9d2af8d61ca651b5ad505c37f42e10ace4894fc2 (diff)
downloadnixpkgs-044c65bd06e969411f2771e093cf89fd42bbbaf5.tar
nixpkgs-044c65bd06e969411f2771e093cf89fd42bbbaf5.tar.gz
nixpkgs-044c65bd06e969411f2771e093cf89fd42bbbaf5.tar.bz2
nixpkgs-044c65bd06e969411f2771e093cf89fd42bbbaf5.tar.lz
nixpkgs-044c65bd06e969411f2771e093cf89fd42bbbaf5.tar.xz
nixpkgs-044c65bd06e969411f2771e093cf89fd42bbbaf5.tar.zst
nixpkgs-044c65bd06e969411f2771e093cf89fd42bbbaf5.zip
Merge branch 'systemd-cross' into staging
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix4
-rw-r--r--pkgs/development/compilers/gcc/7/riscv-pthread-reentrant.patch13
-rw-r--r--pkgs/development/interpreters/guile/2.0.nix10
-rw-r--r--pkgs/development/interpreters/guile/default.nix10
-rw-r--r--pkgs/development/interpreters/guile/riscv.patch13
-rw-r--r--pkgs/development/libraries/libgcrypt/default.nix6
-rw-r--r--pkgs/development/libraries/libidn2/default.nix8
-rw-r--r--pkgs/development/tools/build-managers/meson/default.nix26
-rw-r--r--pkgs/development/tools/build-managers/meson/setup-hook.sh8
-rw-r--r--pkgs/development/tools/misc/autogen/default.nix2
-rw-r--r--pkgs/os-specific/linux/apparmor/default.nix15
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix13
-rw-r--r--pkgs/tools/compression/lzip/default.nix2
13 files changed, 96 insertions, 34 deletions
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index e8997b1efb0..68a47987b2e 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -73,7 +73,9 @@ let version = "7.3.0";
       # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
       # target libraries and tools.
       ++ optional langAda ../gnat-cflags.patch
-      ++ optional langFortran ../gfortran-driving.patch;
+      ++ optional langFortran ../gfortran-driving.patch
+         # https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html
+      ++ optional targetPlatform.isRiscV ./riscv-pthread-reentrant.patch;
 
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
diff --git a/pkgs/development/compilers/gcc/7/riscv-pthread-reentrant.patch b/pkgs/development/compilers/gcc/7/riscv-pthread-reentrant.patch
new file mode 100644
index 00000000000..c7527ffb2b1
--- /dev/null
+++ b/pkgs/development/compilers/gcc/7/riscv-pthread-reentrant.patch
@@ -0,0 +1,13 @@
+Index: gcc/config/riscv/linux.h
+===================================================================
+--- a/gcc/config/riscv/linux.h	(revision 257620)
++++ b/gcc/config/riscv/linux.h	(revision 257621)
+@@ -47,6 +47,8 @@
+ 
+ #define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
+ 
++#define CPP_SPEC "%{pthread:-D_REENTRANT}"
++
+ #define LINK_SPEC "\
+ -melf" XLEN_SPEC "lriscv \
+ %{shared} \
diff --git a/pkgs/development/interpreters/guile/2.0.nix b/pkgs/development/interpreters/guile/2.0.nix
index 5746300fca0..ea8ff924064 100644
--- a/pkgs/development/interpreters/guile/2.0.nix
+++ b/pkgs/development/interpreters/guile/2.0.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
 , libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
-, hostPlatform
+, hostPlatform, buildPackages
 }:
 
 # Do either a coverage analysis build or a standard build.
@@ -19,7 +19,9 @@
   outputs = [ "out" "dev" "info" ];
   setOutputFlags = false; # $dev gets into the library otherwise
 
-  nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ makeWrapper gawk pkgconfig ] ++
+    stdenv.lib.optional stdenv.isCross buildPackages.buildPackages.guile_2_0;
   buildInputs = [ readline libtool libunistring libffi ];
   propagatedBuildInputs = [ gmp boehmgc ]
 
@@ -29,9 +31,6 @@
     # see below.
     ++ [ libtool libunistring ];
 
-  # A native Guile 2.0 is needed to cross-build Guile.
-  selfNativeBuildInput = true;
-
   enableParallelBuilding = true;
 
   patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch
@@ -40,6 +39,7 @@
       url = "http://git.savannah.gnu.org/cgit/guile.git/patch/?id=2fbde7f02adb8c6585e9baf6e293ee49cd23d4c4";
       sha256 = "0p6c1lmw1iniq03z7x5m65kg3lq543kgvdb4nrxsaxjqf3zhl77v";
     })
+    ./riscv.patch
   ] ++
     (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
 
diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix
index e10c5fbb568..fc7cd2b60ea 100644
--- a/pkgs/development/interpreters/guile/default.nix
+++ b/pkgs/development/interpreters/guile/default.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
 , libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
-, hostPlatform
+, hostPlatform, buildPackages
 }:
 
 # Do either a coverage analysis build or a standard build.
@@ -20,7 +20,9 @@
   outputs = [ "out" "dev" "info" ];
   setOutputFlags = false; # $dev gets into the library otherwise
 
-  nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ makeWrapper gawk pkgconfig ] ++
+    stdenv.lib.optional stdenv.isCross buildPackages.buildPackages.guile;
   buildInputs = [ readline libtool libunistring libffi ];
 
   propagatedBuildInputs = [ gmp boehmgc ]
@@ -30,13 +32,11 @@
     # see below.
     ++ [ libtool libunistring ];
 
-  # A native Guile 2.0 is needed to cross-build Guile.
-  selfNativeBuildInput = true;
-
   enableParallelBuilding = true;
 
   patches = [
     ./eai_system.patch
+    ./riscv.patch
   ] ++
     (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
 
diff --git a/pkgs/development/interpreters/guile/riscv.patch b/pkgs/development/interpreters/guile/riscv.patch
new file mode 100644
index 00000000000..b835e161383
--- /dev/null
+++ b/pkgs/development/interpreters/guile/riscv.patch
@@ -0,0 +1,13 @@
+diff --git a/module/system/base/target.scm b/module/system/base/target.scm
+index 95ab8d8c9..93616f4a3 100644
+--- a/module/system/base/target.scm
++++ b/module/system/base/target.scm
+@@ -86,6 +86,8 @@
+              (endianness big))
+             ((string=? "aarch64" cpu)
+              (endianness little))
++            ((string-match "riscv[1-9][0-9]*" cpu)
++             (endianness little))
+             (else
+              (error "unknown CPU endianness" cpu)))))
+ 
diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix
index a02aefb0a74..6f36199bd1a 100644
--- a/pkgs/development/libraries/libgcrypt/default.nix
+++ b/pkgs/development/libraries/libgcrypt/default.nix
@@ -21,18 +21,18 @@ stdenv.mkDerivation rec {
   # The build enables -O2 by default for everything else.
   hardeningDisable = stdenv.lib.optional stdenv.cc.isClang "fortify";
 
-  depsBuildBuild = stdenv.lib.optional stdenv.isCross buildPackages.stdenv.cc;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   buildInputs = [ libgpgerror ]
     ++ stdenv.lib.optional stdenv.isDarwin gettext
     ++ stdenv.lib.optional enableCapabilities libcap;
 
-  preConfigure = if stdenv.isCross then ''
+  preConfigure = stdenv.lib.optionalString stdenv.isCross ''
     # This is intentional: gpg-error-config is a shell script that will work during the build
     mkdir -p "$NIX_BUILD_TOP"/bin
     ln -s ${libgpgerror.dev}/bin/gpg-error-config "$NIX_BUILD_TOP/bin"
     export PATH="$NIX_BUILD_TOP/bin:$PATH"
-  '' else null;
+  '';
 
   # Make sure libraries are correct for .pc and .la files
   # Also make sure includes are fixed for callers who don't use libgpgcrypt-config
diff --git a/pkgs/development/libraries/libidn2/default.nix b/pkgs/development/libraries/libidn2/default.nix
index 521fe00b56d..d375785e497 100644
--- a/pkgs/development/libraries/libidn2/default.nix
+++ b/pkgs/development/libraries/libidn2/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, libiconv, libunistring, help2man, ronn }:
+{ fetchurl, stdenv, libiconv, libunistring, help2man, ronn, buildPackages }:
 
 with stdenv.lib;
 
@@ -15,8 +15,10 @@ stdenv.mkDerivation rec {
 
   patches = optional stdenv.isDarwin ./fix-error-darwin.patch;
 
-  buildInputs = [ libunistring ronn ]
-    ++ optionals stdenv.isDarwin [ libiconv help2man ];
+  nativeBuildInputs = [ ronn ]
+    ++ optional stdenv.isDarwin help2man;
+  buildInputs = [ libunistring ] ++ optional stdenv.isDarwin libiconv;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   meta = {
     homepage = "https://www.gnu.org/software/libidn/#libidn2";
diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
index 5db0bce21f7..27aa38cfa7e 100644
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ b/pkgs/development/tools/build-managers/meson/default.nix
@@ -1,5 +1,7 @@
-{ lib, python3Packages }:
-python3Packages.buildPythonApplication rec {
+{ lib, python3Packages, stdenv, targetPlatform, writeTextDir, m4 }: let
+  targetPrefix = lib.optionalString stdenv.isCross
+                   (targetPlatform.config + "-");
+in python3Packages.buildPythonApplication rec {
   version = "0.44.0";
   pname = "meson";
   name = "${pname}-${version}";
@@ -33,6 +35,26 @@ python3Packages.buildPythonApplication rec {
 
   setupHook = ./setup-hook.sh;
 
+  crossFile = writeTextDir "cross-file.conf" ''
+    [binaries]
+    c = '${targetPrefix}cc'
+    cpp = '${targetPrefix}c++'
+    ar = '${targetPrefix}ar'
+    strip = '${targetPrefix}strip'
+    pkgconfig = 'pkg-config'
+
+    [properties]
+    needs_exe_wrapper = true
+
+    [host_machine]
+    system = '${targetPlatform.parsed.kernel.name}'
+    cpu_family = '${targetPlatform.parsed.cpu.family}'
+    cpu = '${targetPlatform.parsed.cpu.name}'
+    endian = ${if targetPlatform.isLittleEndian then "'little'" else "'big'"}
+  '';
+
+  inherit (stdenv) cc isCross;
+
   meta = with lib; {
     homepage = http://mesonbuild.com;
     description = "SCons-like build system that use python as a front-end language and Ninja as a building backend";
diff --git a/pkgs/development/tools/build-managers/meson/setup-hook.sh b/pkgs/development/tools/build-managers/meson/setup-hook.sh
index eeffa6bf6cf..341b1ff9e6e 100644
--- a/pkgs/development/tools/build-managers/meson/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/meson/setup-hook.sh
@@ -6,11 +6,15 @@ mesonConfigurePhase() {
     fi
 
     # Build release by default.
-    mesonFlags="--buildtype=${mesonBuildType:-release} $mesonFlags"
+    if [ -n "@isCross@" ]; then
+      crossMesonFlags="--cross-file=@crossFile@/cross-file.conf"
+    fi
+
+    mesonFlags="${crossMesonFlags+$crossMesonFlags }--buildtype=${mesonBuildType:-release} $mesonFlags"
 
     echo "meson flags: $mesonFlags ${mesonFlagsArray[@]}"
 
-    meson build $mesonFlags "${mesonFlagsArray[@]}"
+    CC=@cc@/bin/cc CXX=@cc@/bin/c++ meson build $mesonFlags "${mesonFlagsArray[@]}"
     cd build
 
     if ! [[ -v enableParallelBuilding ]]; then
diff --git a/pkgs/development/tools/misc/autogen/default.nix b/pkgs/development/tools/misc/autogen/default.nix
index 77944297a97..660917ee9f1 100644
--- a/pkgs/development/tools/misc/autogen/default.nix
+++ b/pkgs/development/tools/misc/autogen/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ which pkgconfig perl ]
     # autogen needs a build autogen when cross-compiling
     ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
-      buildPackages.autogen buildPackages.texinfo ];
+      buildPackages.buildPackages.autogen buildPackages.texinfo ];
   buildInputs = [
     guile libxml2
   ];
diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix
index 0bb5561e957..c8e58dfbf6f 100644
--- a/pkgs/os-specific/linux/apparmor/default.nix
+++ b/pkgs/os-specific/linux/apparmor/default.nix
@@ -8,6 +8,7 @@
 , swig
 , ncurses
 , pam
+, buildPackages
 }:
 
 let
@@ -29,8 +30,8 @@ let
   };
 
   prePatchCommon = ''
-    substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2man" "${perl}/bin/pod2man"
-    substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2html" "${perl}/bin/pod2html"
+    substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2man" "${buildPackages.perl}/bin/pod2man"
+    substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2html" "${buildPackages.perl}/bin/pod2html"
     substituteInPlace ./common/Make.rules --replace "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h"
     substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man"
   '';
@@ -70,9 +71,10 @@ let
       swig
       ncurses
       which
+      perl
     ];
 
-    buildInputs = [
+    buildInputs = stdenv.lib.optionals (!stdenv.isCross) [
       perl
       python
     ];
@@ -87,11 +89,12 @@ let
     inherit patches;
 
     postPatch = "cd ./libraries/libapparmor";
-    configureFlags = "--with-python --with-perl";
+    # https://gitlab.com/apparmor/apparmor/issues/1
+    configureFlags = stdenv.lib.optionalString (!stdenv.isCross) "--with-python --with-perl";
 
-    outputs = [ "out" "python" ];
+    outputs = if stdenv.isCross then [ "out" ] else [ "out" "python" ];
 
-    postInstall = ''
+    postInstall = stdenv.lib.optionalString (!stdenv.isCross) ''
       mkdir -p $python/lib
       mv $out/lib/python* $python/lib/
     '';
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index 383e3c340e6..df51284689e 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -9,12 +9,13 @@
 , patchelf
 , getent
 , hostPlatform
+, buildPackages
 }:
 
 assert stdenv.isLinux;
 
 let
-  pythonLxmlEnv = python3Packages.python.withPackages ( ps: with ps; [ python3Packages.lxml ]);
+  pythonLxmlEnv = buildPackages.python3Packages.python.withPackages ( ps: with ps; [ python3Packages.lxml ]);
 
 in
 
@@ -35,14 +36,16 @@ in
       [ pkgconfig intltool gperf libxslt gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45
         ninja meson
         coreutils # meson calls date, stat etc.
-        pythonLxmlEnv glibcLocales
-        patchelf getent
+        glibcLocales
+        patchelf getent m4
       ];
     buildInputs =
       [ linuxHeaders libcap kmod xz pam acl
-        /* cryptsetup */ libuuid m4 glib libgcrypt libgpgerror libidn2
+        /* cryptsetup */ libuuid glib libgcrypt libgpgerror libidn2
         libmicrohttpd kexectools libseccomp libffi audit lz4 bzip2 libapparmor
         iptables gnu-efi
+        # This is actually native, but we already pull it from buildPackages
+        pythonLxmlEnv
       ];
 
     #dontAddPrefix = true;
@@ -128,7 +131,7 @@ in
 
         for i in src/basic/generate-gperfs.py src/resolve/generate-dns_type-gperf.py src/test/generate-sym-test.py ; do
           substituteInPlace $i \
-            --replace "#!/usr/bin/env python" "#!${python3Packages.python}/bin/python"
+            --replace "#!/usr/bin/env python" "#!${buildPackages.python3Packages.python}/bin/python"
         done
 
         substituteInPlace src/journal/catalog.c \
diff --git a/pkgs/tools/compression/lzip/default.nix b/pkgs/tools/compression/lzip/default.nix
index 298e490be87..2f6f9aca432 100644
--- a/pkgs/tools/compression/lzip/default.nix
+++ b/pkgs/tools/compression/lzip/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "1abbch762gv8rjr579q3qyyk6c80plklbv2mw4x0vg71dgsw9bgz";
   };
 
-  configureFlags = "CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3";
+  configureFlags = "CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3" + stdenv.lib.optionalString stdenv.isCross " CXX=${stdenv.cc.targetPrefix}c++";
 
   setupHook = ./lzip-setup-hook.sh;