aboutsummaryrefslogtreecommitdiffstats
path: root/main/sqlite/APKBUILD
blob: 77cf9574f3f8df2ae5248e3a8c5b54628f3d7be1 (plain) (blame)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
pkgname=sqlite
# NOTE: pkgver needs to correspond with sqlite-tcl
pkgver=3.36.0
pkgrel=0
pkgdesc="C library that implements an SQL database engine"
url="https://www.sqlite.org/"
arch="all"
license="Public-Domain"
makedepends="readline-dev"
subpackages="$pkgname-static $pkgname-doc $pkgname-dev $pkgname-libs"

# compute _ver
_a=${pkgver%%.*}
_b=${pkgver#$_a.}
_b=${_b%%.*}
_c=${pkgver#$_a.$_b.}
_c=${_c%%.*}
case $pkgver in
	*.*.*.*)_d=${pkgver##*.};;
	*.*.*)	_d=0;;
esac
[ $_b -lt 10 ] && _b=0$_b
[ $_c -lt 10 ] && _c=0$_c
[ $_d -lt 10 ] && _d=0$_d
_ver=${_a}${_b}${_c}$_d

# these variables depend on _ver being set
builddir="$srcdir/$pkgname-autoconf-$_ver"
source="https://www.sqlite.org/2021/sqlite-autoconf-$_ver.tar.gz
	license.txt
	"

# secfixes:
#   3.34.1-r0:
#     - CVE-2021-20227
#   3.32.1-r0:
#     - CVE-2020-13434
#     - CVE-2020-13435
#   3.30.1-r3:
#     - CVE-2020-11655
#   3.30.1-r1:
#     - CVE-2019-19242
#     - CVE-2019-19244
#   3.28.0-r0:
#     - CVE-2019-5018
#     - CVE-2019-8457

# additional CFLAGS to set
_amalgamation="-DSQLITE_ENABLE_FTS4 \
	-DSQLITE_ENABLE_FTS3_PARENTHESIS \
	-DSQLITE_ENABLE_FTS3 \
	-DSQLITE_ENABLE_FTS5 \
	-DSQLITE_ENABLE_COLUMN_METADATA \
	-DSQLITE_SECURE_DELETE \
	-DSQLITE_ENABLE_UNLOCK_NOTIFY \
	-DSQLITE_ENABLE_RTREE \
	-DSQLITE_ENABLE_GEOPOLY \
	-DSQLITE_USE_URI \
	-DSQLITE_ENABLE_DBSTAT_VTAB \
	-DSQLITE_MAX_VARIABLE_NUMBER=250000 \
	-DSQLITE_ENABLE_JSON1"

prepare() {
	if [ -f "$startdir"/../sqlite-tcl/APKBUILD ]; then
		(
		_sqlitever=$pkgver
		. "$startdir"/../sqlite-tcl/APKBUILD
		if [ "$_sqlitever" != "$pkgver" ]; then
			warning "sqlite-tcl version mismatch ($_sqlitever != $pkgver)"
		fi
		)
	fi

	default_prepare
}

build() {
	export CFLAGS="$CFLAGS $_amalgamation"
	./configure \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--enable-threadsafe \
		--enable-readline \
		--enable-static \
		--enable-dynamic-extensions \
		--enable-fts3

	# rpath removal
	sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
	sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm0644 sqlite3.1 \
		"$pkgdir"/usr/share/man/man1/sqlite3.1
	install -Dm644 "$srcdir"/license.txt \
		"$pkgdir"/usr/share/licenses/$pkgname/license.txt
}

libs() {
	replaces="sqlite"
	pkgdesc="Sqlite3 library"

	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
}

static() {
	pkgdesc="Sqlite3 static library"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lib*.a "$subpkgdir"/usr/lib/
}

sha512sums="
e59c57f421b4956c7759af528a2da929167e15179ab9d28267474683e2272f93c901203e5a648732f1a3d43e7be3ac4217c3cdd7adf108c378b9127b771a7cd0  sqlite-autoconf-3360000.tar.gz
5bde14bec5bf18cc686b8b90a8b2324c8c6600bca1ae56431a795bb34b8b5ae85527143f3b5f0c845c776bce60eaa537624104cefc3a47b3820d43083f40c6e9  license.txt
"