libgcrypt: Fix cross-compilation

This commit is contained in:
Shea Levy 2018-02-24 22:51:22 -05:00
parent f4a0c577b9
commit 1c1a6dfd23
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27
2 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, gettext, libgpgerror, enableCapabilities ? false, libcap }:
{ stdenv, fetchurl, gettext, libgpgerror, enableCapabilities ? false, libcap
, buildPackages
}:
assert enableCapabilities -> stdenv.isLinux;
@ -19,10 +21,19 @@ 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;
buildInputs = [ libgpgerror ]
++ stdenv.lib.optional stdenv.isDarwin gettext
++ 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
# Also make sure includes are fixed for callers who don't use libgpgcrypt-config
postFixup = ''

View File

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