summaryrefslogtreecommitdiff
path: root/system/apk-tools/APKBUILD
blob: 5f0683e8650d93b589840598f81920350485911f (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
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org>
pkgname=apk-tools
pkgver=2.12.0
pkgrel=0
pkgdesc="Alpine Package Keeper - package manager"
url="https://code.foxkit.us/adelie/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-dev $pkgname-static $pkgname-doc"
source="https://dev.sick.bike/dist/$pkgname-v$pkgver+adelie.tar.gz
	https://dev.sick.bike/dist/$pkgname-help-v$pkgver.tar.gz
	apk.zsh-completion
	"
builddir="$srcdir/$pkgname-v$pkgver"

prepare() {
	default_prepare
	sed -i -e 's:-Werror::' Make.rules
	cat >config.mk <<-EOF
		FULL_VERSION=$pkgver-r$pkgrel
		LUA=no
		export LUA
	EOF
}

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 not useful
	rm -r "$pkgdir"/usr/share/doc

	install -Dm644 "$srcdir"/apk.zsh-completion \
		"$pkgdir"/usr/share/zsh/site-functions/_apk
}

static() {
	pkgdesc="Alpine Package Keeper - static binary"
	install -Dm755 "$builddir"/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="739cbf487a9184aba56c87448d18acebf357b6eddb4852033cc0cd331fc910d425a5d01f7b0bf109f5cd62f78f10cca96ebcbdb4fa00d197edb90726998e1523  apk-tools-v2.12.0+adelie.tar.gz
b8e6e6e9efe2fc3a900e5fea54ed2f047bbf8917c8c3e470e001865c2169167ce6a273869ba577aceb1a1580b7dd684de115a4d92250786958fa13b9e8abf28b  apk-tools-help-v2.12.0.tar.gz
cedda9bf11e0a516c9bf0fd1a239ffa345cdd236419cbd8b10273410610ae7d0f0f61fd36e1e9ccc3bbf32f895508cdca4fb57a0e04f78dd88469b33bf64a32a  apk.zsh-completion"