aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/APKBUILD
blob: ce96327e0b519e4fa6db8a19923ffb67adb63207 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.11
pkgrel=5
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
license="MIT"
depends=""
depends_dev="!uclibc-dev"
makedepends="$depends_dev"
subpackages="$pkgname-dev $pkgname-utils $pkgname-dbg libc6-compat:compat"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
	0001-remove-use-of-buggy-.SECONDARY-special-target-in-mak.patch
	0002-implement-arm-eabi-mem-functions.patch
	0003-fix-fclose-of-permanent-stdin-out-err-streams.patch
	0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch
	0005-fix-breakage-in-nl_langinfo-from-previous-commit.patch
	0006-remove-unused-and-invalid-C-version-of-sigsetjmp.patch
	0007-fix-missing-earlyclobber-flag-in-i386-a_ctz_64-asm.patch
	0008-fix-uninitialized-scopeid-in-lookups-from-hosts-file.patch
	0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch
	1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
	CVE-2017-15650.patch

	ldconfig
	__stack_chk_fail_local.c
	getconf.c
	getent.c
	iconv.c
	"

# secfixes:
#   1.1.11-r3:
#     - CVE-2016-8859
#   1.1.11-r5:
#     - CVE-2017-15650

_builddir="$srcdir"/musl-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

install_sysroot_headers() {
	cd "$_builddir"
	if [ -z "${CBUILDROOT}" ]; then
		echo "CBUILDROOT not must be set!"
		return 1
	fi
	case "$CARCH" in
	arm*) ARCH="arm" ;;
	x86) ARCH="i386" ;;
	x86_64) ARCH="x86_64" ;;
	mips*) ARCH="mips" ;;
	esac
	make ARCH="$ARCH" prefix=/usr DESTDIR="${CBUILDROOT}" install-headers || return 1
}

build() {
	cd "$_builddir"

	# provide minimal libssp_nonshared.a so we don't need libssp from gcc
	${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS -c "$srcdir"/__stack_chk_fail_local.c -o __stack_chk_fail_local.o || return 1
	${CROSS_COMPILE}ar r libssp_nonshared.a __stack_chk_fail_local.o || return 1

	# getconf/getent/iconv
	local i
	for i in getconf getent iconv ; do
		${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS "$srcdir"/$i.c -o $i || return 1
	done

	# note: not autotools
	LDFLAGS="$LDFLAGS -Wl,-soname,libc.musl-${CARCH}.so.1" \
	./configure \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		|| return 1
	make || return 1
}

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

	cp libssp_nonshared.a "$pkgdir"/usr/lib || return 1

	# make LDSO the be the real file, and libc the symlink
	local LDSO=$(make -f Makefile --eval "$(echo -e 'print-ldso:\n\t@echo $$(basename $(LDSO_PATHNAME))')" print-ldso)
	mv -f "$pkgdir"/usr/lib/libc.so "$pkgdir"/lib/"$LDSO" || return 1
	ln -sf "$LDSO" "$pkgdir"/lib/libc.musl-${CARCH}.so.1 || return 1
	ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/lib/libc.so || return 1
	mkdir -p "$pkgdir"/usr/bin
	ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/bin/ldd || return 1

	# remove libintl.h, currently we don't want by default any NLS
	# and use GNU gettext where needed. the plan is to migrate to
	# musl gettext() later on as fully as possible.
	rm "$pkgdir"/usr/include/libintl.h || return 1
}

utils() {
	depends="!uclibc-utils scanelf"
	replaces="libiconv uclibc-utils"
	license="MIT BSD GPL2+"

	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/sbin
	mv "$pkgdir"/usr/bin/ldd "$subpkgdir"/usr/bin
	find "$pkgdir" -type d -delete 2>/dev/null
	install -D \
		"$_builddir"/getent \
		"$_builddir"/getconf \
		"$_builddir"/iconv \
		"$subpkgdir"/usr/bin

	install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin
}

compat() {
	pkgdesc="compatibility libraries for glibc"

	case "$CARCH" in
	arm*) _ld="ld-linux-armhf.so.3" ;;
	x86) _ld="ld-linux.so.2" ;;
	x86_64) _ld="ld-linux-x86-64.so.2" ;;
	mips*) _ld="ld.so.1" ;;
	esac

	mkdir -p "$subpkgdir"/lib
	ln -sf "/lib/libc.musl-${CARCH}.so.1" "$subpkgdir/lib/$_ld"

	for i in libc.so.6 libm.so.6 libpthread.so.0 librt.so.1 libutil.so.1; do
		ln -sf "/lib/libc.musl-${CARCH}.so.1" "$subpkgdir/lib/$i"
	done
}

