]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - lfs/gcc
fontconfig: Not a package anymore.
[people/teissler/ipfire-2.x.git] / lfs / gcc
CommitLineData
cd1a2927 1###############################################################################
cd1a2927 2# #
70df8302 3# IPFire.org - A linux based firewall #
3f8c9dc5 4# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
70df8302
MT
5# #
6# This program is free software: you can redistribute it and/or modify #
cd1a2927 7# it under the terms of the GNU General Public License as published by #
70df8302 8# the Free Software Foundation, either version 3 of the License, or #
cd1a2927
MT
9# (at your option) any later version. #
10# #
70df8302 11# This program is distributed in the hope that it will be useful, #
cd1a2927
MT
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 #
70df8302 17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
cd1a2927 18# #
cd1a2927
MT
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
82b312a9
MT
27VER = 4.4.7
28
29GMP_VER = 5.0.5
30MPFR_VER = 2.4.2
cd1a2927
MT
31
32THISAPP = gcc-$(VER)
dd714b8a
MT
33DL_FILE = $(THISAPP).tar.bz2
34DL_FROM = $(URL_IPFIRE)
cd1a2927 35DIR_APP = $(DIR_SRC)/$(THISAPP)
cd1a2927 36
ed635824
MT
37CFLAGS := $(patsubst -march=%,,$(CFLAGS))
38CFLAGS := $(patsubst -mtune=%,,$(CFLAGS))
39
cd1a2927
MT
40# Normal build or /tools build.
41#
42ifeq "$(ROOT)" ""
43 TARGET = $(DIR_INFO)/$(THISAPP)
afbd9856
MT
44 EXTRA_CONFIG = \
45 --prefix=/usr \
46 --libexecdir=/usr/lib \
47 --enable-shared \
48 --enable-threads=posix \
49 --enable-__cxa_atexit \
50 --enable-clocale=gnu \
51 --enable-languages=c,c++ \
52 --disable-bootstrap \
53 --disable-nls
857d9bf2
MT
54 EXTRA_MAKE =
55 EXTRA_INSTALL =
cd1a2927 56else
15679d9f 57ifeq "$(PASS)" "1"
cd1a2927 58 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
82b312a9
MT
59 EXTRA_CONFIG = \
60 --target=$(CROSSTARGET) \
61 --prefix=/tools \
62 --disable-nls \
63 --disable-shared \
64 --disable-decimal-float \
65 --disable-threads \
66 --disable-libmudflap \
67 --disable-libssp \
68 --disable-libgomp \
69 --disable-libquadmath \
70 --with-newlib \
71 --without-headers \
72 --without-ppl \
73 --without-cloog \
b469c8c2 74 --enable-languages=c
575ea031 75 EXTRA_MAKE =
cd1a2927
MT
76 EXTRA_INSTALL =
77else
78 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
82b312a9
MT
79 EXTRA_ENV = \
80 CC="$(CROSSTARGET)-gcc -B/tools/lib/" \
81 AR="$(CROSSTARGET)-ar" \
82 RANLIB="$(CROSSTARGET)-ranlib"
83 EXTRA_CONFIG = \
84 --host=$(BUILDTARGET) \
85 --build=$(BUILDTARGET) \
86 --target=$(BUILDTARGET) \
87 --prefix=/tools \
88 --with-local-prefix=/tools \
89 --enable-clocale=gnu \
90 --enable-shared \
91 --enable-threads=posix \
92 --enable-__cxa_atexit \
93 --enable-languages=c,c++ \
94 --disable-libstdcxx-pch \
95 --disable-bootstrap
cd1a2927
MT
96 EXTRA_MAKE =
97 EXTRA_INSTALL =
98endif
99endif
100
cc72d5cb 101ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac 102 EXTRA_CONFIG += \
afbd9856
MT
103 --with-float=soft \
104 --disable-sjlj-exceptions
51f9e7ac
MT
105endif
106
ed635824
MT
107ifeq "$(MACHINE)" "i586"
108 EXTRA_CONFIG += \
109 --with-arch=i586 \
110 --with-tune=generic
111endif
112
113EXTRA_CONFIG += \
114 --with-bugurl=http://bugtracker.ipfire.org \
115 --disable-libunwind-exceptions \
116 --enable-gnu-unique-object
117
51f9e7ac
MT
118export XCFLAGS = $(CFLAGS)
119export TCFLAGS = $(CFLAGS)
120
6c9d6fcc
AF
121ifeq "$(PASS)" "1"
122 CFLAGS =
123endif
124
cd1a2927
MT
125###############################################################################
126# Top-level Rules
127###############################################################################
82b312a9
MT
128
129objects = $(DL_FILE) \
130 gmp-$(GMP_VER).tar.bz2 \
131 mpfr-$(MPFR_VER).tar.bz2
cd1a2927 132
41921bd9 133$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
82b312a9
MT
134gmp-$(GMP_VER).tar.bz2 = $(DL_FROM)/gmp-$(GMP_VER).tar.bz2
135mpfr-$(MPFR_VER).tar.bz2 = $(DL_FROM)/mpfr-$(MPFR_VER).tar.bz2
cd1a2927 136
82b312a9
MT
137$(DL_FILE)_MD5 = 295709feb4441b04e87dea3f1bab4281
138gmp-$(GMP_VER).tar.bz2_MD5 = 041487d25e9c230b0c42b106361055fe
139mpfr-$(MPFR_VER).tar.bz2_MD5 = 89e59fe665e2b3ad44a6789f40b059a0
cd1a2927
MT
140
141install : $(TARGET)
142
143check : $(patsubst %,$(DIR_CHK)/%,$(objects))
144
145download :$(patsubst %,$(DIR_DL)/%,$(objects))
146
147md5 : $(subst %,%_MD5,$(objects))
148
149###############################################################################
150# Downloading, checking, md5sum
151###############################################################################
152
153$(patsubst %,$(DIR_CHK)/%,$(objects)) :
154 @$(CHECK)
155
156$(patsubst %,$(DIR_DL)/%,$(objects)) :
157 @$(LOAD)
158
159$(subst %,%_MD5,$(objects)) :
160 @$(MD5)
161
162###############################################################################
163# Installation Details
164###############################################################################
165
166$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
167 @$(PREBUILD)
168 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
dd714b8a 169 @mkdir $(DIR_SRC)/gcc-build
51f9e7ac 170
ed635824
MT
171 # Apply patches.
172 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-build-id.patch
173 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-c++-builtin-redecl.patch
174 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-i386-libgomp.patch
175 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-libtool-no-rpath.patch
176 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-no-add-needed.patch
177 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-pr33763.patch
178 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh330771.patch
179 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh533181.patch
180 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh610785.patch
181 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-unwind-debug-hook.patch
182
82b312a9
MT
183ifneq "$(ROOT)" ""
184 # Build gmp and mpfr internally in toolchain.
185 cd $(DIR_APP) && tar xfa $(DIR_DL)/gmp-$(GMP_VER).tar.bz2
186 cd $(DIR_APP) && mv -v gmp-$(GMP_VER) gmp
187 cd $(DIR_APP) && tar xfa $(DIR_DL)/mpfr-$(MPFR_VER).tar.bz2
188 cd $(DIR_APP) && mv -v mpfr-$(MPFR_VER) mpfr
189
190ifeq "$(PASS)" "1"
191 # GCC does not detect stack protection correctly, which causes problems
192 # for the build of libresolv_pic.a.
193 cd $(DIR_APP) && sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
194endif
51f9e7ac 195
82b312a9
MT
196ifeq "$(PASS)" "2"
197 cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/gcc-4.4.3-startfiles_fix-1.patch
198
82b312a9
MT
199 for file in $$(find $(DIR_APP)/gcc/config -name linux64.h -o -name linux.h \
200 -o -name sysv4.h -o -name linux-eabi.h -o -name linux-elf.h); do \
201 echo "Processing $${file}..."; \
202 sed -i $${file} \
203 -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
204 -e 's@/usr@/tools@g'; \
205 echo '#undef STANDARD_INCLUDE_DIR' >> $${file}; \
206 echo '#define STANDARD_INCLUDE_DIR 0' >> $${file}; \
207 echo '#define STANDARD_STARTFILE_PREFIX_1 ""' >> $${file}; \
208 echo '#define STANDARD_STARTFILE_PREFIX_2 ""' >> $${file}; \
209 done
210endif
211endif
dd714b8a 212
afbd9856
MT
213 cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in
214 cd $(DIR_APP) && sed -i gcc/Makefile.in \
215 -e 's@\./fixinc\.sh@-c true@' \
216 -e 's/^T_CFLAGS =$$/& -fomit-frame-pointer/'
217
82b312a9
MT
218 # The actual build.
219 cd $(DIR_SRC)/gcc-build && \
220 $(EXTRA_ENV) \
221 $(DIR_APP)/configure \
222 $(EXTRA_CONFIG)
f97be0a6
MT
223 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
224 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
82b312a9 225
afbd9856
MT
226ifeq "$(ROOT)" ""
227 ln -svf ../usr/bin/cpp /lib
6753fbe0 228 ln -svf gcc /usr/bin/cc
afbd9856 229else
82b312a9
MT
230ifeq "$(PASS)" "1"
231 ln -svf libgcc.a $$(/tools/bin/$(CROSSTARGET)-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/')
cd1a2927 232else
82b312a9 233 ln -svf gcc /tools/bin/cc
cd1a2927 234endif
cd1a2927
MT
235endif
236 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build
237 @$(POSTBUILD)