1 %define pkgname cross-armv7l-gcc49
2 %define cross_arch armv7l
3 %define gcc_target_arch armv7l-tizen-linux-gnueabi
6 # spec file for package gcc (Version 4.8.2)
8 # Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany.
9 # This file and all modifications and additions to the pristine
10 # package are under the same license as the package itself.
12 # Please submit bugfixes or comments via http://www.suse.de/feedback/
17 %define build_libjava 0
20 %define build_fortran 0
24 %define gcc_target_arch armv7l-tizen-linux-gnueabi
26 %define binutils_target %{cross_arch}
27 %if %{cross_arch} == "armv7l" || %{cross_arch} == "armv7hl"
28 %define binutils_target arm
30 %if %{cross_arch} == "armv6l" || %{cross_arch} == "armv6hl"
31 %define binutils_target arm
33 %if %{cross_arch} == "armv5tel"
34 %define binutils_target arm
36 %define canonical_target %(echo %{binutils_target} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
37 %if %{binutils_target} == "arm"
38 %define canonical_target_abi -gnueabi
41 %if 0%{?gcc_icecream:1}
42 %define build_sysroot /
47 ExclusiveArch: %{ix86} x86_64
48 BuildRequires: cross-%{binutils_target}-binutils
49 BuildRequires: gcc-c++
52 BuildRequires: gettext-devel
53 BuildRequires: glibc-devel-32bit
54 BuildRequires: mpc-devel
55 BuildRequires: mpfr-devel
57 BuildRequires: makeinfo
58 BuildRequires: zlib-devel
59 %ifarch %ix86 x86_64 ppc ppc64 s390 s390x ia64 %sparc hppa %arm
60 BuildRequires: cloog-devel
61 BuildRequires: ppl-devel
64 BuildRequires: libunwind-devel
66 %if 0%{!?gcc_icecream:1}
67 BuildRequires: cross-%cross_arch-glibc-devel
70 %define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
72 URL: http://gcc.gnu.org/
75 %define gcc_dir_version 4.9
76 %define binsuffix -4.9
77 BuildRoot: %{_tmppath}/%{name}-%{version}-build
78 Source: gcc-%{version}.tar.bz2
80 Source3: gcc49-rpmlintrc
82 Source5: baselibs.conf
84 Group: Development/Building
85 Summary: The GNU C Compiler and Support Files
89 Core package for the GNU Compiler Collection, including the C language
92 Language frontends other than C are split to different sub-packages,
93 namely gcc-ada, gcc-c++, gcc-fortran, gcc-java, gcc-objc and
99 # Define the canonical target and host architecture
100 # %gcc_target_arch is supposed to be the full target triple
101 # %TARGET_ARCH is the canonicalized CPU part
102 # %CONFIGURE_TARGET is the target triple used for --target=
103 %if 0%{?gcc_target_arch:1}
104 %define CONFIGURE_TARGET %{gcc_target_arch}
105 %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/;")
106 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
107 %define CONFIGURE_TARGET powerpc64-tizen-linux
109 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc64"
110 %define CONFIGURE_TARGET powerpc64-tizen-linux
112 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
113 %define CONFIGURE_TARGET i586-tizen-linux
115 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "aarch64"
116 %define CONFIGURE_TARGET aarch64-tizen-linux
118 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
119 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
121 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
122 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
124 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5tel"
125 %define CONFIGURE_TARGET armv5tel-tizen-linux-gnueabi
128 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
130 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
132 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
134 %define GCCDIST powerpc64-tizen-linux
137 %define GCCDIST sparc64-tizen-linux
140 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
142 %define GCCDIST %{HOST_ARCH}-tizen-linux
147 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
148 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
152 %setup -q -n gcc-%{version}
154 # We are configuring ppc as ppc64 but with switched multilibs. Adjust
155 # the libstdc++ abi testsuite baseline files accordingly
157 if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
158 mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
159 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt \
160 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64/
161 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt \
162 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/
167 # Avoid rebuilding of generated files
168 contrib/gcc_update --touch
169 # Avoid fucking up testsuite results with Java and indirect dispatch
170 export LD_AS_NEEDED=0
171 # Split version file into version used for directories (X.Y) and
172 # version to report with --version (X.Y.Z).
173 # See also gcc-dir-version.patch.
174 # Also decrement the patchlevel version by one if possible and remove
175 # the 'prerelease' tagging in this case
176 if test `cat gcc/DEV-PHASE` == "prerelease"; then
177 if test `cat gcc/BASE-VER | cut -d '.' -f 3` != "0"; then
180 ( 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
182 mv gcc/BASE-VER gcc/FULL-VER
184 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
186 rm -rf obj-%{GCCDIST}
189 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' -e 's/-fexceptions//' -e 's/\([[:space:]]\+.*-D_FORTIFY_SOURCE=\)[[:alnum:]]\+/\10/g'
190 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D__USE_FORTIFY_LEVEL=0"`
192 # -mcpu is superceded by -mtune but -mtune is not supported by
193 # our bootstrap compiler. -mcpu gives a warning that stops
194 # the build process, so remove it for now. Also remove all other
195 # -march and -mtune flags. They are superseeded by proper
196 # default compiler settings now.
197 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'`
200 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
201 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
203 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
204 # Kill all -march/tune/cpu because that screws building the target libs
205 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
207 # Replace 2 spaces by one finally
208 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
212 languages=$languages,c++
215 languages=$languages,objc
218 languages=$languages,fortran
221 languages=$languages,obj-c++
224 languages=$languages,java
227 languages=$languages,ada
230 languages=$languages,go
234 if test -z "$J"; then
235 J=$(getconf _NPROCESSORS_CONF)
238 test 1 -gt "$J" && J=1
239 JL=$(($(getconf _NPROCESSORS_CONF)*2))
241 if test "$J" == "0"; then
244 if test "$JL" == "0"; then
247 PARALLEL="-j$J -l$JL"
249 # we don't want some miscompiles in the testsuite, or some fault in
250 # the compiler to kill the machine. Hence we limit the amount of memory
251 # by the physical RAM plus half of swap
252 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
253 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
254 #ulimit -v $(((MEM + SWAP/2)*1024))
256 # In general we want to ship release checking enabled compilers
257 # and run BETA with checking enabled.
258 #ENABLE_CHECKING="--enable-checking=yes"
259 ENABLE_CHECKING="--enable-checking=release"
261 # Work around tail/head -1 changes
262 export _POSIX2_VERSION=199209
265 # Using the host gnatmake like
266 # CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
267 # GNATMAKE="gnatmake%{hostsuffix}"
268 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
270 mkdir -p host-tools/bin
271 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
272 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
273 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
274 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
275 ln -sf /usr/%{_lib} host-tools/%{_lib}
276 export PATH="`pwd`/host-tools/bin:$PATH"
278 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
280 # --enable-threads=posix \
283 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
284 # temporary workaround for a miscompilation of hash functions in java code
285 GCJ_EXTRA_FLAGS="-marm"
288 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
289 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS $GCJ_EXTRA_FLAGS" \
291 --prefix=%{_prefix} \
292 --infodir=%{_infodir} \
293 --mandir=%{_mandir} \
294 --libdir=%{_libdir} \
295 --libexecdir=%{_libdir} \
296 --enable-languages=$languages \
298 --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
301 --disable-bootstrap \
302 %if 0%{!?build_libvtv:1}
306 --with-bugurl="http://bugs.tizen.org/" \
307 --with-pkgversion="Tizen" \
308 %if !%{build_fortran}
309 --disable-libquadmath \
311 %if !%{build_libjava}
314 --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
315 --with-ecj-jar=%{libsubdir}/ecj.jar \
317 %if !%{biarch_libjava}
318 --disable-libjava-multilib \
321 --with-slibdir=/%{_lib} \
323 --enable-__cxa_atexit \
324 --enable-libstdcxx-allocator=new \
325 --disable-libstdcxx-pch \
326 --enable-version-specific-runtime-libs \
327 --enable-linker-build-id \
328 --enable-linux-futex \
329 --program-suffix=%{binsuffix} \
330 %if 0%{!?gcc_target_arch:1}
332 --with-system-libunwind \
334 --without-system-libunwind \
337 %if 0%{?gcc_target_arch:1}
338 --program-prefix=%{gcc_target_arch}- \
339 --target=%{gcc_target_arch} \
342 --with-sysroot=%sysroot \
344 --with-sysroot=%{_prefix}/%{gcc_target_arch} \
346 %if 0%{?build_sysroot:1}
347 --with-build-sysroot=%{build_sysroot} \
350 --with-build-sysroot=%{sysroot} \
352 --with-build-sysroot=%{_prefix}/%{gcc_target_arch} \
355 %if 0%{?canonical_target:1}
356 --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
358 %if "%{TARGET_ARCH}" == "spu"
359 --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
363 %if "%{TARGET_ARCH}" == "armv5tel"
364 --with-arch=armv5te \
367 --with-abi=aapcs-linux \
368 --disable-sjlj-exceptions \
370 %if "%{TARGET_ARCH}" == "armv7l"
371 --with-arch=armv7-a \
372 --with-tune=cortex-a8 \
373 --with-float=softfp \
376 --disable-sjlj-exceptions \
378 %if "%{TARGET_ARCH}" == "armv7hl"
379 --with-arch=armv7-a \
380 --with-tune=cortex-a9 \
382 --with-abi=aapcs-linux \
383 --with-fpu=vfpv3-d16 \
384 --disable-sjlj-exceptions \
386 %if "%{TARGET_ARCH}" == "aarch64"
387 --with-arch=armv8-a \
388 --disable-sjlj-exceptions \
390 %if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
391 %if "%{TARGET_ARCH}" == "powerpc"
392 --with-cpu=default32 \
394 %if "%{TARGET_ARCH}" == "powerpc64le"
397 --with-cpu-64=power4 \
400 --with-long-double-128 \
401 %if "%{TARGET_ARCH}" == "powerpc64le"
405 %if "%{TARGET_ARCH}" == "sparc64"
406 --with-cpu=ultrasparc \
407 --with-long-double-128 \
409 %if "%{TARGET_ARCH}" == "sparc"
411 --with-long-double-128 \
413 %if "%{TARGET_ARCH}" == "i586"
414 --with-arch-32=i586 \
415 --with-tune=generic \
417 %if "%{TARGET_ARCH}" == "x86_64"
418 --with-arch-32=i586 \
419 --with-tune=generic \
422 %if "%{TARGET_ARCH}" == "s390"
423 --with-tune=zEC12 --with-arch=z196 \
424 --with-long-double-128 \
425 --enable-decimal-float \
427 %if "%{TARGET_ARCH}" == "s390x"
428 --with-tune=zEC12 --with-arch=z196 \
429 --with-long-double-128 \
430 --enable-decimal-float \
432 %if "%{TARGET_ARCH}" == "m68k"
439 %if 0%{!?gcc_icecream:1}
440 make %{?jobs:-j%jobs}
442 make %{?jobs:-j%jobs} all-host
445 %package -n cross-%cross_arch-gcc49-icecream-backend
446 Summary: Icecream backend for the GNU C Compiler
447 Group: Development/Languages/C and C++
449 %description -n cross-%cross_arch-gcc49-icecream-backend
450 This package contains the icecream environment for the GNU C Compiler
453 %define targetlibsubdir %{_libdir}/gcc/%{gcc_target_arch}/%{gcc_dir_version}
458 # install and fixup host parts
459 make DESTDIR=$RPM_BUILD_ROOT install-host
460 # with the present setup fixincludes are for the build includes which
461 # is wrong - get rid of them
462 rm -rf $RPM_BUILD_ROOT/%{targetlibsubdir}/include-fixed
463 rm -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.la
465 rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
467 # remove docs and disable automated generation
469 %define disable_docs_package 1
471 # install and fixup target parts
472 # ??? don't do this - debugedit is not prepared for this and crashes
473 # so expect the sysroot to be populated from natively built binaries
475 #make DESTDIR=$RPM_BUILD_ROOT/%{sysroot} install-target
477 #make DESTDIR=$RPM_BUILD_ROOT/%{_prefix}/%{gcc_target_arch} install-target
481 # Build an icecream environment
482 # The assembler comes from the cross-binutils, and hence is _not_
483 # named funnily, not even on ppc, so there we need the original target
484 install -s -D %{_prefix}/bin/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}-as $RPM_BUILD_ROOT/env/usr/bin/as
485 install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix} $RPM_BUILD_ROOT/env/usr/bin/g++
486 install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix} $RPM_BUILD_ROOT/env/usr/bin/gcc
488 for back in cc1 cc1plus; do
489 install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/$back $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
491 if test -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so; then
492 install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
495 # Make sure to also pull in all shared library requirements for the
496 # binaries we put into the environment which is operated by chrooting
497 # into it and execing the compiler
498 libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }' ;done | sort -u`
500 # Check wether the same library also exists in the parent directory,
501 # and prefer that on the assumption that it is a more generic one.
502 baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
503 test -f "$baselib" && lib=$baselib
504 install -s -D $lib $RPM_BUILD_ROOT/env$lib
507 cd $RPM_BUILD_ROOT/env
508 %if 0%{?gcc_icecream:1}
509 tar cvzf ../%{name}-icecream-backend_%{_arch}.tar.gz *
511 tar cvzf ../%{name}_%{_arch}.tar.gz *
514 mkdir -p usr/share/icecream-envs
515 %if 0%{?gcc_icecream:1}
516 mv %{name}-icecream-backend_%{_arch}.tar.gz usr/share/icecream-envs
518 mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
520 rpm -q --changelog glibc > usr/share/icecream-envs/%{name}_%{_arch}.glibc
521 rpm -q --changelog binutils > usr/share/icecream-envs/%{name}_%{_arch}.binutils
525 %defattr(-,root,root)
527 %dir %{targetlibsubdir}
528 %dir %{_libdir}/gcc/%{gcc_target_arch}
531 %files -n cross-%cross_arch-gcc49-icecream-backend
532 %defattr(-,root,root)
533 /usr/share/icecream-envs