From 25d4f0d334ef4a24a11a41dafd3595c26d954f41 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 19 Apr 2021 11:09:36 +0000 Subject: [PATCH] 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. --- pkgs/development/interpreters/lua-5/interpreter.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix index cb31bf52eeb..973e9296435 100644 --- a/pkgs/development/interpreters/lua-5/interpreter.nix +++ b/pkgs/development/interpreters/lua-5/interpreter.nix @@ -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}"}" )