2 # spec file for package gcc (Version 4.8.2)
4 # Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany.
5 # This file and all modifications and additions to the pristine
6 # package are under the same license as the package itself.
8 # Please submit bugfixes or comments via http://www.suse.de/feedback/
13 %define build_libjava 0
15 %define build_fortran 0
19 %define build_with_mudflap 0
20 %define gcc_target_arch x86_64-tizen-linux
21 %define gcc_icecream 1
23 %define binutils_target x86_64
24 %if %{binutils_target} == "armv7l" || %{binutils_target} == "armv7hl" || %{binutils_target} == "armv7el"
25 %define binutils_target arm
27 %if %{binutils_target} == "armv5el"
28 %define binutils_target arm
30 %define canonical_target %(echo %{binutils_target} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
31 %if %{binutils_target} == "arm"
32 %define canonical_target_abi -gnueabi
35 Name: cross-x86_64-gcc48-icecream-backend
36 BuildRequires: cross-%{binutils_target}-binutils
39 BuildRequires: gettext-devel
40 BuildRequires: glibc-devel-32bit
41 BuildRequires: mpc-devel
42 BuildRequires: mpfr-devel
44 BuildRequires: makeinfo
45 BuildRequires: zlib-devel
46 %ifarch %ix86 x86_64 %arm
47 BuildRequires: cloog-devel
48 BuildRequires: ppl-devel
51 BuildRequires: libunwind-devel
53 ExclusiveArch: ppc ppc64 %ix86 ia64
54 %define _binary_payload w.ufdio
56 %define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
58 URL: http://gcc.gnu.org/
61 %define gcc_dir_version 4.8
62 %define binsuffix -4.8
63 BuildRoot: %{_tmppath}/%{name}-%{version}-build
64 Source: gcc-%{version}.tar.bz2
66 Source3: gcc48-rpmlintrc
68 Source6: baselibs.conf
69 Source1001: gcc.manifest
72 Group: Development/Toolchain
73 Summary: The GNU C Compiler and Support Files
77 Core package for the GNU Compiler Collection, including the C language
80 Language frontends other than C are split to different sub-packages,
81 namely gcc-ada, gcc-c++, gcc-fortran, gcc-java, gcc-objc and
87 # Define the canonical target and host architecture
88 # %gcc_target_arch is supposed to be the full target triple
89 # %TARGET_ARCH is the canonicalized CPU part
90 # %CONFIGURE_TARGET is the target triple used for --target=
91 %if 0%{?gcc_target_arch:1}
92 %define CONFIGURE_TARGET %{gcc_target_arch}
93 %define TARGET_ARCH %(echo %{gcc_target_arch} | cut -d - -f 1 | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
94 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
95 %define CONFIGURE_TARGET powerpc64-tizen-linux
97 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc64"
98 %define CONFIGURE_TARGET powerpc64-tizen-linux
100 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
101 %define CONFIGURE_TARGET i586-tizen-linux
103 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
104 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
106 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
107 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
109 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5tel"
110 %define CONFIGURE_TARGET armv5tel-tizen-linux-gnueabi
113 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
115 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
117 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
120 %define GCCDIST powerpc64-tizen-linux
123 %define GCCDIST sparc64-tizen-linux
126 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
128 %define GCCDIST %{HOST_ARCH}-tizen-linux
133 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
134 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
138 %setup -q -n gcc-%{version}
142 # We are configuring ppc as ppc64 but with switched multilibs. Adjust
143 # the libstdc++ abi testsuite baseline files accordingly
145 if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
146 mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
147 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt \
148 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64/
149 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt \
150 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/
155 # Avoid rebuilding of generated files
156 contrib/gcc_update --touch
157 # Avoid fucking up testsuite results with Java and indirect dispatch
158 export LD_AS_NEEDED=0
159 # Split version file into version used for directories (X.Y) and
160 # version to report with --version (X.Y.Z).
161 # See also gcc-dir-version.patch.
162 # Also decrement the patchlevel version by one
163 if test `cat gcc/DEV-PHASE` == "prerelease"; then
164 ( cat gcc/BASE-VER | cut -d '.' -f 1-2 | tr -d '\n'; echo -n .; cat gcc/BASE-VER | cut -d '.' -f 3 | tr '0123456789' '0012345678' ) > gcc/FULL-VER
166 mv gcc/BASE-VER gcc/FULL-VER
168 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
170 rm -rf obj-%{GCCDIST}
173 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
174 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
176 # -mcpu is superceded by -mtune but -mtune is not supported by
177 # our bootstrap compiler. -mcpu gives a warning that stops
178 # the build process, so remove it for now. Also remove all other
179 # -march and -mtune flags. They are superseeded by proper
180 # default compiler settings now.
181 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
184 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
185 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
187 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
188 # Kill all -march/tune/cpu because that screws building the target libs
189 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
191 # Replace 2 spaces by one finally
192 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
196 languages=$languages,c++
199 languages=$languages,objc
202 languages=$languages,fortran
205 languages=$languages,obj-c++
208 languages=$languages,java
211 languages=$languages,ada
215 if test -z "$J"; then
216 J=$(getconf _NPROCESSORS_CONF)
219 test 1 -gt "$J" && J=1
220 JL=$(($(getconf _NPROCESSORS_CONF)*2))
222 if test "$J" == "0"; then
225 if test "$JL" == "0"; then
228 PARALLEL="-j$J -l$JL"
230 # we don't want some miscompiles in the testsuite, or some fault in
231 # the compiler to kill the machine. Hence we limit the amount of memory
232 # by the physical RAM plus half of swap
233 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
234 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
235 #ulimit -v $(((MEM + SWAP/2)*1024))
237 # In general we want to ship release checking enabled compilers
238 # and run BETA with checking enabled.
239 #ENABLE_CHECKING="--enable-checking=yes"
240 ENABLE_CHECKING="--enable-checking=release"
242 # Work around tail/head -1 changes
243 export _POSIX2_VERSION=199209
245 # configure tries to parse include/features.h to detect
246 # if glibc supports SSP. When cross compiling we would need
247 # to install a cross glibc, which we don't, or make the whole
248 # thing point to the native glibc, which is in /, hence the
249 # --with-build-sysroot=/
252 # Using the host gnatmake like
253 # CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
254 # GNATMAKE="gnatmake%{hostsuffix}"
255 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
257 mkdir -p host-tools/bin
258 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
259 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
260 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
261 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
262 ln -sf /usr/%{_lib} host-tools/%{_lib}
263 export PATH="`pwd`/host-tools/bin:$PATH"
265 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
267 # --enable-threads=posix \
270 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
271 # temporary workaround for a miscompilation of hash functions in java code
272 GCJ_EXTRA_FLAGS="-marm"
274 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
275 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS $GCJ_EXTRA_FLAGS" \
277 --prefix=%{_prefix} \
278 --infodir=%{_infodir} \
279 --mandir=%{_mandir} \
280 --libdir=%{_libdir} \
281 --libexecdir=%{_libdir} \
282 --disable-bootstrap \
283 --enable-languages=$languages \
285 --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
289 --with-bugurl="http://bugs.tizen.org/" \
290 --with-pkgversion="Tizen" \
291 %if !%{build_fortran}
292 --disable-libquadmath \
294 %if !%{build_libjava}
297 --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
298 --with-ecj-jar=%{libsubdir}/ecj.jar \
300 %if !%{biarch_libjava}
301 --disable-libjava-multilib \
304 %if !%{build_with_mudflap}
305 --disable-libmudflap \
307 --with-slibdir=/%{_lib} \
309 --enable-__cxa_atexit \
310 --enable-libstdcxx-allocator=new \
311 --disable-libstdcxx-pch \
312 --enable-version-specific-runtime-libs \
313 --enable-linker-build-id \
314 %if 0%{?gcc_target_arch:1}
315 %if 0%{?gcc_icecream:1}
317 --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/include/c++/%{gcc_dir_version} \
318 --enable-linux-futex \
320 %if 0%{?canonical_target:1}
321 --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
324 --with-sysroot=%sysroot \
326 %if 0%{?build_static:1}
329 %if "%{TARGET_ARCH}" == "spu"
330 --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
334 --target=%{CONFIGURE_TARGET} \
336 --program-suffix=%{binsuffix} \
337 --enable-linux-futex \
339 --with-system-libunwind \
341 --without-system-libunwind \
344 %if "%{TARGET_ARCH}" == "armv5tel"
345 --with-arch=armv5te \
348 --with-abi=aapcs-linux \
349 --disable-sjlj-exceptions \
351 %if "%{TARGET_ARCH}" == "armv7l"
352 --with-arch=armv7-a \
353 --with-tune=cortex-a8 \
354 --with-float=softfp \
357 --disable-sjlj-exceptions \
359 %if "%{TARGET_ARCH}" == "armv7hl"
360 --with-arch=armv7-a \
361 --with-tune=cortex-a9 \
363 --with-abi=aapcs-linux \
364 --with-fpu=vfpv3-d16 \
365 --disable-sjlj-exceptions \
367 %if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
368 %if "%{TARGET_ARCH}" == "powerpc"
369 --with-cpu=default32 \
371 --with-cpu-64=power4 \
373 --with-long-double-128 \
375 %if "%{TARGET_ARCH}" == "sparc64"
376 --with-cpu=ultrasparc \
377 --with-long-double-128 \
379 %if "%{TARGET_ARCH}" == "sparc"
381 --with-long-double-128 \
383 %if "%{TARGET_ARCH}" == "i586"
384 --with-arch-32=i586 \
385 --with-tune=generic \
387 %if "%{TARGET_ARCH}" == "x86_64"
388 --with-arch-32=i586 \
389 --with-tune=generic \
391 %if "%{TARGET_ARCH}" == "s390"
392 --with-tune=z196 --with-arch=z10 \
393 --with-long-double-128 \
394 --enable-decimal-float \
396 %if "%{TARGET_ARCH}" == "s390x"
397 --with-tune=z196 --with-arch=z10 \
398 --with-long-double-128 \
399 --enable-decimal-float \
404 make %{?jobs:-j%jobs} all-gcc TARGET-gcc="cc1 cc1plus collect2 gcc-cross xg++ native"
408 rm -rf $RPM_BUILD_ROOT
409 make -C gcc DESTDIR=$RPM_BUILD_ROOT/inst install-driver install-common
410 make DESTDIR=$RPM_BUILD_ROOT/inst maybe-install-lto-plugin
412 # But the assembler comes from the cross-binutils, and hence is _not_
413 # named funnily, not even on ppc, so there we need the original target
414 install -s -D %{_prefix}/bin/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}-as \
415 $RPM_BUILD_ROOT/env/usr/bin/as
416 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-g++ \
417 $RPM_BUILD_ROOT/env/usr/bin/g++
418 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-gcc \
419 $RPM_BUILD_ROOT/env/usr/bin/gcc
421 %define targetlibsubdir %{_libdir}/gcc/%{CONFIGURE_TARGET}/%{gcc_dir_version}
422 for back in cc1 cc1plus collect2; do
423 install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/$back \
424 $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
426 if test -f $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so; then
427 install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so \
428 $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
431 libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do \
432 ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }' ;\
435 # Check wether the same library also exists in the parent directory,
436 # and prefer that on the assumption that it is a more generic one.
437 baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
438 test -f "$baselib" && lib=$baselib
439 install -s -D $lib $RPM_BUILD_ROOT/env$lib
441 rm -rf $RPM_BUILD_ROOT/inst
442 cd $RPM_BUILD_ROOT/env
443 tar cvzf ../%{name}_%{_arch}.tar.gz *
445 mkdir -p usr/share/icecream-envs
446 mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
447 rpm -q --changelog glibc > usr/share/icecream-envs/%{name}_%{_arch}.glibc
448 rpm -q --changelog binutils > usr/share/icecream-envs/%{name}_%{_arch}.binutils
453 rm -rf $RPM_BUILD_ROOT
456 %defattr(-,root,root)
457 /usr/share/icecream-envs
459 %changelog -n cross-x86_64-gcc48-icecream-backend