2024-03-27 17:37:54 +01:00

239 lines
8.4 KiB
Bash

# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Renato Silva <br.renatosilva@gmail.com>
pkgbase="sqlite"
pkgname=('sqlite' 'libsqlite' 'libsqlite-devel' 'sqlite-doc'
'tcl-sqlite'
'sqlite-extensions'
'lemon')
_sqlite_year=2024
_srcver=3450100
_docver=${_srcver}
pkgver=3.45.1
pkgrel=1
pkgdesc="A C library that implements an SQL database engine"
arch=('i686' 'x86_64')
license=(PublicDomain)
url="https://www.sqlite.org/"
msys2_references=(
"anitya: 4877"
"cpe: cpe:/a:sqlite:sqlite"
)
depends=('libreadline' 'zlib' 'tcl')
makedepends=('libreadline-devel' 'icu-devel' 'tcl-devel' 'zlib-devel' 'autotools' 'gcc')
source=(https://www.sqlite.org/${_sqlite_year}/sqlite-src-${_srcver}.zip
https://www.sqlite.org/${_sqlite_year}/sqlite-doc-${_docver}.zip
LICENSE
0010-sqlite-3.34.0-lemon.patch
0001-sqlite3.32.3-configure.ac-fix-OS-recognition-on-MSYS2.patch
0002-sqlite3.32.3-Makefile.in-fix-rule-compiling-rbu.exe.patch
0007-sqlite3.36.0-Makefile.in-fix-libtclsqlite-package-installation-bug.patch
0020-missing-include.patch
Makefile.ext.in README.md.in)
sha256sums=('7f7b14a68edbcd4a57df3a8c4dbd56d2d3546a6e7cdd50de40ceb03af33d34ba'
'bbe376fdd36884a00f4dd93bcd6e80470d66408d4957cb23ba22931fa579206a'
'0b76663a90e034f3d7f2af5bfada4cedec5ebc275361899eccc5c18e6f01ff1f'
'ee6bdd979a97205a1a2dd760e90c8588f45523cecb5256c0d927f24494f7fc9f'
'589b7182343dba3dd8225c13ff1d7d275e5f714e7793bac1c88f7cfdd569d9e0'
'b717c73804be44b82048d90bbb8e0c61ff081339a5757194e9769bd4d9c048e5'
'10f30378e83423f8b84462c1dd5b58501913816865cfd595f69a7b9ddd7e4e2b'
'03116073a007eac25800764f2c0bdc849f3d7ba3e3401e14c94343ec5b1be78f'
'f7da5d5fb4b4b3588fa59d7282244495afe546e01c73c2369e50c3930e461ea9'
'ef3a1faa02a88e05539d160d51679f164dfa23cc5a637ff36bc504bf04d6d7a6')
_sqlite_tools="sqlite3.exe sqlite3_analyzer.exe sqldiff.exe dbhash.exe rbu.exe"
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying $_patch"
patch -Nbp1 -i "${srcdir}/${_patch}"
done
}
prepare() {
msg2 "Preparing sqlite package..."
cd "${srcdir}"/sqlite-src-${_srcver}
apply_patch_with_msg 0001-sqlite3.32.3-configure.ac-fix-OS-recognition-on-MSYS2.patch
apply_patch_with_msg 0002-sqlite3.32.3-Makefile.in-fix-rule-compiling-rbu.exe.patch
apply_patch_with_msg 0007-sqlite3.36.0-Makefile.in-fix-libtclsqlite-package-installation-bug.patch
apply_patch_with_msg 0020-missing-include.patch
autoreconf -vfi
msg2 "Preparing files for lemon.exe to be distributed..."
cd "${srcdir}"
cp -v sqlite-src-${_srcver}/tool/lemon.c .
cp -v sqlite-src-${_srcver}/tool/lempar.c .
patch -Np0 -i 0010-sqlite-3.34.0-lemon.patch
}
build() {
msg2 "Building sqlite package..."
export CPPFLAGS="$CPPFLAGS \
-DSQLITE_ENABLE_DBSTAT_VTAB=1 \
-DSQLITE_ENABLE_DBPAGE_VTAB=1 \
-DSQLITE_ENABLE_STAT4=1 \
-DSQLITE_ENABLE_UNLOCK_NOTIFY=1 \
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 \
-DSQLITE_OMIT_LOOKASIDE \
-DSQLITE_SECURE_DELETE=1 \
-DSQLITE_ENABLE_SESSION=1 \
-DSQLITE_ENABLE_PREUPDATE_HOOK=1 \
-DSQLITE_SOUNDEX=1 \
-DSQLITE_TEMP_STORE=1 \
-DSQLITE_USE_FCNTL_TRACE=1 \
-DUSE_SYSTEM_SQLITE=1 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS=1 \
-DSQLITE_ENABLE_COLUMN_METADATA=1 \
-DSQLITE_USE_ALLOCA=1 \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 \
-DSQLITE_ENABLE_STMTVTAB=1 \
-DSQLITE_HAVE_ZLIB=1 \
-DSQLITE_ENABLE_MATH_FUNCTIONS=1 \
"
export lt_cv_deplibs_check_method='pass_all'
mkdir -p build-${_srcver}-${MSYSTEM_CHOST}
cd build-${_srcver}-${MSYSTEM_CHOST}
../sqlite-src-${_srcver}/configure -C \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--build=${CHOST} \
--enable-shared \
--enable-static \
--enable-readline --disable-editline \
--enable-all
make -j all ${_sqlite_tools}
msg2 "Building sqlite extensions..."
./config.status --file=ext/misc/Makefile:../Makefile.ext.in 2> /dev/null
make -j -C ext/misc
msg2 "Building lemon.exe..."
cd "${srcdir}"
make lemon
}
check() {
cd build-${_srcver}-${MSYSTEM_CHOST}
# This test run lasts very loooong ... despite the target name
# sqlite 3.36.0: 54 errors out of 303582 tests on MSYS_NT-10.0-19043 64-bit little-endian
# !Failures on these tests: attach-6.2 attach-6.2.2 journal3-1.2.2.1 journal3-1.2.2.4 journal3-1.2.3.1 journal3-1.2.3.4 journal3-1.2.4.1 journal3-1.2.4.4 symlink-1.1 symlink-1.1.2 symlink-1.1.4 symlink-1.2.2 symlink-1.2.3 symlink-1.3 symlink-2.1.2 symlink-2.1.4 symlink-2.1.6 symlink-2.2.2 symlink-2.2.4 symlink-2.2.6 symlink-4.2.1 symlink-4.2.2 symlink-4.3.1 symlink-4.3.2 symlink-4.4.2 tableapi-7.transient.37 tkt3457-1.3 triggerA-3.transient.94 triggerA-3.transient.118 triggerA-3.transient.119 triggerA-3.transient.275 triggerA-3.transient.305 triggerA-3.transient.306 triggerA-3.transient.317 triggerA-3.transient.318 triggerA-3.transient.319 triggerA-3.transient.320 wal2-12.2.2.1 wal2-12.2.2.4 wal2-12.2.3.1 wal2-12.2.3.4 wal2-12.2.4.1 wal2-12.2.4.4 wal2-13.3.1 wal2-13.4.1 wal2-13.5.1 wal2-13.7.1 wal2-13.7.3 wal2-13.7.4 wal2-13.8.1 wal2-13.8.3 wal2-13.8.4 wal2-13.9.1 wal2-13.9.2
make quicktest || true
}
_install_license() {
install -D -m644 ${srcdir}/LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
package_sqlite() {
pkgdesc="A C library that implements an SQL database engine"
provides=("sqlite3=${pkgver}")
replaces=("sqlite3")
replaces+=('sqlite-icu' 'sqlite-rbu')
depends=('libreadline' 'zlib')
depends+=('tcl') # sqlite3_analyzer.exe
optdepends=("sqlite-extensions: various extensions for the SQL database engine ${pkgver}")
mkdir -p ${pkgdir}/usr/bin
cd build-${_srcver}-${MSYSTEM_CHOST}/.libs
cp -v ${_sqlite_tools} ${pkgdir}/usr/bin/
# documentation from TEA directory
mkdir -p ${pkgdir}/usr/share/man/man1/
cd ${srcdir}/sqlite-src-${_srcver}
cp autoconf/tea/doc/* ${pkgdir}/usr/share/man/man1/
_install_license
}
package_libsqlite() {
pkgdesc="Sqlite3 library"
groups=('libraries')
depends=()
options+=(!staticlibs)
provides=("libsqlite=${pkgver}")
# make pacman remove the following packages dependant on a certain version
# of libsqlite which became obsolete since sqlite 3.33.0.
conflicts=('sqlite-compress<3.33.0'
'sqlite-icu<3.33.0'
'sqlite-rbu<3.33.0'
'sqlite-vfslog<3.33.0')
cd build-${_srcver}-${MSYSTEM_CHOST}
make lib_install DESTDIR=${pkgdir}
rm -fr ${pkgdir}/usr/lib
_install_license
}
package_libsqlite-devel() {
pkgdesc="Sqlite3 headers and libraries"
groups=('development')
depends=("libsqlite=${pkgver}" 'zlib-devel')
optdepends=('tcl-sqlite: Tcl bindings for SQLite')
options+=('staticlibs')
cd build-${_srcver}-${MSYSTEM_CHOST}
make install DESTDIR=${pkgdir}
rm -fr ${pkgdir}/usr/bin
rm -fr ${pkgdir}/usr/lib/tcl*
_install_license
}
package_sqlite-doc() {
pkgdesc="Most of the static HTML files that comprise Sqlite ${pkgver} website, including all of the SQL Syntax and the C/C++ interface specs and other miscellaneous documentation"
depends=()
provides=("sqlite3-doc=${pkgver}")
cd ${srcdir}/sqlite-doc-${_docver}
mkdir -p ${pkgdir}/usr/share/doc/${pkgbase}
cp -R * ${pkgdir}/usr/share/doc/${pkgbase}/
_install_license
}
package_sqlite-extensions() {
pkgdesc="Various extensions for the SQL database engine ${pkgver}"
depends=("sqlite=${pkgver}" "libsqlite=${pkgver}")
# sqlite 3.32.3: The replaced packages are merged into 'sqlite-extensions'.
replaces=('sqlite-compress' 'sqlite-vfslog')
cd build-${_srcver}-${MSYSTEM_CHOST}
make -C ext/misc install DESTDIR=${pkgdir}
mkdir -p "${pkgdir}/usr/share/sqlite/extensions/"
cat "${srcdir}/README.md.in" | \
sed -e "s|@VERSION@|${pkgver}|g;" \
> "${pkgdir}/usr/share/sqlite/extensions/README.md"
_install_license
}
package_tcl-sqlite() {
pkgdesc="Tcl bindings for SQLite"
depends=("libsqlite=${pkgver}" 'tcl') # tcl 8.6
cd build-${_srcver}-${MSYSTEM_CHOST}
make tcl_install DESTDIR=${pkgdir}
rm -fr ${pkgdir}/usr/bin
find ${pkgdir}/usr/lib -type f -name '*.a' -delete
_install_license
}
package_lemon() {
pkgdesc="The LEMON LALR Parser Generator used in SQLite ${pkgver} (MSYS2)"
depends=()
mkdir -p ${pkgdir}/usr/{bin,share/lemon,share/licenses/lemon}
cp -v lemon.exe ${pkgdir}/usr/bin/
cp -v lempar.c ${pkgdir}/usr/share/lemon/
cp -v LICENSE ${pkgdir}/usr/share/licenses/lemon/
}