]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/glibc
Merge branch 'master' into next
[ipfire-2.x.git] / lfs / glibc
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2016 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.25
28
29 THISAPP = glibc-$(VER)
30 DL_FILE = $(THISAPP).tar.gz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34 # Normal build or /tools 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 \
49 --with-headers=/tools/include \
50 libc_cv_forced_unwind=yes \
51 libc_cv_c_cleanup=yes
52 endif
53
54 # Enable some extra optimization for the glibc code
55 CFLAGS = -O3 -DNDEBUG -fasynchronous-unwind-tables -fPIC -DPIC
56
57 ifeq "$(BUILD_ARCH)" "armv7hl"
58 CFLAGS += -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard
59 endif
60
61 ifeq "$(BUILD_ARCH)" "i586"
62 CFLAGS += -march=i586 -mtune=generic -mno-tls-direct-seg-refs
63 endif
64
65 # Disable hardware FP for armv5tel
66 ifeq "$(BUILD_ARCH)" "armv5tel"
67 EXTRA_CONFIG += \
68 --without-fp
69 endif
70
71 # Add some general configuration flags
72 EXTRA_CONFIG += \
73 --enable-obsolete-rpc \
74 --disable-profile \
75 --enable-kernel=3.2 \
76 --enable-add-ons \
77 --without-selinux \
78 --enable-experimental-malloc \
79 --enable-bind-now
80
81 ###############################################################################
82 # Top-level Rules
83 ###############################################################################
84
85 objects = $(DL_FILE)
86
87 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
88
89 $(DL_FILE)_MD5 = 0c9f827298841dbf3bff3060f3d7f19c
90
91 install : $(TARGET)
92
93 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
94
95 download :$(patsubst %,$(DIR_DL)/%,$(objects))
96
97 md5 : $(subst %,%_MD5,$(objects))
98
99 ###############################################################################
100 # Downloading, checking, md5sum
101 ###############################################################################
102
103 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
104 @$(CHECK)
105
106 $(patsubst %,$(DIR_DL)/%,$(objects)) :
107 @$(LOAD)
108
109 $(subst %,%_MD5,$(objects)) :
110 @$(MD5)
111
112 ###############################################################################
113 # Installation Details
114 ###############################################################################
115
116 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
117 @$(PREBUILD)
118 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
119 @mkdir $(DIR_SRC)/glibc-build
120
121 ifneq "$(TOOLCHAIN)" "1"
122 ifeq "$(BUILD_ARCH)" "x86_64"
123 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib64 -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -o|' \
124 scripts/test-installation.pl
125 endif
126
127 ifeq "$(BUILD_ARCH)" "i586"
128 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
129 scripts/test-installation.pl
130 endif
131
132 ifeq "$(BUILD_ARCH)" "armv5tel"
133 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \
134 scripts/test-installation.pl
135 endif
136 endif
137
138 cd $(DIR_SRC)/glibc-build && \
139 CFLAGS="$(CFLAGS) -fno-asynchronous-unwind-tables" \
140 $(DIR_APP)/configure $(EXTRA_CONFIG)
141
142 cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(MAKETUNING) \
143 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
144
145 cd $(DIR_SRC)/glibc-build && make install
146
147 ifneq "$(TOOLCHAIN)" "1"
148 # Creating the locales
149 mkdir -p /usr/lib/locale
150 cd $(DIR_SRC)/glibc-build && make localedata/install-locales
151
152 # Timezone data will be shipped by tzdata.
153 rm -rfv /usr/share/zoneinfo
154 endif
155
156 ifeq "$(TOOLCHAIN)" "1"
157 # Test the linker in toolchain
158 cd $(DIR_APP) && echo "int main() { return 0; }" > dummy.c
159 cd $(DIR_APP) && $(CROSSTARGET)-gcc dummy.c -o dummy
160
161 # Must be using a runtime linker from /tools
162 cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: /tools"
163 cd $(DIR_APP) && rm -vf dummy dummy.c
164 endif
165
166 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build
167 @$(POSTBUILD)