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