# Contributor: William Pitcock # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.5 pkgrel=4 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-manually-shrink-wrap-fast-path-in-pthread_once.patch 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch 0004-fix-uninitialized-mode-variable-in-openat-function.patch 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch 0008-implement-a-private-state-for-the-uchar.h-functions.patch 0009-getopt-fix-optional-argument-processing.patch 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch 0011-add-support-for-non-option-arguments-extension-to-ge.patch 0012-fix-uninitialized-output-from-sched_getaffinity.patch 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch 0014-add-arm-private-syscall-numbers.patch 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch 0016-don-t-fail-posix_spawn-on-failed-close.patch 0017-use-direct-syscall-rather-than-write-function-in-pos.patch 0018-don-t-shadow-functions-with-macros-in-C.patch 1001-add-basic-dns-record-parsing-functions.patch 1002-implement-FNM_CASEFOLD-gnu-extension.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/ } 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="94f8aa9dab80229fed68991bb9984cc5 musl-1.1.5.tar.gz facc7c96b21a72bc3ef3917f4add88ca 0001-manually-shrink-wrap-fast-path-in-pthread_once.patch 4ef3fa8b6fdc78515b83b7680b55a55f 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch 70f9b257bcc76d6d9fa1e4d55327c220 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch 7d1b8c611caafaf3b6c77359c7bf521e 0004-fix-uninitialized-mode-variable-in-openat-function.patch bdd96730e9f4ce664502bc31336f4941 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch feba13393b07c4ce0a87cba7e3de49e1 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch 859ca10150b56fb1ec046c75554c8aed 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch d7cc03dbd77755b25c7108aada242980 0008-implement-a-private-state-for-the-uchar.h-functions.patch 5ff1064dd67d75814b08270d1448042e 0009-getopt-fix-optional-argument-processing.patch 518c3b3a9819bf7ce1743a3fe58b970e 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch 3896f988be70fad4ff9a774580b23e6c 0011-add-support-for-non-option-arguments-extension-to-ge.patch d9b4d921348fa86e57c44bf4c95714bd 0012-fix-uninitialized-output-from-sched_getaffinity.patch 4ac6a08107b65927400f59f8f5e07f15 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch 5d8dde8258654d404d0b7a06c5046829 0014-add-arm-private-syscall-numbers.patch 256165e3059e1b2ed76397d53870eb5d 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch 346d4db3e125b0679a4e5fedcbd99644 0016-don-t-fail-posix_spawn-on-failed-close.patch b3e9f774ca938dcd1833dbe4af44fea8 0017-use-direct-syscall-rather-than-write-function-in-pos.patch c59cc913f8ce2daffe4ceecc136ff81d 0018-don-t-shadow-functions-with-macros-in-C.patch 2371eb1ce057fcb709a0e6a81f0d356c 1001-add-basic-dns-record-parsing-functions.patch c4c2f5b48af0aef958d191659b9e5192 1002-implement-FNM_CASEFOLD-gnu-extension.patch 71b2a4dcc39c436a6b89173943424043 1003-remove-ulimit-fiddling-from-setxid.patch 830d01f7821b978df770b06db3790921 ldconfig 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c 2b941c4251cac44988a4abfc50e21267 getent.c 45f92f8d59cf84d765de698a9578dbf4 iconv.c" sha256sums="352362b1724cc9740f4c3ce0fe02aae45e4de9809ea4ac961f31aedc11b87393 musl-1.1.5.tar.gz dec352852801f8a5c7e6957014f761efce21e4b6c3223cf8ee6f7cac24c12c01 0001-manually-shrink-wrap-fast-path-in-pthread_once.patch 83168c779dbc575ab240aa360c320bdca8de41cbbd0ad8b9a26fbd74466ca58d 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch c04a1272b934d968a1fbec30269d02171ae5d6b7d4f3cd5d49cbd905c975341c 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch 7d16772140a3f0811c0cf6822eb713e7a77b8974b609f9c7634ae42c3ca25a95 0004-fix-uninitialized-mode-variable-in-openat-function.patch 6052e3b1e0f489edcba648a78122ec21f0e2e2085917b1d2544e5802b2c83e0d 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch 44905edc8b8c66b94c3428f029cd6aa5147074a02ca7f795bc8f92866ba328cf 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch 46306557a669ac4e78a44664b49374a4a30eb041bba5f988bc666f29a2bba3d6 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch a3ac50a13d60ed7115fa423030029513d0f5889b63b7047356234e05095d306c 0008-implement-a-private-state-for-the-uchar.h-functions.patch 9300e0b2c7095fb070a43097c79aad34f019015dfcfae32ef946411537471d2f 0009-getopt-fix-optional-argument-processing.patch bb48d16025f1a8323673141a0d6e5b5e54ddfbf7056cf8e2e38343e55a85a67e 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch 44801a22c3cabc457043073a707412396c97fef0d0f49984818ee8df69f1b3d3 0011-add-support-for-non-option-arguments-extension-to-ge.patch e3622c3b84c0f984b864ecdf5d26f602723d81afee0c9c5dd5a2f0f1b6325965 0012-fix-uninitialized-output-from-sched_getaffinity.patch a6fa226f2bc0b2f56ef38df09bfe066b70e00d915b99657c2ced29c1262dfce4 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch fa2306adeda1a2ee733fcbc64fc8e0bb377b3c0dd6870ea15322722f08d135e1 0014-add-arm-private-syscall-numbers.patch 8c3ca04de81c487c7c8a237adeae3800adcc00996a2535fbdccd3d683be30abf 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch 598856ea334962a36b3ff99d1909306deb7dfe235b0ab8c5e20e531027fe4cf4 0016-don-t-fail-posix_spawn-on-failed-close.patch 0f7a2a055c87c2a2616b106fcf5d9f35c8a710c12383e652744f7429e0bfae96 0017-use-direct-syscall-rather-than-write-function-in-pos.patch da4d97570b552e332859f66c1a6fe8f4dee66b809e1e9f39fb1a3fc5a6e3574d 0018-don-t-shadow-functions-with-macros-in-C.patch 75053a31f6b84a64846d92c0ec631c76d7f747a9c0dc92a6dc1aa1bddfe2ea76 1001-add-basic-dns-record-parsing-functions.patch 57cb534a603dce32efa48be04ce7b1ca3f287fd8cc72258589fd529e86c1dd47 1002-implement-FNM_CASEFOLD-gnu-extension.patch fb542c2bd5081ff2f601c519edb3dac8f54ca5c888f44bc6cfb84e6565472025 1003-remove-ulimit-fiddling-from-setxid.patch b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c" sha512sums="4436887367137cbfc6d34e0f403b8dd36db2a55a5160681fef4de7cc0cb1be38487ea708e6aa6dc1328b61c62868b6cc19f099649c9d12e1ba812dfa8844b772 musl-1.1.5.tar.gz 665cdf9e616493629759ee8184863c124bd042c343f9408e93c5e87d9ed63ded1dce875cd659270d6bcb4453833ec578c81636c80aac15b6bb98f73295087e62 0001-manually-shrink-wrap-fast-path-in-pthread_once.patch e650cf51c88204fad1dc29f8df8ec2faa5f746fa7b818e8b695ed8bb5c3788e7144e342e793731e0ebeaa7bc836b6b0d0f8006e33b802b96450f6cdc9bbdb0cc 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch 96d884faff0b54e1cca9673faa26041c600148e86069ca029fa08fcba25423adc81ada03a3039000f6dfaa3f57f97197b2b54d231b08a051a61ce992e4aaa796 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch 15ba4fa68e8d7b890672789b03f7772bb150b1143883b2e77ade3b7d19ecf9ce2220b34a9ab00bd58e255880ee4cd79278986683ca5af32f84df3c3d09a79c58 0004-fix-uninitialized-mode-variable-in-openat-function.patch ab26de82db2cb9d36bc8f21e5d1a9e89b8e55f189ec67e87d036911ed4bed6e22a78c06ca676136d9c3903f3702f517785566b3aec67d3cb8f861676dc795283 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch 79a082aa9a8588a1778f6d447cd938db7c8c0564fbded6dfd795a96d2c8cc1080b9553cf3a68d951a349c7eae40fd854cdf241a2633afbd456f61d077a9c0f43 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch 564c590cc88eaf85a9c2d65c179589acfd6590639d51227375e46ebe0aa95421ac21c9042aae729a07e6ff8373a81e5c2f1e1776a76372d6a051b23f2e44df69 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch c4fa58663099b5a322557e7f59bdfbe13082baaa07fd387e62a0a72ed89b41b10d766d9e5c7fac8c1d56dc85c1528c7155bfa9e72bd29fe989ff88d56e8b6184 0008-implement-a-private-state-for-the-uchar.h-functions.patch c8e8d9234993756822036e6854a5a9b80319a3c568f0ffb61efc7d5e963d008e0eb4b581535a257280759bedbba131d4cd9772dea6e8b1fa8edb41a4c08cd985 0009-getopt-fix-optional-argument-processing.patch 542173281f5c424922157833aa142bec567d99e402299f59a63685cef31434a5f19fbe55d6858250fc4d930a755855c0cc6946074869cf58777c551ceff4b9a9 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch c15f3a2cbc7e83efbad86930d64e3dd131a4ecc0c0956a395d344ef7e6d2e60d70b2181aefe7c2dddb866cb854d5d77d211ded6344784ddc789409dc1572c5d9 0011-add-support-for-non-option-arguments-extension-to-ge.patch fcd04e66c812d108712d2ad937f117500d73311a0d1390bd6834d2093d844751bb0644f8b4ea820a3430b7b73e318a84e58f26419d5e664fb56b4507f5cf8e9c 0012-fix-uninitialized-output-from-sched_getaffinity.patch 85c3082a4fde1ec2739eb78b820792430cba9aeb082c53718698681b929675ee73546968cc3a41b38711afa2d140296bee7d9e7f43e9d5279cc7fd508835b1fc 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch 3374b983f6a5e4f8f0dc3e67c0cfb0d6fac153c6d5f7e604381e898b318f183faf8fc3995b960cd5a5fd7df0127b16cc6a98e3b0a534b1f156412af492f90ba1 0014-add-arm-private-syscall-numbers.patch 9a7a8a5acb59f45d9fd950d508419ccf10213d954659f454de2fe0542be132497cf19605bb59ed641c171d27053c22789b4d6012b6574721587358e7b6efdad1 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch 54a747fb14b38ffdd0abcd6b202a01e3e778cf853152a4554f7941a2e2544ab1c4c498e2646f421b421180e934ff0ff3372bbd8e08b59b800378cfb2db179940 0016-don-t-fail-posix_spawn-on-failed-close.patch 59060226956ddef64ade61b98a46a6faa5896061186abfa5a8adf1786584beff79acfa6197e2dc7ee1104ad300eda979ad18b6d5466a5dc98ae8957576a5b09d 0017-use-direct-syscall-rather-than-write-function-in-pos.patch a627055d150087fae4d484c60ac7be8cccae0c1b8ddb88684d7b03255c72c1306dc55b7a1ee08ef691691a6b79bfd335609ea5271363c9f4824e48043dd5b037 0018-don-t-shadow-functions-with-macros-in-C.patch 5b8ffa0a50419581adbf6ce2dae5797774022551c6331fa5aa2ff13635eb72b74eedd8a92cb478d45d73e1956af2f588669681ac414f3a255abd4d8ba8579448 1001-add-basic-dns-record-parsing-functions.patch f379f2308a8ed04560d08db90935acf56617d1b650f6227212e9ad530b53318aaecfea326ad4727439112b602a810db6857d1fe72d6e3ddeec519c99cd3608d2 1002-implement-FNM_CASEFOLD-gnu-extension.patch dae010b45419fcab64410568466f659cdc874e63113025e2cbc2fbab047b470fec23851ecbef08886505924482a069caf37c16b483b6922535fbd31832f1c4a3 1003-remove-ulimit-fiddling-from-setxid.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 getent.c 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c"