Initial luarocks package with v3.5.0

Currently luarocks only supports being compiled with luajit
within openresty.

Signed-off-by: imjoey <majunjie@apache.org>
This commit is contained in:
imjoey 2021-07-30 15:09:30 +08:00
parent 80c03a7b56
commit 20d68b2c7f
4 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,39 @@
From aed621d5db1d521404238a92f16b879180a469a2 Mon Sep 17 00:00:00 2001
From: Michel Alexandre Salim <michel@michel-slm.name>
Date: Wed, 27 Jan 2021 20:32:07 -0800
Subject: [PATCH] Dynamically detect libdir on Linux
Some Linux distributions (e.g. Fedora, CentOS) put 64-bit libraries
in `/usr/lib64` rather than `/usr/lib`. On such systems `luarocks`
should use `lib64` rather than `lib`.
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
---
src/luarocks/core/cfg.lua | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
index 4ac5ee2..c7d2cb2 100644
--- a/src/luarocks/core/cfg.lua
+++ b/src/luarocks/core/cfg.lua
@@ -397,6 +397,18 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC"
end
defaults.web_browser = "xdg-open"
+ if platforms.linux then
+ -- inline code from fs/linux.lua since
+ -- luarocks.fs can't be required here
+ -- (circular dependencies)
+ local fd, _, code = io.open("/usr/lib64", "r")
+ if code ~= 2 then
+ defaults.lib_modules_path = "/lib64/lua/"..lua_version
+ end
+ if fd then
+ fd:close()
+ end
+ end
end
if platforms.cygwin then
--
2.29.2

BIN
luarocks-3.5.0.tar.gz Normal file

Binary file not shown.

75
luarocks.spec Normal file
View File

@ -0,0 +1,75 @@
# Use luajit within openresty, which is compatible with lua 5.1
%global lua_version 5.1
%{!?lua_pkgdir: %global lua_pkgdir %{_datadir}/lua/%{lua_version}}
# Use luajit within openresty to build luarocks
%global openresty_prefix %{_usr}/local/openresty
%global openresty_luajit %{openresty_prefix}/luajit
Name: luarocks
Version: 3.5.0
Release: 1%{?dist}
Summary: A deployment and management system for Lua modules
License: MIT
URL: http://luarocks.org
Source0: http://luarocks.org/releases/luarocks-%{version}.tar.gz
Patch0: 0001-luarocks-3.5.0-dynamic_libdir.patch
BuildArch: noarch
BuildRequires: make
BuildRequires: openresty-openssl111-devel >= 1.1.1h-1
BuildRequires: openresty >= 1.19.3.1-1
Requires: unzip
Requires: zip
Requires: openresty-openssl111 >= 1.1.1h-1
Requires: openresty >= 1.19.3.1-1
%description
LuaRocks allows you to install Lua modules as self-contained packages
called "rocks", which also contain version dependency
information. This information is used both during installation, so
that when one rock is requested all rocks it depends on are installed
as well, and at run time, so that when a module is required, the
correct version is loaded. LuaRocks supports both local and remote
repositories, and multiple local rocks trees.
%prep
%autosetup -p1
%build
./configure \
--prefix=%{_prefix} \
--lua-version=%{lua_version} \
--with-lua=%{openresty_luajit}
%make_build
%install
%make_install
mkdir -p %{buildroot}%{_prefix}/lib/luarocks/rocks-%{lua_version}
%check
# TODO - find how to run this without having to pre-download entire rocks tree
# ./test/run_tests.sh
%files
%license COPYING
%doc README.md
%dir %{_sysconfdir}/luarocks
%config(noreplace) %{_sysconfdir}/luarocks/config-%{lua_version}.lua
%{_bindir}/luarocks
%{_bindir}/luarocks-admin
%{_prefix}/lib/luarocks
%{lua_pkgdir}/luarocks
%changelog
* Fri Jul 30 2021 Joey Ma <majunjie@apache.org> - 3.5.0-1
- Initial package with 3.5.0, which only suppports openresty luajit for now

4
luarocks.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: luarocks/luarocks
tag_prefix: ^v
seperator: .