1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 23:20:55 +00:00

lua: use stdenv.cc.targetPrefix

This evaluates to an empty string when not cross compiling, so by
using this instead of stdenv.hostPlatform.config we can eliminate a
conditional.
This commit is contained in:
Alyssa Ross 2021-04-19 11:09:36 +00:00
parent 8abdf1db65
commit 25d4f0d334
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0

View file

@ -54,17 +54,15 @@ self = stdenv.mkDerivation rec {
"LDFLAGS=-fPIC"
"V=${luaversion}"
"PLAT=${plat}"
] ++ (if stdenv.buildPlatform != stdenv.hostPlatform then [
"CC=${stdenv.hostPlatform.config}-gcc"
"RANLIB=${stdenv.hostPlatform.config}-ranlib"
] else [])
;
"CC=${stdenv.cc.targetPrefix}cc"
"RANLIB=${stdenv.cc.targetPrefix}ranlib"
];
configurePhase = ''
runHook preConfigure
makeFlagsArray+=(CFLAGS='-O2 -fPIC${lib.optionalString compat " -DLUA_COMPAT_ALL"} $(SYSCFLAGS)' )
makeFlagsArray+=(${lib.optionalString stdenv.isDarwin "CC=\"$CC\""}${lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) " 'AR=${stdenv.hostPlatform.config}-ar rcu'"})
makeFlagsArray+=(${lib.optionalString stdenv.isDarwin "CC=\"$CC\""}${lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) " 'AR=${stdenv.cc.targetPrefix}ar rcu'"})
installFlagsArray=( TO_BIN="lua luac" INSTALL_DATA='cp -d' \
TO_LIB="${if stdenv.isDarwin then "liblua.${version}.dylib" else "liblua.a liblua.so liblua.so.${luaversion} liblua.so.${version}"}" )