aws-sdk-cpp: fix on darwin

The LD_LIBRARY_PATH variable does nothing on Darwin, but
DYLD_LIBRARY_PATH does the same thing, so splice in the right variable
based on which system we're working on.
This commit is contained in:
Dan Peebles 2017-02-02 02:18:26 +01:00
parent 6bb4e6dba3
commit d34ee526a8

View File

@ -5,7 +5,14 @@
customMemoryManagement ? true
}:
stdenv.mkDerivation rec {
let
loaderVar =
if stdenv.isLinux
then "LD_LIBRARY_PATH"
else if stdenv.isDarwin
then "DYLD_LIBRARY_PATH"
else throw "Unsupported system!";
in stdenv.mkDerivation rec {
name = "aws-sdk-cpp-${version}";
version = "1.0.48";
@ -29,11 +36,12 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Behold the escaping nightmare below on loaderVar o.O
preBuild =
''
# Ensure that the unit tests can find the *.so files.
for i in testing-resources aws-cpp-sdk-*; do
export LD_LIBRARY_PATH=$(pwd)/$i:$LD_LIBRARY_PATH
export ${loaderVar}=$(pwd)/$i:''${${loaderVar}}
done
'';