md5sums="48be0777e32f374d387e9cf85e36ec4d  musl-1.1.11.tar.gz
df95d85134e21b7cd0711aa3edec4a14  0001-remove-use-of-buggy-.SECONDARY-special-target-in-mak.patch
31462dce2f13f68868cf2dc61e05c6da  0002-implement-arm-eabi-mem-functions.patch
45e86522164079c6067994f78c8491e9  0003-fix-fclose-of-permanent-stdin-out-err-streams.patch
edd5e3088b1ad3c1a38d3078a5feadc8  0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch
0b50a3d050c997ad732eedb328559183  0005-fix-breakage-in-nl_langinfo-from-previous-commit.patch
b6f8dbcfe6fb6e25ae30a16bf6485795  0006-remove-unused-and-invalid-C-version-of-sigsetjmp.patch
554812ae180748662f3f5eb0c136e928  0007-fix-missing-earlyclobber-flag-in-i386-a_ctz_64-asm.patch
a68989df58c9af8ded55aeaace6f3993  0008-fix-uninitialized-scopeid-in-lookups-from-hosts-file.patch
fe6de41e930775994f64b772f1fdc45c  0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch
2e3d961d3d50438f42683d2dbf6f2b91  1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
d4ca72c487880e6389ee5638ec00f0c5  CVE-2017-15650.patch
830d01f7821b978df770b06db3790921  ldconfig
0df687757221bbb0fc1aa67f1bd646f9  __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2  getconf.c
2b941c4251cac44988a4abfc50e21267  getent.c
45f92f8d59cf84d765de698a9578dbf4  iconv.c"
sha256sums="bb9e6da51b7b12641f5d1abb39705c6c6c1b2fbd20002362948aa736a0aa353f  musl-1.1.11.tar.gz
68bea76fece3285f6e648cb86fb2bf80d099543332494d5c74fc1b419218dc93  0001-remove-use-of-buggy-.SECONDARY-special-target-in-mak.patch
2cc704dac5f566bff09228a571012d75fad99852357b2c303526155bb599a137  0002-implement-arm-eabi-mem-functions.patch
4d0fb3496d33ed1d376a9a1aec565d7d71c5d2764048668258fc5e3f995b9d2c  0003-fix-fclose-of-permanent-stdin-out-err-streams.patch
f743049757fdfb0d67620ae2783370372a0720509d18c9551b47220f21066bbd  0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch
d15e48f74f760651394dd460ebbb3356c42e56027b2708992b4db7c92e1c40a2  0005-fix-breakage-in-nl_langinfo-from-previous-commit.patch
2310fba590d57cd7193048d49c0bbab0fffe81fd2266d26bc750f9ed96787c27  0006-remove-unused-and-invalid-C-version-of-sigsetjmp.patch
47f4d1049658bbe3b59f17b0b7f16c901f2de14c89eb9640b5c98d4ff4fd9813  0007-fix-missing-earlyclobber-flag-in-i386-a_ctz_64-asm.patch
f1e47791bb59bbfcb07a6f4b8c4bb9d1680acdaa00ad202b9e03a218b25fe288  0008-fix-uninitialized-scopeid-in-lookups-from-hosts-file.patch
cec3fdd3a90f153a2c5a5d22ffd7429c14ecb105259a9c2540e46db6cfe71b55  0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch
31700cb0c3bdbeebb78aafbce4cee7d058c9c8d1a37d576ee95c5c598c488912  1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
a25e35436a6ac67c01add006327068a210636ddbbdaffd7be364bd08bdf41a11  CVE-2017-15650.patch
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7  ldconfig
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da  __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c  getconf.c
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe  getent.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7  iconv.c"
sha512sums="573131fe7a2c5a9c9bf796a5fc02e6ec093148648b9b43dc13d9c85e5777b1691499af6f673075a0d2b4b36c788b4dd7d72eb450c6ec3a586901bd410ee1ea6d  musl-1.1.11.tar.gz
4b3bfb0b3a6e5c72dad3813a9606d646077ef4e5d3cf68c8d8a03a4e026f2f4d5f96155ccf5ba8ff170ff529d3d78432bcdc9f164941b140beac240feff6c835  0001-remove-use-of-buggy-.SECONDARY-special-target-in-mak.patch
663817a4b9ef9cde4cf45485ac974c1775da1854769d168fde98d8982498e7eed05b72e840613996c577e9097a4697fe39079f06038dd7bb4ba1f812cecdc8df  0002-implement-arm-eabi-mem-functions.patch
a7d63a7d70aa71104ccef9c530cdd5b76d1cf5f6f372ec56ac5d636b1ccbcf2c3f639712ba96e98068f1fb6511b7d8dbd251df23e3b8e3c09ee7538eaa2dbc0b  0003-fix-fclose-of-permanent-stdin-out-err-streams.patch
64e74b1c042a032657ffba29f4a933fbb47d2108281957812e05a6cdd2d3431e79d1ed4ad7c0a4acbd281593cc63a31a5c482163f890e0fbba8f20c1c507928f  0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch
d1ad5d8ee7f9dbb337d7df6a2d851b47db51ae42df6c3219e1657c9a73b6b36ba72fe4f55d8685c19024f21b9ae3da2336e1800e3b3c67238f5d74bae1280827  0005-fix-breakage-in-nl_langinfo-from-previous-commit.patch
ef12fed5f595ebfafe948225eab7fde24ff11384ddd3f5542a092df264a6d6459fc3d0998e5ed98b290139371164fa022250faf6122049ef1f62e37692435bfd  0006-remove-unused-and-invalid-C-version-of-sigsetjmp.patch
5dff942055f916ea45a19063d647187ce79aca8a2cbc64e5fa19ae15b13dab866db5a2916077172eadc77df353f2dbc5e5850164456d3a46738d7e7f85486af2  0007-fix-missing-earlyclobber-flag-in-i386-a_ctz_64-asm.patch
828ded1a37a6818b28a944b4eda5d2a5e06615b3c21eaeebf600b66e304efd4c2883e755adcee735cc9a19d24acc49de6a8f997e9804a54c463491cbe41c5d53  0008-fix-uninitialized-scopeid-in-lookups-from-hosts-file.patch
6376167c67fdd22c0c4476fc38ff89ae3ce46435f72d7c506460944dd8f7d9153eed9696738dff5b320f09b474964f2a57394530eb40197ad58a6956e87e68ff  0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch
99f4c7e09860978f5a15fdfc6b8786e24bf763b838c623cbb91dbc27ebcdfa4fd0ed9fd02ad38cff1c903b0e2dc0a021d8786c938e990e8cc8d4475a13bf3c57  1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
ff3bbaf43e2202db570377836782c8b2f95db39bbf2b09ef0891d9f1b25b3160e0ff6b16e055745b72357b1cf99a486b70a689b4928ed1cc6b78b4d4f0bbea32  CVE-2017-15650.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f  ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b  __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d  getconf.c
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2  getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf  iconv.c"