]> git.ipfire.org Git - ipfire-3.x.git/blob - pkgs/gcc/gcc.nm
Merge remote-tracking branch 'maniacikarus/acpid'
[ipfire-3.x.git] / pkgs / gcc / gcc.nm
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
25 include $(PKGROOT)/Include
26
27 PKG_NAME = gcc
28 PKG_VER = 4.6.0
29 PKG_REL = 3
30
31 PKG_MAINTAINER = Michael Tremer <michael.tremer@ipfire.org>
32 PKG_GROUPS = Development/Compilers
33 PKG_URL = http://gcc.gnu.org/
34 PKG_LICENSE = GPLv3+ and GPLv2+ with exceptions
35 PKG_SUMMARY = Various compilers (C, C++, Objective-C, Java, ...).
36
37 define PKG_DESCRIPTION
38 The gcc package contains the GNU Compiler Collection. \
39 You'll need this package in order to compile C code.
40 endef
41
42 BINUTILS_VER = 2.21.51.0.8-1
43
44 PKG_BUILD_DEPS+= autogen binutils>=$(BINUTILS_VER) cloog-devel dejagnu \
45 elfutils-devel expect flex gmp-devel libffi-devel mpc-devel mpfr-devel \
46 ppl-devel=0.10.2-0.ip3 texinfo zlib-devel
47 PKG_DEPS-gcc += binutils>=$(BINUTILS_VER) libgcc-devel cloog>=0.15
48
49 # Make the GCC target platform
50 GCC_TARGET_PLATFORM = $(subst -gnu,,$(DISTRO_MACHINE))
51
52 ifeq "$(DISTRO_ARCH)" "x86_64"
53 CONFIGURE_ARGS = --disable-multilib
54 endif
55
56 ifeq "$(DISTRO_ARCH)" "i686"
57 CONFIGURE_ARGS = --with-arch=$(DISTRO_ARCH) --with-tune=generic
58 endif
59
60 # Modify CFLAGS
61 # Remove -m32 and -m64
62 CFLAGS := $(subst -m32,,$(CFLAGS))
63 CFLAGS := $(subst -m64,,$(CFLAGS))
64 # Remove -march=i686
65 CFLAGS := $(subst -march=i686,,$(CFLAGS))
66
67 HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
68
69 export CFLAGS
70 export CXXFLAGS = $(subst -Wall,,$(CFLAGS))
71
72 PKG_TARBALL += $(THISAPP).tar.gz
73
74 PKG_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
89 # A package for C++
90 PKG_PACKAGES += $(PKG_NAME)-c++
91 PKG_DEPS-$(PKG_NAME)-c++ = gcc libstdc++-devel
92 define PKG_FILES-$(PKG_NAME)-c++
93 /usr/bin/*++
94 /usr/lib/gcc/*/*/cc1plus
95 /usr/share/man/man*/*++*
96 endef
97
98 # libgcc
99 PKG_PACKAGES += libgcc
100 define PKG_FILES-libgcc
101 /lib/libgcc*.so.*
102 endef
103
104 PKG_PACKAGES += libgcc-devel
105 define PKG_FILES-libgcc-devel
106 /usr/lib/libgcc*.so
107 endef
108
109 # libstdc++
110 PKG_PACKAGES += libstdc++
111 define PKG_FILES-libstdc++
112 /usr/lib/libstdc++*.so.*
113 endef
114
115 PKG_PACKAGES += libstdc++-devel
116 define PKG_FILES-libstdc++-devel
117 /usr/include/c++
118 /usr/lib/libstdc++*.so
119 endef
120
121 # libgomp
122 PKG_PACKAGES += libgomp
123 define PKG_FILES-libgomp
124 /usr/lib/libgomp*.so.*
125 endef
126
127 PKG_PACKAGES += libgomp-devel
128 define PKG_FILES-libgomp-devel
129 /usr/lib/libgomp*.so
130 /usr/lib/libgomp.spec
131 endef
132
133 # libmudflap
134 PKG_PACKAGES += libmudflap
135 define PKG_FILES-libmudflap
136 /usr/lib/libmudflap*.so.*
137 endef
138
139 PKG_PACKAGES += libmudflap-devel
140 define PKG_FILES-libmudflap-devel
141 /usr/lib/libmudflap*.so
142 endef
143
144 # libquadmath
145 PKG_PACKAGES += libquadmath
146 define PKG_FILES-libquadmath
147 /usr/lib/libquadmath*.so.*
148 endef
149
150 PKG_PACKAGES += libquadmath-devel
151 define PKG_FILES-libquadmath-devel
152 /usr/lib/libquadmath*.so
153 endef
154
155 define STAGE_PREPARE_CMDS
156 -mkdir -v $(DIR_SRC)/gcc-build
157
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
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
167 # Branding gcc
168 echo "$(DISTRO_NAME) $(PKG_VER)-$(PKG_RELEASE)" > $(DIR_APP)/gcc/DEV-PHASE
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
173
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:
178 cd $(DIR_APP) && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
179
180 cd $(DIR_APP) && sed -i gcc/Makefile.in \
181 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
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 =|"
196 endef
197
198 define STAGE_BUILD
199 cd $(DIR_SRC)/gcc-build && \
200 CFLAGS="$(CFLAGS)" \
201 CXXFLAGS="$(CXXFLAGS)" \
202 XCFLAGS="$(CFLAGS)" \
203 TCFLAGS="$(CFLAGS)" \
204 ../$(THISAPP)/configure \
205 --build=$(GCC_TARGET_PLATFORM) \
206 --prefix=/usr \
207 --libexecdir=/usr/lib \
208 --mandir=/usr/share/man \
209 --enable-esp \
210 --enable-shared \
211 --enable-threads=posix \
212 --enable-__cxa_atexit \
213 --enable-clocale=gnu \
214 --enable-languages=c,c++,lto \
215 --enable-bootstrap \
216 --enable-checking=release \
217 --disable-werror \
218 --disable-libssp \
219 --disable-static \
220 --with-system-zlib \
221 --with-bugurl=http://bugtracker.ipfire.org \
222 --with-ppl \
223 --with-cloog \
224 --disable-libunwind-exceptions \
225 --enable-gnu-unique-object \
226 --enable-linker-build-id \
227 $(CONFIGURE_ARGS)
228
229 cd $(DIR_SRC)/gcc-build && make profiledbootstrap #$(PARALLELISMFLAGS)
230 endef
231
232 #define STAGE_TEST
233 # cd $(DIR_SRC)/gcc-build && make check
234 # cd $(DIR_APP) && ./contrib/test_summary
235 #endef
236
237 define STAGE_INSTALL
238 cd $(DIR_SRC)/gcc-build && make install DESTDIR=$(BUILDROOT)
239
240 -mkdir -pv $(BUILDROOT)/lib
241 ln -sfv ../usr/bin/cpp $(BUILDROOT)/lib/cpp
242 ln -sfv gcc $(BUILDROOT)/usr/bin/cc
243
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
248 # Remove some GNU debugger stuff.
249 rm -vf $(BUILDROOT)/usr/lib/lib*.py
250 endef