# Contributor: William Pitcock # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.4 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" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0001-v1.1.4-to-d86af2a0.patch 0002-fix-dn_expand-empty-name-handling-and-offsets-to-0.patch 0003-fix-potential-read-past-end-of-buffer-in-getnameinfo.patch 0004-fix-off-by-one-in-bounds-check-in-fpathconf.patch 0005-fix-incorrect-sequence-generation-in-rand48-prng-fun.patch 0006-fix-handling-of-odd-lengths-in-swab-function.patch 0007-getopt-fix-optional-argument-processing.patch 0008-fix-uninitialized-output-from-sched_getaffinity.patch 0009-add-basic-dns-record-parsing-functions.patch 0010-implement-FNM_CASEFOLD-extension-to-fnmatch-function.patch 0011-fix-return-value-computation-in-one-code-path-of-wcs.patch 0012-check-for-connect-failure-in-syslog-log-opening.patch 0013-remove-rlimit-hacks-from-multi-threaded-set-id-code.patch 0014-increase-syslog-message-limit-from-256-to-1024.patch 0015-fix-erroneous-return-of-partial-username-matches-by-.patch 0016-make-execvp-continue-PATH-search-on-EACCES-rather-th.patch 0017-fix-bad-character-checking-in-wordexp.patch 0018-fix-internal-buffer-overrun-in-inet_pton.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/ } 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 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 } md5sums="f18f3bdbe088438cd64a5313c19a7312 musl-1.1.4.tar.gz 7e6f4c4e0992f73d61963959d7fbbaa5 0001-v1.1.4-to-d86af2a0.patch f8457d0491d4153a1e325a9dfe36e4db 0002-fix-dn_expand-empty-name-handling-and-offsets-to-0.patch c2406605027ab02aa4c17a304a47bcdf 0003-fix-potential-read-past-end-of-buffer-in-getnameinfo.patch 569172258227edf59cc5e03eefb4b93c 0004-fix-off-by-one-in-bounds-check-in-fpathconf.patch 9358c23d74262b7cbe539b43899d34cf 0005-fix-incorrect-sequence-generation-in-rand48-prng-fun.patch 585820a71ac2e6804dfe389b7ec76ea9 0006-fix-handling-of-odd-lengths-in-swab-function.patch 1b2e656a335656ce88f178f19df56f0e 0007-getopt-fix-optional-argument-processing.patch b2675bc12beea391bd1902cec5df8771 0008-fix-uninitialized-output-from-sched_getaffinity.patch 0e41a4102c8e4e6425de731a3e664038 0009-add-basic-dns-record-parsing-functions.patch 50294ade36bfc753cd17f01a62db1b32 0010-implement-FNM_CASEFOLD-extension-to-fnmatch-function.patch 943f58fee69ea3ffc68ef48f2e4c089f 0011-fix-return-value-computation-in-one-code-path-of-wcs.patch 630c52c5dd73e3f67850b30c0eab6061 0012-check-for-connect-failure-in-syslog-log-opening.patch be538c6090834d47409f10b9076309a6 0013-remove-rlimit-hacks-from-multi-threaded-set-id-code.patch 7329a779c72f7e61947eb49f9222f6cb 0014-increase-syslog-message-limit-from-256-to-1024.patch d79ef63a229730460dbcadc56bab3125 0015-fix-erroneous-return-of-partial-username-matches-by-.patch de0609ff5cb0ecf1bb486fa3831733e7 0016-make-execvp-continue-PATH-search-on-EACCES-rather-th.patch 5e109ef55748ad9ff2061386a4c47756 0017-fix-bad-character-checking-in-wordexp.patch f99a4519a796a56360a203723c1dff0e 0018-fix-internal-buffer-overrun-in-inet_pton.patch 830d01f7821b978df770b06db3790921 ldconfig 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c 2b941c4251cac44988a4abfc50e21267 getent.c 45f92f8d59cf84d765de698a9578dbf4 iconv.c" sha256sums="658c65ad3c3a9b281a96c5281e75720c758d91fcaae35ab987f2fdfb4f88f5cd musl-1.1.4.tar.gz 2966fe530dfda4affca61375d16a4d03140ddf3beb39df90b9f5f0b10558eb5d 0001-v1.1.4-to-d86af2a0.patch deeea7912e9310ae9a56ea8b342ab5c64b1387451d9120afe2e677da2db20822 0002-fix-dn_expand-empty-name-handling-and-offsets-to-0.patch 100cac9484c3ca0f751837d9e466c28769de0e5d99bde6ca1955d1808b9c3cee 0003-fix-potential-read-past-end-of-buffer-in-getnameinfo.patch 62815c38abb538e27f48301697baca61cb1819af40f858973f85f939414a7600 0004-fix-off-by-one-in-bounds-check-in-fpathconf.patch 5d60bfed298924f184ba4dcd0712ea6483b1876112767562bd8a916f5a50ae4b 0005-fix-incorrect-sequence-generation-in-rand48-prng-fun.patch 585d59d592f4820968eae3855f70bd5087239a433f5adae469091ec781e3d9c9 0006-fix-handling-of-odd-lengths-in-swab-function.patch b63bdf4b6a3b0386947d3d602840c817f9af8ba003c51257e05cc4b05ec89f6e 0007-getopt-fix-optional-argument-processing.patch 1b27e1f570cf9c4abcdb95c5becba094795abbaa0c4cbcb859fa5c20a0f75874 0008-fix-uninitialized-output-from-sched_getaffinity.patch 9a3045bae08176ecb165341a222d8b16bfd11efbdc3bfd79a359d522ee03a412 0009-add-basic-dns-record-parsing-functions.patch 48fdcaa32d166c2fe63f7210ad0a63509266693cc3f02824eab5cc5d74825d57 0010-implement-FNM_CASEFOLD-extension-to-fnmatch-function.patch c40f1eed144dfb89573afe056294fa245cdef3f3565806b29742e6178cb0b457 0011-fix-return-value-computation-in-one-code-path-of-wcs.patch d31ad22cf0fc4bd6f4c796298c60fc4241c8cc7e67e8f32ca3db206b496c696c 0012-check-for-connect-failure-in-syslog-log-opening.patch 440f53dc370b8287c26295514f8ba7ce8e8f36dcd4f357dbc2d4f3c1422cb233 0013-remove-rlimit-hacks-from-multi-threaded-set-id-code.patch ea9a88e707be52f971b828681f0c48e57a91d9b186d4e5419147b23112161ff5 0014-increase-syslog-message-limit-from-256-to-1024.patch fb7b5b8f04b711684bbf7fb1a98a0883d587eac77507c84c7946b4015947eaa2 0015-fix-erroneous-return-of-partial-username-matches-by-.patch c91c5ad143f0f34c29fafc455a3ea869d5c0d4b6b619acd9ff3cb428db070207 0016-make-execvp-continue-PATH-search-on-EACCES-rather-th.patch 329edb23ba7d31b037fa63999e469f7f46f525afb873fb6577f17b56f4e53aa6 0017-fix-bad-character-checking-in-wordexp.patch 2362acd6c14977072d25a205190277c25edc0d32396a5bca5eab8d88894ac654 0018-fix-internal-buffer-overrun-in-inet_pton.patch b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c" sha512sums="a46fb1db23f518beaa959e9bebcb3bf0574e583c197792d30dcd52b3974e3c285594984207043d317859fc5552f1d303a5686e9fbe3b8825df6346de7f917f9f musl-1.1.4.tar.gz 6ef512bd4c05ae3a24493c4cffeac71953bb7383aaf88d2012f95b1e13dfa5f09ad3fc24b7f0d08e0d3788bcdf7195a1a8e639ec56b2ac01551a403398ac003e 0001-v1.1.4-to-d86af2a0.patch 321bd6945c3a5e0684764ffa16f22cc070ae9ee0d04300bef54f9fe0bc873607e81b604f3927c3816e6cfd0170a81cf5f54edf443eb587176d81e29cd6c4d705 0002-fix-dn_expand-empty-name-handling-and-offsets-to-0.patch 7d1da92b0d2983f1d8ae7d1024585e3205450b0479443d714637f5ae6af1ccd1d29551c24e162afa02a2bea93daeb08ca96a60c81b6882e87af2158db2f65bcd 0003-fix-potential-read-past-end-of-buffer-in-getnameinfo.patch 44b3e533239b9e961e9b217f100aab82220b12cb4814467e53ce6f801570df11998d7a9210c358b25078a6f044ac213f5abf56139e9b95683aa3810d30bc13a4 0004-fix-off-by-one-in-bounds-check-in-fpathconf.patch 0ad22b78d41008f1766412c2ac6e4ff2f41cd5376e91cd9eb170b4f67aa692f199520f0d82aaafd47892054658436809914b2a3f79e765503d1722d7d0ab8555 0005-fix-incorrect-sequence-generation-in-rand48-prng-fun.patch 600120aa7e0d1d1f1a75c9257a77ab4fdaeee1c39d038906c18b67c77c12c04ae254d65fd6273912c37a3ce1e9d30137abe91b0f850fa10a32a677a1931574e1 0006-fix-handling-of-odd-lengths-in-swab-function.patch a2226d14a7f320ecbc2f5e71ac8ad971d13e750f1890693abe4723f2ad8a31e8b5ddfc7b52a49873c40e953dfdc1fb754d940f31e155f43e28864d7559ee6be1 0007-getopt-fix-optional-argument-processing.patch 6f38a76614a43a415d6e71d091e3f5336380e8eb98d881ffe791181c9a713f1fbc3fc4c4bd07291242b66478c2ddb3eb7e540b3f4f81d243c2e7a21f3f3e9282 0008-fix-uninitialized-output-from-sched_getaffinity.patch 5893d928e24e51c03c6d72ea97add8f9a7d4d69c8ca476cc00c479348669f9ac3f56dc1770708260549ac2d7b15725022f00807ac130f26e220181379a96474a 0009-add-basic-dns-record-parsing-functions.patch 26e405fb127e2d7365885e15202d4e7023d33a1b4947238523dba56032b6c9e6e2b4772f0e779a489e2b8a226e1e5c3672b556424dacac2c6f95a4a98f8ba818 0010-implement-FNM_CASEFOLD-extension-to-fnmatch-function.patch b65e4c303a4343da9cd13702baa49def95d98eb26cc10a4024b086230772b754fb54810f3ee34f1e24f0a8207c079f817827ed4e73d60bee60736f1d19dd46a7 0011-fix-return-value-computation-in-one-code-path-of-wcs.patch 13326ddb538880e4f6d5d8d86182e5deb6a0bcd88ecce72e7536dbac8aa3295e20b7d0345a8b6ab4f52d3bdf5cf1feffb5d156734ef230e8790d85b4d453d459 0012-check-for-connect-failure-in-syslog-log-opening.patch aebb5ee9a273cbe02b43ca268210d0124b789e2bf97de89c07b59696399ab06cf5a97f38d7db44dec62f20689cb3e65f0b27309a713e0b79a943e38988c290c6 0013-remove-rlimit-hacks-from-multi-threaded-set-id-code.patch d64cb02502263f62b496be906824e6090296c53002a6195f1f364e951807a63132ac6926d2a3bf36095d2db86a300c563a792dc9d70ef6fa0833c34182147ef0 0014-increase-syslog-message-limit-from-256-to-1024.patch 5964ba6421480d01906188f85f58b02ad5ee9fe4179b082584a0da831087944fb4edbe1431d2647938212277e242700beb3bc6c678e33bcc6db03b6ff4fd7597 0015-fix-erroneous-return-of-partial-username-matches-by-.patch 782a49b1f0102877a7fc04741972e83391e18b68be1b1a71db4aa545fc0c8c7de4a44415f751a017a9a1dbc1ad530df66653ff3e60f2313c33c0f2863fd4bc36 0016-make-execvp-continue-PATH-search-on-EACCES-rather-th.patch 5a6b5a2b7681daf920092ca9d544c91efb857afd0535a94e17e931c81c5229dede7e9c8417f5dc241d5eff55305ffc0d9f1c3c1c57e4424965f4806820080552 0017-fix-bad-character-checking-in-wordexp.patch 0e978f001e8339f22c3fe09bd4f40227978db922b353559e2f052f81641b289510b9f344dd71f7205e8463ce0a1da01ebb8445089cf822c6d6996eb3e37e0eac 0018-fix-internal-buffer-overrun-in-inet_pton.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 getent.c 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c"