diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 7cd66dd583..fb98216a3a 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/ | +| [`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/ | | [`make`](make/) | GNU make | 4.3 | https://www.gnu.org/software/make/ | diff --git a/Ports/luarocks/package.sh b/Ports/luarocks/package.sh new file mode 100755 index 0000000000..ea3dd01ac4 --- /dev/null +++ b/Ports/luarocks/package.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port=luarocks +version=3.8.0 +useconfigure=true +depends=("lua" "git" "readline") +files="https://luarocks.org/releases/luarocks-${version}.tar.gz luarocks-${version}.tar.gz 56ab9b90f5acbc42eb7a94cf482e6c058a63e8a1effdf572b8b2a6323a06d923" +auth_type=sha256 + +configure() { + run ./configure --with-lua-include=${SERENITY_INSTALL_ROOT}/usr/local/include --prefix=/usr/local --with-lua-interpreter=lua +} + +installopts=("INSTALL_TOP=${SERENITY_INSTALL_ROOT}/usr/local") diff --git a/Ports/luarocks/patches/ReadMe.md b/Ports/luarocks/patches/ReadMe.md new file mode 100644 index 0000000000..e573efaab3 --- /dev/null +++ b/Ports/luarocks/patches/ReadMe.md @@ -0,0 +1,8 @@ +# Patches for LuaRocks on SerenityOS + +## `luarocks.patch` + +src/luarocks/core/cfg.lua: Setup serenity as a platform and config `defaults.variables.UNZIP` to work around our `unzip` command not supporting the flag `-n` +src/luarocks/core/sysdetect.lua: Detect SerenityOS using the `uname` command + +This should should be upstreamed so next versions of LuaRocks will support Serenity out of the box. diff --git a/Ports/luarocks/patches/luarocks.patch b/Ports/luarocks/patches/luarocks.patch new file mode 100644 index 0000000000..35023ed49a --- /dev/null +++ b/Ports/luarocks/patches/luarocks.patch @@ -0,0 +1,49 @@ +diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua +index 926d4793..7c2914b3 100644 +--- a/src/luarocks/core/cfg.lua ++++ b/src/luarocks/core/cfg.lua +@@ -42,6 +42,7 @@ local platform_order = { + "cygwin", + "msys", + "haiku", ++ "serenity", + -- Windows + "windows", + "win32", +@@ -152,6 +153,7 @@ local platform_sets = { + netbsd = { unix = true, bsd = true, netbsd = true }, + haiku = { unix = true, haiku = true }, + linux = { unix = true, linux = true }, ++ serenity = { unix = true, serenity = true }, + mingw = { windows = true, win32 = true, mingw32 = true, mingw = true }, + msys = { unix = true, cygwin = true, msys = true }, + msys2_mingw_w64 = { windows = true, win32 = true, mingw32 = true, mingw = true, msys = true, msys2_mingw_w64 = true }, +@@ -497,6 +499,12 @@ local function make_defaults(lua_version, target_cpu, platforms, home) + defaults.variables.MAKE = "gmake" + end + ++ if platforms.serenity then ++ defaults.arch = "serenity"..target_cpu ++ defaults.variables.UNZIP = "unzip" ++ defaults.web_browser = "br" ++ end ++ + -- Expose some more values detected by LuaRocks for use by rockspec authors. + defaults.variables.LIB_EXTENSION = defaults.lib_extension + defaults.variables.OBJ_EXTENSION = defaults.obj_extension +diff --git a/src/luarocks/core/sysdetect.lua b/src/luarocks/core/sysdetect.lua +index 02b8a492..b05f170b 100644 +--- a/src/luarocks/core/sysdetect.lua ++++ b/src/luarocks/core/sysdetect.lua +@@ -189,6 +189,11 @@ local function detect_elf_system(fd, hdr, sections) + return "linux" + end + end ++ ++ local uname_s = io.popen("uname -s"):read("*l") ++ if uname_s == "SerenityOS" then ++ return "serenity" ++ end + end + + return system