summaryrefslogtreecommitdiffstats
path: root/main/busybox/APKBUILD
blob: 1b85018560ac14da7d28f94ae7efbb1431c166a0 (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
108
109
110
111
112
113
114
115
116
117
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.20.2
pkgrel=5
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://busybox.net/downloads/fixes-1.20.2/busybox-1.20.2-kernel_ver.patch
	http://busybox.net/downloads/fixes-1.20.2/busybox-1.20.2-ntpd.patch
	http://busybox.net/downloads/fixes-1.20.2/busybox-1.20.2-pkg-config-selinux.patch
	http://busybox.net/downloads/fixes-1.20.2/busybox-1.20.2-sys-resource.patch
	bbsuid.c

	nologin.c
	$pkgname-1.11.1-bb.patch
	busybox-uname-is-not-gnu.patch
	bb-app-location.patch
	0001-tar-Implement-no-recursion.patch
	0001-unzip-ignore-chmod-errors-so-unzipping-on-FAT-works.patch
	loginutils-sha512.patch

	0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
	0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
	busyboxconfig
	glibc.patch"
	
_sdir="$srcdir"/$pkgname-$pkgver
_staticdir="$srcdir"/build-static
_dyndir="$srcdir"/build-dynamic
_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

	cp "$srcdir"/nologin.c loginutils/
}

build() {
	# build bbsuid
	msg "Building bbsuid"
	${CC:-gcc} $CFLAGS "$srcdir"/bbsuid.c $LDFLAGS -o "$_dyndir"/bbsuid || 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 "$_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 || return 1
	install -m4111 bbsuid "$pkgdir"/bin/bbsuid || return 1
	# we need /bin/sh to be able to execute post-install
	ln -s /bin/busybox "$pkgdir"/bin/sh

	#ifupdown needs those dirs to be present
	mkdir -p \
		"$pkgdir"/etc/network/if-down.d \
		"$pkgdir"/etc/network/if-post-down.d \
		"$pkgdir"/etc/network/if-post-up.d \
		"$pkgdir"/etc/network/if-pre-down.d \
		"$pkgdir"/etc/network/if-pre-up.d \
		"$pkgdir"/etc/network/if-up.d \
		|| return 1
}

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

md5sums="e025414bc6cd79579cc7a32a45d3ae1c  busybox-1.20.2.tar.bz2
3386a2bf992f2284b86608498f4cb822  busybox-1.20.2-kernel_ver.patch
87538be04a4f313d5a99fa543f64ffee  busybox-1.20.2-ntpd.patch
a1b6587697c70808808f3693c4610884  busybox-1.20.2-pkg-config-selinux.patch
cfb5d5d7ed1414b5749f2c2ec0bf066a  busybox-1.20.2-sys-resource.patch
8485cf1e389e891914cbb8771a6d9bbd  bbsuid.c
d64b58a30892c558bdbab7f0d0997577  nologin.c
4c0f3b486eaa0674961b7ddcd0c60a9b  busybox-1.11.1-bb.patch
b5375210f13fd6e1ca61a565e8fabd35  busybox-uname-is-not-gnu.patch
754916e52fa11d3fe7c29c93248b6707  bb-app-location.patch
b0977368029587bab23067f0267ae309  0001-tar-Implement-no-recursion.patch
8bf65d5bc87112946675f540b46d406d  0001-unzip-ignore-chmod-errors-so-unzipping-on-FAT-works.patch
8c42c9ef0f0419c314c86bcaf7796106  loginutils-sha512.patch
04eeda8c49d4688e6dec02451f8b6aae  0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
e1c183cbe1ca18a0fa0d9597314076c9  0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
8b3bcd5dd5e3245721da3d376172dcac  busyboxconfig
befaac2c59c380e36a452b3f1c1d4a3a  glibc.patch"