1 %define pkgname cross-armv7hl-gcc49
2 %define cross_arch armv7hl
3 %define gcc_target_arch armv7hl-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 armv7hl-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 Requires(post): update-alternatives
71 Requires(postun): update-alternatives
73 %define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
75 URL: http://gcc.gnu.org/
78 %define gcc_dir_version 4.9
79 %define binsuffix -4.9
80 BuildRoot: %{_tmppath}/%{name}-%{version}-build
81 Source: gcc-%{version}.tar.bz2
83 Source3: gcc49-rpmlintrc
85 Source5: baselibs.conf
87 Group: Development/Building
88 Summary: The GNU C Compiler and Support Files
92 Core package for the GNU Compiler Collection, including the C language
95 Language frontends other than C are split to different sub-packages,
96 namely gcc-ada, gcc-c++, gcc-fortran, gcc-java, gcc-objc and
102 # Define the canonical target and host architecture
103 # %gcc_target_arch is supposed to be the full target triple
104 # %TARGET_ARCH is the canonicalized CPU part
105 # %CONFIGURE_TARGET is the target triple used for --target=
106 %if 0%{?gcc_target_arch:1}
107 %define CONFIGURE_TARGET %{gcc_target_arch}
108 %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/;")
109 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
110 %define CONFIGURE_TARGET powerpc64-tizen-linux
112 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc64"
113 %define CONFIGURE_TARGET powerpc64-tizen-linux
115 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
116 %define CONFIGURE_TARGET i586-tizen-linux
118 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "aarch64"
119 %define CONFIGURE_TARGET aarch64-tizen-linux
121 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
122 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
124 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
125 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
127 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5tel"
128 %define CONFIGURE_TARGET armv5tel-tizen-linux-gnueabi
131 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
133 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
135 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
137 %define GCCDIST powerpc64-tizen-linux
140 %define GCCDIST sparc64-tizen-linux
143 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
145 %define GCCDIST %{HOST_ARCH}-tizen-linux
150 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
151 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
153 %define bfd_plugin_dir %{_bindir}/../lib/bfd-plugins
154 %define bfd_plugin_lto_name liblto_plugin_%{_arch}.so
155 %define bfd_plugin_lto %{bfd_plugin_dir}/%{bfd_plugin_lto_name}
156 %if 0%{?cross_arch:1}
157 %define gcc_plugin_lto %{targetlibsubdir}/liblto_plugin.so
159 %define gcc_plugin_lto %{libsubdir}/liblto_plugin.so
164 %setup -q -n gcc-%{version}
166 # We are configuring ppc as ppc64 but with switched multilibs. Adjust
167 # the libstdc++ abi testsuite baseline files accordingly
169 if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
170 mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
171 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt \
172 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64/
173 mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt \
174 libstdc++-v3/config/abi/post/powerpc64-linux-gnu/
179 # Avoid rebuilding of generated files
180 contrib/gcc_update --touch
181 # Avoid fucking up testsuite results with Java and indirect dispatch
182 export LD_AS_NEEDED=0
183 # Split version file into version used for directories (X.Y) and
184 # version to report with --version (X.Y.Z).
185 # See also gcc-dir-version.patch.
186 # Also decrement the patchlevel version by one if possible and remove
187 # the 'prerelease' tagging in this case
188 if test `cat gcc/DEV-PHASE` == "prerelease"; then
189 if test `cat gcc/BASE-VER | cut -d '.' -f 3` != "0"; then
192 ( 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
194 mv gcc/BASE-VER gcc/FULL-VER
196 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
198 rm -rf obj-%{GCCDIST}
201 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'
202 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D__USE_FORTIFY_LEVEL=0"`
204 # -mcpu is superceded by -mtune but -mtune is not supported by
205 # our bootstrap compiler. -mcpu gives a warning that stops
206 # the build process, so remove it for now. Also remove all other
207 # -march and -mtune flags. They are superseeded by proper
208 # default compiler settings now.
209 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'`
212 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
213 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
215 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
216 # Kill all -march/tune/cpu because that screws building the target libs
217 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
219 # Replace 2 spaces by one finally
220 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
224 languages=$languages,c++
227 languages=$languages,objc
230 languages=$languages,fortran
233 languages=$languages,obj-c++
236 languages=$languages,java
239 languages=$languages,ada
242 languages=$languages,go
246 if test -z "$J"; then
247 J=$(getconf _NPROCESSORS_CONF)
250 test 1 -gt "$J" && J=1
251 JL=$(($(getconf _NPROCESSORS_CONF)*2))
253 if test "$J" == "0"; then
256 if test "$JL" == "0"; then
259 PARALLEL="-j$J -l$JL"
261 # we don't want some miscompiles in the testsuite, or some fault in
262 # the compiler to kill the machine. Hence we limit the amount of memory
263 # by the physical RAM plus half of swap
264 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
265 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
266 #ulimit -v $(((MEM + SWAP/2)*1024))
268 # In general we want to ship release checking enabled compilers
269 # and run BETA with checking enabled.
270 #ENABLE_CHECKING="--enable-checking=yes"
271 ENABLE_CHECKING="--enable-checking=release"
273 # Work around tail/head -1 changes
274 export _POSIX2_VERSION=199209
277 # Using the host gnatmake like
278 # CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
279 # GNATMAKE="gnatmake%{hostsuffix}"
280 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
282 mkdir -p host-tools/bin
283 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
284 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
285 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
286 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
287 ln -sf /usr/%{_lib} host-tools/%{_lib}
288 export PATH="`pwd`/host-tools/bin:$PATH"
290 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
292 # --enable-threads=posix \
295 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
296 # temporary workaround for a miscompilation of hash functions in java code
297 GCJ_EXTRA_FLAGS="-marm"
300 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
301 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS $GCJ_EXTRA_FLAGS" \
303 --prefix=%{_prefix} \
304 --infodir=%{_infodir} \
305 --mandir=%{_mandir} \
306 --libdir=%{_libdir} \
307 --libexecdir=%{_libdir} \
308 --enable-languages=$languages \
310 --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
313 --disable-bootstrap \
314 %if 0%{!?build_libvtv:1}
318 --with-bugurl="http://bugs.tizen.org/" \
319 --with-pkgversion="Tizen" \
320 %if !%{build_fortran}
321 --disable-libquadmath \
323 %if !%{build_libjava}
326 --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
327 --with-ecj-jar=%{libsubdir}/ecj.jar \
329 %if !%{biarch_libjava}
330 --disable-libjava-multilib \
333 --with-slibdir=/%{_lib} \
335 --enable-__cxa_atexit \
336 --enable-libstdcxx-allocator=new \
337 --disable-libstdcxx-pch \
338 --enable-version-specific-runtime-libs \
339 --enable-linker-build-id \
340 --enable-linux-futex \
341 --program-suffix=%{binsuffix} \
342 %if 0%{!?gcc_target_arch:1}
344 --with-system-libunwind \
346 --without-system-libunwind \
349 %if 0%{?gcc_target_arch:1}
350 --program-prefix=%{gcc_target_arch}- \
351 --target=%{gcc_target_arch} \
354 --with-sysroot=%sysroot \
356 --with-sysroot=%{_prefix}/%{gcc_target_arch} \
358 %if 0%{?build_sysroot:1}
359 --with-build-sysroot=%{build_sysroot} \
362 --with-build-sysroot=%{sysroot} \
364 --with-build-sysroot=%{_prefix}/%{gcc_target_arch} \
367 %if 0%{?canonical_target:1}
368 --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
370 %if "%{TARGET_ARCH}" == "spu"
371 --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
375 %if "%{TARGET_ARCH}" == "armv5tel"
376 --with-arch=armv5te \
379 --with-abi=aapcs-linux \
380 --disable-sjlj-exceptions \
382 %if "%{TARGET_ARCH}" == "armv7l"
383 --with-arch=armv7-a \
384 --with-tune=cortex-a8 \
385 --with-float=softfp \
388 --disable-sjlj-exceptions \
390 %if "%{TARGET_ARCH}" == "armv7hl"
391 --with-arch=armv7-a \
392 --with-tune=cortex-a9 \
394 --with-abi=aapcs-linux \
395 --with-fpu=vfpv3-d16 \
396 --disable-sjlj-exceptions \
398 %if "%{TARGET_ARCH}" == "aarch64"
399 --with-arch=armv8-a \
400 --disable-sjlj-exceptions \
402 %if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
403 %if "%{TARGET_ARCH}" == "powerpc"
404 --with-cpu=default32 \
406 %if "%{TARGET_ARCH}" == "powerpc64le"
409 --with-cpu-64=power4 \
412 --with-long-double-128 \
413 %if "%{TARGET_ARCH}" == "powerpc64le"
417 %if "%{TARGET_ARCH}" == "sparc64"
418 --with-cpu=ultrasparc \
419 --with-long-double-128 \
421 %if "%{TARGET_ARCH}" == "sparc"
423 --with-long-double-128 \
425 %if "%{TARGET_ARCH}" == "i586"
426 --with-arch-32=i586 \
427 --with-tune=generic \
429 %if "%{TARGET_ARCH}" == "x86_64"
430 --with-arch-32=i586 \
431 --with-tune=generic \
434 %if "%{TARGET_ARCH}" == "s390"
435 --with-tune=zEC12 --with-arch=z196 \
436 --with-long-double-128 \
437 --enable-decimal-float \
439 %if "%{TARGET_ARCH}" == "s390x"
440 --with-tune=zEC12 --with-arch=z196 \
441 --with-long-double-128 \
442 --enable-decimal-float \
444 %if "%{TARGET_ARCH}" == "m68k"
451 %if 0%{!?gcc_icecream:1}
452 make %{?jobs:-j%jobs}
454 make %{?jobs:-j%jobs} all-host
457 %package -n cross-%cross_arch-gcc49-icecream-backend
458 Summary: Icecream backend for the GNU C Compiler
459 Group: Development/Languages/C and C++
461 %description -n cross-%cross_arch-gcc49-icecream-backend
462 This package contains the icecream environment for the GNU C Compiler
465 %define targetlibsubdir %{_libdir}/gcc/%{gcc_target_arch}/%{gcc_dir_version}
470 # install and fixup host parts
471 make DESTDIR=$RPM_BUILD_ROOT install-host
472 # with the present setup fixincludes are for the build includes which
473 # is wrong - get rid of them
474 rm -rf $RPM_BUILD_ROOT/%{targetlibsubdir}/include-fixed
475 rm -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.la
477 rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
479 # remove docs and disable automated generation
481 %define disable_docs_package 1
483 # install and fixup target parts
484 # ??? don't do this - debugedit is not prepared for this and crashes
485 # so expect the sysroot to be populated from natively built binaries
487 #make DESTDIR=$RPM_BUILD_ROOT/%{sysroot} install-target
489 #make DESTDIR=$RPM_BUILD_ROOT/%{_prefix}/%{gcc_target_arch} install-target
493 # Build an icecream environment
494 # The assembler comes from the cross-binutils, and hence is _not_
495 # named funnily, not even on ppc, so there we need the original target
496 install -s -D %{_prefix}/bin/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}-as $RPM_BUILD_ROOT/env/usr/bin/as
497 install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix} $RPM_BUILD_ROOT/env/usr/bin/g++
498 install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix} $RPM_BUILD_ROOT/env/usr/bin/gcc
500 for back in cc1 cc1plus collect2 lto1 lto-wrapper; do
501 install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/$back $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
503 if test -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so; then
504 install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
507 # Make sure to also pull in all shared library requirements for the
508 # binaries we put into the environment which is operated by chrooting
509 # into it and execing the compiler
510 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`
512 # Check wether the same library also exists in the parent directory,
513 # and prefer that on the assumption that it is a more generic one.
514 baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
515 test -f "$baselib" && lib=$baselib
516 install -s -D $lib $RPM_BUILD_ROOT/env$lib
519 cd $RPM_BUILD_ROOT/env
520 %if 0%{?gcc_icecream:1}
521 tar cvzf ../%{name}-icecream-backend_%{_arch}.tar.gz *
523 tar cvzf ../%{name}_%{_arch}.tar.gz *
526 mkdir -p usr/share/icecream-envs
527 %if 0%{?gcc_icecream:1}
528 mv %{name}-icecream-backend_%{_arch}.tar.gz usr/share/icecream-envs
530 mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
532 rpm -q --changelog glibc > usr/share/icecream-envs/%{name}_%{_arch}.glibc
533 rpm -q --changelog binutils > usr/share/icecream-envs/%{name}_%{_arch}.binutils
536 # liblto_plugin alternatives
537 mkdir -p "$RPM_BUILD_ROOT%{bfd_plugin_dir}"
538 touch "$RPM_BUILD_ROOT%{bfd_plugin_lto}"
541 "%_sbindir/update-alternatives" --install \
542 "%{bfd_plugin_lto}" "%{bfd_plugin_lto_name}" "%{gcc_plugin_lto}" 5
545 "%_sbindir/update-alternatives" --remove "%{bfd_plugin_lto_name}" "%{gcc_plugin_lto}"
549 %defattr(-,root,root)
551 %dir %{targetlibsubdir}
552 %dir %{_libdir}/gcc/%{gcc_target_arch}
554 %ghost %{bfd_plugin_lto}
556 %files -n cross-%cross_arch-gcc49-icecream-backend
557 %defattr(-,root,root)
558 /usr/share/icecream-envs