File cross-icecream.spec.in of Package gcc43

#
# 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/
#

# norootforbuild

%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_for_opt 0
%define gcc_target_arch @cross_arch@-linux
%define gcc_icecream 1

Name:         cross-@cross_arch@-gcc-icecream-backend
BuildRequires: cross-@cross_arch@-binutils glibc-devel-32bit
BuildRequires: gmp-devel mpfr-devel
BuildRequires: bison
BuildRequires: flex
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
BUILD_TARGET=%{TARGET_ARCH}
ORIG_TARGET=$BUILD_TARGET
# We play funny tricks with the ppc compiler.  We want to have it biarch,
# which the powerpc compiler itself doesn't support.  So we actually
# configure it as powerpc64 target compiler (i.e. a native cross compiler
# even on ppc), with the default code generation to be powerpc32.
# But this doesn't hide the fact that it's still a cross compiler which
# shows also in various paths
test "$BUILD_TARGET" = powerpc && BUILD_TARGET=powerpc64
make -C gcc DESTDIR=$RPM_BUILD_ROOT/inst install-driver install-common
# 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 /opt/cross/bin/${ORIG_TARGET}-linux-as $RPM_BUILD_ROOT/env/usr/bin/as
install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/${BUILD_TARGET}-linux-g++ $RPM_BUILD_ROOT/env/usr/bin/g++
install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/${BUILD_TARGET}-linux-gcc $RPM_BUILD_ROOT/env/usr/bin/gcc

for back in cc1 cc1plus; do 
	install -s -D $RPM_BUILD_ROOT/inst%{_libdir}/gcc/${BUILD_TARGET}-linux/%{gcc_dir_version}/$back \
		$RPM_BUILD_ROOT/env%{_libdir}/gcc/${BUILD_TARGET}-linux/%{gcc_dir_version}/$back
done

libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{_libdir}/gcc/${BUILD_TARGET}-linux/%{gcc_dir_version}/*; 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-icecream-backend
openSUSE Build Service is sponsored by