# Contributor: William Pitcock # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.10 pkgrel=3 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-uselocale-locale_t-0-to-not-modify-locale.patch 0002-ns_parse.c-fix-ns_skiprr.patch 0003-handle-loss-of-syslog-socket-connection.patch 0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch 0005-mitigate-vsz-explotion.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 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 } 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="fc30892ee582c91920505bbd0021049f musl-1.1.10.tar.gz 787a1c3661a0fcf887ec0d3c4550e90b 0001-fix-uselocale-locale_t-0-to-not-modify-locale.patch b468a4063182bc08d6d100075067d7fe 0002-ns_parse.c-fix-ns_skiprr.patch ccf33ac806e1152b14316eadbb667fb3 0003-handle-loss-of-syslog-socket-connection.patch 14dd2ac16696f3bd894ffd8ce2e5ea15 0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch 4b5d01740934c549173ef89575b70f97 0005-mitigate-vsz-explotion.patch 830d01f7821b978df770b06db3790921 ldconfig 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c 2b941c4251cac44988a4abfc50e21267 getent.c 45f92f8d59cf84d765de698a9578dbf4 iconv.c" sha256sums="45bbe9b1c7f7a0f743477af1e103b6889bfe4dd9815e16f6c89f6c90831c8b7c musl-1.1.10.tar.gz af5821fd50ad1587a9ef8117dc1e121cdda573f623286c6af4793e999afe840f 0001-fix-uselocale-locale_t-0-to-not-modify-locale.patch 8b16b8bb3eef89c799aed85caf3f495abd00bbbba1819a5feeede781040296da 0002-ns_parse.c-fix-ns_skiprr.patch 624aeae194332de57c525306f00cc513a7708eff065fce75fe176645aa1c4062 0003-handle-loss-of-syslog-socket-connection.patch aca83a914e90d9d1dbf8584fd00363301d453e324477e705dc3086ba00db2fb5 0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch b33c02f11b8ec1aad49bc054b1a52486077156dd7d91d3b68108f7e1cb6c53ac 0005-mitigate-vsz-explotion.patch b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c" sha512sums="183a66a8cc9cd056a8387a1602dd44b502d8976642a21dd0dcef51165fa0dec8a4a124fda6c1918f402b20ad2d6037fcc188a8b174b07a0cbedf11fc2e011141 musl-1.1.10.tar.gz a77981c637a091e19435ee8b3ef3ee21dbc7171f8fa88b59cfd42934a270bb92c9c3777c176fa64c814cd531244764f440f46fce532c4192d9727baa144b98e6 0001-fix-uselocale-locale_t-0-to-not-modify-locale.patch 08e2ce562acef8dc4232461ffdbc1c948c19025495a8c59b1328f83cb2baf3ee5db67b7d0d54794aa639d008286bedb5453d9afbc7e6e56b2f64f95d9b76be85 0002-ns_parse.c-fix-ns_skiprr.patch 68ea86c8a388c1b122ef2e07fff847c9fbecc0ca818b2710c52976fbd91c11e0ed07c612ce8771ab6e2520e813701ea764e84744d7e08fa54616230c6499da01 0003-handle-loss-of-syslog-socket-connection.patch 9a696b0eeebffee21ae84d4fc415b36b93e412ddd4a7272ed3cfe93e06c9815c4070ea998d63de348b2ee82180162a586326f1741f1d98088c27989354c5ecb3 0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch 2141c557a5f71a38510703d8266ed3fd21adfe137892b0fe81adcb28841b20a495f419beb273f381e6d9cb7f61cb8b182a249da61bf5a7b9df42b84235a01bc4 0005-mitigate-vsz-explotion.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 getent.c 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c"