1 # Maintainer: Andreas Radke <andyrtr@archlinux.org>
2 # Contributor: Tom Newsom <Jeepster@gmx.co.uk>
5 pkgname=('sqlite' 'sqlite-tcl' 'sqlite-analyzer' 'lemon' 'sqlite-doc')
11 pkgdesc="A C library that implements an SQL database engine"
13 license=('custom:Public Domain')
14 url="https://www.sqlite.org/"
15 makedepends=('tcl' 'readline' 'zlib')
16 options=('!emptydirs')
17 source=(https://www.sqlite.org/2023/sqlite-src-${_srcver}.zip
18 https://www.sqlite.org/2023/sqlite-doc-${_docver}.zip
19 sqlite-lemon-system-template.patch
21 # upstream now switched to sha3sums - currently not supported by makepkg
22 sha256sums=('38ca56a317be37fb00bd92bc280d9b9209bd4008b297d483c41ec1f6079bfb6d'
23 'd62fd5f0fcfd15b2c26171e89f762268e2863df3c09696e76cf1482e34db8262'
24 '55746d93b0df4b349c4aa4f09535746dac3530f9fd6de241c9f38e2c92e8ee97'
25 '4e57d9ac979f1c9872e69799c2597eeef4c6ce7224f3ede0bf9dc8d217b1e65d')
28 cd sqlite-src-$_srcver
30 # patch taken from Fedora
31 # https://src.fedoraproject.org/rpms/sqlite/blob/master/f/sqlite.spec
32 patch -Np1 -i ../sqlite-lemon-system-template.patch
38 export CPPFLAGS="$CPPFLAGS \
39 -DSQLITE_ENABLE_COLUMN_METADATA=1 \
40 -DSQLITE_ENABLE_UNLOCK_NOTIFY \
41 -DSQLITE_ENABLE_DBSTAT_VTAB=1 \
42 -DSQLITE_ENABLE_FTS3_TOKENIZER=1 \
43 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
44 -DSQLITE_SECURE_DELETE \
45 -DSQLITE_ENABLE_STMTVTAB \
46 -DSQLITE_MAX_VARIABLE_NUMBER=250000 \
47 -DSQLITE_MAX_EXPR_DEPTH=10000 \
48 -DSQLITE_ENABLE_MATH_FUNCTIONS"
51 cd sqlite-src-$_srcver
52 ./configure --prefix=/usr \
58 TCLLIBDIR=/usr/lib/sqlite$pkgver
59 sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
61 # build additional tools
62 make showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
67 pkgdesc="A C library that implements an SQL database engine"
68 depends=('readline' 'zlib')
69 provides=("sqlite3=$pkgver" 'libsqlite3.so')
72 cd sqlite-src-$_srcver
73 make DESTDIR="${pkgdir}" install
75 install -m755 showdb showjournal showstat4 showwal sqldiff "${pkgdir}"/usr/bin/
78 install -m755 -d "${pkgdir}"/usr/share/man/man1
79 install -m644 sqlite3.1 "${pkgdir}"/usr/share/man/man1/
81 # license - no linking required because pkgbase=pkgname
82 install -D -m644 "${srcdir}"/license.txt "${pkgdir}"/usr/share/licenses/${pkgbase}/license.txt
84 # split out tcl extension
86 mv "$pkgdir"/usr/lib/sqlite* "$srcdir"/tcl
89 package_sqlite-tcl() {
91 pkgdesc="sqlite Tcl Extension Architecture (TEA)"
93 provides=("sqlite3-tcl=$pkgver")
94 replaces=("sqlite3-tcl")
96 install -m755 -d "${pkgdir}"/usr/lib
97 mv "$srcdir"/tcl/* "${pkgdir}"/usr/lib
100 install -m755 -d "${pkgdir}"/usr/share/man/mann
101 install -m644 "${srcdir}"/sqlite-src-$_srcver/autoconf/tea/doc/sqlite3.n "${pkgdir}"/usr/share/man/mann/
104 install -m755 -d "${pkgdir}"/usr/share/licenses
105 ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
108 package_sqlite-analyzer() {
110 pkgdesc="An analysis program for sqlite3 database files"
111 depends=('sqlite' 'tcl')
113 cd sqlite-src-$_srcver
114 install -m755 -d "${pkgdir}"/usr/bin
115 install -m755 sqlite3_analyzer "${pkgdir}"/usr/bin/
120 # https://www.sqlite.org/lemon.html
121 pkgdesc="A parser generator"
124 cd sqlite-src-$_srcver
125 # ELF file ('usr/bin/lemon') lacks FULL RELRO, check LDFLAGS. - no fix found so far
126 install -Dm755 lemon ${pkgdir}/usr/bin/lemon
127 install -Dm644 lempar.c ${pkgdir}/usr/share/lemon/lempar.c
129 mkdir -p "${pkgdir}"/usr/share/doc/${pkgname}
130 cp ../sqlite-doc-${_docver}/lemon.html "${pkgdir}"/usr/share/doc/${pkgname}/
131 install -m755 -d "${pkgdir}"/usr/share/licenses
132 ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
136 package_sqlite-doc() {
138 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"
139 #arch=('any') - not yet supported
140 provides=("sqlite3-doc=$pkgver")
141 replaces=("sqlite3-doc")
143 cd sqlite-doc-${_docver}
144 mkdir -p "${pkgdir}"/usr/share/doc/${pkgbase}
145 cp -R * "${pkgdir}"/usr/share/doc/${pkgbase}/
147 rm "${pkgdir}"/usr/share/doc/${pkgbase}/lemon.html