summaryrefslogtreecommitdiffstats
path: root/pkgs/development/interpreters/luajit
diff options
context:
space:
mode:
authorLuka Blaskovic <lblasc@tvbeat.com>2021-08-25 11:02:11 +0000
committerLuka Blaskovic <lblasc@tvbeat.com>2021-08-26 09:15:32 +0000
commit9634784777d48ce6352c0a7cd7ebde5abbd02ef3 (patch)
tree88891a86b6bb0c048c95982b965800c734f0450d /pkgs/development/interpreters/luajit
parenta15ee4845bec7dd5dfe74971d23b788cb2d49885 (diff)
luajit: disable unwind external on aarch64-darwin
see: https://github.com/LuaJIT/LuaJIT/issues/698
Diffstat (limited to 'pkgs/development/interpreters/luajit')
-rw-r--r--pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch14
-rw-r--r--pkgs/development/interpreters/luajit/default.nix4
2 files changed, 18 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch b/pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch
new file mode 100644
index 000000000000..dcfb1e9d4e7f
--- /dev/null
+++ b/pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch
@@ -0,0 +1,14 @@
+diff --git a/src/Makefile b/src/Makefile
+index 2538503f..7e6380da 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -320,7 +320,9 @@ ifeq (Darwin,$(TARGET_SYS))
+ $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY)
+ endif
+ TARGET_STRIP+= -x
++ ifneq (arm64,$(shell uname -m))
+ TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL
++ endif
+ TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
+ TARGET_DYNXLDOPTS=
+ TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix
index 2a94f9f69e7c..6a163c4b562f 100644
--- a/pkgs/development/interpreters/luajit/default.nix
+++ b/pkgs/development/interpreters/luajit/default.nix
@@ -51,6 +51,10 @@ stdenv.mkDerivation rec {
luaversion = "5.1";
+ # Fix for pcall on aarch64-darwin.
+ # Upstream issue: https://github.com/LuaJIT/LuaJIT/issues/698
+ patches = lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin") [ ./aarch64-darwin-disable-unwind-external.patch ];
+
postPatch = ''
substituteInPlace Makefile --replace ldconfig :
if test -n "''${dontStrip-}"; then