]>
Commit | Line | Data |
---|---|---|
e9f13859 JP |
1 | %bcond_without lua51 # lua51 package |
2 | %bcond_without luajit # lua51 package | |
3 | ||
81853464 JP |
4 | %define real_version 1.43.0 |
5 | %global extra_version 0 | |
e9f13859 JP |
6 | |
7 | %define luajit_abi 2.1 | |
8 | ||
754ed768 ER |
9 | Summary: Bare libuv bindings for lua |
10 | Name: lua-luv | |
11 | Version: %{real_version}.%{extra_version} | |
12 | Release: 1 | |
13 | License: Apache v2.0 | |
81853464 JP |
14 | Group: Libraries |
15 | Source0: https://github.com/luvit/luv/releases/download/1.43.0-0/luv-1.43.0-0.tar.gz | |
16 | # Source0-md5: 294c7ea4d8d2e21414b90f1fb70182e9 | |
17 | URL: https://github.com/luvit/luv | |
754ed768 ER |
18 | BuildRequires: cmake |
19 | BuildRequires: libuv-devel | |
20 | BuildRequires: lua-devel >= 5.4 | |
e9f13859 JP |
21 | %if %{with lua51} |
22 | BuildRequires: lua51-devel | |
23 | %endif | |
24 | %if %{with luajit} | |
25 | BuildRequires: luajit-devel | |
81853464 | 26 | BuildRequires: rpmbuild(macros) >= 1.605 |
e9f13859 | 27 | %endif |
81853464 | 28 | Requires: lua54-libs |
754ed768 ER |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
30 | ||
31 | %description | |
32 | This library makes libuv available to lua scripts. It was made for the | |
33 | luvit project but should usable from nearly any lua project. | |
34 | ||
35 | The library can be used by multiple threads at once. Each thread is | |
36 | assumed to load the library from a different lua_State. Luv will | |
37 | create a unique uv_loop_t for each state. You can't share uv handles | |
38 | between states/loops. | |
39 | ||
40 | The best docs currently are the libuv docs themselves. Hopefully soon | |
41 | we'll have a copy locally tailored for lua. | |
42 | ||
43 | %package devel | |
44 | Summary: Development files for lua-luv | |
81853464 | 45 | Group: Development/Libraries |
754ed768 | 46 | Requires: lua-luv = %{version}-%{release} |
81853464 | 47 | Requires: lua54-devel |
754ed768 ER |
48 | |
49 | %description devel | |
50 | Files required for lua-luv development | |
51 | ||
e9f13859 JP |
52 | %package -n lua51-luv |
53 | Summary: Bare libuv bindings for lua | |
81853464 | 54 | Requires: lua51-libs |
e9f13859 JP |
55 | |
56 | %description -n lua51-luv | |
57 | This library makes libuv available to lua scripts. It was made for the | |
58 | luvit project but should usable from nearly any lua project. | |
59 | ||
60 | The library can be used by multiple threads at once. Each thread is | |
61 | assumed to load the library from a different lua_State. Luv will | |
62 | create a unique uv_loop_t for each state. You can't share uv handles | |
63 | between states/loops. | |
64 | ||
65 | The best docs currently are the libuv docs themselves. Hopefully soon | |
66 | we'll have a copy locally tailored for lua. | |
67 | ||
68 | Package for Lua 5.1. | |
69 | ||
70 | %package -n lua51-luv-devel | |
71 | Summary: Development files for lua51-luv | |
81853464 | 72 | Group: Development/Libraries |
e9f13859 | 73 | Requires: lua51-luv = %{version}-%{release} |
81853464 | 74 | Requires: lua51-devel |
e9f13859 JP |
75 | |
76 | %description -n lua51-luv-devel | |
77 | Files required for lua51-luv development | |
78 | ||
79 | %package -n luajit-luv | |
80 | Summary: Bare libuv bindings for lua | |
81853464 | 81 | Requires: luajit-libs |
e9f13859 JP |
82 | |
83 | %description -n luajit-luv | |
84 | This library makes libuv available to lua scripts. It was made for the | |
85 | luvit project but should usable from nearly any lua project. | |
86 | ||
87 | The library can be used by multiple threads at once. Each thread is | |
88 | assumed to load the library from a different lua_State. Luv will | |
89 | create a unique uv_loop_t for each state. You can't share uv handles | |
90 | between states/loops. | |
91 | ||
92 | The best docs currently are the libuv docs themselves. Hopefully soon | |
93 | we'll have a copy locally tailored for lua. | |
94 | ||
95 | Package for LuaJIT. | |
96 | ||
97 | %package -n luajit-luv-devel | |
98 | Summary: Development files for luajit-luv | |
81853464 | 99 | Group: Development/Libraries |
e9f13859 | 100 | Requires: luajit-luv = %{version}-%{release} |
81853464 | 101 | Requires: luajit-devel |
e9f13859 JP |
102 | |
103 | %description -n luajit-luv-devel | |
104 | Files required for luajit-luv development | |
105 | ||
754ed768 | 106 | %prep |
81853464 | 107 | %setup -q -n luv-%{real_version}-%{extra_version} |
754ed768 ER |
108 | |
109 | # Remove bundled dependencies | |
e9f13859 | 110 | rm -r deps/{lua.cmake,luajit.cmake,libuv} |
754ed768 ER |
111 | # Remove network sensitive tests gh#luvit/luv#340 |
112 | rm -f tests/test-dns.lua | |
113 | ||
114 | %build | |
5f57bc5d | 115 | %cmake -B build \ |
754ed768 ER |
116 | -DWITH_SHARED_LIBUV=ON \ |
117 | -DBUILD_MODULE=ON \ | |
118 | -DBUILD_SHARED_LIBS=ON \ | |
119 | -DWITH_LUA_ENGINE=Lua \ | |
120 | -DLUA_BUILD_TYPE=System \ | |
121 | -DINSTALL_LIB_DIR=%{_libdir} \ | |
5f57bc5d | 122 | -DLUA_INCLUDE_DIR=%{_includedir}/lua5.4 |
754ed768 ER |
123 | |
124 | %{__make} -C build | |
125 | ||
126 | %if %{with tests} | |
127 | ln -sfn build/luv.so luv.so | |
128 | lua tests/run.lua | |
129 | rm luv.so | |
130 | %endif | |
131 | ||
e9f13859 JP |
132 | %if %{with lua51} |
133 | %cmake -B build-lua51 \ | |
134 | -DWITH_SHARED_LIBUV=ON \ | |
135 | -DBUILD_MODULE=ON \ | |
136 | -DBUILD_SHARED_LIBS=ON \ | |
137 | -DWITH_LUA_ENGINE=Lua \ | |
138 | -DLUA_BUILD_TYPE=System \ | |
139 | -DINSTALL_LIB_DIR=%{_libdir} \ | |
140 | -DLUA_INCLUDE_DIR=%{_includedir}/lua5.1 | |
141 | ||
142 | %{__make} -C build-lua51 | |
143 | %endif | |
144 | ||
145 | %if %{with luajit} | |
146 | %cmake -B build-luajit \ | |
147 | -DWITH_SHARED_LIBUV=ON \ | |
148 | -DBUILD_MODULE=ON \ | |
149 | -DBUILD_SHARED_LIBS=ON \ | |
150 | -DWITH_LUA_ENGINE=LuaJIT \ | |
151 | -DLUA_BUILD_TYPE=System \ | |
152 | -DINSTALL_LIB_DIR=%{_libdir} \ | |
153 | -DLUA_INCLUDE_DIR=%{_includedir}/luajit-%{luajit_abi} | |
154 | ||
155 | %{__make} -C build-luajit | |
156 | %endif | |
157 | ||
754ed768 ER |
158 | %install |
159 | rm -rf $RPM_BUILD_ROOT | |
e9f13859 | 160 | |
754ed768 ER |
161 | install -d $RPM_BUILD_ROOT%{_libdir}/lua/5.4 |
162 | install -p build/luv.so $RPM_BUILD_ROOT%{_libdir}/lua/5.4/luv.so | |
163 | ||
164 | install -d $RPM_BUILD_ROOT%{_includedir}/lua5.4/luv | |
165 | for f in lhandle.h lreq.h luv.h util.h; do | |
166 | install -m 0644 -p src/$f $RPM_BUILD_ROOT%{_includedir}/lua5.4/luv/$f | |
167 | done | |
168 | ||
e9f13859 JP |
169 | %if %{with lua51} |
170 | install -d $RPM_BUILD_ROOT%{_libdir}/lua/5.1 | |
171 | install -p build-lua51/luv.so $RPM_BUILD_ROOT%{_libdir}/lua/5.1/luv.so | |
172 | ||
173 | install -d $RPM_BUILD_ROOT%{_includedir}/lua5.1/luv | |
174 | for f in lhandle.h lreq.h luv.h util.h; do | |
175 | install -m 0644 -p src/$f $RPM_BUILD_ROOT%{_includedir}/lua5.1/luv/$f | |
176 | done | |
177 | %endif | |
178 | ||
179 | %if %{with luajit} | |
180 | install -d $RPM_BUILD_ROOT%{_libdir}/luajit/%{luajit_abi} | |
181 | install -p build-luajit/luv.so $RPM_BUILD_ROOT%{_libdir}/luajit/%{luajit_abi}/luv.so | |
182 | ||
183 | install -d $RPM_BUILD_ROOT%{_includedir}/luajit-%{luajit_abi}/luv | |
184 | for f in lhandle.h lreq.h luv.h util.h; do | |
185 | install -m 0644 -p src/$f $RPM_BUILD_ROOT%{_includedir}/luajit-%{luajit_abi}/luv/$f | |
186 | done | |
187 | %endif | |
188 | ||
754ed768 ER |
189 | %clean |
190 | rm -rf $RPM_BUILD_ROOT | |
191 | ||
192 | %files | |
193 | %defattr(644,root,root,755) | |
194 | %doc README.md | |
195 | %attr(755,root,root) %{_libdir}/lua/5.4/luv.so | |
196 | ||
197 | %files devel | |
198 | %defattr(644,root,root,755) | |
199 | %dir %{_includedir}/lua5.4/luv | |
200 | %{_includedir}/lua5.4/luv/lhandle.h | |
201 | %{_includedir}/lua5.4/luv/lreq.h | |
202 | %{_includedir}/lua5.4/luv/luv.h | |
203 | %{_includedir}/lua5.4/luv/util.h | |
e9f13859 JP |
204 | |
205 | %files -n lua51-luv | |
206 | %defattr(644,root,root,755) | |
207 | %doc README.md | |
208 | %attr(755,root,root) %{_libdir}/lua/5.1/luv.so | |
209 | ||
210 | %files -n lua51-luv-devel | |
211 | %defattr(644,root,root,755) | |
212 | %dir %{_includedir}/lua5.1/luv | |
213 | %{_includedir}/lua5.1/luv/lhandle.h | |
214 | %{_includedir}/lua5.1/luv/lreq.h | |
215 | %{_includedir}/lua5.1/luv/luv.h | |
216 | %{_includedir}/lua5.1/luv/util.h | |
217 | ||
218 | %files -n luajit-luv | |
219 | %defattr(644,root,root,755) | |
220 | %doc README.md | |
221 | %attr(755,root,root) %{_libdir}/luajit/%{luajit_abi}/luv.so | |
222 | ||
223 | %files -n luajit-luv-devel | |
224 | %defattr(644,root,root,755) | |
225 | %dir %{_includedir}/luajit-%{luajit_abi}/luv | |
226 | %{_includedir}/luajit-%{luajit_abi}/luv/lhandle.h | |
227 | %{_includedir}/luajit-%{luajit_abi}/luv/lreq.h | |
228 | %{_includedir}/luajit-%{luajit_abi}/luv/luv.h | |
229 | %{_includedir}/luajit-%{luajit_abi}/luv/util.h |