# Contributor: William Pitcock # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.16 pkgrel=8 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-dbg libc6-compat:compat:noarch" case "$BOOTSTRAP" in nocc) pkgname="musl-dev"; subpackages="";; nolibc) ;; *) subpackages="$subpackages $pkgname-utils";; esac source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0001-fix-strftime-y-for-negative-years.patch 0002-make-globfree-safe-after-failed-glob-from-over-lengt.patch 0003-reduce-impact-of-REG_-namespace-pollution-in-x86-_64.patch 0004-fix-getopt-_long-clobbering-of-optopt-on-success.patch 0005-treat-base-1-as-an-error-in-strtol-family-functions.patch 0006-fix-crash-from-corrupted-tls-module-list-after-faile.patch 0007-fix-bindtextdomain-logic-error-deactivating-other-do.patch 0008-fix-use-of-uninitialized-pointer-in-gettext-core.patch 0009-avoid-unbounded-strlen-in-gettext-functions.patch 0010-s390x-implement-dlsym.patch 0011-fix-build-regression-in-arm-atomics-asm-with-new-bin.patch 0012-allow-page-size-to-vary-on-arm.patch 0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch 0014-fix-ld-behavior-dependent-crash-in-ppc64-ldso-startu.patch 0015-treat-STB_WEAK-and-STB_GNU_UNIQUE-like-STB_GLOBAL-in.patch 0016-rework-ldso-handling-of-global-symbol-table-for-cons.patch 0017-reorder-addend-handling-before-symbol-lookup-in-relo.patch 0018-emulate-lazy-relocation-as-deferrable-relocation.patch 0019-fix-free-of-uninitialized-buffer-pointer-on-error-in.patch 0020-in-static-dl_iterate_phdr-fix-use-of-possibly-uninit.patch 0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch 0022-fix-wide-scanf-s-use-of-a-compound-literal-past-its-.patch 0023-fix-one-byte-overflow-in-legacy-getpass-function.patch 0024-avoid-loading-of-multiple-libc-versions-via-explicit.patch 0025-remove-unused-refcnt-field-for-shared-libraries.patch 0026-fix-threshold-constants-in-j0f-y0f-j1f-y1f.patch 0027-precalculate-gnu-hash-rather-than-doing-it-lazily-in.patch 0028-s390x-fix-fpreg_t-and-remove-unused-per_struct.patch 0029-fix-POSIX-format-TZ-dst-transition-times-for-souther.patch 0030-fix-dlopen-dlsym-regression-opening-libs-already-loa.patch 0031-s390x-provide-a-working-sigcontext-struct-definition.patch 0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch ldconfig __stack_chk_fail_local.c getconf.c getent.c iconv.c " # secfixes: # 1.1.15-r4: # - CVE-2016-8859 builddir="$srcdir"/musl-$pkgver build() { cd "$builddir" [ "$BOOTSTRAP" = "nocc" ] && return 0 # 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 if [ "$BOOTSTRAP" != "nolibc" ]; then # 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 fi # note: not autotools LDFLAGS="$LDFLAGS -Wl,-soname,libc.musl-${CARCH}.so.1" \ ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --localstatedir=/var \ || return 1 make || return 1 } package() { cd "$builddir" if [ "$BOOTSTRAP" = "nocc" ]; then case "$CARCH" in aarch64*) ARCH="aarch64" ;; arm*) ARCH="arm" ;; x86) ARCH="i386" ;; x86_64) ARCH="x86_64" ;; ppc) ARCH="powerpc" ;; ppc64*) ARCH="powerpc64" ;; s390*) ARCH="s390x" ;; mips*) ARCH="mips" ;; esac make ARCH="$ARCH" prefix=/usr DESTDIR="$pkgdir" install-headers || return 1 else 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 || return 1 ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/bin/ldd || return 1 fi # 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 "$subpkgdir"/sbin mv "$pkgdir"/usr/bin "$subpkgdir"/usr/ || return 1 install -D \ "$builddir"/getent \ "$builddir"/getconf \ "$builddir"/iconv \ "$subpkgdir"/usr/bin install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin } compat() { pkgdesc="compatibility libraries for glibc" mkdir -p "$subpkgdir"/lib 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" # go precompiled binary uses /lib64/ld-linux-x86-64.so.2 # so we add a symlink ln -s lib "$subpkgdir"/lib64 ;; mips* | s390*) _ld="ld.so.1" ;; esac ln -sf "/lib/libc.musl-${CARCH}.so.1" "$subpkgdir/lib/$_ld" for i in libc.so.6 libcrypt.so.1 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 } sha512sums="47c00e50b7605102fb4aebe1f9ba9db94d26fac64805f6d744c9c557a05b8a58dff7f9558ff7c8d66b5d7c43740cdc2dd79448bacac47f1414e6ada99c210140 musl-1.1.16.tar.gz 74e95ab3a74513e7a0513e004c376d4055eca0e21162e717dfcab249302a9060d3ac3eb88b562dea14b71b475b4dd2f703e355e2f5050b58891a848c5093c5f6 0001-fix-strftime-y-for-negative-years.patch 04805970e7dc11f84a86df49688f3b7670933860192e99637e189494c261e49b3cce1d80019d69341452062df03d5a349450015076c947296ac4a0d40e5789f4 0002-make-globfree-safe-after-failed-glob-from-over-lengt.patch 61a4f48055aa88cb5f40dd1ea9cc032e372896d7be530f25f17edba3d01706c233bf58a79bddf8952fb6b5d1481f04fac6dd619f4609251874f5a2e1f668f4a0 0003-reduce-impact-of-REG_-namespace-pollution-in-x86-_64.patch ea103de2721926111510116dedb10e2320715fd20563a342c1dd30f3d1e68049990924b2cf4d03fd9d481ae9488f0e49da5373a79bcec4a8d8c357c64a24751b 0004-fix-getopt-_long-clobbering-of-optopt-on-success.patch df96c4bd5ff9c197c8aa599948b69716587837de0f298d3adec56077b073e71a49a3c3345e0508cf8a4ed636e3171495bbbdc35435bd8e343c546436f6348359 0005-treat-base-1-as-an-error-in-strtol-family-functions.patch 4dc5cdcab11dee6b62fcb81401a816341e1d802a99e46b072c51575a2c25933354540fe22ae06dcdc85eb9a3cbf7256e7c43aab0e75843846551f9e18bfc39c2 0006-fix-crash-from-corrupted-tls-module-list-after-faile.patch 2184c81e97b78ed7c9e0d41200560420c9e60a8ec297d2e2055c9bf0ee5fdaef475ea6a9bcd4b732d53b453379146a9efb28b7b8aef0726e326fb3da26ba0b8d 0007-fix-bindtextdomain-logic-error-deactivating-other-do.patch 9c443c0902ed3d38ca2503ce7d4fd6d09d325caf07117833dd03ae999fa2e69ea2bd7b2751f1037eadaa9f13dfaae351841cfbf23301ca2682c98ff3af1a8294 0008-fix-use-of-uninitialized-pointer-in-gettext-core.patch fc3fce8a2dc10e1b48ef5d3c57cc1702503a849aa98166b2f25a56f6141340030c87e087b4eef5ccb5e2c3b750205c602c0dced3513031f39d19d1d5a0184506 0009-avoid-unbounded-strlen-in-gettext-functions.patch ba0a1e644f3b360e22716333f1125f04130f9fc0a2a0ee4c2cd51a454da5ccced043a510f41088b39ca565787d987331d5730cb87f35b21ad5bb3b85db939a72 0010-s390x-implement-dlsym.patch 75348cf93be68039aebe37c670981bca04b816fd7ba5846adfe07623592645f6ff2541389a9083fe012cf3472d91eb9d8da47fb31574693557152a34b080e51a 0011-fix-build-regression-in-arm-atomics-asm-with-new-bin.patch d73358b5377db7b708dd8fecda8f6bdae007423e853cde86b33ce5078e31761eab3f2169541aca5be8f72a59286db4b866f443a6c2f6565e5852447778fbadac 0012-allow-page-size-to-vary-on-arm.patch e3fe35bf310c9d5813553e6762c66764b384a9c2f405e3ba3cea887ff55f6bcd947e55012c5f3e06e16a66d5f289b694ac898fc9b1d4bb0cfb50cf92135e36a3 0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch 7a6cd67a5ca246eaedb992f9267bb94b0baccbbd5bb9a6a10a503f623ef052480fc4832da4330b5d3531f239580fdb9e36072f456fe4dd2e9ca6ae6050c55aab 0014-fix-ld-behavior-dependent-crash-in-ppc64-ldso-startu.patch 48d4fd3510404b2fe934dffb2fc725c6a31e30e33421dc81073673d680d00866890f9c826bf48874845c863db52ebbb015c9e94b45c7a20b6949236f76f81709 0015-treat-STB_WEAK-and-STB_GNU_UNIQUE-like-STB_GLOBAL-in.patch 41b8ba87082e586393b6c9570b7fc32455832a4a294ca1bb344f9eb72cd971be92cd03e590508cc1cd44fea532ab860690f38daaae665c68864302a20f11a01d 0016-rework-ldso-handling-of-global-symbol-table-for-cons.patch cad53ef772bc3ceae7695304df2a202d01a72cd4a707cffa9a7489947c9151ddd72bd2e2672e6508f56ec188973c886a0a99f85d4a4c54306284fe1b241c52db 0017-reorder-addend-handling-before-symbol-lookup-in-relo.patch e4935a23787e5eb5df4f1d487c10d63d4d2f34509ba5871c40037229f09057caad0679d12c444d7e7c5c719c2106e1b130921275d2ed3b1b8ffc6c97c9dde67a 0018-emulate-lazy-relocation-as-deferrable-relocation.patch 0754297d5e2cc9d2244835badb39325b0907604e377ddbabbb865a12429741c71b461ee9f19ebdebc6bd9b6e878919b2bc292b113e1477591171627623dbf557 0019-fix-free-of-uninitialized-buffer-pointer-on-error-in.patch 0fb792b688bea5024a59645eda680c57c509ad5f6923c8816647644ce5b438f18ef2036b4252ae2993c003e0e192d3a0cfd1f909d5a8c3cd8c21ef1130fca929 0020-in-static-dl_iterate_phdr-fix-use-of-possibly-uninit.patch 5cb2e43b01d30b9552668508bc4e855c7e90b323c811bf34989eae97b8cfbdccbe50e13bf95cac727314c0077af823eb4666318e53cb2d4584052b2870c36a3b 0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch d8faf157e46f46cf1fbdd8422a1c918834192634f66e54d7cfa88d14a618a8a3c321269b98e2ad33e4059a58b3a23ffd16111011a51f4007c7258befed64bfb5 0022-fix-wide-scanf-s-use-of-a-compound-literal-past-its-.patch efabb66abd01dbf73d89933328beffb738d71b227f7d7dd48b02ca0c9b04b554475bde70a814317b7a016c64c60fbaf98bf78c1b50da504a3e23fd175950515a 0023-fix-one-byte-overflow-in-legacy-getpass-function.patch b1141d2b5c28d16848dcd8b40182938d634023a4aa0e7f0be567fa7e6c40c03431574e9214949e723a031f90a6c20153ca1a6c21eda3b8ea05de5cebf6b1fe38 0024-avoid-loading-of-multiple-libc-versions-via-explicit.patch 955882a1a2a3e7211e20527858ca5dc0944b5d44fdacb547e0d4b4bd27fdf63672b95e16faa4b37e9ee4b384e7f33ce394ee556a201be6011630c84ebf64b312 0025-remove-unused-refcnt-field-for-shared-libraries.patch dad1ed979898ddaa0a49c601160a948ba229b251307210a14240e4ebf6230b16ffc0138f396fc226942c487e196211964449e7314f83d208ac219a071a4e11b3 0026-fix-threshold-constants-in-j0f-y0f-j1f-y1f.patch 9b91076729245d4192c01b82700898e8baca0d3db11fdb5f257f88a40d3d59442c30d13434a81e4a067553e28477ceea9edd0960c49da9bba684147dd645a85d 0027-precalculate-gnu-hash-rather-than-doing-it-lazily-in.patch 0472694cdd5a95b8df9b0e585afc7171ae9138133832ad7c0fadae4ea0a742eaa09a4d4449197ccaaefeae99c3cb7ec784068243a3a2d434429a0455c396e6bb 0028-s390x-fix-fpreg_t-and-remove-unused-per_struct.patch 33c24b895bcf1b84d90a522328b39d5b0a4aff822d0701f2f9db07a6c44c49bb3a8b16a19150c550b4fe04fad40e9af43fdf5e1fda0201e9779a471088fe9f23 0029-fix-POSIX-format-TZ-dst-transition-times-for-souther.patch adcb5b213ebd9fc5d50cc46d4444ed64a4f928a6b4767428d7d720c6a563ba1d4a3173d6546b41379356b155a26eaad652d7b831776cc3f31e942f155db9239d 0030-fix-dlopen-dlsym-regression-opening-libs-already-loa.patch 15ad590306829d196ecdb076d0491a822f80a46fac8179c30e29ea6b9138ebf5e1501796c8b116f8182c4ad6d1216e9702d407b7d29aeff35479f6ef568638bc 0031-s390x-provide-a-working-sigcontext-struct-definition.patch 690daa7f4c7ba0d24e103299406226849ad1314e2f3ea32cc571a6cdf0bac097b24fa3efa228b03ea495d9d437c9dd90eebe7b0268f94b7e19861100f84fa66e 0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c 378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413 getent.c 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c"