diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix index 638dec302b77..d8708114c8e6 100644 --- a/pkgs/development/libraries/libgcrypt/default.nix +++ b/pkgs/development/libraries/libgcrypt/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { ++ stdenv.lib.optional stdenv.isDarwin gettext ++ stdenv.lib.optional enableCapabilities libcap; - preConfigure = stdenv.lib.optionalString stdenv.isCross '' + preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' # 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" diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix index 3cb906d50edf..ca53c4d8c535 100644 --- a/pkgs/development/tools/build-managers/meson/default.nix +++ b/pkgs/development/tools/build-managers/meson/default.nix @@ -1,7 +1,6 @@ -{ lib, python3Packages, stdenv, targetPlatform, writeTextDir, substituteAll }: let - targetPrefix = lib.optionalString stdenv.isCross - (targetPlatform.config + "-"); -in python3Packages.buildPythonApplication rec { +{ lib, python3Packages, stdenv, targetPlatform, writeTextDir, substituteAll }: + +python3Packages.buildPythonApplication rec { version = "0.46.1"; pname = "meson"; @@ -48,10 +47,10 @@ in python3Packages.buildPythonApplication rec { crossFile = writeTextDir "cross-file.conf" '' [binaries] - c = '${targetPrefix}cc' - cpp = '${targetPrefix}c++' - ar = '${targetPrefix}ar' - strip = '${targetPrefix}strip' + c = '${stdenv.cc.targetPrefix}cc' + cpp = '${stdenv.cc.targetPrefix}c++' + ar = '${stdenv.cc.bintools.targetPrefix}ar' + strip = '${stdenv.cc.bintools.targetPrefix}strip' pkgconfig = 'pkg-config' [properties] @@ -69,7 +68,9 @@ in python3Packages.buildPythonApplication rec { # checkInputs = [ ninja pkgconfig ]; # checkPhase = "python ./run_project_tests.py"; - inherit (stdenv) cc isCross; + inherit (stdenv) cc; + + isCross = stdenv.buildPlatform != stdenv.hostPlatform; meta = with lib; { homepage = http://mesonbuild.com; diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix index cbbe4d5ca462..08428f95b06c 100644 --- a/pkgs/os-specific/linux/apparmor/default.nix +++ b/pkgs/os-specific/linux/apparmor/default.nix @@ -2,9 +2,9 @@ , pkgconfig, which , flex, bison , linuxHeaders ? stdenv.cc.libc.linuxHeaders -, python , gawk -, perl +, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform && perl.meta.available or false, perl +, withPython ? stdenv.hostPlatform == stdenv.buildPlatform && python.meta.available or false, python , swig , ncurses , pam @@ -76,10 +76,9 @@ let perl ]; - buildInputs = stdenv.lib.optionals (!stdenv.isCross) [ - perl - python - ]; + buildInputs = [] + ++ stdenv.lib.optional withPerl perl + ++ stdenv.lib.optional withPython python; # required to build apparmor-parser dontDisableStatic = true; @@ -92,11 +91,14 @@ let postPatch = "cd ./libraries/libapparmor"; # https://gitlab.com/apparmor/apparmor/issues/1 - configureFlags = stdenv.lib.optionalString (!stdenv.isCross) "--with-python --with-perl"; + configureFlags = [ + (stdenv.lib.withFeature withPerl "perl") + (stdenv.lib.withFeature withPython "python") + ]; - outputs = if stdenv.isCross then [ "out" ] else [ "out" "python" ]; + outputs = [ "out" ] ++ stdenv.lib.optional withPython "python"; - postInstall = stdenv.lib.optionalString (!stdenv.isCross) '' + postInstall = stdenv.lib.optionalString withPython '' mkdir -p $python/lib mv $out/lib/python* $python/lib/ ''; @@ -137,7 +139,9 @@ let inherit doCheck; - meta = apparmor-meta "user-land utilities"; + meta = apparmor-meta "user-land utilities" // { + broken = !(withPython && withPerl); + }; }; apparmor-bin-utils = stdenv.mkDerivation { diff --git a/pkgs/os-specific/linux/iputils/default.nix b/pkgs/os-specific/linux/iputils/default.nix index 4caa0acb4b6a..3430797666eb 100644 --- a/pkgs/os-specific/linux/iputils/default.nix +++ b/pkgs/os-specific/linux/iputils/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { ] ++ stdenv.lib.optional (!stdenv.hostPlatform.isMusl) libidn; # ninfod probably could build on cross, but the Makefile doesn't pass --host etc to the sub configure... - buildFlags = "man all" + stdenv.lib.optionalString (!stdenv.isCross) " ninfod"; + buildFlags = "man all" + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) " ninfod"; installPhase = '' diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 2eac9e58daa6..b3934c88ed27 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -141,8 +141,6 @@ let inherit overrides; inherit cc; - - isCross = targetPlatform != buildPlatform; } # Propagate any extra attributes. For instance, we use this to diff --git a/pkgs/tools/compression/lzip/default.nix b/pkgs/tools/compression/lzip/default.nix index 25d09e6e947b..561849162167 100644 --- a/pkgs/tools/compression/lzip/default.nix +++ b/pkgs/tools/compression/lzip/default.nix @@ -11,7 +11,12 @@ stdenv.mkDerivation rec { sha256 = "0319q59kb8g324wnj7xzbr7vvlx5bcs13lr34j0zb3kqlyjq2fy9"; }; - configureFlags = "CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3" + stdenv.lib.optionalString stdenv.isCross " CXX=${stdenv.cc.targetPrefix}c++"; + configureFlags = [ + "CPPFLAGS=-DNDEBUG" + "CFLAGS=-O3" + "CXXFLAGS=-O3" + ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + "CXX=${stdenv.cc.targetPrefix}c++"; setupHook = ./lzip-setup-hook.sh; diff --git a/pkgs/tools/system/monit/default.nix b/pkgs/tools/system/monit/default.nix index 17e472b8d2be..362545285ede 100644 --- a/pkgs/tools/system/monit/default.nix +++ b/pkgs/tools/system/monit/default.nix @@ -1,7 +1,10 @@ -{stdenv, fetchurl, openssl, bison, flex, pam, zlib, usePAM ? stdenv.isLinux - , buildPlatform, hostPlatform }: -let useSSL = (openssl != null); - isCross = ( buildPlatform != hostPlatform ) ; in +{ stdenv +, fetchurl, bison, flex +, zlib +, usePAM ? stdenv.hostPlatform.isLinux, pam +, useSSL ? true, openssl +}: + stdenv.mkDerivation rec { name = "monit-5.25.2"; @@ -15,15 +18,18 @@ stdenv.mkDerivation rec { stdenv.lib.optionals useSSL [ openssl ] ++ stdenv.lib.optionals usePAM [ pam ]; - configureFlags = - if useSSL then [ + configureFlags = [ + (stdenv.lib.withFeature usePAM "pam") + ] ++ (if useSSL then [ "--with-ssl-incl-dir=${openssl.dev}/include" "--with-ssl-lib-dir=${openssl.out}/lib" - ] else [ "--without-ssl" ] ++ - stdenv.lib.optionals (! usePAM) [ "--without-pam" ] ++ + ] else [ + "--without-ssl" + ]) ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # will need to check both these are true for musl - stdenv.lib.optionals isCross [ "libmonit_cv_setjmp_available=yes" - "libmonit_cv_vsnprintf_c99_conformant=yes"]; + "libmonit_cv_setjmp_available=yes" + "libmonit_cv_vsnprintf_c99_conformant=yes" + ]; meta = { homepage = http://mmonit.com/monit/;