1# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com> 2# Released under the MIT license (see COPYING.MIT for the terms) 3 4require musl.inc 5inherit linuxloader 6 7SRCREV = "c4d4028dde90562f631edf559fbc42d8ec1b29de" 8 9BASEVER = "1.2.2" 10 11PV = "${BASEVER}+git${SRCPV}" 12 13# mirror is at git://github.com/kraj/musl.git 14 15SRC_URI = "git://git.musl-libc.org/musl;branch=master \ 16 file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ 17 file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ 18 " 19 20S = "${WORKDIR}/git" 21 22PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" 23 24DEPENDS = "virtual/${TARGET_PREFIX}binutils \ 25 virtual/${TARGET_PREFIX}gcc \ 26 libgcc-initial \ 27 linux-libc-headers \ 28 bsd-headers \ 29 libssp-nonshared \ 30 " 31GLIBC_LDSO = "${@get_glibc_loader(d)}" 32MUSL_LDSO_ARCH = "${@get_musl_loader_arch(d)}" 33 34export CROSS_COMPILE="${TARGET_PREFIX}" 35 36LDFLAGS += "-Wl,-soname,libc.so" 37 38# When compiling for Thumb or Thumb2, frame pointers _must_ be disabled since the 39# Thumb frame pointer in r7 clashes with musl's use of inline asm to make syscalls 40# (where r7 is used for the syscall NR). In most cases, frame pointers will be 41# disabled automatically due to the optimisation level, but append an explicit 42# -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame 43# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc. 44CFLAGS:append:arm = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" 45 46CONFIGUREOPTS = " \ 47 --prefix=${prefix} \ 48 --exec-prefix=${exec_prefix} \ 49 --bindir=${bindir} \ 50 --libdir=${libdir} \ 51 --includedir=${includedir} \ 52 --syslibdir=/lib \ 53" 54 55do_configure() { 56 ${S}/configure ${CONFIGUREOPTS} 57} 58 59do_compile() { 60 oe_runmake 61} 62 63do_install() { 64 oe_runmake install DESTDIR='${D}' 65 install -d ${D}${bindir} ${D}/lib ${D}${sysconfdir} 66 echo "${base_libdir}" > ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path 67 echo "${libdir}" >> ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path 68 rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO} 69 ln -rs ${D}${libdir}/libc.so ${D}${bindir}/ldd 70} 71 72FILES:${PN} += "/lib/ld-musl-${MUSL_LDSO_ARCH}.so.1 ${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path" 73FILES:${PN}-staticdev = "${libdir}/libc.a" 74FILES:${PN}-dev =+ "${libdir}/libcrypt.a ${libdir}/libdl.a ${libdir}/libm.a \ 75 ${libdir}/libpthread.a ${libdir}/libresolv.a \ 76 ${libdir}/librt.a ${libdir}/libutil.a ${libdir}/libxnet.a \ 77 " 78 79RDEPENDS:${PN}-dev += "linux-libc-headers-dev bsd-headers-dev libssp-nonshared-staticdev" 80RPROVIDES:${PN}-dev += "libc-dev virtual-libc-dev" 81RPROVIDES:${PN} += "ldd rtld(GNU_HASH)" 82 83LEAD_SONAME = "libc.so" 84INSANE_SKIP:${PN}-dev = "staticdev" 85INSANE_SKIP:${PN} = "libdir" 86 87UPSTREAM_CHECK_COMMITS = "1" 88