summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3d2eade865b9ff893844a5e287a265c9ca6bf0a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

_android_arch=armv7a-eabi

pkgbase=android-${_android_arch}-sqlite
pkgname=("android-${_android_arch}-sqlite"
         "android-${_android_arch}-sqlite-tcl")
pkgver=3.46.1
_srcver=3460100
pkgrel=1
arch=('any')
pkgdesc="A C library that implements an SQL database engine (Android ${_android_arch})"
license=('LicenseRef-Sqlite')
url="https://www.sqlite.org/"
makedepends=('android-configure'
             "android-${_android_arch}-tcl"
             "android-${_android_arch}-readline"
             "android-${_android_arch}-zlib")
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://www.sqlite.org/2024/sqlite-src-${_srcver}.zip")
md5sums=('ce83f1ffb3b051856e072678cbd3039f')

prepare() {
    cd "${srcdir}/sqlite-src-${_srcver}"
    source android-env ${_android_arch}

    autoreconf -vfi
}

build() {
    cd "${srcdir}/sqlite-src-${_srcver}"
    source android-env ${_android_arch}

    # 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"

    android-${_android_arch}-configure \
        --enable-threadsafe \
        --enable-readline \
        --enable-fts3 \
        --enable-fts4 \
        --enable-fts5 \
        --enable-rtree \
        --enable-json1 \
        --enable-session \
        TCLLIBDIR="${ANDROID_PREFIX_LIB}/sqlite${pkgver}"
    make $MAKEFLAGS
}

package_android-armv7a-eabi-sqlite() {
    pkgdesc="A C library that implements an SQL database engine (Android ${_android_arch})"
    groups=('android-sqlite')
    depends=("android-${_android_arch}-readline"
             "android-${_android_arch}-zlib")

    cd "${srcdir}/sqlite-src-$_srcver"
    source android-env ${_android_arch}

    make DESTDIR="${pkgdir}" install
    rm -rf "$pkgdir/${ANDROID_PREFIX_BIN}"
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a || true

    # split out tcl extension
    mkdir -p "${srcdir}/tcl"
    mv -f "${pkgdir}/${ANDROID_PREFIX_LIB}"/sqlite* "${srcdir}/tcl"
}

package_android-armv7a-eabi-sqlite-tcl() {
    pkgdesc="sqlite Tcl Extension Architecture (TEA) (Android ${_android_arch})"
    groups=('android-sqlite-tcl')
    depends=("android-${_android_arch}-sqlite")

    cd "${srcdir}/sqlite-src-$_srcver"
    source android-env ${_android_arch}

    install -m755 -d "${pkgdir}/${ANDROID_PREFIX_LIB}"
    mv -f "${srcdir}/tcl"/* "${pkgdir}/${ANDROID_PREFIX_LIB}"
}