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