aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/APKBUILD
blob: fe7ff3781f251b35da9657d718691f907f45df2c (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
96
97
98
99
100
101
102
103
104
105
106
107
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.19.2
pkgrel=1
_bbsuidver=0.6
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
license="GPL-2"
depends=
install="$pkgname.post-install $pkgname.post-upgrade"
subpackages="$pkgname-static"
triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
	http://git.alpinelinux.org/cgit/bbsuid.git/snapshot/bbsuid-$_bbsuidver.tar.bz2
	$pkgname-1.11.1-bb.patch
	busybox-uname-is-not-gnu.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-android.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-buildsys.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-chpasswd.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-crond.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-inetd.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-syslogd.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-tail.patch
	http://busybox.net/downloads/fixes-1.19.2/busybox-1.19.2-tftp.patch
	0001-loginutils-use-sha512.patch

	busyboxconfig"

_sdir="$srcdir"/$pkgname-$pkgver
_staticdir="$srcdir"/build-static
_dyndir="$srcdir"/build-dynamic
_bbsuid="$srcdir"/bbsuid-$_bbsuidver
_config="$srcdir"/busyboxconfig
prepare() {
	mkdir -p "$_staticdir" "$_dyndir"
	#patches
	cd "$_sdir"
	for i in $source; do
		local p=${i##*/}
		case $i in
		*.patch) msg $p; patch -p1 -i "$srcdir"/$p || return 1;;
		esac
	done

	sed -i	-e 's/(ip, _BB_DIR_BIN/(ip, _BB_DIR_SBIN/' \
		-e 's/(lspci, _BB_DIR_USR_BIN/(lspci, _BB_DIR_USR_SBIN/' \
		-e 's/(vi, _BB_DIR_BIN/(vi, _BB_DIR_USR_BIN/' \
		include/applets.src.h || return 1
}

build() {
	msg "Building bbsuid"
	cd "$_bbsuid"
	make || return 1

	cd "$_staticdir"
	msg "Building static busybox"
	sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \
		-e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \
		"$_config" > .config
	make -C "$_sdir" O="$PWD" silentoldconfig || return 1
	make || return 1
	mv busybox busybox.static

	# build dynamic
	cd "$_dyndir"
	msg "Building dynamic busybox"
	cp "$_config" .config
	make -C "$_sdir" O="$PWD" silentoldconfig || return 1
	make || return 1
}

package() {
	cd "$_bbsuid"
	make install DESTDIR="$pkgdir" || return 1

	cd "$_dyndir"
	mkdir -p "$pkgdir"/usr/sbin "$pkgdir"/usr/bin "$pkgdir"/tmp \
		"$pkgdir"/var/cache/misc "$pkgdir"/bin "$pkgdir"/sbin
	chmod 1777 "$pkgdir"/tmp
	install -m755 busybox "$pkgdir"/bin/busybox
	# we need /bin/sh to be able to execute post-install
	ln -s /bin/busybox "$pkgdir"/bin/sh
}

static() {
	pkgdesc="Statically linked Busybox"
	mkdir -p "$subpkgdir"/bin
	install -m755 "$_staticdir"/busybox.static \
		"$subpkgdir"/bin/busybox.static
}

md5sums="50267054345f1a0b77fe65f6e0e5ba29  busybox-1.19.2.tar.bz2
968b3a058db04f95e9c4cdb44d7d3ddb  bbsuid-0.6.tar.bz2
4c0f3b486eaa0674961b7ddcd0c60a9b  busybox-1.11.1-bb.patch
b5375210f13fd6e1ca61a565e8fabd35  busybox-uname-is-not-gnu.patch
c695eea6c721e4f7f66fd3a1674ea6f5  busybox-1.19.2-android.patch
b239f0a6e6556a9df9beb7d8725907c4  busybox-1.19.2-buildsys.patch
04ec247d117d93a0097185ccea03aec5  busybox-1.19.2-chpasswd.patch
2707b318e733d5b091e2df301e418b5a  busybox-1.19.2-crond.patch
9d13b96b805e238e0fe33c5c9df9e9b1  busybox-1.19.2-inetd.patch
6f158c07c70a6250d6db5fc05b4bda5d  busybox-1.19.2-syslogd.patch
4b291c97d371f0957d4c1698976e5569  busybox-1.19.2-tail.patch
ddeac26c403f8518212637731b5ae26b  busybox-1.19.2-tftp.patch
784383013b8f015fb0d214618c46b4b8  0001-loginutils-use-sha512.patch
4ec89e4b45bcf667974a2778a559196f  busyboxconfig"