1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2018 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 \
50 libc_cv_forced_unwind=yes \
54 # Enable some extra optimization for the glibc code
55 CFLAGS = -O3 -DNDEBUG -fasynchronous-unwind-tables -fPIC -DPIC
57 ifeq "$(BUILD_ARCH)" "armv7hl"
58 CFLAGS += -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard
61 ifeq "$(BUILD_ARCH)" "i586"
62 CFLAGS += -march=i586 -mtune=generic -mindirect-branch=thunk -mfunction-return=thunk -mno-tls-direct-seg-refs
65 ifeq "$(BUILD_ARCH)" "x86_64"
66 CFLAGS += -mindirect-branch=thunk -mfunction-return=thunk
69 # Disable hardware FP for armv5tel
70 ifeq "$(BUILD_ARCH)" "armv5tel"
75 # Add some general configuration flags
77 --enable-obsolete-rpc \
82 --enable-experimental-malloc \
84 --enable-obsolete-rpc \
85 --enable-obsolete-nsl \
88 ###############################################################################
90 ###############################################################################
94 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
96 $(DL_FILE)_MD5 = c81d2388896379997bc359d4f2084239
100 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
102 download :$(patsubst %,$(DIR_DL)/%,$(objects))
104 md5 : $(subst %,%_MD5,$(objects))
106 ###############################################################################
107 # Downloading, checking, md5sum
108 ###############################################################################
110 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
113 $(patsubst %,$(DIR_DL)/%,$(objects)) :
116 $(subst %,%_MD5,$(objects)) :
119 ###############################################################################
120 # Installation Details
121 ###############################################################################
123 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
125 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
126 @mkdir $(DIR_SRC)/glibc-build
128 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-localedef-no-archive.patch
130 ifneq "$(TOOLCHAIN)" "1"
131 ifeq "$(BUILD_ARCH)" "x86_64"
132 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib64 -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -o|' \
133 scripts/test-installation.pl
136 ifeq "$(BUILD_ARCH)" "i586"
137 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
138 scripts/test-installation.pl
141 ifeq "$(BUILD_ARCH)" "armv5tel"
142 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \
143 scripts/test-installation.pl
147 cd $(DIR_SRC)/glibc-build && \
148 CFLAGS="$(CFLAGS) -fno-asynchronous-unwind-tables" \
149 $(DIR_APP)/configure $(EXTRA_CONFIG)
151 cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(MAKETUNING) \
152 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
154 cd $(DIR_APP) && sed '/test-installation/s@\$$(PERL)@echo not running@' -i Makefile
156 cd $(DIR_SRC)/glibc-build && make install
158 ifneq "$(TOOLCHAIN)" "1"
159 # Creating the locales
160 mkdir -p /usr/lib/locale
161 cd $(DIR_SRC)/glibc-build && make localedata/install-locales
163 # Timezone data will be shipped by tzdata.
164 rm -rfv /usr/share/zoneinfo
167 ifeq "$(TOOLCHAIN)" "1"
168 # Test the linker in toolchain
169 cd $(DIR_APP) && echo "int main() { return 0; }" > dummy.c
170 cd $(DIR_APP) && $(CROSSTARGET)-gcc dummy.c -o dummy
172 # Must be using a runtime linker from $(TOOLS_DIR)
173 cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: $(TOOLS_DIR)"
174 cd $(DIR_APP) && rm -vf dummy dummy.c
177 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build