More updates...
[dragora.git] / recipes / db / sqlite / recipe
blob804b2dfa2db1b208e0f1964dbd5f1f2534013f48
1 # Build recipe for sqlite.
3 # Copyright (c) 2019-2020 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 program=sqlite
18 version=3310100
19 release=1
21 # Define hash tag to categorize the package name output
22 pkghashtag=db
24 tarname=${program}-autoconf-${version}.tar.gz
26 # Remote source(s)
27 fetch=http://sqlite.org/2020/$tarname
29 description="
30 SQlite is a C-language library that implements a SQL database engine.
32 The sqlite package is a software library that implements a
33 self-contained, serverless, zero-configuration, transactional
34 SQL database engine.
37 homepage=http://www.sqlite.org
38 license="Public Domain"
40 # Source documentation
41 docs="README.txt"
42 docsdir="${docdir}/${program}-${version}"
44 # The source has a custom source directory
45 srcdir=${program}-autoconf-${version}
47 build()
49     set -e
51     unpack "${tardir}/$tarname"
53     cd "$srcdir"
55     # Set sane permissions
56     chmod -R u+w,go-w,a+rX-s .
58     ./configure LDFLAGS="$QILDFLAGS" \
59      $configure_args \
60      --libdir=/usr/lib${libSuffix} \
61      --mandir=$mandir \
62      --docdir=$docsdir \
63      --build="$(cc -dumpmachine)" \
64      --enable-fts5 \
65       CFLAGS="$QICFLAGS \
66        -DSQLITE_ENABLE_FTS3=1             \
67        -DSQLITE_ENABLE_FTS4=1             \
68        -DSQLITE_ENABLE_COLUMN_METADATA=1  \
69        -DSQLITE_ENABLE_UNLOCK_NOTIFY=1    \
70        -DSQLITE_ENABLE_DBSTAT_VTAB=1      \
71        -DSQLITE_SECURE_DELETE=1           \
72        -DSQLITE_ENABLE_FTS3_TOKENIZER=1"
74     make -j${jobs} V=1 && make -j${jobs} check
75     make -j${jobs} DESTDIR="$destdir" install-strip
77     # Build TCL extension (TEA)
79     cd tea
81     ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
82      $configure_args --libdir=/usr/lib${libSuffix}
84     make -j${jobs} && make -j${jobs} DESTDIR="$destdir" install
86     cd ..
88     # Compress and link man pages (if needed)
89     if test -d "${destdir}/$mandir"
90     then
91         (
92             cd "${destdir}/$mandir"
93             find . -type f -exec lzip -9 '{}' +
94             find . -type l | while read -r file
95             do
96                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
97                 rm -- "$file"
98             done
99         )
100     fi
102     # Copy documentation
103     mkdir -p "${destdir}${docsdir}"
104     cp -p $docs "${destdir}${docsdir}"