1 ################################################################################
5 ################################################################################
7 GLIBC_VERSION = $(call qstrip,$(BR2_GLIBC_VERSION_STRING))
9 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_EGLIBC),y)
10 GLIBC_SITE = http://downloads.yoctoproject.org/releases/eglibc
11 GLIBC_SOURCE = eglibc-$(GLIBC_VERSION).tar.bz2
12 GLIBC_SRC_SUBDIR = libc
14 GLIBC_SITE = $(BR2_GNU_MIRROR)/libc
15 GLIBC_SOURCE = glibc-$(GLIBC_VERSION).tar.xz
19 GLIBC_LICENSE = GPLv2+ (programs), LGPLv2.1+, BSD-3c, MIT (library)
20 GLIBC_LICENSE_FILES = $(addprefix $(GLIBC_SRC_SUBDIR)/,COPYING COPYING.LIB LICENSES)
22 # glibc is part of the toolchain so disable the toolchain dependency
23 GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
25 # Before (e)glibc is configured, we must have the first stage
26 # cross-compiler and the kernel headers
27 GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-gawk
31 GLIBC_INSTALL_STAGING = YES
33 GLIBC_INSTALL_STAGING_OPTS = install_root=$(STAGING_DIR) install
35 # Thumb build is broken, build in ARM mode
36 ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
37 GLIBC_EXTRA_CFLAGS += -marm
40 # MIPS64 defaults to n32 so pass the correct -mabi if
41 # we are using a different ABI. OABI32 is also used
42 # in MIPS so we pass -mabi=32 in this case as well
43 # even though it's not strictly necessary.
44 ifeq ($(BR2_MIPS_NABI64),y)
45 GLIBC_EXTRA_CFLAGS += -mabi=64
46 else ifeq ($(BR2_MIPS_OABI32),y)
47 GLIBC_EXTRA_CFLAGS += -mabi=32
50 ifeq ($(BR2_ENABLE_DEBUG),y)
51 GLIBC_EXTRA_CFLAGS += -g
54 # The stubs.h header is not installed by install-headers, but is
55 # needed for the gcc build. An empty stubs.h will work, as explained
56 # in http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html. The same trick
57 # is used by Crosstool-NG.
58 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_GLIBC),y)
59 define GLIBC_ADD_MISSING_STUB_H
60 mkdir -p $(STAGING_DIR)/usr/include/gnu
61 touch $(STAGING_DIR)/usr/include/gnu/stubs.h
65 # Even though we use the autotools-package infrastructure, we have to
66 # override the default configure commands for several reasons:
68 # 1. We have to build out-of-tree, but we can't use the same
69 # 'symbolic link to configure' used with the gcc packages.
71 # 2. We have to execute the configure script with bash and not sh.
73 # Note that as mentionned in
74 # http://patches.openembedded.org/patch/38849/, eglibc/glibc must be
75 # built with -O2, so we pass our own CFLAGS and CXXFLAGS below.
76 define GLIBC_CONFIGURE_CMDS
78 # Do the configuration
80 $(TARGET_CONFIGURE_OPTS) \
81 CFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
82 CXXFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" \
83 $(SHELL) $(@D)/$(GLIBC_SRC_SUBDIR)/configure \
84 ac_cv_path_BASH_SHELL=/bin/bash \
85 libc_cv_forced_unwind=yes \
87 --target=$(GNU_TARGET_NAME) \
88 --host=$(GNU_TARGET_NAME) \
89 --build=$(GNU_HOST_NAME) \
92 $(if $(BR2_SOFT_FLOAT),--without-fp,--with-fp) \
93 --with-pkgversion="Buildroot" \
97 --enable-obsolete-rpc \
98 --with-headers=$(STAGING_DIR)/usr/include)
99 $(GLIBC_ADD_MISSING_STUB_H)
104 # We also override the install to target commands since we only want
105 # to install the libraries, and nothing more.
109 ld*.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* \
110 libnsl.so.* libpthread.so.* libresolv.so.* librt.so.* libutil.so.* \
111 libnss_files.so.* libnss_dns.so.*
113 ifeq ($(BR2_PACKAGE_GDB),y)
114 GLIBC_LIBS_LIB += libthread_db.so.*
117 define GLIBC_INSTALL_TARGET_CMDS
118 for libs in $(GLIBC_LIBS_LIB); do \
119 $(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
123 $(eval $(autotools-package))