treewide: Remove stdenv.isCross

I *want* cross-specific overrides to be verbose, so I rather not have
this shorthand. This makes the syntactic overhead more proportional to
the maintainence cost. Hopefully this pushes people towards fewer
conditionals and more abstractions.
wip/yesman
John Ericson 6 years ago
parent 89a89ddfb3
commit 34da7e2ce2
  1. 2
      pkgs/development/libraries/libgcrypt/default.nix
  2. 19
      pkgs/development/tools/build-managers/meson/default.nix
  3. 24
      pkgs/os-specific/linux/apparmor/default.nix
  4. 2
      pkgs/os-specific/linux/iputils/default.nix
  5. 2
      pkgs/stdenv/generic/default.nix
  6. 7
      pkgs/tools/compression/lzip/default.nix
  7. 26
      pkgs/tools/system/monit/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"

@ -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;

@ -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 {

@ -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 =
''

@ -141,8 +141,6 @@ let
inherit overrides;
inherit cc;
isCross = targetPlatform != buildPlatform;
}
# Propagate any extra attributes. For instance, we use this to

@ -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;

@ -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/;

Loading…
Cancel
Save