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 source=(https://www.sqlite.org/2022/sqlite-src-${_srcver}.zip
17 https://www.sqlite.org/2022/sqlite-doc-${_docver}.zip
18 sqlite-lemon-system-template.patch
20 options=('!emptydirs')
21 # upstream now switched to sha3sums - currently not suppoerted by makepkg
22 sha256sums=('e933d77000f45f3fbc8605f0050586a3013505a8de9b44032bd00ed72f1586f0'
23 '50f08a09e8858b023f24b59963e0559e1cf2e24a0c4d9ca61f35414a900d409e'
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_SECURE_DELETE \
44 -DSQLITE_ENABLE_STMTVTAB \
45 -DSQLITE_MAX_VARIABLE_NUMBER=250000 \
46 -DSQLITE_MAX_EXPR_DEPTH=10000 \
47 -DSQLITE_ENABLE_MATH_FUNCTIONS"
50 cd sqlite-src-$_srcver
51 ./configure --prefix=/usr \
57 TCLLIBDIR=/usr/lib/sqlite$pkgver
58 sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
60 # build additional tools
61 make showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
66 pkgdesc="A C library that implements an SQL database engine"
67 depends=('readline' 'zlib')
68 provides=("sqlite3=$pkgver")
71 cd sqlite-src-$_srcver
72 make DESTDIR="${pkgdir}" install
74 install -m755 showdb showjournal showstat4 showwal sqldiff "${pkgdir}"/usr/bin/
77 install -m755 -d "${pkgdir}"/usr/share/man/man1
78 install -m644 sqlite3.1 "${pkgdir}"/usr/share/man/man1/
80 # license - no linking required because pkgbase=pkgname
81 install -D -m644 "${srcdir}"/license.txt "${pkgdir}"/usr/share/licenses/${pkgbase}/license.txt
83 # split out tcl extension
85 mv "$pkgdir"/usr/lib/sqlite* "$srcdir"/tcl
88 package_sqlite-tcl() {
90 pkgdesc="sqlite Tcl Extension Architecture (TEA)"
92 provides=("sqlite3-tcl=$pkgver")
93 replaces=("sqlite3-tcl")
95 install -m755 -d "${pkgdir}"/usr/lib
96 mv "$srcdir"/tcl/* "${pkgdir}"/usr/lib
99 install -m755 -d "${pkgdir}"/usr/share/man/mann
100 install -m644 "${srcdir}"/sqlite-src-$_srcver/autoconf/tea/doc/sqlite3.n "${pkgdir}"/usr/share/man/mann/
103 install -m755 -d "${pkgdir}"/usr/share/licenses
104 ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
107 package_sqlite-analyzer() {
109 pkgdesc="An analysis program for sqlite3 database files"
110 depends=('sqlite' 'tcl')
112 cd sqlite-src-$_srcver
113 install -m755 -d "${pkgdir}"/usr/bin
114 install -m755 sqlite3_analyzer "${pkgdir}"/usr/bin/
119 # https://www.sqlite.org/lemon.html
120 pkgdesc="A parser generator"
123 cd sqlite-src-$_srcver
124 # ELF file ('usr/bin/lemon') lacks FULL RELRO, check LDFLAGS. - no fix found so far
125 install -Dm755 lemon ${pkgdir}/usr/bin/lemon
126 install -Dm644 lempar.c ${pkgdir}/usr/share/lemon/lempar.c
128 mkdir -p "${pkgdir}"/usr/share/doc/${pkgname}
129 cp ../sqlite-doc-${_docver}/lemon.html "${pkgdir}"/usr/share/doc/${pkgname}/
130 install -m755 -d "${pkgdir}"/usr/share/licenses
131 ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
135 package_sqlite-doc() {
137 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"
138 #arch=('any') - not yet supported
139 provides=("sqlite3-doc=$pkgver")
140 replaces=("sqlite3-doc")
142 cd sqlite-doc-${_docver}
143 mkdir -p "${pkgdir}"/usr/share/doc/${pkgbase}
144 cp -R * "${pkgdir}"/usr/share/doc/${pkgbase}/
146 rm "${pkgdir}"/usr/share/doc/${pkgbase}/lemon.html