]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/glibc
5dbc386d7699b88621909d039ad467caf32751e0
[ipfire-2.x.git] / lfs / glibc
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2021 IPFire Team <info@ipfire.org> #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = 2.33
28
29 THISAPP = glibc-$(VER)
30 DL_FILE = $(THISAPP).tar.xz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34 # Normal build or $(TOOLS_DIR) build.
35 #
36 ifeq "$(ROOT)" ""
37 TARGET = $(DIR_INFO)/$(THISAPP)
38 EXTRA_CONFIG = \
39 --build=$(BUILDTARGET) \
40 --prefix=/usr \
41 --libexecdir=/usr/lib/glibc \
42 --enable-stack-protector=strong
43 else
44 TARGET = $(DIR_INFO)/$(THISAPP)-tools
45 EXTRA_CONFIG = \
46 --host=$(CROSSTARGET) \
47 --build=$(BUILDTARGET) \
48 --prefix=$(TOOLS_DIR) \
49 --with-headers=$(TOOLS_DIR)/include \
50 libc_cv_forced_unwind=yes \
51 libc_cv_c_cleanup=yes
52 endif
53
54 ifeq "$(BUILD_ARCH)" "aarch64"
55 CFLAGS += -Wno-error=maybe-uninitialized
56 endif
57
58 ifeq "$(BUILD_ARCH)" "i586"
59 EXTRA_CONFIG += libc_cv_include_x86_isa_level=no
60 endif
61
62 # Add some general configuration flags
63 EXTRA_CONFIG += \
64 --disable-profile \
65 --enable-kernel=4.14.0 \
66 --enable-add-ons \
67 --without-selinux \
68 --enable-experimental-malloc \
69 --enable-bind-now \
70 --disable-crypt
71
72 ###############################################################################
73 # Top-level Rules
74 ###############################################################################
75
76 objects = $(DL_FILE)
77
78 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
79
80 $(DL_FILE)_MD5 = 390bbd889c7e8e8a7041564cb6b27cca
81
82 install : $(TARGET)
83
84 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
85
86 download :$(patsubst %,$(DIR_DL)/%,$(objects))
87
88 md5 : $(subst %,%_MD5,$(objects))
89
90 ###############################################################################
91 # Downloading, checking, md5sum
92 ###############################################################################
93
94 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
95 @$(CHECK)
96
97 $(patsubst %,$(DIR_DL)/%,$(objects)) :
98 @$(LOAD)
99
100 $(subst %,%_MD5,$(objects)) :
101 @$(MD5)
102
103 ###############################################################################
104 # Installation Details
105 ###############################################################################
106
107 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
108 @$(PREBUILD)
109 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
110 @mkdir $(DIR_SRC)/glibc-build
111
112 # Security Fixes
113 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-2.33-use-__pthread_attr_copy-in-mq_notify-bug-27896.patch
114 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-2.33-librt-fix-null-pointer-dereference-bug-28213.patch
115
116 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-localedef-no-archive.patch
117
118 ifneq "$(TOOLCHAIN)" "1"
119 ifeq "$(BUILD_ARCH)" "x86_64"
120 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib64 -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -o|' \
121 scripts/test-installation.pl
122 endif
123
124 ifeq "$(BUILD_ARCH)" "i586"
125 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
126 scripts/test-installation.pl
127 endif
128
129 ifeq "$(BUILD_ARCH)" "armv6l"
130 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \
131 scripts/test-installation.pl
132 endif
133 endif
134
135 cd $(DIR_SRC)/glibc-build && \
136 CFLAGS="$(CFLAGS) -fno-asynchronous-unwind-tables" \
137 $(DIR_APP)/configure $(EXTRA_CONFIG)
138
139 cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(MAKETUNING) \
140 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
141
142 cd $(DIR_APP) && sed '/test-installation/s@\$$(PERL)@echo not running@' -i Makefile
143
144 cd $(DIR_SRC)/glibc-build && make install
145
146 ifneq "$(TOOLCHAIN)" "1"
147 # Creating the locales
148 mkdir -p /usr/lib/locale
149 cd $(DIR_SRC)/glibc-build && make localedata/install-locales $(MAKETUNING)
150
151 # Timezone data will be shipped by tzdata.
152 rm -rfv /usr/share/zoneinfo
153 endif
154
155 ifeq "$(TOOLCHAIN)" "1"
156 # Test the linker in toolchain
157 cd $(DIR_APP) && echo "int main() { return 0; }" > dummy.c
158 cd $(DIR_APP) && $(CROSSTARGET)-gcc dummy.c -o dummy
159
160 # Must be using a runtime linker from $(TOOLS_DIR)
161 cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: $(TOOLS_DIR)"
162 cd $(DIR_APP) && rm -vf dummy dummy.c
163 endif
164
165 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build
166 @$(POSTBUILD)