]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/blame - pkgs/gcc/gcc.nm
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x
[people/stevee/ipfire-3.x.git] / pkgs / gcc / gcc.nm
CommitLineData
166a6c21
MT
1###############################################################################
2# #
3# IPFire.org - A linux based firewall #
4# Copyright (C) 2007, 2008, 2009 Michael Tremer & Christian Schmidt #
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
a7c97434 25include $(PKGROOT)/Include
166a6c21
MT
26
27PKG_NAME = gcc
b147bdbc 28PKG_VER = 4.6.1
e1102ce9 29PKG_REL = 2
166a6c21
MT
30
31PKG_MAINTAINER = Michael Tremer <michael.tremer@ipfire.org>
bb7d617c 32PKG_GROUPS = Development/Compilers
166a6c21
MT
33PKG_URL = http://gcc.gnu.org/
34PKG_LICENSE = GPLv3+ and GPLv2+ with exceptions
35PKG_SUMMARY = Various compilers (C, C++, Objective-C, Java, ...).
36
37define PKG_DESCRIPTION
38 The gcc package contains the GNU Compiler Collection. \
39 You'll need this package in order to compile C code.
40endef
41
05c35d87
MT
42BINUTILS_VER = 2.21.51.0.8-1
43
e1102ce9
MT
44PKG_BUILD_DEPS+= autogen binutils>=$(BINUTILS_VER) cloog-ppl-devel dejagnu \
45 elfutils-devel expect flex gmp-devel libffi-devel libmpc-devel mpfr-devel \
c0b61a27 46 ppl-devel texinfo zlib-devel
e1102ce9 47PKG_DEPS-gcc += binutils>=$(BINUTILS_VER) libgcc-devel cloog-ppl>=0.15
166a6c21 48
e370ba51
MT
49# Make the GCC target platform
50GCC_TARGET_PLATFORM = $(subst -gnu,,$(DISTRO_MACHINE))
51
ea08336e
MT
52ifeq "$(DISTRO_ARCH)" "x86_64"
53 CONFIGURE_ARGS = --disable-multilib
166a6c21
MT
54endif
55
ea08336e
MT
56ifeq "$(DISTRO_ARCH)" "i686"
57 CONFIGURE_ARGS = --with-arch=$(DISTRO_ARCH) --with-tune=generic
166a6c21
MT
58endif
59
ea08336e
MT
60# Modify CFLAGS
61# Remove -m32 and -m64
62CFLAGS := $(subst -m32,,$(CFLAGS))
63CFLAGS := $(subst -m64,,$(CFLAGS))
64# Remove -march=i686
65CFLAGS := $(subst -march=i686,,$(CFLAGS))
66
05c35d87
MT
67HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
68
ea08336e
MT
69export CFLAGS
70export CXXFLAGS = $(subst -Wall,,$(CFLAGS))
71
1fdf0857 72PKG_TARBALL += $(THISAPP).tar.gz
166a6c21 73
3c926509
MT
74PKG_PATCHES = \
75 gcc46-hack.patch0 \
76 gcc46-c++-builtin-redecl.patch0 \
77 gcc46-pr33763.patch0 \
78 gcc46-libgomp-omp_h-multilib.patch0 \
79 gcc46-libtool-no-rpath.patch0 \
80 gcc46-cloog-dl.patch0 \
81 gcc46-pr38757.patch0 \
82 gcc46-no-add-needed.patch0 \
83 gcc46-unwind-debughook-sdt.patch0 \
84 gcc46-ppl-0.10.patch \
85 gcc46-Woverlength-string.patch0 \
86 gcc46-Woverlength-string-asm.patch0 \
87 gcc-4.6.0-piepatches-20110407.patch
88
819979f7
MT
89# A package for C++
90PKG_PACKAGES += $(PKG_NAME)-c++
91PKG_DEPS-$(PKG_NAME)-c++ = gcc libstdc++-devel
92define PKG_FILES-$(PKG_NAME)-c++
93 /usr/bin/*++
94 /usr/lib/gcc/*/*/cc1plus
95 /usr/share/man/man*/*++*
96endef
97
98# libgcc
99PKG_PACKAGES += libgcc
100define PKG_FILES-libgcc
4ea2e3d9 101 /lib/libgcc*.so.*
819979f7
MT
102endef
103
104PKG_PACKAGES += libgcc-devel
105define PKG_FILES-libgcc-devel
106 /usr/lib/libgcc*.so
107endef
108
109# libstdc++
110PKG_PACKAGES += libstdc++
111define PKG_FILES-libstdc++
112 /usr/lib/libstdc++*.so.*
113endef
114
115PKG_PACKAGES += libstdc++-devel
116define PKG_FILES-libstdc++-devel
117 /usr/include/c++
118 /usr/lib/libstdc++*.so
119endef
120
5146efdc
MT
121# libgomp
122PKG_PACKAGES += libgomp
123define PKG_FILES-libgomp
124 /usr/lib/libgomp*.so.*
125endef
126
127PKG_PACKAGES += libgomp-devel
128define PKG_FILES-libgomp-devel
129 /usr/lib/libgomp*.so
b7eab83e 130 /usr/lib/libgomp.spec
5146efdc
MT
131endef
132
133# libmudflap
134PKG_PACKAGES += libmudflap
135define PKG_FILES-libmudflap
136 /usr/lib/libmudflap*.so.*
137endef
138
139PKG_PACKAGES += libmudflap-devel
140define PKG_FILES-libmudflap-devel
141 /usr/lib/libmudflap*.so
142endef
166a6c21 143
b7eab83e
MT
144# libquadmath
145PKG_PACKAGES += libquadmath
146define PKG_FILES-libquadmath
147 /usr/lib/libquadmath*.so.*
148endef
149
150PKG_PACKAGES += libquadmath-devel
151define PKG_FILES-libquadmath-devel
152 /usr/lib/libquadmath*.so
153endef
154
17c0ee8a 155define STAGE_PREPARE_CMDS
166a6c21
MT
156 -mkdir -v $(DIR_SRC)/gcc-build
157
166a6c21
MT
158 # Remove unneeded features that will save some compile time
159 rm -rf $(DIR_APP)/lib{gfortran,java,objc} \
160 $(DIR_APP)/gcc/{fortran,java,objc,objcp}
161
0ba3cc3e
MT
162 # Apply a sed substitution that will suppress the installation of
163 # libiberty.a. The version of libiberty.a provided by Binutils will be used
164 # instead:
165 cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in
166
166a6c21 167 # Branding gcc
3c926509 168 echo "$(DISTRO_NAME) $(PKG_VER)-$(PKG_RELEASE)" > $(DIR_APP)/gcc/DEV-PHASE
166a6c21
MT
169
170 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
171 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
172 cd $(DIR_APP) && sed -e "s/-Werror//" -i libgomp/configure
0ba3cc3e 173
0ba3cc3e
MT
174 # The fixincludes script is known to occasionally erroneously attempt to
175 # "fix" the system headers installed so far. As the headers up to this point
176 # are known to not require fixing, issue the following command to prevent
177 # the fixincludes script from running:
166a6c21 178 cd $(DIR_APP) && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
ea08336e
MT
179
180 cd $(DIR_APP) && sed -i gcc/Makefile.in \
181 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
05c35d87
MT
182
183 # we want to be able to control the pie patch logic via something other
184 # than ALL_CFLAGS...
185 cd $(DIR_APP) && sed -i gcc/Makefile.in \
186 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
187 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $$(HARD_CFLAGS) |'
188
189 # Enable the GCC hardening by default.
190 cd $(DIR_APP) && sed -i gcc/Makefile.in \
191 -e "s|^HARD_CFLAGS = |HARD_CFLAGS = $(HARD_CFLAGS) |"
192
193 # Compile the compile with -fPIC as well.
194 cd $(DIR_APP) && sed -i gcc/Makefile.in \
195 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|"
17c0ee8a 196endef
166a6c21 197
17c0ee8a 198define STAGE_BUILD
166a6c21 199 cd $(DIR_SRC)/gcc-build && \
ea08336e
MT
200 CFLAGS="$(CFLAGS)" \
201 CXXFLAGS="$(CXXFLAGS)" \
f23b0b6e
MT
202 XCFLAGS="$(CFLAGS)" \
203 TCFLAGS="$(CFLAGS)" \
166a6c21 204 ../$(THISAPP)/configure \
e370ba51 205 --build=$(GCC_TARGET_PLATFORM) \
166a6c21
MT
206 --prefix=/usr \
207 --libexecdir=/usr/lib \
107ed6ee 208 --mandir=/usr/share/man \
b8b873e7 209 --enable-esp \
166a6c21
MT
210 --enable-shared \
211 --enable-threads=posix \
212 --enable-__cxa_atexit \
213 --enable-clocale=gnu \
f23b0b6e
MT
214 --enable-languages=c,c++,lto \
215 --enable-bootstrap \
216 --enable-checking=release \
166a6c21
MT
217 --disable-werror \
218 --disable-libssp \
219 --disable-static \
f23b0b6e
MT
220 --with-system-zlib \
221 --with-bugurl=http://bugtracker.ipfire.org \
3c926509
MT
222 --with-ppl \
223 --with-cloog \
b415c6aa
MT
224 --disable-libunwind-exceptions \
225 --enable-gnu-unique-object \
226 --enable-linker-build-id \
166a6c21
MT
227 $(CONFIGURE_ARGS)
228
05c35d87 229 cd $(DIR_SRC)/gcc-build && make profiledbootstrap #$(PARALLELISMFLAGS)
17c0ee8a 230endef
166a6c21 231
0ba3cc3e 232#define STAGE_TEST
cd5b2d3e 233# cd $(DIR_SRC)/gcc-build && make check
0ba3cc3e
MT
234# cd $(DIR_APP) && ./contrib/test_summary
235#endef
236
17c0ee8a 237define STAGE_INSTALL
166a6c21
MT
238 cd $(DIR_SRC)/gcc-build && make install DESTDIR=$(BUILDROOT)
239
1a9fda21
MT
240 -mkdir -pv $(BUILDROOT)/lib
241 ln -sfv ../usr/bin/cpp $(BUILDROOT)/lib/cpp
166a6c21 242 ln -sfv gcc $(BUILDROOT)/usr/bin/cc
53b9464e 243
4ea2e3d9
MT
244 # Move libgcc_s to /lib
245 mv -vf $(BUILDROOT)/usr/lib/libgcc_s.so.1 $(BUILDROOT)/lib/
246 ln -svf ../../lib/libgcc_s.so.1 $(BUILDROOT)/usr/lib/libgcc_s.so
247
53b9464e
MT
248 # Remove some GNU debugger stuff.
249 rm -vf $(BUILDROOT)/usr/lib/lib*.py
17c0ee8a 250endef