summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/glibc/glibc.inc')
-rw-r--r--meta/recipes-core/glibc/glibc.inc92
1 files changed, 92 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
new file mode 100644
index 0000000000..8aa78dfb34
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -0,0 +1,92 @@
1require glibc-common.inc
2require glibc-ld.inc
3require glibc-testing.inc
4
5STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
6STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
7PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
8
9TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
10
11# glibc can't be built without optimization, if someone tries to compile an
12# entire image as -O0, we override it with -O2 here and give a note about it.
13def get_optimization(d):
14 selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True)
15 if bb.utils.contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x":
16 bb.note("glibc can't be built with -O0, -O2 will be used instead.")
17 return selected_optimization.replace("-O0", "-O2")
18 return selected_optimization
19
20SELECTED_OPTIMIZATION := "${@get_optimization(d)}"
21
22# siteconfig.bbclass runs configure which needs a working compiler
23# For the compiler to work we need a working libc yet libc isn't
24# in the sysroots directory at this point. This means the libc.so
25# linker script won't work as the --sysroot setting isn't correct.
26# Here we create a hacked up libc linker script and pass in the right
27# flags to let configure work. Ugly.
28EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
29siteconfig_do_siteconfig_gencache_prepend = " \
30 mkdir -p ${WORKDIR}/site_config_libc; \
31 cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
32 sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
33"
34
35# nptl needs unwind support in gcc, which can't be built without glibc.
36DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers virtual/${TARGET_PREFIX}libc-initial"
37# nptl needs libgcc but dlopens it, so our shlibs code doesn't detect this
38#RDEPENDS_${PN} += "${@['','libgcc']['nptl' in '${GLIBC_ADDONS}']}"
39PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
40PROVIDES += "virtual/libintl virtual/libiconv"
41inherit autotools texinfo distro_features_check
42require glibc-options.inc
43
44# The main purpose of setting this variable is to prevent users from accidently
45# overriding DISTRO_FEATRUES, causing obscure build failures because of lack
46# of libc functions.
47REQUIRED_DISTRO_FEATURES = "${DISTRO_FEATURES_LIBC}"
48
49LEAD_SONAME = "libc.so"
50
51CACHED_CONFIGUREVARS += " \
52 ac_cv_path_KSH=${base_bindir}/bash \
53 ac_cv_path_BASH_SHELL=${base_bindir}/bash \
54 libc_cv_slibdir=${base_libdir} \
55 libc_cv_rootsbindir=${base_sbindir} \
56 libc_cv_localedir=${localedir} \
57 libc_cv_ssp=no \
58"
59
60GLIBC_EXTRA_OECONF ?= ""
61GLIBC_EXTRA_OECONF_class-nativesdk = ""
62INHIBIT_DEFAULT_DEPS = "1"
63
64ARM_INSTRUCTION_SET = "arm"
65
66# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
67# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE
68EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}""
69EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM"
70EXTRA_OEMAKE += "${EGLIBCPARALLELISM}"
71PARALLEL_MAKE = ""
72
73# glibc make-syscalls.sh has a number of issues with /bin/dash and
74# it's output which make calls via the SHELL also has issues, so
75# ensure make uses /bin/bash
76EXTRA_OEMAKE += "SHELL=/bin/bash"
77
78OE_FEATURES = "${@features_to_glibc_settings(d)}"
79do_configure_prepend() {
80 sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
81 echo '${OE_FEATURES}' > ${B}/option-groups.config
82}
83
84do_configure_append() {
85 oe_runmake config
86
87 # Remove quotation marks from OPTION_EGLIBC_NSSWITCH_FIXED_*. This will
88 # avoid install error.
89 sed -i 's/^OPTION_EGLIBC_NSSWITCH_FIXED_\(.*\)="\(.*\)"$/OPTION_EGLIBC_NSSWITCH_FIXED_\1=\2/' option-groups.config
90}
91
92GLIBC_ADDONS ?= "nptl,libidn"