]> git.pld-linux.org Git - packages/lua-luv.git/blame - lua-luv.spec
fix build without luajit or without lua51
[packages/lua-luv.git] / lua-luv.spec
CommitLineData
e9f13859
JP
1%bcond_without lua51 # lua51 package
2%bcond_without luajit # lua51 package
3
e25837a6
JP
4%ifnarch %{ix86} %{x8664} %{arm} aarch64 mips mips64 mipsel ppc
5%undefine with_luajit
6%endif
7
81853464
JP
8%define real_version 1.43.0
9%global extra_version 0
e9f13859
JP
10
11%define luajit_abi 2.1
12
754ed768
ER
13Summary: Bare libuv bindings for lua
14Name: lua-luv
15Version: %{real_version}.%{extra_version}
16Release: 1
17License: Apache v2.0
81853464
JP
18Group: Libraries
19Source0: https://github.com/luvit/luv/releases/download/1.43.0-0/luv-1.43.0-0.tar.gz
20# Source0-md5: 294c7ea4d8d2e21414b90f1fb70182e9
21URL: https://github.com/luvit/luv
754ed768
ER
22BuildRequires: cmake
23BuildRequires: libuv-devel
24BuildRequires: lua-devel >= 5.4
e9f13859
JP
25%if %{with lua51}
26BuildRequires: lua51-devel
27%endif
28%if %{with luajit}
29BuildRequires: luajit-devel
81853464 30BuildRequires: rpmbuild(macros) >= 1.605
e9f13859 31%endif
81853464 32Requires: lua54-libs
754ed768
ER
33BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
34
35%description
36This library makes libuv available to lua scripts. It was made for the
37luvit project but should usable from nearly any lua project.
38
39The library can be used by multiple threads at once. Each thread is
40assumed to load the library from a different lua_State. Luv will
41create a unique uv_loop_t for each state. You can't share uv handles
42between states/loops.
43
44The best docs currently are the libuv docs themselves. Hopefully soon
45we'll have a copy locally tailored for lua.
46
47%package devel
48Summary: Development files for lua-luv
81853464 49Group: Development/Libraries
754ed768 50Requires: lua-luv = %{version}-%{release}
81853464 51Requires: lua54-devel
754ed768
ER
52
53%description devel
54Files required for lua-luv development
55
e9f13859
JP
56%package -n lua51-luv
57Summary: Bare libuv bindings for lua
81853464 58Requires: lua51-libs
e9f13859
JP
59
60%description -n lua51-luv
61This library makes libuv available to lua scripts. It was made for the
62luvit project but should usable from nearly any lua project.
63
64The library can be used by multiple threads at once. Each thread is
65assumed to load the library from a different lua_State. Luv will
66create a unique uv_loop_t for each state. You can't share uv handles
67between states/loops.
68
69The best docs currently are the libuv docs themselves. Hopefully soon
70we'll have a copy locally tailored for lua.
71
72Package for Lua 5.1.
73
74%package -n lua51-luv-devel
75Summary: Development files for lua51-luv
81853464 76Group: Development/Libraries
e9f13859 77Requires: lua51-luv = %{version}-%{release}
81853464 78Requires: lua51-devel
e9f13859
JP
79
80%description -n lua51-luv-devel
81Files required for lua51-luv development
82
83%package -n luajit-luv
84Summary: Bare libuv bindings for lua
81853464 85Requires: luajit-libs
e9f13859
JP
86
87%description -n luajit-luv
88This library makes libuv available to lua scripts. It was made for the
89luvit project but should usable from nearly any lua project.
90
91The library can be used by multiple threads at once. Each thread is
92assumed to load the library from a different lua_State. Luv will
93create a unique uv_loop_t for each state. You can't share uv handles
94between states/loops.
95
96The best docs currently are the libuv docs themselves. Hopefully soon
97we'll have a copy locally tailored for lua.
98
99Package for LuaJIT.
100
101%package -n luajit-luv-devel
102Summary: Development files for luajit-luv
81853464 103Group: Development/Libraries
e9f13859 104Requires: luajit-luv = %{version}-%{release}
81853464 105Requires: luajit-devel
e9f13859
JP
106
107%description -n luajit-luv-devel
108Files required for luajit-luv development
109
754ed768 110%prep
81853464 111%setup -q -n luv-%{real_version}-%{extra_version}
754ed768
ER
112
113# Remove bundled dependencies
e9f13859 114rm -r deps/{lua.cmake,luajit.cmake,libuv}
754ed768
ER
115# Remove network sensitive tests gh#luvit/luv#340
116rm -f tests/test-dns.lua
117
118%build
5f57bc5d 119%cmake -B build \
754ed768
ER
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} \
5f57bc5d 126 -DLUA_INCLUDE_DIR=%{_includedir}/lua5.4
754ed768
ER
127
128%{__make} -C build
129
130%if %{with tests}
131ln -sfn build/luv.so luv.so
132lua tests/run.lua
133rm luv.so
134%endif
135
e9f13859
JP
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
754ed768
ER
162%install
163rm -rf $RPM_BUILD_ROOT
e9f13859 164
754ed768
ER
165install -d $RPM_BUILD_ROOT%{_libdir}/lua/5.4
166install -p build/luv.so $RPM_BUILD_ROOT%{_libdir}/lua/5.4/luv.so
167
168install -d $RPM_BUILD_ROOT%{_includedir}/lua5.4/luv
169for 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
171done
172
e9f13859
JP
173%if %{with lua51}
174install -d $RPM_BUILD_ROOT%{_libdir}/lua/5.1
175install -p build-lua51/luv.so $RPM_BUILD_ROOT%{_libdir}/lua/5.1/luv.so
176
177install -d $RPM_BUILD_ROOT%{_includedir}/lua5.1/luv
178for 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
180done
181%endif
182
183%if %{with luajit}
184install -d $RPM_BUILD_ROOT%{_libdir}/luajit/%{luajit_abi}
185install -p build-luajit/luv.so $RPM_BUILD_ROOT%{_libdir}/luajit/%{luajit_abi}/luv.so
186
187install -d $RPM_BUILD_ROOT%{_includedir}/luajit-%{luajit_abi}/luv
188for 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
190done
191%endif
192
754ed768
ER
193%clean
194rm -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
e9f13859 208
29998255 209%if %{with lua51}
e9f13859
JP
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
29998255 222%endif
e9f13859 223
29998255 224%if %{with luajit}
e9f13859
JP
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
29998255 237%endif
This page took 0.277671 seconds and 4 git commands to generate.