archrelease: copy trunk to extra-x86_64
[arch-packages.git] / sqlite / trunk / PKGBUILD
blob7f0d3a703f1b0d88f71cdf97da49f6bccb791437
1 # Maintainer: Andreas Radke <andyrtr@archlinux.org>
2 # Contributor: Tom Newsom <Jeepster@gmx.co.uk>
4 pkgbase="sqlite"
5 pkgname=('sqlite' 'sqlite-tcl' 'sqlite-analyzer' 'lemon' 'sqlite-doc')
6 _srcver=3390200
7 _docver=${_srcver}
8 #_docver=3330000
9 pkgver=3.39.2
10 pkgrel=1
11 pkgdesc="A C library that implements an SQL database engine"
12 arch=('x86_64')
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
19         license.txt)
20 options=('!emptydirs')
21 # upstream now switched to sha3sums - currently not suppoerted by makepkg
22 sha256sums=('e933d77000f45f3fbc8605f0050586a3013505a8de9b44032bd00ed72f1586f0'
23             '50f08a09e8858b023f24b59963e0559e1cf2e24a0c4d9ca61f35414a900d409e'
24             '55746d93b0df4b349c4aa4f09535746dac3530f9fd6de241c9f38e2c92e8ee97'
25             '4e57d9ac979f1c9872e69799c2597eeef4c6ce7224f3ede0bf9dc8d217b1e65d')
27 prepare() {
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
34   #autoreconf -vfi
37 build() {
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"
49   # build sqlite
50   cd sqlite-src-$_srcver
51   ./configure --prefix=/usr \
52         --disable-static \
53         --enable-fts3 \
54         --enable-fts4 \
55         --enable-fts5 \
56         --enable-rtree \
57         TCLLIBDIR=/usr/lib/sqlite$pkgver
58   sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
59   make
60   # build additional tools
61   make showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
64 package_sqlite() {
66  pkgdesc="A C library that implements an SQL database engine"
67  depends=('readline' 'zlib')
68  provides=("sqlite3=$pkgver")
69  replaces=("sqlite3")
71   cd sqlite-src-$_srcver
72   make DESTDIR="${pkgdir}" install
74   install -m755 showdb showjournal showstat4 showwal sqldiff "${pkgdir}"/usr/bin/
76   # install manpage
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
84   mkdir "$srcdir"/tcl
85   mv "$pkgdir"/usr/lib/sqlite* "$srcdir"/tcl
88 package_sqlite-tcl() {
90  pkgdesc="sqlite Tcl Extension Architecture (TEA)"
91  depends=('sqlite')
92  provides=("sqlite3-tcl=$pkgver")
93  replaces=("sqlite3-tcl")
95   install -m755 -d "${pkgdir}"/usr/lib
96   mv "$srcdir"/tcl/* "${pkgdir}"/usr/lib
98   # install manpage
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/
102   # link license
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/
117 package_lemon() {
119  # https://www.sqlite.org/lemon.html
120  pkgdesc="A parser generator"
121  depends=('glibc')
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
127   
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}/
145   
146   rm "${pkgdir}"/usr/share/doc/${pkgbase}/lemon.html