musl_git.bb 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
  2. # Released under the MIT license (see COPYING.MIT for the terms)
  3. require musl.inc
  4. inherit linuxloader
  5. SRCREV = "c50985d5c8e316c5c464f352e79eeebfed1121a9"
  6. PV = "1.1.20+git${SRCPV}"
  7. # mirror is at git://github.com/kraj/musl.git
  8. SRC_URI = "git://git.musl-libc.org/musl \
  9. file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
  10. "
  11. S = "${WORKDIR}/git"
  12. PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc virtual/libiconv virtual/libintl virtual/crypt"
  13. DEPENDS = "virtual/${TARGET_PREFIX}binutils \
  14. virtual/${TARGET_PREFIX}gcc-initial \
  15. libgcc-initial \
  16. linux-libc-headers \
  17. bsd-headers \
  18. libssp-nonshared \
  19. "
  20. GLIBC_LDSO = "${@get_glibc_loader(d)}"
  21. export CROSS_COMPILE="${TARGET_PREFIX}"
  22. LDFLAGS += "-Wl,-soname,libc.so"
  23. # When compiling for Thumb or Thumb2, frame pointers _must_ be disabled since the
  24. # Thumb frame pointer in r7 clashes with musl's use of inline asm to make syscalls
  25. # (where r7 is used for the syscall NR). In most cases, frame pointers will be
  26. # disabled automatically due to the optimisation level, but append an explicit
  27. # -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame
  28. # pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc.
  29. CFLAGS_append_arm = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
  30. CONFIGUREOPTS = " \
  31. --prefix=${prefix} \
  32. --exec-prefix=${exec_prefix} \
  33. --bindir=${bindir} \
  34. --libdir=${libdir} \
  35. --includedir=${includedir} \
  36. --syslibdir=${base_libdir} \
  37. "
  38. do_configure() {
  39. ${S}/configure ${CONFIGUREOPTS}
  40. }
  41. do_compile() {
  42. oe_runmake
  43. }
  44. do_install() {
  45. oe_runmake install DESTDIR='${D}'
  46. install -d ${D}${bindir}
  47. rm -f ${D}${bindir}/ldd
  48. lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
  49. lnr ${D}${libdir}/libc.so ${D}${GLIBC_LDSO}
  50. for l in crypt dl m pthread resolv rt util xnet
  51. do
  52. ln -sf libc.so ${D}${libdir}/lib$l.so
  53. done
  54. for i in libc.so.6 libcrypt.so.1 libdl.so.2 libm.so.6 libpthread.so.0 libresolv.so.2 librt.so.1 libutil.so.1; do
  55. ln -sf libc.so ${D}${libdir}/$i
  56. done
  57. }
  58. PACKAGES =+ "${PN}-glibc-compat"
  59. FILES_${PN}-glibc-compat += "\
  60. ${libdir}/libc.so.6 ${libdir}/libcrypt.so.1 \
  61. ${libdir}/libdl.so.2 ${libdir}/libm.so.6 \
  62. ${libdir}/libpthread.so.0 ${libdir}/libresolv.so.2 \
  63. ${libdir}/librt.so.1 ${libdir}/libutil.so.1 \
  64. ${GLIBC_LDSO} \
  65. "
  66. RDEPENDS_${PN}-dev += "linux-libc-headers-dev bsd-headers-dev libssp-nonshared-staticdev"
  67. RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev"
  68. RPROVIDES_${PN} += "ldd libsegfault rtld(GNU_HASH)"
  69. LEAD_SONAME = "libc.so"