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