jobcore/sqlite/PKGBUILD

178 lines
5.7 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase="sqlite"
pkgname=('sqlite' 'sqlite-tcl' 'sqlite-analyzer' 'lemon' 'sqlite-doc')
_srcver=3450200
_docver=${_srcver}
#_docver=3450200
pkgver=3.45.2
pkgrel=01
pkgdesc="A C library that implements an SQL database engine"
url="https://www.sqlite.org/"
makedepends=('tcl' 'readline' 'zlib')
#options=('!emptydirs' 'debug') ## uncomment this to produce the debug pkg
options=('!emptydirs')
source=(https://www.sqlite.org/2024/sqlite-src-${_srcver}.zip
https://www.sqlite.org/2024/sqlite-doc-${_docver}.zip
sqlite-lemon-system-template.patch
license.txt)
# upstream now switched to sha3sums - currently not supported by makepkg
prepare() {
cd sqlite-src-$_srcver
# patch taken from Fedora
# https://src.fedoraproject.org/rpms/sqlite/blob/master/f/sqlite.spec
patch -Np1 -i ../sqlite-lemon-system-template.patch
#autoreconf -vfi
}
build() {
# this uses malloc_usable_size, which is incompatible with fortification level 3
export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CPPFLAGS="$CPPFLAGS \
-DSQLITE_ENABLE_COLUMN_METADATA=1 \
-DSQLITE_ENABLE_UNLOCK_NOTIFY \
-DSQLITE_ENABLE_DBSTAT_VTAB=1 \
-DSQLITE_ENABLE_FTS3_TOKENIZER=1 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_SECURE_DELETE \
-DSQLITE_ENABLE_STMTVTAB \
-DSQLITE_ENABLE_STAT4 \
-DSQLITE_MAX_VARIABLE_NUMBER=250000 \
-DSQLITE_MAX_EXPR_DEPTH=10000 \
-DSQLITE_ENABLE_MATH_FUNCTIONS"
# build sqlite
cd sqlite-src-$_srcver
./configure --prefix=/usr \
--disable-static \
--enable-fts3 \
--enable-fts4 \
--enable-fts5 \
--enable-rtree \
TCLLIBDIR=/usr/lib/sqlite$pkgver
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make
# build additional tools
make showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
}
package_sqlite() {
pkgdesc="A C library that implements an SQL database engine"
depends=('readline' 'zlib' 'glibc')
provides=("sqlite3=$pkgver" 'libsqlite3.so')
replaces=("sqlite3")
cd sqlite-src-$_srcver
make DESTDIR="${pkgdir}" install
install -m755 showdb showjournal showstat4 showwal sqldiff "${pkgdir}"/usr/bin/
# install manpage
install -m755 -d "${pkgdir}"/usr/share/man/man1
install -m644 sqlite3.1 "${pkgdir}"/usr/share/man/man1/
# license
install -D -m644 "${srcdir}"/license.txt "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt
# split out tcl extension
mkdir "$srcdir"/tcl
mv "$pkgdir"/usr/lib/sqlite* "$srcdir"/tcl
}
package_sqlite-tcl() {
pkgdesc="sqlite Tcl Extension Architecture (TEA)"
depends=('sqlite' 'glibc')
provides=("sqlite3-tcl=$pkgver")
replaces=("sqlite3-tcl")
install -m755 -d "${pkgdir}"/usr/lib
mv "$srcdir"/tcl/* "${pkgdir}"/usr/lib
# install manpage
install -m755 -d "${pkgdir}"/usr/share/man/mann
install -m644 "${srcdir}"/sqlite-src-$_srcver/autoconf/tea/doc/sqlite3.n "${pkgdir}"/usr/share/man/mann/
# license
install -D -m644 "${srcdir}"/license.txt "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt
}
package_sqlite-analyzer() {
pkgdesc="An analysis program for sqlite3 database files"
depends=('sqlite' 'tcl' 'glibc')
cd sqlite-src-$_srcver
install -m755 -d "${pkgdir}"/usr/bin
install -m755 sqlite3_analyzer "${pkgdir}"/usr/bin/
# license
install -D -m644 "${srcdir}"/license.txt "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt
}
package_lemon() {
# https://www.sqlite.org/lemon.html
pkgdesc="A parser generator"
depends=('glibc')
cd sqlite-src-$_srcver
# ELF file ('usr/bin/lemon') lacks FULL RELRO, check LDFLAGS. - no fix found so far
install -Dm755 lemon ${pkgdir}/usr/bin/lemon
install -Dm644 lempar.c ${pkgdir}/usr/share/lemon/lempar.c
mkdir -p "${pkgdir}"/usr/share/doc/${pkgname}
cp ../sqlite-doc-${_docver}/lemon.html "${pkgdir}"/usr/share/doc/${pkgname}/
# license
install -D -m644 "${srcdir}"/license.txt "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt
}
package_sqlite-doc() {
pkgdesc="most of the static HTML files that comprise this website, including all of the SQL Syntax and the C/C++ interface specs and other miscellaneous documentation"
#arch=('any') - not yet supported
provides=("sqlite3-doc=$pkgver")
replaces=("sqlite3-doc")
cd sqlite-doc-${_docver}
mkdir -p "${pkgdir}"/usr/share/doc/${pkgbase}
cp -R * "${pkgdir}"/usr/share/doc/${pkgbase}/
# license
install -D -m644 "${srcdir}"/license.txt "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt
rm "${pkgdir}"/usr/share/doc/${pkgbase}/lemon.html
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('LicenseRef-Sqlite')
sha256sums=(4a45a3577cc8af683c4bd4c6e81a7c782c5b7d5daa06175ea2cb971ca71691b1 # sqlite-src-3450200.zip
645fd1078a4a03cfe83bfccc380685cc5dcf7dd132a23f78fad4f660e40cf2c7 # sqlite-doc-3450200.zip
55746d93b0df4b349c4aa4f09535746dac3530f9fd6de241c9f38e2c92e8ee97 # sqlite-lemon-system-template.patch
4e57d9ac979f1c9872e69799c2597eeef4c6ce7224f3ede0bf9dc8d217b1e65d) # license.txt
## a71536921bb8b5360ed765644f0046aaa1dd4580ec2955ecde0aef5d7248a1a2 lemon-3.45.2-01-x86_64.pkg.tar.lz
## 4e90d9598fcb264eb13ffd0161436271f218bdf81de94a682cb7849ac91dfa2b sqlite-3.45.2-01-x86_64.pkg.tar.lz
## 03f570cc36d3563630ef0580d6785cbb12ac8fc610b520c482fd7d21a2661fa5 sqlite-analyzer-3.45.2-01-x86_64.pkg.tar.lz
## 1fa74e64577d1bde29abe663fe46890acb9f85e91b6c9ca85a58534295ae32cc sqlite-doc-3.45.2-01-x86_64.pkg.tar.lz
## 9af0085d671c67390dc8aaa0813003a4a44d42beff76e0aed32710a0d09c5c80 sqlite-tcl-3.45.2-01-x86_64.pkg.tar.lz