File cross-icecream.spec.in of Package gcc47

#
# 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_nof 0
%define build_with_mudflap 0
%define gcc_target_arch @cross_arch@-suse-linux
%define gcc_icecream 1

%define binutils_target @cross_arch@
%if %{binutils_target} == "armv7l" || %{binutils_target} == "armv7hl"
%define binutils_target arm
%endif
%if %{binutils_target} == "armv5tel"
%define binutils_target arm
%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} == "arm"
%define canonical_target_abi -gnueabi
%endif

Name:         cross-@cross_arch@-gcc@base_ver@-icecream-backend
BuildRequires: cross-%{binutils_target}-binutils
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: cloog-devel
BuildRequires: ppl-devel
%endif
%ifarch ia64
BuildRequires: libunwind-devel
%endif
ExclusiveArch: ppc ppc64 %ix86 x86_64 ia64 
%define _binary_payload w.ufdio

# COMMON-BEGIN
# COMMON-END

make %{?jobs:-j%jobs} all-gcc TARGET-gcc="cc1 cc1plus gcc-cross g++ native"

%install
cd obj-%{GCCDIST}
rm -rf $RPM_BUILD_ROOT
make -C gcc DESTDIR=$RPM_BUILD_ROOT/inst install-driver install-common
make DESTDIR=$RPM_BUILD_ROOT/inst maybe-install-lto-plugin

# But 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/%{canonical_target}-suse-linux%{?canonical_target_abi:%canonical_target_abi}-as \
	$RPM_BUILD_ROOT/env/usr/bin/as
install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-g++ \
	$RPM_BUILD_ROOT/env/usr/bin/g++
install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-gcc \
	$RPM_BUILD_ROOT/env/usr/bin/gcc

%define targetlibsubdir %{_libdir}/gcc/%{CONFIGURE_TARGET}/%{gcc_dir_version}
for back in cc1 cc1plus; do 
	install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/$back \
		$RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
done
if test -f $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so; then
  install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so \
		$RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
fi

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
rm -rf $RPM_BUILD_ROOT/inst
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

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
/usr/share/icecream-envs

%changelog -n cross-@cross_arch@-gcc@base_ver@-icecream-backend
openSUSE Build Service is sponsored by