summaryrefslogtreecommitdiff
path: root/system/apk-tools/APKBUILD
blob: cbbf3ceaf22b2147d548cf1d8c4694ad9607cebd (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
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org>
pkgname=apk-tools
pkgver=2.10.5
pkgrel=0
pkgdesc="Alpine Package Keeper - package manager"
url="https://git.alpinelinux.org/cgit/apk-tools/"
arch="all"
license="GPL-2.0-only"
depends="ca-certificates"
makedepends_build=""
makedepends_host="zlib-dev openssl openssl-dev linux-headers"
makedepends="$makedepends_build $makedepends_host"
subpackages="$pkgname-static"
source="https://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
	dash.patch
	pmmx.patch
	"

prepare() {
	default_prepare
	sed -i -e 's:-Werror::' Make.rules
	echo "FULL_VERSION=$pkgver-r$pkgrel" > config.mk
	echo "LUAAPK=" >> config.mk
	echo "export LUAAPK" >> config.mk
}

build() {
	make
	make static
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -d "$pkgdir"/var/lib/apk \
		"$pkgdir"/var/cache/misc \
		"$pkgdir"/etc/apk/keys \
		"$pkgdir"/etc/apk/protected_paths.d
	# 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

	# Sign the static binary so it can be vefified from distros
	# that do 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
}

sha512sums="0f85ec7c734f2ffc671007fa029f3c96eacfb196c45e465e33aa65c32a6fbcd7523153b6441fdf826a5b4d2e66de02d338620474d333c28cb1ce0233f1120495  apk-tools-2.10.5.tar.xz
5892ad7038c942e82b011a64484253a157711ad65cb754b884c2b9b6047dd4693b530b6639f6d8c35aa21f9c293ee01a3f36ead1d148f77a2012053766f75ee2  dash.patch
edff13f21debc227c7448f0ac42744b2655f8f23ea23aefa04db7d2c44e8a91f77227e84ef090e65364f6999b6ee1138c98490530cb6b9b0594b7cfeeef25b61  pmmx.patch"