aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/APKBUILD
blob: c3506665a2174a37da3dcef59bdcf91bc103d5a7 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.4.0_rc2
pkgrel=1
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
makedepends="zlib-dev openssl-dev"
if [ "$CBUILD" == "$CHOST" ]; then
	subpackages="$subpackages lua5.2-apk:luaapk"
	makedepends="$makedepends lua5.2-dev"
fi
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
	0001-db-fix-segfault-when-root-points-to-invalid-dir.patch
	0002-solver-do-not-disqualify-already-disqualified-packag.patch
	"

url="http://git.alpinelinux.org/cgit/apk-tools/"
arch="all"
license=GPL-2

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	cd "$_builddir"
	sed -i -e 's:-Werror::' Make.rules
	for i in $source; do
		case $i in
		*.patch) msg "$i"; patch -p1 -i "$srcdir"/$i || return 1
		esac
	done

	echo "FULL_VERSION=$pkgver-r$pkgrel" > config.mk || return 1
	if [ "$CBUILD" = "$CHOST" ]; then
		echo "LUAAPK=YesPlease" >> config.mk
	else
		echo "LUAAPK=" >> config.mk
	fi
	echo "export LUAAPK" >> config.mk
}

build() {
	cd "$_builddir"
	make || return 1
	make static || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install
	install -d "$pkgdir"/var/lib/apk \
		"$pkgdir"/var/cache/misc \
		"$pkgdir"/etc/apk/keys \
		"$pkgdir"/etc/apk/protected_paths.d \
		|| return 1
	# the shipped README is empty
	rm -r "$pkgdir"/usr/share/
}

static() {
	pkgdesc="Alpine Package Keeper - static binary"
	install -Dm755 "$srcdir"/$pkgname-$pkgver/src/apk.static \
		"$subpkgdir"/sbin/apk.static

	# lets sign the static binary so it can be vefified from distros
	# that does not have apk-tools
	local abuild_conf=${ABUILD_CONF:-"/etc/abuild.conf"}
	local abuild_home=${ABUILD_USERDIR:-"$HOME/.abuild"}
	local abuild_userconf=${ABUILD_USERCONF:-"$abuild_home/abuild.conf"}
	[ -f "$abuild_userconf" ] && . "$abuild_userconf"
	local privkey="$PACKAGER_PRIVKEY"
	local pubkey=${PACKAGER_PUBKEY:-"${privkey}.pub"}
	local keyname=${pubkey##*/}
	${CROSS_COMPILE}strip "$subpkgdir"/sbin/apk.static
	openssl dgst -sha1 -sign "$privkey" \
		-out "$subpkgdir"/sbin/apk.static.SIGN.RSA.$keyname \
		"$subpkgdir"/sbin/apk.static || return 1
}

luaapk() {
	pkgdesc="Lua module for apk-tools"
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/
}

md5sums="970ac62007eb16f30344bf9169765067  apk-tools-2.4.0_rc2.tar.xz
64c14782f96a25d9e3330c9e980cadc5  0001-db-fix-segfault-when-root-points-to-invalid-dir.patch
11764f6c050ab908c291552dc2766f52  0002-solver-do-not-disqualify-already-disqualified-packag.patch"
sha256sums="89e0a4d91b2eab372fdbd488f45c9db8c0c947bbe690c626b0160b3f338bac5b  apk-tools-2.4.0_rc2.tar.xz
1dad8fd826337ad4cea737800ad1b5506a77c23acc1d4c61cbafeb02b270205c  0001-db-fix-segfault-when-root-points-to-invalid-dir.patch
a9de444758a78fe6a7408f3fad34280bbc60589767450a5ab1641cb09be2fcd4  0002-solver-do-not-disqualify-already-disqualified-packag.patch"
sha512sums="08e2cae4e55602800d09db7951bec297ed4e3251a1e5df87a2437b44608db7560533af5994cc0902e8f5f505d388af6d89295f85245d2fc30d028b2e59a6d496  apk-tools-2.4.0_rc2.tar.xz
aacb08fa26cdba29d84022b1945ccd3ac3d0c57a887ad6898d1028db35f88f5d67bff157269dff41d1994f0d38eb64a0eefbf7525647c08a970f18ca36c5766b  0001-db-fix-segfault-when-root-points-to-invalid-dir.patch
8f7345d86ffd392c914c3f95709173830d6da5fe858fb0e2d6a8d395d8036e4608567af6c02b3b30c76ddbdc083138f821e865e673f1c480ea7e3f9f5ec44565  0002-solver-do-not-disqualify-already-disqualified-packag.patch"