1 ################################################################################
5 ################################################################################
7 GLIBC_VERSION
= $(call qstrip
,$(BR2_GLIBC_VERSION_STRING
))
8 GLIBC_SITE
= $(BR2_GNU_MIRROR
)/libc
9 GLIBC_SOURCE
= glibc-
$(GLIBC_VERSION
).
tar.xz
12 GLIBC_LICENSE
= GPLv2
+ (programs
), LGPLv2.1
+, BSD-3c
, MIT
(library
)
13 GLIBC_LICENSE_FILES
= $(addprefix $(GLIBC_SRC_SUBDIR
)/,COPYING COPYING.LIB LICENSES
)
15 # glibc is part of the toolchain so disable the toolchain dependency
16 GLIBC_ADD_TOOLCHAIN_DEPENDENCY
= NO
18 # Before glibc is configured, we must have the first stage
19 # cross-compiler and the kernel headers
20 GLIBC_DEPENDENCIES
= host-gcc-initial linux-headers host-gawk
24 GLIBC_INSTALL_STAGING
= YES
26 GLIBC_INSTALL_STAGING_OPTS
= install_root
=$(STAGING_DIR
) install
28 # Thumb build is broken, build in ARM mode
29 ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB
),y
)
30 GLIBC_EXTRA_CFLAGS
+= -marm
33 # MIPS64 defaults to n32 so pass the correct -mabi if
34 # we are using a different ABI. OABI32 is also used
35 # in MIPS so we pass -mabi=32 in this case as well
36 # even though it's not strictly necessary.
37 ifeq ($(BR2_MIPS_NABI64
),y
)
38 GLIBC_EXTRA_CFLAGS
+= -mabi
=64
39 else ifeq ($(BR2_MIPS_OABI32
),y
)
40 GLIBC_EXTRA_CFLAGS
+= -mabi
=32
43 ifeq ($(BR2_ENABLE_DEBUG
),y
)
44 GLIBC_EXTRA_CFLAGS
+= -g
47 # The stubs.h header is not installed by install-headers, but is
48 # needed for the gcc build. An empty stubs.h will work, as explained
49 # in http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html. The same trick
50 # is used by Crosstool-NG.
51 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_GLIBC
),y
)
52 define GLIBC_ADD_MISSING_STUB_H
53 mkdir
-p
$(STAGING_DIR
)/usr
/include/gnu
54 touch
$(STAGING_DIR
)/usr
/include/gnu
/stubs.h
58 # Even though we use the autotools-package infrastructure, we have to
59 # override the default configure commands for several reasons:
61 # 1. We have to build out-of-tree, but we can't use the same
62 # 'symbolic link to configure' used with the gcc packages.
64 # 2. We have to execute the configure script with bash and not sh.
66 # Note that as mentionned in
67 # http://patches.openembedded.org/patch/38849/, glibc must be
68 # built with -O2, so we pass our own CFLAGS and CXXFLAGS below.
69 define GLIBC_CONFIGURE_CMDS
71 # Do the configuration
73 $(TARGET_CONFIGURE_OPTS
) \
74 CFLAGS
="-O2 $(GLIBC_EXTRA_CFLAGS)" CPPFLAGS
="" \
75 CXXFLAGS
="-O2 $(GLIBC_EXTRA_CFLAGS)" \
76 $(SHELL
) $(@D
)/$(GLIBC_SRC_SUBDIR
)/configure \
77 ac_cv_path_BASH_SHELL
=/bin
/bash \
78 libc_cv_forced_unwind
=yes \
80 --target
=$(GNU_TARGET_NAME
) \
81 --host
=$(GNU_TARGET_NAME
) \
82 --build
=$(GNU_HOST_NAME
) \
85 $(if
$(BR2_SOFT_FLOAT
),--without-fp
,--with-fp
) \
86 $(if
$(BR2_x86_64
),--enable-lock-elision
) \
87 --with-pkgversion
="Buildroot" \
91 --enable-obsolete-rpc \
92 --enable-kernel
=$(call qstrip
,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST
)) \
93 --with-headers
=$(STAGING_DIR
)/usr
/include)
94 $(GLIBC_ADD_MISSING_STUB_H
)
99 # We also override the install to target commands since we only want
100 # to install the libraries, and nothing more.
104 ld*.so.
* libanl.so.
* libc.so.
* libcrypt.so.
* libdl.so.
* libgcc_s.so.
* \
105 libm.so.
* libnsl.so.
* libpthread.so.
* libresolv.so.
* librt.so.
* \
106 libutil.so.
* libnss_files.so.
* libnss_dns.so.
* libmvec.so.
*
108 ifeq ($(BR2_PACKAGE_GDB
),y
)
109 GLIBC_LIBS_LIB
+= libthread_db.so.
*
112 define GLIBC_INSTALL_TARGET_CMDS
113 for libs in
$(GLIBC_LIBS_LIB
); do \
114 $(call copy_toolchain_lib_root
,$$libs) ; \
118 # MIPS R6 requires to have NaN2008 support which is currently not
119 # supported by the Linux kernel. In order to prevent building the
120 # glibc against kernels not having NaN2008 support on platforms that
121 # requires it, glibc currently checks for an (inexisting) 10.0.0
122 # kernel headers version.
124 # Since in practice the kernel support for NaN2008 is not really
125 # required for things to work properly, we adjust the glibc check to
126 # make it believe that NaN2008 support was added in the kernel
127 # starting from version 4.0.0.
129 # In general the compatibility issues introduced by mis-matched NaN
130 # encodings will not cause a problem as signalling NaNs are rarely used
131 # in average code. For MIPS R6 there isn't actually any compatibility
132 # issue as the hardware is always NaN2008 and software is always
133 # NaN2008. The problem only comes from when older MIPS code is linked in
134 # via a DSO and multiple NaN encodings are introduced. Since Buildroot
135 # is intended to have all code built from source then this scenario is
136 # highly unlikely. The failure mode, if it ever occurs, would be either
137 # that a signalling NaN fails to raise an invalid operation exception or
138 # (more likely) an ordinary NaN raises an invalid operation exception.
139 ifeq ($(BR2_MIPS_CPU_MIPS32R6
)$(BR2_MIPS_CPU_MIPS64R6
),y
)
140 define GLIBC_FIX_MIPS_R6
141 $(SED
) 's#10.0.0#4.0.0#' \
142 $(@D
)/sysdeps
/unix
/sysv
/linux
/mips
/configure \
143 $(@D
)/sysdeps
/unix
/sysv
/linux
/mips
/configure.ac
145 GLIBC_POST_EXTRACT_HOOKS
+= GLIBC_FIX_MIPS_R6
148 $(eval
$(autotools-package
))