]>
Commit | Line | Data |
---|---|---|
1 | # TODO: | |
2 | # - some tests fail with tcl8.5, it's tcl fault, | |
3 | # if someone REALLY cares (s)he can look into it | |
4 | # - sqlite binary is linked statically with sqlite library | |
5 | # | |
6 | # Conditional build: | |
7 | %bcond_with tests # run tests | |
8 | %bcond_with readline # readline (GPL) instead of libedit | |
9 | %bcond_without tcl # Tcl extension | |
10 | %bcond_without doc # disable documentation building | |
11 | %bcond_without unlock_notify # disable unlock notify API | |
12 | %bcond_without load_extension # enable load extension API | |
13 | %bcond_with icu # ICU tokenizer support | |
14 | %bcond_without wal_replication # WAL replication support | |
15 | ||
16 | %ifarch %{x8664} | |
17 | %undefine with_tests | |
18 | %endif | |
19 | ||
20 | # disabling tcl currently breaks making test target, | |
21 | # some hack in Makefile needs to be done | |
22 | %if %{without tcl} | |
23 | %undefine with_tests | |
24 | %endif | |
25 | ||
26 | # sqlite3 version with zero padded without any dots (3 08 10 01 is 3.8.10.1) | |
27 | # but trailing 00 means no 4rd part (3 11 01 00 is 3.11.1) | |
28 | %define vnum 3280000 | |
29 | %define ver %{lua:vn=rpm.expand("%vnum");v="";for i in string.gmatch(string.format("%08d", vn), "..") do v=v.."."..i:gsub("^0", "");end;v=v:gsub("^.",""):gsub("\.0$","");print(v)} | |
30 | ||
31 | # wal replication version | |
32 | %define walver 3.28.0 | |
33 | ||
34 | %define tclver 8.6 | |
35 | Summary: SQLite3 library | |
36 | Summary(pl.UTF-8): Biblioteka SQLite3 | |
37 | Name: sqlite3 | |
38 | Version: %{ver} | |
39 | Release: 1 | |
40 | License: Public Domain | |
41 | Group: Libraries | |
42 | # Source0Download: http://www.sqlite.org/download.html | |
43 | Source0: https://www.sqlite.org/2019/sqlite-src-%{vnum}.zip | |
44 | # Source0-md5: fe28fd6a90b86c4b9a4a7c61fdb1beb6 | |
45 | Patch0: %{name}-sign-function.patch | |
46 | # https://github.com/CanonicalLtd/dqlite/issues/91 | |
47 | Patch1: https://github.com/CanonicalLtd/sqlite/releases/download/version-%{walver}+replication3/sqlite-%{walver}.diff | |
48 | # Patch1-md5: 58d6b67af08d373047756ed5d2579fa8 | |
49 | URL: https://www.sqlite.org/ | |
50 | BuildRequires: autoconf >= 2.50 | |
51 | BuildRequires: automake | |
52 | %{!?with_readline:BuildRequires: libedit-devel} | |
53 | BuildRequires: libtool | |
54 | %{?with_readline:BuildRequires: readline-devel} | |
55 | %{?with_load_extension:BuildRequires: sed >= 4.0} | |
56 | BuildRequires: tcl | |
57 | %{?with_tcl:BuildRequires: tcl-devel >= %{tclver}} | |
58 | BuildRequires: unzip | |
59 | Requires: %{name}-libs = %{version}-%{release} | |
60 | %{?with_icu:Provides: %{name}(icu) = %{version}} | |
61 | %{?with_load_extension:Provides: %{name}(load_extension) = %{version}} | |
62 | %{?with_unlock_notify:Provides: %{name}(unlock_notify) = %{version}} | |
63 | %{?with_wal_replication:Provides: %{name}(wal_replication) = %{version}} | |
64 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
65 | ||
66 | %define _ulibdir /usr/lib | |
67 | ||
68 | %description | |
69 | SQLite is a C library that implements an SQL database engine. A large | |
70 | subset of SQL92 is supported. A complete database is stored in a | |
71 | single disk file. The API is designed for convenience and ease of use. | |
72 | Applications that link against SQLite can enjoy the power and | |
73 | flexiblity of an SQL database without the administrative hassles of | |
74 | supporting a separate database server. Because it omits the | |
75 | client-server interaction overhead and writes directly to disk, SQLite | |
76 | is also faster than the big database servers for most operations. In | |
77 | addition to the C library, the SQLite distribution includes a | |
78 | command-line tool for interacting with SQLite databases and SQLite | |
79 | bindings for Tcl/Tk. | |
80 | ||
81 | %description -l pl.UTF-8 | |
82 | SQLite jest biblioteką języka C, która implementuje silnik baz danych | |
83 | SQL (obsługiwana jest większość standardu SQL92). Cała baza danych | |
84 | przechowywana jest w jednym pliku. Aplikacje wykorzystujące tę | |
85 | bibliotekę charakteryzują się siłą i elastycznością SQLowych baz | |
86 | danych bez konieczności utrzymywania osobnego serwera baz danych. | |
87 | Ponieważ pomijana jest komunikacja klient-serwer i dane są zapisywane | |
88 | bezpośrednio na dysku, SQLite jest szybsza od dużych serwerów | |
89 | bazodanowych przy większości operacji na bazie danych. Dodatkowo | |
90 | oprócz biblioteki języka C, dostarczany jest program do zarządzania | |
91 | bazami danych. | |
92 | ||
93 | %package libs | |
94 | Summary: Shared library for the sqlite3 embeddable SQL database engine | |
95 | Summary(pl.UTF-8): Biblioteka współdzielona osadzalnego silnika baz danych SQL sqlite3 | |
96 | Group: Libraries | |
97 | %{?with_icu:Provides: %{name}-libs(icu) = %{version}} | |
98 | %{?with_load_extension:Provides: %{name}-libs(load_extension) = %{version}} | |
99 | %{?with_unlock_notify:Provides: %{name}-libs(unlock_notify) = %{version}} | |
100 | %{?with_wal_replication:Provides: %{name}-libs(wal_replication) = %{version}} | |
101 | Conflicts: sqlite3 < 3.23.1-2 | |
102 | ||
103 | %description libs | |
104 | This package contains the SQLite 3 shared library. | |
105 | ||
106 | %description libs -l pl.UTF-8 | |
107 | Ten pakiet zawiera bibliotekę współdzieloną SQLite 3. | |
108 | ||
109 | %package devel | |
110 | Summary: Header files for SQLite development | |
111 | Summary(pl.UTF-8): Pliki nagłówkowe SQLite | |
112 | Group: Development/Libraries | |
113 | Requires: %{name}-libs = %{version}-%{release} | |
114 | %if %{with unlock_notify} | |
115 | Provides: %{name}-devel(unlock_notify) = %{version} | |
116 | %endif | |
117 | %if %{with load_extension} | |
118 | Provides: %{name}-devel(load_extension) = %{version} | |
119 | %endif | |
120 | %if %{with icu} | |
121 | Provides: %{name}-devel(icu) = %{version} | |
122 | %endif | |
123 | %{?with_wal_replication:Provides: %{name}-devel(wal_replication) = %{version}} | |
124 | ||
125 | %description devel | |
126 | SQLite is a C library that implements an SQL database engine. A large | |
127 | subset of SQL92 is supported. A complete database is stored in a | |
128 | single disk file. The API is designed for convenience and ease of use. | |
129 | Applications that link against SQLite can enjoy the power and | |
130 | flexiblity of an SQL database without the administrative hassles of | |
131 | supporting a separate database server. Because it omits the | |
132 | client-server interaction overhead and writes directly to disk, SQLite | |
133 | is also faster than the big database servers for most operations. In | |
134 | addition to the C library, the SQLite distribution includes a | |
135 | command-line tool for interacting with SQLite databases and SQLite | |
136 | bindings for Tcl/Tk. | |
137 | ||
138 | This package contains the header files needed to develop programs that | |
139 | use these SQLite. | |
140 | ||
141 | %description devel -l pl.UTF-8 | |
142 | SQLite jest biblioteką języka C, która implementuje silnik baz danych | |
143 | SQL (obsługiwana jest większość standardu SQL92). Cała baza danych | |
144 | przechowywana jest w jednym pliku. Aplikacje wykorzystujące tę | |
145 | bibliotekę charakteryzują się siłą i elastycznością SQLowych baz | |
146 | danych bez konieczności utrzymywania osobnego serwera baz danych. | |
147 | Ponieważ pomijana jest komunikacja klient-serwer i dane są zapisywane | |
148 | bezpośrednio na dysku, SQLite jest szybsza od dużych serwerów | |
149 | bazodanowych przy większości operacji na bazie danych. Dodatkowo | |
150 | oprócz biblioteki języka C, dostarczany jest program do zarządzania | |
151 | bazami danych. | |
152 | ||
153 | Pakiet zawiera pliki nagówkowe niezbedne do kompilowania programów | |
154 | używających biblioteki SQLite. | |
155 | ||
156 | %package static | |
157 | Summary: Static libraries for SQLite development | |
158 | Summary(pl.UTF-8): Statyczne biblioteki SQLite | |
159 | Group: Development/Libraries | |
160 | Requires: %{name}-devel = %{version}-%{release} | |
161 | %if %{with unclock_notify} | |
162 | Provides: %{name}-static(unlock_notify) | |
163 | %endif | |
164 | %if %{with load_extension} | |
165 | Provides: %{name}-static(load_extension) | |
166 | %endif | |
167 | %{?with_wal_replication:Provides: %{name}-static(wal_replication)} | |
168 | ||
169 | %description static | |
170 | SQLite is a C library that implements an SQL database engine. A large | |
171 | subset of SQL92 is supported. A complete database is stored in a | |
172 | single disk file. The API is designed for convenience and ease of use. | |
173 | Applications that link against SQLite can enjoy the power and | |
174 | flexiblity of an SQL database without the administrative hassles of | |
175 | supporting a separate database server. Because it omits the | |
176 | client-server interaction overhead and writes directly to disk, SQLite | |
177 | is also faster than the big database servers for most operations. In | |
178 | addition to the C library, the SQLite distribution includes a | |
179 | command-line tool for interacting with SQLite databases and SQLite | |
180 | bindings for Tcl/Tk. | |
181 | ||
182 | This package contains the static SQLite libraries. | |
183 | ||
184 | %description static -l pl.UTF-8 | |
185 | SQLite jest biblioteką języka C, która implementuje silnik baz danych | |
186 | SQL (obsługiwana jest większość standardu SQL92). Cała baza danych | |
187 | przechowywana jest w jednym pliku. Aplikacje wykorzystujące tę | |
188 | bibliotekę charakteryzują się siłą i elastycznością SQLowych baz | |
189 | danych bez konieczności utrzymywania osobnego serwera baz danych. | |
190 | Ponieważ pomijana jest komunikacja klient-serwer i dane są zapisywane | |
191 | bezpośrednio na dysku, SQLite jest szybsza od dużych serwerów | |
192 | bazodanowych przy większości operacji na bazie danych. Dodatkowo | |
193 | oprócz biblioteki języka C, dostarczany jest program do zarządzania | |
194 | bazami danych. | |
195 | ||
196 | Pakiet zawiera statyczne biblioteki SQLite. | |
197 | ||
198 | %package -n tcl-%{name} | |
199 | Summary: sqlite3 tcl extension | |
200 | Summary(pl.UTF-8): Rozszerzenie sqlite3 dla Tcl | |
201 | Group: Development/Languages/Tcl | |
202 | ||
203 | %description -n tcl-%{name} | |
204 | sqlite3 tcl extension. | |
205 | ||
206 | %description -n tcl-%{name} -l pl.UTF-8 | |
207 | Rozszerzenie sqlite3 dla Tcl. | |
208 | ||
209 | %prep | |
210 | %setup -q -n sqlite-src-%{vnum} | |
211 | %patch0 -p1 | |
212 | %{?with_wal_replication:%patch1 -p1} | |
213 | ||
214 | %{__sed} -i 's/mkdir doc/#mkdir doc/' Makefile.in | |
215 | ||
216 | if [ "$(cat VERSION)" != "%{version}" ]; then | |
217 | echo "Tarball content doesn't match version %{version}." >&2 | |
218 | exit 1 | |
219 | fi | |
220 | ||
221 | %build | |
222 | %{__libtoolize} | |
223 | cp -f /usr/share/automake/config.sub . | |
224 | %{__aclocal} | |
225 | %{__autoconf} --force | |
226 | append-cppflags() { | |
227 | CPPFLAGS="$CPPFLAGS $*" | |
228 | } | |
229 | append-libs() { | |
230 | LIBS="$LIBS $*" | |
231 | } | |
232 | export CPPFLAGS="%{rpmcflags}" | |
233 | export LIBS | |
234 | %if %{with tcl} | |
235 | export TCLLIBDIR="%{tcl_sitearch}/sqlite3" | |
236 | %endif | |
237 | ||
238 | append-cppflags -DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_SECURE_DELETE | |
239 | ||
240 | # Support for optional ORDER BY and LIMIT clause on UPDATE and DELETE statements | |
241 | append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT | |
242 | ||
243 | # Support column metadata functions. | |
244 | # http://sqlite.org/c3ref/column_database_name.html | |
245 | # http://sqlite.org/c3ref/table_column_metadata.html | |
246 | append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA | |
247 | ||
248 | # Support Full-Text Search versions 3 and 4. | |
249 | # http://sqlite.org/fts3.html | |
250 | #append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS4_UNICODE61 | |
251 | append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS | |
252 | append-cppflags -DSQLITE_ENABLE_FTS3_TOKENIZER | |
253 | ||
254 | # Support R*Trees. | |
255 | # http://sqlite.org/rtree.html | |
256 | append-cppflags -DSQLITE_ENABLE_RTREE | |
257 | ||
258 | # Support Geopoly module (new as of 3.25.0) | |
259 | # https://www.sqlite.org/geopoly.html | |
260 | append-cppflags -DSQLITE_ENABLE_GEOPOLY | |
261 | ||
262 | # Support soundex() function. | |
263 | # http://sqlite.org/lang_corefunc.html#soundex | |
264 | #append-cppflags -DSQLITE_SOUNDEX | |
265 | ||
266 | # Support dbstat virtual table. | |
267 | # https://www.sqlite.org/dbstat.html | |
268 | append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB | |
269 | ||
270 | # Support for session extension (record changes to a changeset). | |
271 | # https://www.sqlite.org/sessionintro.html | |
272 | append-cppflags -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK | |
273 | ||
274 | %if %{with unlock_notify} | |
275 | # Support unlock notification. | |
276 | # http://sqlite.org/unlock_notify.html | |
277 | append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY | |
278 | %endif | |
279 | ||
280 | %if %{with icu} | |
281 | append-cppflags -DSQLITE_ENABLE_ICU | |
282 | append-libs "-licui18n -licuuc" | |
283 | %endif | |
284 | ||
285 | %if %{with load_extension} | |
286 | append-libs "-ldl" | |
287 | %endif | |
288 | ||
289 | %if %{with wal_replication} | |
290 | # A patched version of SQLite with support for WAL-based replication | |
291 | append-cppflags -DSQLITE_ENABLE_WAL_REPLICATION | |
292 | %endif | |
293 | ||
294 | %configure \ | |
295 | %{?with_readline:--disable-editline} \ | |
296 | %{!?with_tcl:--disable-tcl}%{?with_tcl:--with-tcl=%{_ulibdir}} \ | |
297 | %{__enable_disable load_extension load-extension} \ | |
298 | --enable-threadsafe \ | |
299 | --enable-fts5 | |
300 | ||
301 | %{__make} | |
302 | ||
303 | %if %{with doc} | |
304 | %{__make} doc | |
305 | %endif | |
306 | ||
307 | %{?with_tests:LC_ALL=C %{__make} test} | |
308 | ||
309 | %install | |
310 | rm -rf $RPM_BUILD_ROOT | |
311 | install -d $RPM_BUILD_ROOT{/%{_lib},%{_bindir},%{_includedir},%{_libdir},%{_mandir}/man1} | |
312 | ||
313 | %{__make} install \ | |
314 | DESTDIR=$RPM_BUILD_ROOT | |
315 | ||
316 | %{__mv} $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib} | |
317 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/lib*.so | |
318 | ln -sf /%{_lib}/$(cd $RPM_BUILD_ROOT/%{_lib}; echo lib*.so.*.*) \ | |
319 | $RPM_BUILD_ROOT%{_libdir}/libsqlite3.so | |
320 | ||
321 | cp -p sqlite3.1 $RPM_BUILD_ROOT%{_mandir}/man1 | |
322 | ||
323 | %clean | |
324 | rm -rf $RPM_BUILD_ROOT | |
325 | ||
326 | %post libs -p /sbin/ldconfig | |
327 | %postun libs -p /sbin/ldconfig | |
328 | ||
329 | %files libs | |
330 | %defattr(644,root,root,755) | |
331 | %attr(755,root,root) /%{_lib}/libsqlite3.so.*.*.* | |
332 | %attr(755,root,root) %ghost /%{_lib}/libsqlite3.so.0 | |
333 | ||
334 | %files | |
335 | %defattr(644,root,root,755) | |
336 | %doc README.md | |
337 | %attr(755,root,root) %{_bindir}/sqlite3 | |
338 | %{_mandir}/man1/sqlite3.1* | |
339 | ||
340 | %files devel | |
341 | %defattr(644,root,root,755) | |
342 | %attr(755,root,root) %{_libdir}/libsqlite3.so | |
343 | %{_libdir}/libsqlite3.la | |
344 | %{_includedir}/sqlite3.h | |
345 | %{_includedir}/sqlite3ext.h | |
346 | %{_pkgconfigdir}/sqlite3.pc | |
347 | ||
348 | %files static | |
349 | %defattr(644,root,root,755) | |
350 | %{_libdir}/libsqlite3.a | |
351 | ||
352 | %if %{with tcl} | |
353 | %files -n tcl-%{name} | |
354 | %defattr(644,root,root,755) | |
355 | %dir %{_libdir}/tcl*/sqlite3 | |
356 | %attr(755,root,root) %{_libdir}/tcl%{tclver}/sqlite3/libtclsqlite3.so | |
357 | %{_libdir}/tcl%{tclver}/sqlite3/pkgIndex.tcl | |
358 | %endif |