# Contributor: William Pitcock # Maintainer: Timo Teräs pkgname=musl pkgver=1.0.0 pkgrel=1 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" license="MIT" depends="" depends_dev="" makedepends="$depends_dev" install="" subpackages="$pkgname-dev $pkgname-utils" [ "${CTARGET#*musl}" = "$CTARGET" ] && subpackages="$subpackages musl-gcc:crosstool" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 1001-add-basic-dns-record-parsing-functions.patch 1002-fix-confstr-return-value.patch 1003-implement-PT_GNU_RELRO-support.patch 2001-workaround-gcc-pr58245.patch getopt_long.c __stack_chk_fail_local.c getconf.c getent ldconfig " _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 ${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS "$srcdir"/getconf.c -o getconf || return 1 # 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() { mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/ldd "$subpkgdir"/usr/bin find "$pkgdir" -type d -delete 2>/dev/null install -D "$srcdir"/getent "$subpkgdir"/usr/bin/getent install -D "$_builddir"/getconf "$subpkgdir"/usr/bin/getconf install -D "$srcdir"/ldconfig "$subpkgdir"/sbin/ldconfig } crosstool() { mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib mv "$pkgdir"/usr/bin/musl-gcc "$subpkgdir"/usr/bin mv "$pkgdir"/usr/lib/musl-gcc.specs "$subpkgdir"/usr/lib find "$pkgdir" -type d -delete 2>/dev/null } md5sums="e54664fdf211d27737e328c4462b545e musl-1.0.0.tar.gz a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.patch 499bced87843940199898d1508ef58df 1002-fix-confstr-return-value.patch 82bdbdb20210ca6e19dbd7da6b54e2e6 1003-implement-PT_GNU_RELRO-support.patch 7a09c5cd7b3e9532e6902f54a5e928bb 2001-workaround-gcc-pr58245.patch 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c 7b391300396e58fe9073866b5a80cfe8 getconf.c ef81489a6258501cf45db58dfc6d5211 getent 33e4fd94e2560e008e2c3b431d0e3419 ldconfig" sha256sums="1ad7f45d2972daff19c9e6a92714e6d70f4aad003cd8c3d1e6113432114c1a32 musl-1.0.0.tar.gz 758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch dba7e5155efab40829ec0202f1135942004e8e79cff287cbb455355a0d67705f 1002-fix-confstr-return-value.patch ad4cf7c3d778514daaf3ad2de5939900214522387c7904a246b2892efe87c3d0 1003-implement-PT_GNU_RELRO-support.patch 45d6efda7450809e4e68f6e951431dcadf6cb7f0260930d50a9f1a8667aca49f 2001-workaround-gcc-pr58245.patch d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c 530ea449f93d53fafcb377fa0a23a7564f2961e49c07a8fdef6c960110317301 getconf.c d6996273f5aaaed429058257e4646b243d9e3a4d8609522f802762453f5be4cb getent 306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb ldconfig" sha512sums="c76cbfe60cbe9b1ceb1faedddf2dcce0f11c942c8f74e4f217efe63e8e1d7be70fcb6cf1182eeaee90441152c4493d678682cb247a0dbc7537d24f943a7bbdf8 musl-1.0.0.tar.gz dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch d4c5f3c5a8ab3a9f1f63a22933bf4dcc67d6aff630066c9e3bb0edf9f46ab8b6e228ded906e4f82b7849d3b7e84ca25c9322bf5c5787fca10203482a38176700 1002-fix-confstr-return-value.patch 5199c16d12a46dd990005ad0d2bc4c49e978db440be92cf8e1f848d6a74dcb5e789052c17088bbeac6540365f02fda1603b156c3346f89132f71122f384d734e 1003-implement-PT_GNU_RELRO-support.patch 69ad3fc851b44f33dd7c98b83fd0adbd149b37263d17b989f4d7338ee0703dfe8994f4299744e2509492300227d652de6f21b6cdba9b633fcefd3d9f7ca0cf20 2001-workaround-gcc-pr58245.patch 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c d638cdd02371351190fd0545fb83f44b822fa8c930e9fb47ef93d32a1aaee27641f875e10fa2e9833f1a56dfc2055fb89932a89c88da3e2eb17529bca58f5182 getconf.c 4d92f934d760cf5157d80f19fd766be6b673c65317229b32ac824d9d192f6abcc414e2382b2416dfd5c2f757b46ced98c18e4762bf91f5a48647e0ee61813b06 getent 69f097faa9ccb981e78c3a914ad68a51771637d9aecd2dbc807003ac30663e6d921091a48ff529dfff27a6cd55b0808f91683118acf7acdf406d37266e622b17 ldconfig"