]> git.ipfire.org Git - ipfire-2.x.git/blame_incremental - lfs/glibc
make.sh: Cleanup of polluted environment
[ipfire-2.x.git] / lfs / glibc
... / ...
CommitLineData
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
25include Config
26
27VER = 2.25
28
29THISAPP = glibc-$(VER)
30DL_FILE = $(THISAPP).tar.gz
31DL_FROM = $(URL_IPFIRE)
32DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34# Normal build or /tools build.
35#
36ifeq "$(ROOT)" ""
37 TARGET = $(DIR_INFO)/$(THISAPP)
38 EXTRA_CONFIG = \
39 --build=$(BUILDTARGET) \
40 --prefix=/usr \
41 --libexecdir=/usr/lib/glibc
42else
43 TARGET = $(DIR_INFO)/$(THISAPP)-tools
44 EXTRA_CONFIG = \
45 --host=$(CROSSTARGET) \
46 --build=$(BUILDTARGET) \
47 --prefix=/tools \
48 --with-headers=/tools/include \
49 libc_cv_forced_unwind=yes \
50 libc_cv_c_cleanup=yes
51endif
52
53# Enable some extra optimization for the glibc code
54CFLAGS = -O3 -DNDEBUG -fasynchronous-unwind-tables -fPIC -DPIC
55
56ifeq "$(BUILD_ARCH)" "armv7hl"
57 CFLAGS += -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard
58endif
59
60ifeq "$(BUILD_ARCH)" "i586"
61 CFLAGS += -march=i586 -mtune=generic -mno-tls-direct-seg-refs
62endif
63
64# Disable hardware FP for armv5tel
65ifeq "$(BUILD_ARCH)" "armv5tel"
66 EXTRA_CONFIG += \
67 --without-fp
68endif
69
70# Add some general configuration flags
71EXTRA_CONFIG += \
72 --disable-profile \
73 --enable-kernel=3.2 \
74 --enable-add-ons \
75 --without-selinux \
76 --enable-experimental-malloc \
77 --enable-bind-now \
78 --enable-stack-protector=strong
79
80###############################################################################
81# Top-level Rules
82###############################################################################
83
84objects = $(DL_FILE)
85
86$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
87
88$(DL_FILE)_MD5 = 0c9f827298841dbf3bff3060f3d7f19c
89
90install : $(TARGET)
91
92check : $(patsubst %,$(DIR_CHK)/%,$(objects))
93
94download :$(patsubst %,$(DIR_DL)/%,$(objects))
95
96md5 : $(subst %,%_MD5,$(objects))
97
98###############################################################################
99# Downloading, checking, md5sum
100###############################################################################
101
102$(patsubst %,$(DIR_CHK)/%,$(objects)) :
103 @$(CHECK)
104
105$(patsubst %,$(DIR_DL)/%,$(objects)) :
106 @$(LOAD)
107
108$(subst %,%_MD5,$(objects)) :
109 @$(MD5)
110
111###############################################################################
112# Installation Details
113###############################################################################
114
115$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
116 @$(PREBUILD)
117 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
118 @mkdir $(DIR_SRC)/glibc-build
119
120ifneq "$(TOOLCHAIN)" "1"
121 ifeq "$(BUILD_ARCH)" "x86_64"
122 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib64 -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -o|' \
123 scripts/test-installation.pl
124 endif
125
126 ifeq "$(BUILD_ARCH)" "i586"
127 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
128 scripts/test-installation.pl
129 endif
130
131 ifeq "$(BUILD_ARCH)" "armv5tel"
132 cd $(DIR_APP) && sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.3 -o|' \
133 scripts/test-installation.pl
134 endif
135endif
136
137 cd $(DIR_SRC)/glibc-build && \
138 CFLAGS="$(CFLAGS) -fno-asynchronous-unwind-tables" \
139 $(DIR_APP)/configure $(EXTRA_CONFIG)
140
141 cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(MAKETUNING) \
142 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
143
144 cd $(DIR_SRC)/glibc-build && make install
145
146ifeq "$(TOOLCHAIN)" "1"
147 ln -svf lib /tools/lib64
148else
149 # Creating the locales
150 mkdir -p /usr/lib/locale
151 cd $(DIR_SRC)/glibc-build && make localedata/install-locales
152
153 # Timezone data will be shipped by tzdata.
154 rm -rfv /usr/share/zoneinfo
155endif
156
157 @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build
158 @$(POSTBUILD)