lua.pkgs.luarocks: fix usage in cross-compilation

copy of comment 8d878e4981 (r954257465)

with this patch the build of luasystem fails

LD=ld
```
ld  -shared -o system/core.so src/core.o src/compat.o src/time.o -L/nix/store/...-glibc-2.35-163/lib -Wl,-rpath,/nix/store/...-glibc-2.35-163/lib -lrt
/nix/store/vhf2cr6immz4qdxd83y025fnxim8mmfg-binutils-2.38/bin/ld: unrecognized option '-Wl,-rpath,/nix/store/...-glibc-2.35-163/lib'
/nix/store/vhf2cr6immz4qdxd83y025fnxim8mmfg-binutils-2.38/bin/ld: use the --help option for usage information

Error: Build error: Failed compiling module system/core.so
```

LD=gcc
```
gcc  -shared -o system/core.so src/core.o src/compat.o src/time.o -L/nix/store/...-glibc-2.35-163/lib -Wl,-rpath,/nix/store/...-glibc-2.35-163/lib -lrt
```

`-Wl,rpath... -lrt` are added by ecb63347bf/src/luarocks/build/builtin.lua (L249-L250)
This commit is contained in:
Artturin 2022-08-23 02:31:38 +03:00
parent ec35f6341b
commit a2c61752fb

View file

@ -1,4 +1,5 @@
{lib, stdenv, fetchFromGitHub, buildPackages
, fetchpatch
, curl, makeWrapper, which, unzip
, lua
# for 'luarocks pack'
@ -20,7 +21,15 @@ stdenv.mkDerivation rec {
sha256 = "sha256-i0NmF268aK5lr4zjYyhk4TPUO7Zyz0Cl0fSW43Pmd1Q=";
};
patches = [ ./darwin-3.7.0.patch ];
patches = [
./darwin-3.7.0.patch
# follow standard environmental variables
# https://github.com/luarocks/luarocks/pull/1433
(fetchpatch {
url = "https://github.com/luarocks/luarocks/commit/d719541577a89909185aa8de7a33cf73b7a63ac3.diff";
sha256 = "sha256-rMnhZFqLEul0wnsxvw9nl6JXVanC5QgOZ+I/HJ0vRCM=";
})
];
postPatch = lib.optionalString stdenv.targetPlatform.isDarwin ''
substituteInPlace src/luarocks/core/cfg.lua --subst-var-by 'darwinMinVersion' '${stdenv.targetPlatform.darwinMinVersion}'