From ce5f34f153cc0e6c6cf217b16b93f37190616feb Mon Sep 17 00:00:00 2001 From: circl Date: Sat, 19 Mar 2022 16:42:18 +0100 Subject: [PATCH] Ports: Add luajit port --- Ports/AvailablePorts.md | 1 + Ports/luajit/package.sh | 15 +++++++++++ .../0001-Recognize-Serenity-as-POSIX.patch | 25 ++++++++++++++++++ ...0002-Serenity-doesn-t-have-setitimer.patch | 26 +++++++++++++++++++ Ports/luajit/patches/ReadMe.md | 12 +++++++++ 5 files changed, 79 insertions(+) create mode 100755 Ports/luajit/package.sh create mode 100644 Ports/luajit/patches/0001-Recognize-Serenity-as-POSIX.patch create mode 100644 Ports/luajit/patches/0002-Serenity-doesn-t-have-setitimer.patch create mode 100644 Ports/luajit/patches/ReadMe.md diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 2950adea4cb..3d437a59cca 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -115,6 +115,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^ | [`links`](links/) | Links web browser | 2.25 | http://links.twibright.com/ | | [`llvm`](llvm/) | LLVM | 13.0.0 | https://llvm.org/ | | [`lua`](lua/) | Lua | 5.3.6 | https://www.lua.org/ | +| [`luajit`](luajit/) | LuaJIT | 2.1.0-beta3 | https://luajit.org/luajit.html | | [`luarocks`](luarocks/) | LuaRocks | 3.8.0 | https://luarocks.org/ | | [`lure`](lure/) | Lure of the Temptress | 1.1 | https://www.scummvm.org/games/#games-lure | | [`m4`](m4/) | GNU M4 | 1.4.9 | https://www.gnu.org/software/m4/ | diff --git a/Ports/luajit/package.sh b/Ports/luajit/package.sh new file mode 100755 index 00000000000..c807f19e431 --- /dev/null +++ b/Ports/luajit/package.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port=luajit +version=2.1.0-beta3 +files="https://luajit.org/download/LuaJIT-${version}.tar.gz LuaJIT-${version}.tar.gz 1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3" +auth_type=sha256 +workdir="LuaJIT-${version}" + +printf "\x1b[31m\x1b[5mATTENTION: \x1b[0m\x1b[31m\x1b[1mIf this fails, install either libc6-dev-i386 or libc6-dev-amd64\x1b[0m\n" +if [ ${SERENITY_ARCH} = "i686" ]; then + M_FLAG=-m32 +elif [ ${SERENITY_ARCH} = "x86_64" ]; then + M_FLAG=-m64 +fi + +makeopts=("CROSS=${SERENITY_ARCH}-pc-serenity-" "HOST_CC=gcc ${M_FLAG}") diff --git a/Ports/luajit/patches/0001-Recognize-Serenity-as-POSIX.patch b/Ports/luajit/patches/0001-Recognize-Serenity-as-POSIX.patch new file mode 100644 index 00000000000..e25e2e75c5c --- /dev/null +++ b/Ports/luajit/patches/0001-Recognize-Serenity-as-POSIX.patch @@ -0,0 +1,25 @@ +From 514ea84845d1cff0c274ac5e278c0a783d63032f Mon Sep 17 00:00:00 2001 +From: circl +Date: Sat, 19 Mar 2022 20:05:26 +0100 +Subject: [PATCH 1/2] Recognize Serenity as POSIX + +--- + src/lj_arch.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/lj_arch.h b/src/lj_arch.h +index c8d7138..ba7be19 100644 +--- a/src/lj_arch.h ++++ b/src/lj_arch.h +@@ -74,7 +74,7 @@ + defined(__NetBSD__) || defined(__OpenBSD__) || \ + defined(__DragonFly__)) && !defined(__ORBIS__) + #define LUAJIT_OS LUAJIT_OS_BSD +-#elif (defined(__sun__) && defined(__svr4__)) || defined(__HAIKU__) ++#elif (defined(__sun__) && defined(__svr4__)) || defined(__HAIKU__) || defined(__serenity__) + #define LUAJIT_OS LUAJIT_OS_POSIX + #elif defined(__CYGWIN__) + #define LJ_TARGET_CYGWIN 1 +-- +2.32.0 + diff --git a/Ports/luajit/patches/0002-Serenity-doesn-t-have-setitimer.patch b/Ports/luajit/patches/0002-Serenity-doesn-t-have-setitimer.patch new file mode 100644 index 00000000000..41bb83dc017 --- /dev/null +++ b/Ports/luajit/patches/0002-Serenity-doesn-t-have-setitimer.patch @@ -0,0 +1,26 @@ +From a8fd0e7a0e83e768acb4503ba06b19875c2b03ab Mon Sep 17 00:00:00 2001 +From: circl +Date: Sat, 19 Mar 2022 20:07:39 +0100 +Subject: [PATCH 2/2] Serenity doesn't have setitimer + +--- + src/lj_arch.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/lj_arch.h b/src/lj_arch.h +index ba7be19..0bd7b1b 100644 +--- a/src/lj_arch.h ++++ b/src/lj_arch.h +@@ -490,6 +490,9 @@ + #define LJ_HASFFI 1 + #endif + ++// FIXME: Disabled due to lack of setitimer ++#define LUAJIT_DISABLE_PROFILE ++ + #if defined(LUAJIT_DISABLE_PROFILE) + #define LJ_HASPROFILE 0 + #elif LJ_TARGET_POSIX +-- +2.32.0 + diff --git a/Ports/luajit/patches/ReadMe.md b/Ports/luajit/patches/ReadMe.md new file mode 100644 index 00000000000..9d39f5980d5 --- /dev/null +++ b/Ports/luajit/patches/ReadMe.md @@ -0,0 +1,12 @@ +# Patches for luajit on SerenityOS + +## `0001-Recognize-Serenity-as-POSIX.patch` + +Recognize Serenity as POSIX + + +## `0002-Serenity-doesn-t-have-setitimer.patch` + +Serenity doesn't have setitimer + +