# # 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/ # %define build_cp 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 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 %define binutils_os %{canonical_target}-suse-linux %endif %endif %endif %if 0%{?gcc_icecream:1} %define build_sysroot / %else # use same sysroot as in binutils.spec %define sysroot %{_prefix}/%{binutils_os}/sys-root %endif %if 0%{!?gcc_target_newlib:1} %define gcc_target_glibc 1 %endif %if %{suse_version} >= 1220 %define selfconflict() %1 %else %define selfconflict() otherproviders(%1) %endif Name: %{pkgname} BuildRequires: cross-%{binutils_target}-binutils 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 %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 # 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} install-target %endif %endif # remove docs rm -rf $RPM_BUILD_ROOT%{_mandir} rm -rf $RPM_BUILD_ROOT%{_infodir} %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 cvzf ../%{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 %files %defattr(-,root,root) %{_prefix}/bin/%{gcc_target_arch}-* %dir %{targetlibsubdir} %dir %{_libdir}/gcc/%{gcc_target_arch} %{targetlibsubdir} %if 0%{!?gcc_icecream:1} && 0%{!?gcc_libc_bootstrap:1} %{sysroot} %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@