]>
Commit | Line | Data |
---|---|---|
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 | 25 | include $(PKGROOT)/Include |
166a6c21 MT |
26 | |
27 | PKG_NAME = gcc | |
e1e6f5c8 | 28 | PKG_VER = 4.5.2 |
b415c6aa | 29 | PKG_REL = 7 |
166a6c21 MT |
30 | |
31 | PKG_MAINTAINER = Michael Tremer <michael.tremer@ipfire.org> | |
bb7d617c | 32 | PKG_GROUPS = Development/Compilers |
166a6c21 MT |
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 | ||
819979f7 | 42 | PKG_BUILD_DEPS+= autogen cloog-devel dejagnu elfutils-devel expect gmp-devel \ |
ea08336e | 43 | libffi-devel mpc-devel mpfr-devel pkg-config ppl-devel texinfo zlib-devel |
819979f7 | 44 | PKG_DEPS-gcc += binutils libgcc-devel |
166a6c21 | 45 | |
e370ba51 MT |
46 | # Make the GCC target platform |
47 | GCC_TARGET_PLATFORM = $(subst -gnu,,$(DISTRO_MACHINE)) | |
48 | ||
ea08336e MT |
49 | ifeq "$(DISTRO_ARCH)" "x86_64" |
50 | CONFIGURE_ARGS = --disable-multilib | |
166a6c21 MT |
51 | endif |
52 | ||
ea08336e MT |
53 | ifeq "$(DISTRO_ARCH)" "i686" |
54 | CONFIGURE_ARGS = --with-arch=$(DISTRO_ARCH) --with-tune=generic | |
166a6c21 MT |
55 | endif |
56 | ||
ea08336e MT |
57 | # Modify CFLAGS |
58 | # Remove -m32 and -m64 | |
59 | CFLAGS := $(subst -m32,,$(CFLAGS)) | |
60 | CFLAGS := $(subst -m64,,$(CFLAGS)) | |
61 | # Remove -march=i686 | |
62 | CFLAGS := $(subst -march=i686,,$(CFLAGS)) | |
63 | ||
64 | export CFLAGS | |
65 | export CXXFLAGS = $(subst -Wall,,$(CFLAGS)) | |
66 | ||
1fdf0857 | 67 | PKG_TARBALL += $(THISAPP).tar.gz |
166a6c21 | 68 | |
819979f7 MT |
69 | # A package for C++ |
70 | PKG_PACKAGES += $(PKG_NAME)-c++ | |
71 | PKG_DEPS-$(PKG_NAME)-c++ = gcc libstdc++-devel | |
72 | define PKG_FILES-$(PKG_NAME)-c++ | |
73 | /usr/bin/*++ | |
74 | /usr/lib/gcc/*/*/cc1plus | |
75 | /usr/share/man/man*/*++* | |
76 | endef | |
77 | ||
78 | # libgcc | |
79 | PKG_PACKAGES += libgcc | |
80 | define PKG_FILES-libgcc | |
4ea2e3d9 | 81 | /lib/libgcc*.so.* |
819979f7 MT |
82 | endef |
83 | ||
84 | PKG_PACKAGES += libgcc-devel | |
85 | define PKG_FILES-libgcc-devel | |
86 | /usr/lib/libgcc*.so | |
87 | endef | |
88 | ||
89 | # libstdc++ | |
90 | PKG_PACKAGES += libstdc++ | |
91 | define PKG_FILES-libstdc++ | |
92 | /usr/lib/libstdc++*.so.* | |
93 | endef | |
94 | ||
95 | PKG_PACKAGES += libstdc++-devel | |
96 | define PKG_FILES-libstdc++-devel | |
97 | /usr/include/c++ | |
98 | /usr/lib/libstdc++*.so | |
99 | endef | |
100 | ||
5146efdc MT |
101 | # libgomp |
102 | PKG_PACKAGES += libgomp | |
103 | define PKG_FILES-libgomp | |
104 | /usr/lib/libgomp*.so.* | |
105 | endef | |
106 | ||
107 | PKG_PACKAGES += libgomp-devel | |
108 | define PKG_FILES-libgomp-devel | |
109 | /usr/lib/libgomp*.so | |
110 | endef | |
111 | ||
112 | # libmudflap | |
113 | PKG_PACKAGES += libmudflap | |
114 | define PKG_FILES-libmudflap | |
115 | /usr/lib/libmudflap*.so.* | |
116 | endef | |
117 | ||
118 | PKG_PACKAGES += libmudflap-devel | |
119 | define PKG_FILES-libmudflap-devel | |
120 | /usr/lib/libmudflap*.so | |
121 | endef | |
166a6c21 | 122 | |
17c0ee8a | 123 | define STAGE_PREPARE_CMDS |
166a6c21 MT |
124 | -mkdir -v $(DIR_SRC)/gcc-build |
125 | ||
166a6c21 MT |
126 | # Remove unneeded features that will save some compile time |
127 | rm -rf $(DIR_APP)/lib{gfortran,java,objc} \ | |
128 | $(DIR_APP)/gcc/{fortran,java,objc,objcp} | |
129 | ||
0ba3cc3e MT |
130 | # Apply a sed substitution that will suppress the installation of |
131 | # libiberty.a. The version of libiberty.a provided by Binutils will be used | |
132 | # instead: | |
133 | cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in | |
134 | ||
166a6c21 | 135 | # Branding gcc |
17c0ee8a | 136 | cd $(DIR_APP) && sed -e "s:PKGVERSION:\"(GCC for $(DISTRO_NAME)-$(DISTRO_VERSION)) \":" \ |
166a6c21 MT |
137 | -i gcc/version.c |
138 | ||
139 | # Libgomp uses -Werror regardless of --disable-werror, and this will cause a | |
140 | # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings: | |
141 | cd $(DIR_APP) && sed -e "s/-Werror//" -i libgomp/configure | |
0ba3cc3e MT |
142 | |
143 | # Apply the following sed to force the build to use the -fomit-frame-pointer | |
144 | # compiler flag in order to ensure consistent compiler builds: | |
145 | cd $(DIR_APP) && sed -i 's/^T_CFLAGS =$$/& -fomit-frame-pointer/' gcc/Makefile.in | |
146 | ||
147 | # The fixincludes script is known to occasionally erroneously attempt to | |
148 | # "fix" the system headers installed so far. As the headers up to this point | |
149 | # are known to not require fixing, issue the following command to prevent | |
150 | # the fixincludes script from running: | |
166a6c21 | 151 | cd $(DIR_APP) && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in |
ea08336e MT |
152 | |
153 | cd $(DIR_APP) && sed -i gcc/Makefile.in \ | |
154 | -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/" | |
17c0ee8a | 155 | endef |
166a6c21 | 156 | |
17c0ee8a | 157 | define STAGE_BUILD |
166a6c21 | 158 | cd $(DIR_SRC)/gcc-build && \ |
ea08336e MT |
159 | CFLAGS="$(CFLAGS)" \ |
160 | CXXFLAGS="$(CXXFLAGS)" \ | |
f23b0b6e MT |
161 | XCFLAGS="$(CFLAGS)" \ |
162 | TCFLAGS="$(CFLAGS)" \ | |
166a6c21 | 163 | ../$(THISAPP)/configure \ |
e370ba51 | 164 | --build=$(GCC_TARGET_PLATFORM) \ |
166a6c21 MT |
165 | --prefix=/usr \ |
166 | --libexecdir=/usr/lib \ | |
107ed6ee | 167 | --mandir=/usr/share/man \ |
b8b873e7 | 168 | --enable-esp \ |
166a6c21 MT |
169 | --enable-shared \ |
170 | --enable-threads=posix \ | |
171 | --enable-__cxa_atexit \ | |
172 | --enable-clocale=gnu \ | |
f23b0b6e MT |
173 | --enable-languages=c,c++,lto \ |
174 | --enable-bootstrap \ | |
175 | --enable-checking=release \ | |
166a6c21 MT |
176 | --disable-werror \ |
177 | --disable-libssp \ | |
178 | --disable-static \ | |
f23b0b6e MT |
179 | --with-system-zlib \ |
180 | --with-bugurl=http://bugtracker.ipfire.org \ | |
b415c6aa MT |
181 | --disable-libunwind-exceptions \ |
182 | --enable-gnu-unique-object \ | |
183 | --enable-linker-build-id \ | |
166a6c21 MT |
184 | $(CONFIGURE_ARGS) |
185 | ||
186 | cd $(DIR_SRC)/gcc-build && make $(PARALLELISMFLAGS) | |
17c0ee8a | 187 | endef |
166a6c21 | 188 | |
0ba3cc3e | 189 | #define STAGE_TEST |
cd5b2d3e | 190 | # cd $(DIR_SRC)/gcc-build && make check |
0ba3cc3e MT |
191 | # cd $(DIR_APP) && ./contrib/test_summary |
192 | #endef | |
193 | ||
17c0ee8a | 194 | define STAGE_INSTALL |
166a6c21 MT |
195 | cd $(DIR_SRC)/gcc-build && make install DESTDIR=$(BUILDROOT) |
196 | ||
1a9fda21 MT |
197 | -mkdir -pv $(BUILDROOT)/lib |
198 | ln -sfv ../usr/bin/cpp $(BUILDROOT)/lib/cpp | |
166a6c21 | 199 | ln -sfv gcc $(BUILDROOT)/usr/bin/cc |
53b9464e | 200 | |
4ea2e3d9 MT |
201 | # Move libgcc_s to /lib |
202 | mv -vf $(BUILDROOT)/usr/lib/libgcc_s.so.1 $(BUILDROOT)/lib/ | |
203 | ln -svf ../../lib/libgcc_s.so.1 $(BUILDROOT)/usr/lib/libgcc_s.so | |
204 | ||
53b9464e MT |
205 | # Remove some GNU debugger stuff. |
206 | rm -vf $(BUILDROOT)/usr/lib/lib*.py | |
17c0ee8a | 207 | endef |