blob: db26b4fef28b4efd5f6309e080c1369439f7ae50 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001# 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
5
Brad Bishopd7bf8c12018-02-25 22:55:05 -05006SRCREV = "eb03bde2f24582874cb72b56c7811bf51da0c817"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05007
Brad Bishopd7bf8c12018-02-25 22:55:05 -05008PV = "1.1.18+git${SRCPV}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05009
10# mirror is at git://github.com/kraj/musl.git
11
12SRC_URI = "git://git.musl-libc.org/musl \
13 file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
14 "
15
16S = "${WORKDIR}/git"
17
18PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc virtual/libiconv virtual/libintl"
19
20DEPENDS = "virtual/${TARGET_PREFIX}binutils \
21 virtual/${TARGET_PREFIX}gcc-initial \
22 libgcc-initial \
23 linux-libc-headers \
24 bsd-headers \
25 "
26
27export CROSS_COMPILE="${TARGET_PREFIX}"
28
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050029LDFLAGS += "-Wl,-soname,libc.so"
30
Brad Bishopd7bf8c12018-02-25 22:55:05 -050031# When compiling for Thumb or Thumb2, frame pointers _must_ be disabled since the
32# Thumb frame pointer in r7 clashes with musl's use of inline asm to make syscalls
33# (where r7 is used for the syscall NR). In most cases, frame pointers will be
34# disabled automatically due to the optimisation level, but append an explicit
35# -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame
36# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc.
37CFLAGS_append_arm = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
38
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050039CONFIGUREOPTS = " \
40 --prefix=${prefix} \
41 --exec-prefix=${exec_prefix} \
42 --bindir=${bindir} \
43 --libdir=${libdir} \
44 --includedir=${includedir} \
45 --syslibdir=${base_libdir} \
46"
47
48do_configure() {
49 ${S}/configure ${CONFIGUREOPTS}
50}
51
52do_compile() {
53 oe_runmake
54}
55
56do_install() {
57 oe_runmake install DESTDIR='${D}'
58
59 install -d ${D}${bindir}
Brad Bishopd7bf8c12018-02-25 22:55:05 -050060 rm -f ${D}${bindir}/ldd
Brad Bishop6e60e8b2018-02-01 10:27:11 -050061 lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
Patrick Williamsc0f7c042017-02-23 20:41:17 -060062 for l in crypt dl m pthread resolv rt util xnet
63 do
Brad Bishopd7bf8c12018-02-25 22:55:05 -050064 ln -sf libc.so ${D}${libdir}/lib$l.so
Patrick Williamsc0f7c042017-02-23 20:41:17 -060065 done
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050066}
67
68RDEPENDS_${PN}-dev += "linux-libc-headers-dev bsd-headers-dev"
69RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev"
70RPROVIDES_${PN} += "ldd libsegfault rtld(GNU_HASH)"
71
72LEAD_SONAME = "libc.so"