Skip to content

Commit d05b391

Browse files
committed
MAJOR: Non-intrusive packaging of Lua 5.3 with basic modules
1 parent 4c0df41 commit d05b391

File tree

2 files changed

+188
-0
lines changed

2 files changed

+188
-0
lines changed

SOURCES/lua-5.3.6-lua-path.patch

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff -ru lua-5.3.6.ori/Makefile lua-5.3.6/Makefile
2+
--- lua-5.3.6.ori/Makefile 2020-07-13 20:38:27.000000000 +0200
3+
+++ lua-5.3.6/Makefile 2022-05-27 19:49:09.385708152 +0200
4+
@@ -10,13 +10,13 @@
5+
# so take care if INSTALL_TOP is not an absolute path. See the local target.
6+
# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
7+
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
8+
-INSTALL_TOP= /usr/local
9+
+INSTALL_TOP= /opt/lua-5.3
10+
INSTALL_BIN= $(INSTALL_TOP)/bin
11+
INSTALL_INC= $(INSTALL_TOP)/include
12+
INSTALL_LIB= $(INSTALL_TOP)/lib
13+
INSTALL_MAN= $(INSTALL_TOP)/man/man1
14+
-INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
15+
-INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
16+
+INSTALL_LMOD= $(INSTALL_TOP)/share/lua
17+
+INSTALL_CMOD= $(INSTALL_TOP)/lib/lua
18+
19+
# How to install. If your install program does not support "-p", then
20+
# you may have to run ranlib on the installed liblua.a.
21+
diff -ru lua-5.3.6.ori/src/luaconf.h lua-5.3.6/src/luaconf.h
22+
--- lua-5.3.6.ori/src/luaconf.h 2020-09-14 17:34:01.000000000 +0200
23+
+++ lua-5.3.6/src/luaconf.h 2022-05-27 19:48:16.316385947 +0200
24+
@@ -200,9 +200,9 @@
25+
26+
#else /* }{ */
27+
28+
-#define LUA_ROOT "/usr/local/"
29+
-#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
30+
-#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
31+
+#define LUA_ROOT "/opt/lua-5.3/"
32+
+#define LUA_LDIR LUA_ROOT "share/lua/"
33+
+#define LUA_CDIR LUA_ROOT "lib/lua/"
34+
#define LUA_PATH_DEFAULT \
35+
LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
36+
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \

