diff --git a/sqlite-doc-3360000.zip b/sqlite-doc-3360000.zip new file mode 100644 index 0000000000000000000000000000000000000000..14dcf01b5ab7cc744f6cbf611eca4063a9095fe7 Binary files /dev/null and b/sqlite-doc-3360000.zip differ diff --git a/sqlite-src-3360000.zip b/sqlite-src-3360000.zip new file mode 100644 index 0000000000000000000000000000000000000000..0e3d3927b261af9b24552d47186240886a30183d Binary files /dev/null and b/sqlite-src-3360000.zip differ diff --git a/sqlite-version-3.37.2.tar.gz b/sqlite-version-3.37.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..8b7d4a95b2935979361fb2ba1f950635af390df8 Binary files /dev/null and b/sqlite-version-3.37.2.tar.gz differ diff --git a/sqlite.spec b/sqlite.spec new file mode 100644 index 0000000000000000000000000000000000000000..5b5fe6483a041f8fec74ec81a6b7a8ac4c5d4d05 --- /dev/null +++ b/sqlite.spec @@ -0,0 +1,235 @@ +%define anolis_release 1 + +%bcond_without tcl +%bcond_without sqldiff +%bcond_with static +%bcond_without check + +%define realver 3360000 +%define docver 3360000 +%define year 2021 + +Summary: Library that implements an embeddable SQL database engine +Name: sqlite +Version: 3.37.2 +Release: %{anolis_release}%{?dist} +License: Public Domain +URL: http://www.sqlite.org/ + +Source0: http://www.sqlite.org/%{year}/sqlite-src-%{realver}.zip +Source1: http://www.sqlite.org/%{year}/sqlite-doc-%{docver}.zip +Source2: https://github.com/sqlite/archive/refs/tags/sqlite-version-3.37.2.tar.gz + +BuildRequires: make +BuildRequires: gcc +BuildRequires: ncurses-devel readline-devel glibc-devel +BuildRequires: autoconf +%if %{with tcl} +BuildRequires: /usr/bin/tclsh +BuildRequires: tcl-devel +%{!?tcl_version: %global tcl_version 8.6} +%{!?tcl_sitearch: %global tcl_sitearch %{_libdir}/tcl%{tcl_version}} +%endif + +Requires: %{name}-libs = %{version}-%{release} + +%description +SQLite is a C library that implements an SQL database engine. A large +subset of SQL92 is supported. A complete database is stored in a +single disk file. The API is designed for convenience and ease of use. +Applications that link against SQLite can enjoy the power and +flexibility of an SQL database without the administrative hassles of +supporting a separate database server. Version 2 and version 3 binaries +are named to permit each to be installed on a single host + +%package devel +Summary: Development tools for the sqlite3 embeddable SQL database engine +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: pkgconfig + +%description devel +This package contains the header files and development documentation +for %{name}. If you like to develop programs using %{name}, you will need +to install %{name}-devel. + +%package libs +Summary: Shared library for the sqlite3 embeddable SQL database engine. + +%description libs +This package contains the shared library for %{name}. + +%package doc +Summary: Documentation for sqlite +BuildArch: noarch + +%description doc +This package contains most of the static HTML files that comprise the +www.sqlite.org website, including all of the SQL Syntax and the +C/C++ interface specs and other miscellaneous documentation. + +%package -n lemon +Summary: A parser generator + +%description -n lemon +Lemon is an LALR(1) parser generator for C or C++. It does the same +job as bison and yacc. But lemon is not another bison or yacc +clone. It uses a different grammar syntax which is designed to reduce +the number of coding errors. Lemon also uses a more sophisticated +parsing engine that is faster than yacc and bison and which is both +reentrant and thread-safe. Furthermore, Lemon implements features +that can be used to eliminate resource leaks, making is suitable for +use in long-running programs such as graphical user interfaces or +embedded controllers. + +%if %{with sqldiff} +%package tools +Summary: %{name} tools +Group: Development/Tools + +%description tools +%{name} related tools. Currently contains only sqldiff. +- sqldiff: The sqldiff binary is a command-line utility program + that displays the differences between SQLite databases. +%endif + +%if %{with tcl} +%package tcl +Summary: Tcl module for the sqlite3 embeddable SQL database engine +Requires: %{name} = %{version}-%{release} +Requires: tcl(abi) = %{tcl_version} + +%description tcl +This package contains the tcl modules for %{name}. + +%package analyzer +Summary: An analysis program for sqlite3 database files +Requires: %{name} = %{version}-%{release} +Requires: tcl(abi) = %{tcl_version} + +%description analyzer +This package contains the analysis program for %{name}. +%endif + +%prep +%setup -q -a1 -n %{name}-src-%{realver} + +# Remove backup-file +rm -f %{name}-doc-%{docver}/sqlite.css~ || : + +autoconf # Rerun with new autoconf to add support for aarm64 + +%build +export CFLAGS="$RPM_OPT_FLAGS $RPM_LD_FLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1 \ + -DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_ENABLE_FTS3=1 \ + -DSQLITE_ENABLE_RTREE=1 -DSQLITE_SECURE_DELETE=1 \ + -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 \ + -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_JSON1=1 \ + -DSQLITE_ENABLE_FTS4=1 \ + -DSQLITE_ENABLE_MATH_FUNCTIONS \ + -DSQLITE_ENABLE_DBPAGE_VTAB \ + -Wall -fno-strict-aliasing" +%configure %{!?with_tcl:--disable-tcl} \ + --enable-fts4 \ + --enable-fts5 \ + --enable-threadsafe \ + --enable-threads-override-locks \ + --enable-load-extension \ + %{?with_tcl:TCLLIBDIR=%{tcl_sitearch}/sqlite3} + +# rpath removal +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool + +%make_build + +# Build sqlite3_analyzer +# depends on tcl +%if %{with tcl} +%make_build sqlite3_analyzer +%endif + +# Build sqldiff +%if %{with tcl} +%make_build sqldiff +%endif + +%install +%make_install + +install -D -m0644 sqlite3.1 $RPM_BUILD_ROOT/%{_mandir}/man1/sqlite3.1 +install -D -m0755 lemon $RPM_BUILD_ROOT/%{_bindir}/lemon +install -D -m0644 tool/lempar.c $RPM_BUILD_ROOT/%{_datadir}/lemon/lempar.c + +%if %{with tcl} +# fix up permissions to enable dep extraction +chmod 0755 ${RPM_BUILD_ROOT}/%{tcl_sitearch}/sqlite3/*.so +# Install sqlite3_analyzer +install -D -m0755 sqlite3_analyzer $RPM_BUILD_ROOT/%{_bindir}/sqlite3_analyzer +%endif + +# Install sqldiff +%if %{with tcl} +install -D -m0755 sqldiff $RPM_BUILD_ROOT/%{_bindir}/sqldiff +%endif + +%if ! %{with static} +rm -f $RPM_BUILD_ROOT/%{_libdir}/*.{la,a} +%endif + +%if %{with check} +%check +# XXX shell tests are broken due to loading system libsqlite3, work around... +export LD_LIBRARY_PATH=`pwd`/.libs +export MALLOC_CHECK_=3 + +# csv01 hangs on all non-intel archs i've tried +%ifarch x86_64 +%else +rm test/csv01.test +%endif + +make test +%endif #with check + +%ldconfig_scriptlets libs + +%files +%{_bindir}/sqlite3 +%{_mandir}/man?/* + +%files libs +%doc README.md +%{_libdir}/*.so.* + +%files devel +%{_includedir}/*.h +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%if %{with static} +%{_libdir}/*.a +%exclude %{_libdir}/*.la +%endif + +%files doc +%doc %{name}-doc-%{docver}/* + +%files -n lemon +%{_bindir}/lemon +%{_datadir}/lemon + +%if %{with tcl} +%files tcl +%{tcl_sitearch}/sqlite3 + +%if %{with sqldiff} +%files tools +%{_bindir}/sqldiff +%endif + +%files analyzer +%{_bindir}/sqlite3_analyzer +%endif + +%changelog +* Fri Mar 11 2022 liuzhilin - 3.37.2-1 +- Init for Anolis OS 23