Merge pull request #55580 from LnL7/darwin-luarocks
luarocks: patch sw_vers and gcc
This commit is contained in:
commit
5b0e7de0bd
27
pkgs/development/tools/misc/luarocks/darwin.patch
Normal file
27
pkgs/development/tools/misc/luarocks/darwin.patch
Normal file
@ -0,0 +1,27 @@
|
||||
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
|
||||
index 55cd4c9..060a6f1 100644
|
||||
--- a/src/luarocks/cfg.lua
|
||||
+++ b/src/luarocks/cfg.lua
|
||||
@@ -587,9 +587,9 @@ if cfg.platforms.macosx then
|
||||
defaults.external_lib_extension = "dylib"
|
||||
defaults.arch = "macosx-"..cfg.target_cpu
|
||||
defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load"
|
||||
- defaults.variables.STAT = "/usr/bin/stat"
|
||||
+ defaults.variables.STAT = "stat"
|
||||
defaults.variables.STATFLAG = "-f '%A'"
|
||||
- local version = io.popen("sw_vers -productVersion"):read("*l")
|
||||
+ local version = "10.10"
|
||||
version = tonumber(version and version:match("^[^.]+%.([^.]+)")) or 3
|
||||
if version >= 10 then
|
||||
version = 8
|
||||
@@ -598,8 +598,8 @@ if cfg.platforms.macosx then
|
||||
else
|
||||
defaults.gcc_rpath = false
|
||||
end
|
||||
- defaults.variables.CC = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." gcc"
|
||||
- defaults.variables.LD = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." gcc"
|
||||
+ defaults.variables.CC = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." clang"
|
||||
+ defaults.variables.LD = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." clang"
|
||||
defaults.web_browser = "open"
|
||||
end
|
||||
|
@ -6,6 +6,7 @@
|
||||
# some packages need to be compiled with cmake
|
||||
, cmake
|
||||
}:
|
||||
|
||||
let
|
||||
s = # Generated upstream information
|
||||
rec {
|
||||
@ -20,18 +21,20 @@ let
|
||||
lua curl makeWrapper which unzip
|
||||
];
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit (s) name version;
|
||||
inherit buildInputs;
|
||||
src = fetchurl {
|
||||
inherit (s) url sha256;
|
||||
};
|
||||
patches = [ ./darwin.patch ];
|
||||
preConfigure = ''
|
||||
lua -e "" || {
|
||||
luajit -e "" && {
|
||||
export LUA_SUFFIX=jit
|
||||
configureFlags="$configureFlags --lua-suffix=$LUA_SUFFIX"
|
||||
}
|
||||
export LUA_SUFFIX=jit
|
||||
configureFlags="$configureFlags --lua-suffix=$LUA_SUFFIX"
|
||||
}
|
||||
}
|
||||
lua_inc="$(echo "${lua}/include"/*/)"
|
||||
if test -n "$lua_inc"; then
|
||||
@ -42,13 +45,12 @@ stdenv.mkDerivation {
|
||||
sed -e "1s@.*@#! ${lua}/bin/lua$LUA_SUFFIX@" -i "$out"/bin/*
|
||||
for i in "$out"/bin/*; do
|
||||
test -L "$i" || {
|
||||
wrapProgram "$i" \
|
||||
--suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?.lua" \
|
||||
--suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \
|
||||
--suffix LUA_CPATH ";" "$(echo "$out"/lib/lua/*/)?.so" \
|
||||
--suffix LUA_CPATH ";" "$(echo "$out"/share/lua/*/)?/init.lua"
|
||||
|
||||
}
|
||||
wrapProgram "$i" \
|
||||
--suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?.lua" \
|
||||
--suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \
|
||||
--suffix LUA_CPATH ";" "$(echo "$out"/lib/lua/*/)?.so" \
|
||||
--suffix LUA_CPATH ";" "$(echo "$out"/share/lua/*/)?/init.lua"
|
||||
}
|
||||
done
|
||||
'';
|
||||
|
||||
|
@ -6,15 +6,11 @@ _tryRockSpec() {
|
||||
}
|
||||
|
||||
_trySourceRock() {
|
||||
|
||||
if ! [[ "$curSrc" =~ \.src.rock$ ]]; then return 1; fi
|
||||
|
||||
export PATH=${unzip}/bin:$PATH
|
||||
|
||||
# luarocks expects a clean <name>.rock.spec name to be the package name
|
||||
# so we have to strip the hash
|
||||
renamed="$(stripHash $curSrc)"
|
||||
cp "$curSrc" "$renamed"
|
||||
luarocks unpack --force "$renamed"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user