summaryrefslogtreecommitdiffstats
path: root/main/musl/APKBUILD
blob: da37aac3841e740ce2af7fdf0b1c14d9ea7f090e (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
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.3
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"
install="$pkgname.post-upgrade"
subpackages="$pkgname-dev $pkgname-utils $pkgname-dbg"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
	0001-fix-regression-in-dynamic-linker-error-reporting.patch
	0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
	0003-fix-incorrect-return-value-for-fwide-function.patch
	0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
	0005-fix-multiple-issues-in-legacy-function-getpass.patch
	0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch
	0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch
	0008-fix-the-m-specifier-in-syslog.patch
	0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch
	1001-add-basic-dns-record-parsing-functions.patch
	1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
	1003-remove-ulimit-fiddling-from-setxid.patch

	ldconfig
	getopt_long.c
	__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

	# use GNU compatible getopt() from BSD
	rm -f src/misc/getopt*.c
	cp "$srcdir"/getopt_long.c src/misc/

	# remove libintl wrappers that we don't want
	rm src/locale/intl.c include/libintl.h
}

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" ;;
	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
	rm -f "$pkgdir"/usr/lib/*.la

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

	# make LDSO the be the real file, and libc the symlink (will be upstream change)
	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
}

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
}

md5sums="1628bd4c86b14b90447e1dcf8421aed7  musl-1.1.3.tar.gz
672514299b9b0f3fca1ba389c03b23a5  0001-fix-regression-in-dynamic-linker-error-reporting.patch
fe9d6f28d19f0e8d22073572df7f4e86  0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
43790c32ecd7cad6622a1b08e2ec14a7  0003-fix-incorrect-return-value-for-fwide-function.patch
73c7c31ef8a93e5a8a3dfba5fe4b970d  0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
ec24fa025b9a24e5c2ca05839956c1fb  0005-fix-multiple-issues-in-legacy-function-getpass.patch
5e432ef2b8ef6daf76f2e2b0081da4ee  0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch
db9e6b1782ab40b08b2bd2fbc237315c  0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch
d4be3c4e254a34f94f2a18d0fd43824c  0008-fix-the-m-specifier-in-syslog.patch
f77891cda55e2f54567814eff91934c0  0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch
2371eb1ce057fcb709a0e6a81f0d356c  1001-add-basic-dns-record-parsing-functions.patch
50bc2caec315ec814f3ffd374008738b  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
71b2a4dcc39c436a6b89173943424043  1003-remove-ulimit-fiddling-from-setxid.patch
013be8897f27c3909ada59c62020502f  ldconfig
61c6c1e84ed1df82abbe6d75e90cf21c  getopt_long.c
0df687757221bbb0fc1aa67f1bd646f9  __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2  getconf.c
2b941c4251cac44988a4abfc50e21267  getent.c
45f92f8d59cf84d765de698a9578dbf4  iconv.c"
sha256sums="4ef8a7559b947808d41dbea98e24d9f36be38326fb2754a91a35520b4ca4af9f  musl-1.1.3.tar.gz
b41d785a8550843febd5e1b5aae55a4fc1847518fd52f76476a0643deb822ff0  0001-fix-regression-in-dynamic-linker-error-reporting.patch
cb21b6af4a9f9ff478a838b05362a63215fe5721e909acf0f09115ea22be677f  0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
f555678ed344f2d06eff9f2e1e46eff95c7df974023ac2ffee3a7aa72dec699d  0003-fix-incorrect-return-value-for-fwide-function.patch
788279d797f08e8be5857e3124b2684e6d34e5473c0ac9fba60883c518b26d5f  0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
b72394ced802d6b4e88a2bd9eed24f239c787d0a63d8c2862db13b102c118ce1  0005-fix-multiple-issues-in-legacy-function-getpass.patch
0383402d2577a82408a1c5030522f1f81ace8cf374feb5edf41426ab106cb82d  0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch
2ba10f0e8efbce263db3147ecd4791d3363b968fcbfb2db4baaaeda1014d0079  0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch
a48df68855aec62da663ebf05f358bb49d054fbcb46c109db0a2b5e7a92a4259  0008-fix-the-m-specifier-in-syslog.patch
448280d267f6dcf9d3695b10a037092a0b963f026c83e4b03564d5564faec052  0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch
75053a31f6b84a64846d92c0ec631c76d7f747a9c0dc92a6dc1aa1bddfe2ea76  1001-add-basic-dns-record-parsing-functions.patch
9aee829aadb3e1fb3e61ca3ad56a7512dcfada2658ba31f83290ada86ace455b  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
fb542c2bd5081ff2f601c519edb3dac8f54ca5c888f44bc6cfb84e6565472025  1003-remove-ulimit-fiddling-from-setxid.patch
398dc26ec82cc6af056c738e8ac62da212ba978229d9839eb8b61f7ce536da4a  ldconfig
d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96  getopt_long.c
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da  __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c  getconf.c
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe  getent.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7  iconv.c"
sha512sums="c580c700d609eced15dc398ff6dcbc2e38fab24eaa5ea80a58c3d41d9f749579cce328bbad149f2b5975533d6ec051e6cc08be3bea4d65e143fc850745bf24c2  musl-1.1.3.tar.gz
c41219cfd0ee302ca0f8063102ec42cbaabf809ac7cc2ea3c7a7aa1d2aec246be843e6225eb23409e90710e4be0ebcc1c7f0bafaa4060e66f99c6c84f0f4956d  0001-fix-regression-in-dynamic-linker-error-reporting.patch
d621e097f8b23c9bd1dffa4dbc471db0fee0aa3665d9c4588daa1b1479d011f0963b615af559433073e5b92d6207dd6ed7ab3f4b02cdd20ac3149e2024d531d1  0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
bc06965a05d1e482a7ab0bcba8230b45778ab19ee907bddb68cf5496c38d23d51780d12980bb68344ff43b4c7c5f8e6edbbb576632f3e2ff50cc515b43e7985c  0003-fix-incorrect-return-value-for-fwide-function.patch
e16fc1a78c128212fc82488b0e2291cb64656d1c0938bda9c6e96aa285676bd959d1cd10192287c339a20a6e76a32176c04a3697b8f6b068629d63eb8494b5dd  0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
8868b29c1fc520b081601b2c4b750e2b4fdb76166cd64702aa2b22aca86b5a541fbd393243c55a3d59aca9944e17b0fe9c93673547da04b2517163c271c30fbf  0005-fix-multiple-issues-in-legacy-function-getpass.patch
1c3ca3317d7dd3e2959754988b1cb7b56215e18b9481205b9a254f8842cdf2d5cdcdaf0ba45dd7c9d4f4629b53a44415b94016faea0b166cc44a6e1ffd4f5ace  0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch
0878ab3babec6ac16d464fbda3151122637c80a30bc9f37b1079d31df17f62062f04bcf0c620014a45cb04255b4db7de56cf906d070dd29be17ef6db756a8060  0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch
5212d345635b88497a1e050d22c387a75e849ca257b41a01391882510b469a1162259c99f101c26ac1ce4c9cce9e3c55a2f422564a949bb3b438f182cb65a414  0008-fix-the-m-specifier-in-syslog.patch
29387d468bf06cb53acae098b06268fdfc74a6c5cc612776f96012be49978090e0f74ee1a6128a8cfd452af5c698d4cd07749013dd8c722e1173c9e328677499  0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch
5b8ffa0a50419581adbf6ce2dae5797774022551c6331fa5aa2ff13635eb72b74eedd8a92cb478d45d73e1956af2f588669681ac414f3a255abd4d8ba8579448  1001-add-basic-dns-record-parsing-functions.patch
3df7500a06960490412c15002cdd68916f6d4ad13c3070477d0859874649ff5f6de128b2d9592e614b5ff4ba7616fd074c353f4d2dc2eb1549903a3975fd9e5e  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
dae010b45419fcab64410568466f659cdc874e63113025e2cbc2fbab047b470fec23851ecbef08886505924482a069caf37c16b483b6922535fbd31832f1c4a3  1003-remove-ulimit-fiddling-from-setxid.patch
33e13d2242063f3dc9ec199ae9528e469a52ccae4d3726faa3c866e0c7dcf546f69294f9c00307324cee05fd965f84350ae100b8b1138f9d9c8c916de04ab0d1  ldconfig
140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9  getopt_long.c
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b  __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d  getconf.c
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2  getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf  iconv.c"