blob: bf1dccdeb8eb83455f00515de48a0b7aaab28a9f [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require 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
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050011python () {
12 opt_effective = "-O"
13 for opt in d.getVar('SELECTED_OPTIMIZATION', True).split():
14 if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
15 opt_effective = opt
16 if opt_effective == "-O0":
17 bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN', True), opt_effective))
18 if opt_effective in ("-O", "-O1", "-Os"):
19 bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN', True), opt_effective))
20 d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
21}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022
23# siteconfig.bbclass runs configure which needs a working compiler
24# For the compiler to work we need a working libc yet libc isn't
25# in the sysroots directory at this point. This means the libc.so
26# linker script won't work as the --sysroot setting isn't correct.
27# Here we create a hacked up libc linker script and pass in the right
28# flags to let configure work. Ugly.
29EXTRASITECONFIG = "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}'"
30siteconfig_do_siteconfig_gencache_prepend = " \
31 mkdir -p ${WORKDIR}/site_config_libc; \
32 cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
33 sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
34"
35
36# nptl needs unwind support in gcc, which can't be built without glibc.
37DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers virtual/${TARGET_PREFIX}libc-initial"
38# nptl needs libgcc but dlopens it, so our shlibs code doesn't detect this
39#RDEPENDS_${PN} += "${@['','libgcc']['nptl' in '${GLIBC_ADDONS}']}"
40PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
41PROVIDES += "virtual/libintl virtual/libiconv"
42inherit autotools texinfo distro_features_check systemd
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043
44LEAD_SONAME = "libc.so"
45
46CACHED_CONFIGUREVARS += " \
47 ac_cv_path_BASH_SHELL=${base_bindir}/bash \
48 libc_cv_slibdir=${base_libdir} \
49 libc_cv_rootsbindir=${base_sbindir} \
50 libc_cv_localedir=${localedir} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050051 libc_cv_ssp_strong=no \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052 libc_cv_ssp=no \
53"
54
55GLIBC_EXTRA_OECONF ?= ""
56GLIBC_EXTRA_OECONF_class-nativesdk = ""
57INHIBIT_DEFAULT_DEPS = "1"
58
59# This needs to match with glibc-collateral.inc, otherwise glibc-scripts and glibc-locale
60# will fail to find main glibc, for details see
61# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html
62ARM_INSTRUCTION_SET = "arm"
63
64# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
65# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE
66EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}""
67EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM"
68EXTRA_OEMAKE += "${EGLIBCPARALLELISM}"
69PARALLEL_MAKE = ""
70
71# glibc make-syscalls.sh has a number of issues with /bin/dash and
72# it's output which make calls via the SHELL also has issues, so
73# ensure make uses /bin/bash
74EXTRA_OEMAKE += "SHELL=/bin/bash"
75
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076do_configure_prepend() {
77 sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078}
79
80GLIBC_ADDONS ?= "nptl,libidn"