1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2021 IPFire Team <info@ipfire.org> #
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. #
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. #
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/>. #
19 ###############################################################################
21 ###############################################################################
23 ###############################################################################
29 THISAPP = glibc-$(VER)
30 DL_FILE = $(THISAPP).tar.xz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
34 # Normal build or $(TOOLS_DIR) build.
37 TARGET = $(DIR_INFO)/$(THISAPP)
39 --build=$(BUILDTARGET) \
41 --libexecdir=/usr/lib/glibc \
42 --enable-stack-protector=strong
44 TARGET = $(DIR_INFO)/$(THISAPP)-tools
46 --host=$(CROSSTARGET) \
47 --build=$(BUILDTARGET) \
48 --prefix=$(TOOLS_DIR) \
49 --with-headers=$(TOOLS_DIR)/include
52 ifeq "$(BUILD_ARCH)" "aarch64"
53 CFLAGS += -Wno-error=maybe-uninitialized
56 # Add some general configuration flags
59 --enable-kernel=5.4.0 \
62 --enable-experimental-malloc \
64 --enable-fortify-source \
66 --disable-build-nscd \
69 ifeq "$(BUILD_ARCH)" "x86_64"
70 EXTRA_CONFIG += --enable-cet
73 ifeq "$(BUILD_ARCH)" "aarch64"
74 EXTRA_CONFIG += --enable-memory-tagging
77 ###############################################################################
79 ###############################################################################
83 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
85 $(DL_FILE)_BLAKE2 = 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb
89 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
91 download :$(patsubst %,$(DIR_DL)/%,$(objects))
93 b2 : $(subst %,%_BLAKE2,$(objects))
95 ###############################################################################
96 # Downloading, checking, b2sum
97 ###############################################################################
99 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
102 $(patsubst %,$(DIR_DL)/%,$(objects)) :
105 $(subst %,%_BLAKE2,$(objects)) :
108 ###############################################################################
109 # Installation Details
110 ###############################################################################
112 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
114 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
115 @mkdir $(DIR_SRC)/glibc-build
117 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-localedef-no-archive.patch
119 ifneq "$(TOOLCHAIN)" "1"
120 ifeq "$(BUILD_ARCH)" "x86_64"
121 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib64 -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -o|' \
122 scripts/test-installation.pl
126 cd $(DIR_SRC)/glibc-build && \
127 CFLAGS="$(CFLAGS) -fno-asynchronous-unwind-tables" \
128 $(DIR_APP)/configure $(EXTRA_CONFIG)
130 cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(MAKETUNING) \
131 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
133 cd $(DIR_APP) && sed '/test-installation/s@\$$(PERL)@echo not running@' -i Makefile
135 cd $(DIR_SRC)/glibc-build && make install
137 ifneq "$(TOOLCHAIN)" "1"
138 # Creating the locales
139 mkdir -p /usr/lib/locale
140 cd $(DIR_SRC)/glibc-build && make localedata/install-locales $(MAKETUNING)
142 # Timezone data will be shipped by tzdata.
143 rm -rfv /usr/share/zoneinfo
146 ifeq "$(TOOLCHAIN)" "1"
147 # Test the linker in toolchain
148 cd $(DIR_APP) && echo "int main() { return 0; }" > dummy.c
149 cd $(DIR_APP) && $(CROSSTARGET)-gcc dummy.c -o dummy
151 # Must be using a runtime linker from $(TOOLS_DIR)
152 cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: $(TOOLS_DIR)"
153 cd $(DIR_APP) && rm -vf dummy dummy.c
156 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build