|
| 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