SPECS/lua.spec

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
%global major_version 5.3
2+
%global minor_version 6
3+
4+
%define lua_cjson_version 2.1.0
5+
%define lua_cjson_xprefix lua-cjson-%{lua_cjson_version}
6+
7+
%define lua_curl_version 0.3.13
8+
%define lua_curl_xprefix Lua-cURLv3-%{lua_curl_version}
9+
%define lua_curl_makeopts \\\
10+
LUA_INC=../src/ \\\
11+
LIBDIR=../src/ \\\
12+
LUA_CMOD=/opt/lua-%{major_version}/lib/lua \\\
13+
LUA_LMOD=/opt/lua-%{major_version}/share/lua
14+
15+
%define lua_filesystem_version 1_8_0
16+
%define lua_filesystem_xprefix luafilesystem-%{lua_filesystem_version}
17+
18+
%define lua_socket_version 3.0.0
19+
%define lua_socket_xprefix luasocket-%{lua_socket_version}
20+
%define lua_socket_makeopts \\\
21+
PLAT=linux \\\
22+
LUAV=%{major_version} \\\
23+
LUAINC_linux=../../src \\\
24+
LUAPREFIX_linux=/opt/lua-%{major_version} \\\
25+
LDIR_linux=share/lua \\\
26+
CDIR_linux=lib/lua \\\
27+
SOCKET_V=%{lua_socket_version}
28+
29+
Name: lua53z
30+
Summary: Powerful light-weight programming language
31+
Version: %{major_version}.%{minor_version}
32+
Release: 1%{?dist}.zenetys
33+
License: MIT
34+
Group: Development/Languages
35+
URL: http://www.lua.org/
36+
37+
Source0: https://www.lua.org/ftp/lua-%{version}.tar.gz
38+
Source1000: https://github.com/mpx/lua-cjson/archive/refs/tags/%{lua_cjson_version}.tar.gz#/%{lua_cjson_xprefix}.tar.gz
39+
Source1100: https://github.com/Lua-cURL/Lua-cURLv3/archive/refs/tags/v%{lua_curl_version}.tar.gz#/%{lua_curl_xprefix}.tar.gz
40+
Source1200: https://github.com/keplerproject/luafilesystem/archive/refs/tags/v%{lua_filesystem_version}.tar.gz#/%{lua_filesystem_xprefix}.tar.gz
41+
Source1300: https://github.com/lunarmodules/luasocket/archive/refs/tags/v%{lua_socket_version}.tar.gz#/%{lua_socket_xprefix}.tar.gz
42+
43+
Patch0: lua-5.3.6-lua-path.patch
44+
45+
BuildRequires: libcurl-devel
46+
BuildRequires: ncurses-devel
47+
BuildRequires: readline-devel
48+
49+
%description
50+
Lua %{major_version} packaged to be non-intrusive so that is does not replace
51+
the standard package provided by the distribution. This package
52+
installs its files in /opt/lua-5.3 and provides the following Lua
53+
modules:
54+
- lua-cjson (https://github.com/mpx/lua-cjson)
55+
- Lua-cURLv3 (https://github.com/Lua-cURL/Lua-cURLv3)
56+
- luafilesystem (https://github.com/keplerproject/luafilesystem)
57+
- luasocket (https://github.com/lunarmodules/luasocket)
58+
59+
%package devel
60+
Summary: Development files for %{name}
61+
Group: System Environment/Libraries
62+
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
63+
64+
%description devel
65+
This package contains development files for %{name}.
66+
67+
%prep
68+
# lua
69+
%setup -n lua-%{version}
70+
%patch0 -p1
71+
72+
# lua-cjson
73+
%setup -n lua-%{version} -T -D -a 1000
74+
75+
# lua-curl
76+
%setup -n lua-%{version} -T -D -a 1100
77+
78+
# luafilesystem
79+
%setup -n lua-%{version} -T -D -a 1200
80+
81+
# luasocket
82+
%setup -n lua-%{version} -T -D -a 1300
83+
sed -i -re 's,(LUASOCKET_VERSION\s+"[^[:space:]]+\s+).*,\1%{lua_socket_version}",' \
84+
%{lua_socket_xprefix}/src/luasocket.h
85+
86+
%build
87+
# lua
88+
make linux MYCFLAGS='-g -fPIC'
89+
90+
# lua-cjson
91+
cd %{lua_cjson_xprefix}
92+
make LUA_INCLUDE_DIR=../src/
93+
cd ..
94+
95+
# lua-curl
96+
cd %{lua_curl_xprefix}
97+
make %{lua_curl_makeopts}
98+
cd ..
99+
100+
# luafilesystem
101+
cd %{lua_filesystem_xprefix}
102+
make LUA_INC=-I../src
103+
cd ..
104+
105+
# luasocket
106+
cd %{lua_socket_xprefix}
107+
make %{lua_socket_makeopts}
108+
cd ..
109+
110+
%install
111+
# lua
112+
make install INSTALL_TOP=%{buildroot}/opt/lua-%{major_version}
113+
mkdir -p %{buildroot}/opt/lua-%{major_version}/lib/lua
114+
mkdir -p %{buildroot}/opt/lua-%{major_version}/share/lua
115+
116+
# lua-cjson
117+
cd %{lua_cjson_xprefix}
118+
make install PREFIX=%{buildroot}/opt/lua-%{major_version} LUA_CMODULE_DIR=%{buildroot}/opt/lua-%{major_version}/lib/lua
119+
cd ..
120+
121+
# lua-curl
122+
cd %{lua_curl_xprefix}
123+
make install DESTDIR=%{buildroot} %{lua_curl_makeopts}
124+
cd ..
125+
126+
# luafilesystem
127+
cd %{lua_filesystem_xprefix}
128+
make install DESTDIR=%{buildroot} LUA_LIBDIR=/opt/lua-%{major_version}/lib/lua
129+
cd ..
130+
131+
# luasocket
132+
cd %{lua_socket_xprefix}
133+
make install %{lua_socket_makeopts} DESTDIR=%{buildroot}
134+
cd ..
135+
136+
%files
137+
%defattr(-,root,root,-)
138+
%dir /opt/lua-%{major_version}
139+
%dir /opt/lua-%{major_version}/bin
140+
/opt/lua-%{major_version}/bin/*
141+
%dir /opt/lua-%{major_version}/man
142+
/opt/lua-%{major_version}/man/*
143+
%dir /opt/lua-%{major_version}/lib
144+
%dir /opt/lua-%{major_version}/lib/lua
145+
/opt/lua-%{major_version}/lib/lua/*
146+
%dir /opt/lua-%{major_version}/share
147+
/opt/lua-%{major_version}/share/*
148+
149+
%files devel
150+
/opt/lua-%{major_version}/lib/liblua.a
151+
%dir /opt/lua-%{major_version}/include
152+
/opt/lua-%{major_version}/include/*

0 commit comments

Comments
 (0)