# # spec file for package gcc (Version 4.0.1) # # Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # Please submit bugfixes or comments via http://www.suse.de/feedback/ # # nospeccleaner %define build_cp 0%{!?gcc_accel:1} %define build_ada 0 %define build_libjava 0 %define build_java 0 %define build_fortran 0 %define build_objc 0 %define build_objcp 0 %define build_go 0 %define build_hsa 0 %define build_nvptx 0 %define enable_plugins 0 %define binutils_target %{cross_arch} %if %{cross_arch} == "armv7l" || %{cross_arch} == "armv7hl" %define binutils_target arm %endif %if %{cross_arch} == "armv6l" || %{cross_arch} == "armv6hl" %define binutils_target arm %endif %if %{cross_arch} == "armv5tel" %define binutils_target arm %endif %if %{cross_arch} == "sparcv9" %define binutils_target sparc %endif %define canonical_target %(echo %{binutils_target} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;") %if "%{binutils_target}" == "avr" || "%{binutils_target}" == "spu" %define binutils_os %{canonical_target} %else %if "%{binutils_target}" == "epiphany" || "%{binutils_target}" == "nds32le" || "%{binutils_target}" == "rl78" || "%{binutils_target}" == "rx" %define binutils_os %{canonical_target}-elf %else %if "%{binutils_target}" == "arm" %define binutils_os %{canonical_target}-suse-linux-gnueabi %else %if 0%{?gcc_accel:1} %define binutils_os %{gcc_target_arch} %else %define binutils_os %{canonical_target}-suse-linux %endif %endif %endif %endif %if 0%{?gcc_icecream:1} %define build_sysroot / %define sysroot %{_prefix}/%{gcc_target_arch} %else # offloading builds newlib in-tree and can install in # the GCC private path without extra sysroot %if 0%{!?gcc_accel:1} # use same sysroot as in binutils.spec %define sysroot %{_prefix}/%{binutils_os}/sys-root %endif %endif %if %{suse_version} >= 1220 %define selfconflict() %1 %else %define selfconflict() otherproviders(%1) %endif Name: %{pkgname} %if %{cross_arch} != "nvptx" BuildRequires: cross-%{binutils_target}-binutils Requires: cross-%{binutils_target}-binutils %endif BuildRequires: gcc-c++ BuildRequires: bison BuildRequires: flex BuildRequires: gettext-devel BuildRequires: glibc-devel-32bit BuildRequires: mpc-devel BuildRequires: mpfr-devel BuildRequires: perl %if %{suse_version} > 1220 BuildRequires: makeinfo %else BuildRequires: texinfo %endif BuildRequires: zlib-devel %ifarch %ix86 x86_64 ppc ppc64 s390 s390x ia64 %sparc hppa %arm BuildRequires: isl-devel %endif %ifarch ia64 BuildRequires: libunwind-devel %endif %if 0%{!?gcc_icecream:1} %if 0%{?gcc_target_newlib:1} && 0%{!?gcc_libc_bootstrap:1} BuildRequires: cross-%cross_arch-newlib-devel %endif %if 0%{?gcc_target_glibc:1} BuildRequires: cross-%cross_arch-glibc-devel %endif %if %{cross_arch} == "nvptx" BuildRequires: nvptx-tools Requires: nvptx-tools ExclusiveArch: x86_64 %define nvptx_newlib 1 %endif %endif %if 0%{?gcc_icecream:1} ExclusiveArch: ppc64le ppc64 x86_64 s390x aarch64 %endif %define _binary_payload w.ufdio # Obsolete cross-ppc-gcc49 from cross-ppc64-gcc49 which has # file conflicts with it and is no longer packaged %if "%pkgname" == "cross-ppc64-gcc49" Obsoletes: cross-ppc-gcc49 <= 4.9.0+r209354 %endif %if 0%{?gcc_target_newlib:1} # Generally only one cross for the same target triplet can be installed # at the same time as we are populating a non-version-specific sysroot Provides: %{gcc_target_arch}-gcc Conflicts: %selfconflict %{gcc_target_arch}-gcc %endif #!BuildIgnore: gcc-PIE BuildRequires: update-alternatives Requires(post): update-alternatives Requires(preun): update-alternatives # COMMON-BEGIN # COMMON-END %if 0%{!?gcc_icecream:1} && 0%{!?gcc_libc_bootstrap:1} make %{?jobs:-j%jobs} %else make %{?jobs:-j%jobs} all-host %endif %if 0%{?gcc_icecream:%gcc_icecream} %package -n cross-%cross_arch-gcc@base_ver@-icecream-backend Summary: Icecream backend for the GNU C Compiler Group: Development/Languages/C and C++ %description -n cross-%cross_arch-gcc@base_ver@-icecream-backend This package contains the icecream environment for the GNU C Compiler %endif %define targetlibsubdir %{_libdir}/gcc/%{gcc_target_arch}/%{gcc_dir_version} %install cd obj-%{GCCDIST} # install and fixup host parts make DESTDIR=$RPM_BUILD_ROOT install-host %if 0%{?gcc_icecream:1} # with the gcc_icecream setup fixincludes are for the build includes which # is wrong - get rid of them rm -rf $RPM_BUILD_ROOT/%{targetlibsubdir}/include-fixed %endif rm -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.la # common fixup rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a # install and fixup target parts # debugedit is not prepared for this and crashes %if 0%{?gcc_icecream:1} # so expect the sysroot to be populated from natively built binaries %else %if 0%{!?gcc_libc_bootstrap:1} export NO_BRP_STRIP_DEBUG=true export NO_DEBUGINFO_STRIP_DEBUG=true %define __debug_install_post %{nil} : >../debugfiles.list : >../debugsources.list make DESTDIR=$RPM_BUILD_ROOT/%{?sysroot:%sysroot} install-target %endif %endif # remove docs rm -rf $RPM_BUILD_ROOT%{_mandir} rm -rf $RPM_BUILD_ROOT%{_infodir} # for accelerators remove all frontends but lto1 and also install-tools %if 0%{?gcc_accel:1} rm -f $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/cc1 rm -f $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/cc1plus rm -rf $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/install-tools rm -rf $RPM_BUILD_ROOT%{targetlibsubdir}/install-tools %endif %if 0%{?gcc_icecream:%gcc_icecream} # Build an icecream environment # The assembler comes from the cross-binutils, and hence is _not_ # named funnily, not even on ppc, so there we need the original target install -s -D %{_prefix}/bin/%{binutils_os}-as \ $RPM_BUILD_ROOT/env/usr/bin/as install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix} \ $RPM_BUILD_ROOT/env/usr/bin/g++ install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix} \ $RPM_BUILD_ROOT/env/usr/bin/gcc for back in cc1 cc1plus; do install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/$back \ $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back done if test -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so; then install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so \ $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so fi # Make sure to also pull in all shared library requirements for the # binaries we put into the environment which is operated by chrooting # into it and execing the compiler 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 ` for lib in $libs; do # Check wether the same library also exists in the parent directory, # and prefer that on the assumption that it is a more generic one. baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'` test -f "$baselib" && lib=$baselib install -s -D $lib $RPM_BUILD_ROOT/env$lib done cd $RPM_BUILD_ROOT/env tar --no-recursion --mtime @${SOURCE_DATE_EPOCH:-$(date +%s)} --format=gnu -cv `find *|LC_ALL=C sort` |\ gzip -n9 > ../%{name}_%{_arch}.tar.gz cd .. mkdir -p usr/share/icecream-envs mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs rpm -q --changelog glibc > usr/share/icecream-envs/%{name}_%{_arch}.glibc rpm -q --changelog binutils > usr/share/icecream-envs/%{name}_%{_arch}.binutils rm -r env %endif # we provide update-alternatives for selecting a compiler version for # crosses %if 0%{!?gcc_accel:1} mkdir -p %{buildroot}%{_sysconfdir}/alternatives for ex in gcc c++ cpp g++ gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool; do ln -s %{_sysconfdir}/alternatives/%{gcc_target_arch}-$ex \ %{buildroot}%{_bindir}/%{gcc_target_arch}-$ex done %post %{_sbindir}/update-alternatives \ --install %{_bindir}/%{gcc_target_arch}-gcc %{gcc_target_arch}-gcc %{_bindir}/%{gcc_target_arch}-gcc%{binsuffix} @base_ver@ \ --slave %{_bindir}/%{gcc_target_arch}-c++ %{gcc_target_arch}-c++ %{_bindir}/%{gcc_target_arch}-c++%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-cpp %{gcc_target_arch}-cpp %{_bindir}/%{gcc_target_arch}-cpp%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-g++ %{gcc_target_arch}-g++ %{_bindir}/%{gcc_target_arch}-g++%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-gcc-ar %{gcc_target_arch}-gcc-ar %{_bindir}/%{gcc_target_arch}-gcc-ar%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-gcc-nm %{gcc_target_arch}-gcc-nm %{_bindir}/%{gcc_target_arch}-gcc-nm%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-gcc-ranlib %{gcc_target_arch}-gcc-ranlib %{_bindir}/%{gcc_target_arch}-gcc-ranlib%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-gcov %{gcc_target_arch}-gcov %{_bindir}/%{gcc_target_arch}-gcov%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-gcov-dump %{gcc_target_arch}-gcov-dump %{_bindir}/%{gcc_target_arch}-gcov-dump%{binsuffix} \ --slave %{_bindir}/%{gcc_target_arch}-gcov-tool %{gcc_target_arch}-gcov-tool %{_bindir}/%{gcc_target_arch}-gcov-tool%{binsuffix} %postun if [ ! -f %{_bindir}/%{gcc_target_arch}-gcc ] ; then %{_sbindir}/update-alternatives --remove %{gcc_target_arch}-gcc %{_bindir}/%{gcc_target_arch}-gcc%{binsuffix} fi %endif %files %defattr(-,root,root) %if 0%{?gcc_accel:1} %{_prefix}/bin/%{GCCDIST}-accel-%{gcc_target_arch}-* %dir %{libsubdir} %dir %{libsubdir}/accel %{libsubdir}/accel/%{gcc_target_arch} %else %{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-c++%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-cpp%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-gcc-ar%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-gcc-nm%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-gcov%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-gcov-dump%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-gcov-tool%{binsuffix} %{_prefix}/bin/%{gcc_target_arch}-gcc %{_prefix}/bin/%{gcc_target_arch}-c++ %{_prefix}/bin/%{gcc_target_arch}-cpp %{_prefix}/bin/%{gcc_target_arch}-g++ %{_prefix}/bin/%{gcc_target_arch}-gcc-ar %{_prefix}/bin/%{gcc_target_arch}-gcc-nm %{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib %{_prefix}/bin/%{gcc_target_arch}-gcov %{_prefix}/bin/%{gcc_target_arch}-gcov-dump %{_prefix}/bin/%{gcc_target_arch}-gcov-tool %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-c++ %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-cpp %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-g++ %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ar %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-nm %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ranlib %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov-dump %ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov-tool %endif %dir %{targetlibsubdir} %dir %{_libdir}/gcc/%{gcc_target_arch} %{targetlibsubdir} %if 0%{!?gcc_icecream:1} && 0%{!?gcc_libc_bootstrap:1} && 0%{?sysroot:1} %{sysroot} %endif %if 0%{?nvptx_newlib:1} %{_prefix}/%{gcc_target_arch} %endif %if 0%{?gcc_icecream:%gcc_icecream} %files -n cross-%cross_arch-gcc@base_ver@-icecream-backend %defattr(-,root,root) /usr/share/icecream-envs %endif %changelog -n cross-%{pkgname}-gcc@base_ver@