aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/APKBUILD
blob: bb51443abe6da7c6aca21eb0f6870329d634857b (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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.12
pkgrel=2
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-fix-single-byte-overflow-of-malloc-d-buffer-in-getde.patch
	0002-safely-handle-failure-to-open-hosts-services-resolv..patch
	0003-getnameinfo-make-size-check-not-fail-for-bigger-size.patch
	0004-properly-access-mcontext_t-program-counter-in-cancel.patch
	0005-use-explicit-__cp_cancel-label-in-cancellable-syscal.patch
	0006-prevent-allocs-than-PTRDIFF_MAX-via-mremap.patch
	0007-fix-mremap-memory-synchronization-and-use-of-variadi.patch
	0008-have-configure-check-add-ffunction-sections-and-fdat.patch
	0009-have-configure-check-add-linker-options-to-reduce-si.patch
	0010-have-configure-check-add-gc-sections-linker-option.patch
	0011-work-around-toolchains-with-broken-visibility-in-lib.patch
	0012-fix-return-value-of-nl_langinfo-for-invalid-item-arg.patch
	0013-math-explicitly-promote-expressions-to-excess-precis.patch
	0014-ldso-fix-the-dtv-update-logic-in-__tls_get_new.patch
	0015-properly-handle-point-to-point-interfaces-in-getifad.patch
	0016-fix-tdelete-to-properly-balance-the-tree.patch
	0017-fix-tsearch-to-avoid-crash-on-oom.patch
	0018-tsearch-code-cleanup.patch
	0019-fix-tsearch-tfind-tdelete-to-handle-null-pointer-inp.patch
	0020-fix-crash-when-signal-number-0-is-passed-to-sigactio.patch
	0021-avoid-updating-caller-s-size-when-getdelim-fails-to-.patch
	0022-fix-overly-pessimistic-realloc-strategy-in-getdelim.patch
	0023-add-missing-protocols-to-protoent-lookup-functions.patch

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

_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="42875e0c111aa1cb9d08663f8d42c799  musl-1.1.12.tar.gz
02d3339c59ed2996aec7909d3c45c655  0001-fix-single-byte-overflow-of-malloc-d-buffer-in-getde.patch
0893b094870823046db1b19786ddae22  0002-safely-handle-failure-to-open-hosts-services-resolv..patch
a340ce73f0e77440c546163cfe4e0e87  0003-getnameinfo-make-size-check-not-fail-for-bigger-size.patch
3fb065e44e1fcaef160f897a8b4650c1  0004-properly-access-mcontext_t-program-counter-in-cancel.patch
79a29b7dad83283adca8e68dfd3bc59f  0005-use-explicit-__cp_cancel-label-in-cancellable-syscal.patch
e13993cb4786fd692e33e1406ad2b216  0006-prevent-allocs-than-PTRDIFF_MAX-via-mremap.patch
c693ab04bb7ff779f5e94ecf94cdc7d6  0007-fix-mremap-memory-synchronization-and-use-of-variadi.patch
fc6a1e682050520e1ae3f45b3d922a1e  0008-have-configure-check-add-ffunction-sections-and-fdat.patch
76c29ad893c80191cee395493430f385  0009-have-configure-check-add-linker-options-to-reduce-si.patch
ce46e304c8e54ee44473b94643a7fcde  0010-have-configure-check-add-gc-sections-linker-option.patch
5f051185cb80074708c9d9d4ed09b999  0011-work-around-toolchains-with-broken-visibility-in-lib.patch
b231d5033566c5d4afc936fe52f5e2d4  0012-fix-return-value-of-nl_langinfo-for-invalid-item-arg.patch
a636889b40dd3d4d48687aba2d07d8eb  0013-math-explicitly-promote-expressions-to-excess-precis.patch
469bcc5b68f39112748e59af8c6e9dd4  0014-ldso-fix-the-dtv-update-logic-in-__tls_get_new.patch
ecb2784515da574cb829713f6d05221f  0015-properly-handle-point-to-point-interfaces-in-getifad.patch
5c60f8931354e219e73a6f068786821a  0016-fix-tdelete-to-properly-balance-the-tree.patch
9f34e1c6d510e3c461dc83ab28a52ef5  0017-fix-tsearch-to-avoid-crash-on-oom.patch
197ecc83ff71f081e41e3dca8d7e9c6c  0018-tsearch-code-cleanup.patch
ca459c4237bdafb9d0047cc104bf1376  0019-fix-tsearch-tfind-tdelete-to-handle-null-pointer-inp.patch
cc6a97327c6d16da0b8416f61266ef83  0020-fix-crash-when-signal-number-0-is-passed-to-sigactio.patch
a9bd9d9659a359d5bd330aa42fc62d5e  0021-avoid-updating-caller-s-size-when-getdelim-fails-to-.patch
99f93be1cc75bc35ce51d6b221b9c7c1  0022-fix-overly-pessimistic-realloc-strategy-in-getdelim.patch
cde5cb6872b78efd8748e379b0865861  0023-add-missing-protocols-to-protoent-lookup-functions.patch
830d01f7821b978df770b06db3790921  ldconfig
0df687757221bbb0fc1aa67f1bd646f9  __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2  getconf.c
2b941c4251cac44988a4abfc50e21267  getent.c
45f92f8d59cf84d765de698a9578dbf4  iconv.c"
sha256sums="720b83c7e276b4b679c0bffe9509340d5f81fd601508e607e708177df0d31c0e  musl-1.1.12.tar.gz
ee51a2ae17e123e5363cd8c09c121263d1b4e0c2484515ae0d9b2c666e3863e6  0001-fix-single-byte-overflow-of-malloc-d-buffer-in-getde.patch
2ee9a4d8085e1a35aff8874d3dc021c3a0ffd2842b6835383aa8d8a24ec558ed  0002-safely-handle-failure-to-open-hosts-services-resolv..patch
c165876c6a744768f842e0a4c66a3817f3a50464ad1549f62214819149e70019  0003-getnameinfo-make-size-check-not-fail-for-bigger-size.patch
5be81238a8995ea02a9251b2ec514ab6fbb293abd093f542dde6c110b9ad8a74  0004-properly-access-mcontext_t-program-counter-in-cancel.patch
765b7d653680793bf607a14965444af42a2b75b89401b0265996cdce58873859  0005-use-explicit-__cp_cancel-label-in-cancellable-syscal.patch
2ea9de6eebc02ddc6ef36083467e8b38700e94acff03dc954f4f7fd8b996eb90  0006-prevent-allocs-than-PTRDIFF_MAX-via-mremap.patch
9f464642f19298a13bc0b8d1964489275fa1526bd12212322d0d021beb1960a8  0007-fix-mremap-memory-synchronization-and-use-of-variadi.patch
b49213cabb1323f75891c6cedb0388ef8a36527326b263863f09f9a6e041c9b3  0008-have-configure-check-add-ffunction-sections-and-fdat.patch
8f66ec53c0bcc2eaf48d8893df537b9b3b800c2b5b11a8ac4426517b17e7e561  0009-have-configure-check-add-linker-options-to-reduce-si.patch
47ae56a03d509dca5767de38dad77ffbd28f820e7b6c5ebb6a62ef58443fc74d  0010-have-configure-check-add-gc-sections-linker-option.patch
1f545670eb4c3d8dc95930cfa2e0bd2b5fdb7a0dd7fc7cbf53423566cb1a2642  0011-work-around-toolchains-with-broken-visibility-in-lib.patch
970a22adfc08d8f2685fdf5b47f1b52bce97a12094f048ca50e42ca70187cbbe  0012-fix-return-value-of-nl_langinfo-for-invalid-item-arg.patch
d5b15f2dd9305e16f562c5daae3d08e1aa17b16954c76efa62922e5fb30a1061  0013-math-explicitly-promote-expressions-to-excess-precis.patch
09d6a5518d7c2185117b7240222efbd58f8e02600c00960f4dcf08841b49313a  0014-ldso-fix-the-dtv-update-logic-in-__tls_get_new.patch
adbd062b398a4effcbaf9c451ed48faab152b1a9cffcc7cc36c749e91ba66f72  0015-properly-handle-point-to-point-interfaces-in-getifad.patch
3924429c0475bd14e7109539281b5011f6f3dd27257bbce3fd6e1232d6b12c61  0016-fix-tdelete-to-properly-balance-the-tree.patch
c26d7070c5cff59ae8383d74d6b7919e26876b448b8be9df44b92ae983a4d1c6  0017-fix-tsearch-to-avoid-crash-on-oom.patch
6913e0d2d7a04ae813847125e2dda1399502c76b679c4caf25510a43d7b1642e  0018-tsearch-code-cleanup.patch
f8b10603a9e6ab53c7a6a90ac79eceee67aef2a3a2467a9c05b3eb6a0c661f7a  0019-fix-tsearch-tfind-tdelete-to-handle-null-pointer-inp.patch
11e27faaf0f795ce89e772746d0575f5ff506a4c82e2595b68238c3d44153a61  0020-fix-crash-when-signal-number-0-is-passed-to-sigactio.patch
abbc746c46c96478c9ccc7ac3e61142e5dde63a00d80787d24e79802a4cd32b6  0021-avoid-updating-caller-s-size-when-getdelim-fails-to-.patch
3469865c391422dc56806c32b5ba373f2f0e67476235a69c172c8d9f866125cd  0022-fix-overly-pessimistic-realloc-strategy-in-getdelim.patch
b9c4ca23898d8f57c7ad26bd8214df2294b2ef06bf7a517dad3750ddd0581f75  0023-add-missing-protocols-to-protoent-lookup-functions.patch
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7  ldconfig
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da  __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c  getconf.c
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe  getent.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7  iconv.c"
sha512sums="7cabbe2665e32bd3408c8865f89f474106e982b4e5de81d0cdeea19e19e20b4d2496faf1adc6b2811d996f30f39258184ba347e8eb5f3811eab89179e8f52d70  musl-1.1.12.tar.gz
ec23ce27f1c2b4c8dae4c76b38da2795d46df55dce6a159e98b2755c0a6d391749626e65862b46d36d8473edc71ad01f2bf3521e41666895f705c7dad27a12bc  0001-fix-single-byte-overflow-of-malloc-d-buffer-in-getde.patch
36bc9d2a236a9cc8e0e4de87c47abb887891b29c9f67b5e708c25373f9c060080f8bde95d1dac313e02de5a76fd4b22ad2f34eb5cb5506d9e44386d6473f7cdb  0002-safely-handle-failure-to-open-hosts-services-resolv..patch
9d651de100a68c87bdb427e034717c6f885d395d63a5337f185da0a7ff10502dbee9234dc952e014f1362d78fd44752ac10eef78a9d3a81e33f2e2374132693e  0003-getnameinfo-make-size-check-not-fail-for-bigger-size.patch
f1e627690aaf494052b573c16d17901edbefe99a2ff216b68b1261024c28e5c049de35bdddf018e826e8971fe34e328bd6507a6f8d3810d4179f2662cc7794fc  0004-properly-access-mcontext_t-program-counter-in-cancel.patch
19fafc5a62150a9500e8495b7ebb71b680e8c827002e863f641ff5631812fe242981b452932c2759c6cf0150151393d1ed1a213a7ce8dd7e6de3e2ffd6c9f280  0005-use-explicit-__cp_cancel-label-in-cancellable-syscal.patch
2c73458719e68fea6684905c4b2632e67d83674da7e92d37794939d277efc7469471aae4b7ade395214e4a7061f1027b87e3cdf664085bc473089d72f38d8baf  0006-prevent-allocs-than-PTRDIFF_MAX-via-mremap.patch
d17d9deedbed9a2fa7d7988a2b13f9c3273faf19543a8b184c2f0b4e1740403199bc8884399abe15ce65143a9277b53c77231f176808b7f15ee9f0c479b8c93d  0007-fix-mremap-memory-synchronization-and-use-of-variadi.patch
21eb9d66f93276bf46fb2dead1b9bf73d5703ceae3dff6e8bb9e9d273e39515623cde71a4728b7c6557fe39a7fd1229b92fe41af13b7df6a05f781c4cca2ac14  0008-have-configure-check-add-ffunction-sections-and-fdat.patch
abdeece8b2a64d45607ee513949e8a788e7f54a4f3e2111926a354e5b5af2c932ef0b5cc1d1ad8db48d168cee34e21b918ef01e1a9f3efadc5b6ef2c4c22c508  0009-have-configure-check-add-linker-options-to-reduce-si.patch
c49071c8014a5a8407c6df006a8874481a97f03f95a14420f66457e20446085e173ec12a2f161fd9bc3d85a2b1f40972092d89d339498fb7890e0512cb13d0ca  0010-have-configure-check-add-gc-sections-linker-option.patch
1ef9e77b9f17e9cd1dd77487005ff08b9fda357380d70dedb9752bfdf071cc077a8b93eae84f08ce27af7f0e4f8cb7f2b09d17d2e953a6429e20959decce517a  0011-work-around-toolchains-with-broken-visibility-in-lib.patch
636cc187f96916aef02e1bab8ceafb0ce02a087f8358b36e8ded0a5db431bb5d26c90234e21e85742e2dad90fa8315c80ac818c26777cbd1f55d8b6d1d7a5eeb  0012-fix-return-value-of-nl_langinfo-for-invalid-item-arg.patch
49a0a51f652e818769380eeccaab1e58e58afecfe99277a157391c8038cbc101eaefc11f1440461834e2f428c02ead740b89afeaece7966efbb9a2f053fd4d29  0013-math-explicitly-promote-expressions-to-excess-precis.patch
270e40a25012d2ccd9d5ec53eba7089b920aa68de0e75baf69cb658bfe42837f0546bf5323fa7bf248c0bbe5e76e8d4df789da3cda89f29dab75346e9ed63723  0014-ldso-fix-the-dtv-update-logic-in-__tls_get_new.patch
15f5061ccb11413c98e8cbf9b39533496a2326e69256234902f0e954350247ff4fdcc1acec482ceb5d96a835bb3bf62e79d14cfffc8c7b4806abf19250afe688  0015-properly-handle-point-to-point-interfaces-in-getifad.patch
cd3178963bb0ea3c4bc670ab75fad15d85cf157cbf22f6b24a16d31f6c78b57aac58af4756a0e2ecddff38e383552134cc666e14955e0dedfdd0f2853afe7e0a  0016-fix-tdelete-to-properly-balance-the-tree.patch
dd14c638499a9364c64371f45183bc01b078594291da8b11a4a8bedf58cdb853502b8e871f52aae7bbcd71e930c6abda7aa6ea280d5ea226091a5256836f7ef1  0017-fix-tsearch-to-avoid-crash-on-oom.patch
12c9ad56768cd97768f7be51784b7df3ef9041ad568252d9e5f6ba725836d9aa8bdc2a53d17b4161395e5e10ad08acc03237bb0d48eafe93eb46f5967bc4f2ab  0018-tsearch-code-cleanup.patch
6136a11408ccd58427507841773fb73e3755f073ae22cfb1b41ff6228f6b9b9719e7313b24c5198a32f7d6aa0601f2792aa4ccd558aaf2a6311ac896c89b7c1c  0019-fix-tsearch-tfind-tdelete-to-handle-null-pointer-inp.patch
5a754335dfa9b8856aa04876c4dc8c98a27630c670242b77f3fdcf1dd1133edb1661c124c60a594ee1c1fbf9401d481a6be186a00b53120ba83644a835799e2c  0020-fix-crash-when-signal-number-0-is-passed-to-sigactio.patch
7b9618242ae75767a5eb7dc3ea83e2fb44ab073c1062cb1f7c3b2168f7185f442ff1438755e3e8bab8eee9406d08ba4bed0a39ec9c4b8fb7ff523424a020c920  0021-avoid-updating-caller-s-size-when-getdelim-fails-to-.patch
d166fabf4178c4f74113182a9294e1b864c78be1123bf0c5a59ec627017440369cabc31fe69c570df672a9eccfe891bddf5306fb9d638b0b69e5a2416af015ee  0022-fix-overly-pessimistic-realloc-strategy-in-getdelim.patch
feda1aa70f6bf70d00da1d633ad9b5a539abaa3638707a4c9ff624d2492086af381963c3ec021fc67c67c314967c66148fd6a8852ec1538936170f40c6f81525  0023-add-missing-protocols-to-protoent-lookup-functions.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f  ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b  __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d  getconf.c
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2  getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf  iconv.c"