libgcrypt: Fix cross-compilation
This commit is contained in:
parent
f4a0c577b9
commit
1c1a6dfd23
@ -1,4 +1,6 @@
|
|||||||
{ stdenv, fetchurl, gettext, libgpgerror, enableCapabilities ? false, libcap }:
|
{ stdenv, fetchurl, gettext, libgpgerror, enableCapabilities ? false, libcap
|
||||||
|
, buildPackages
|
||||||
|
}:
|
||||||
|
|
||||||
assert enableCapabilities -> stdenv.isLinux;
|
assert enableCapabilities -> stdenv.isLinux;
|
||||||
|
|
||||||
@ -19,10 +21,19 @@ stdenv.mkDerivation rec {
|
|||||||
# The build enables -O2 by default for everything else.
|
# The build enables -O2 by default for everything else.
|
||||||
hardeningDisable = stdenv.lib.optional stdenv.cc.isClang "fortify";
|
hardeningDisable = stdenv.lib.optional stdenv.cc.isClang "fortify";
|
||||||
|
|
||||||
|
depsBuildBuild = stdenv.lib.optional stdenv.isCross buildPackages.stdenv.cc;
|
||||||
|
|
||||||
buildInputs = [ libgpgerror ]
|
buildInputs = [ libgpgerror ]
|
||||||
++ stdenv.lib.optional stdenv.isDarwin gettext
|
++ stdenv.lib.optional stdenv.isDarwin gettext
|
||||||
++ stdenv.lib.optional enableCapabilities libcap;
|
++ stdenv.lib.optional enableCapabilities libcap;
|
||||||
|
|
||||||
|
preConfigure = if stdenv.isCross then ''
|
||||||
|
# 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
|
# Make sure libraries are correct for .pc and .la files
|
||||||
# Also make sure includes are fixed for callers who don't use libgpgcrypt-config
|
# Also make sure includes are fixed for callers who don't use libgpgcrypt-config
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
|
@ -135,6 +135,8 @@ let
|
|||||||
inherit overrides;
|
inherit overrides;
|
||||||
|
|
||||||
inherit cc;
|
inherit cc;
|
||||||
|
|
||||||
|
isCross = targetPlatform != buildPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Propagate any extra attributes. For instance, we use this to
|
# Propagate any extra attributes. For instance, we use this to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user