File cross.spec.in of Package libffi46

#! /bin/sh

#
# call this via pre_checkin.sh
#
# 2005-05-09, jw@suse.de

test -z "$cross_arch" && echo 1>&2 "Error: $0 needs environment variable 'cross_arch'"
test -z "$outfile" && echo 1>&2 "Error: $0 needs environment variable 'outfile'"
cross_arch_cpu=`echo $cross_arch | sed -e 's/\([^-]*\)-\?.*/\1/'`

cat << EOF
#
# 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_java 0
%define build_libjava 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

%if "$cross_arch" == "spu"
%define build_fortran 1
%endif

%if 0%{?build_static:1}
%define build_fortran 0
%endif

Name: cross-$cross_arch-gcc$base_ver$name_suffix
BuildRequires: bison flex mpfr-devel zlib-devel mpc-devel
%ifarch %ix86 x86_64 ppc ppc64 s390 s390x ia64 %sparc
BuildRequires: cloog-devel ppl-devel libelf-devel
%endif
BuildRequires: cross-$cross_arch_cpu-binutils
%if "$cross_arch" == "spu"
%if 0%{?build_static:1}
BuildRequires: cross-$cross_arch_cpu-newlib-headers
%else
BuildRequires: cross-$cross_arch_cpu-newlib
%endif
Requires: cross-$cross_arch_cpu-newlib
%endif
Requires: cross-$cross_arch_cpu-binutils
# Suffixed gcc conflicts with unsuffixed gcc
%if "$name_suffix" == ""
%else
Conflicts: cross-$cross_arch_cpu-gcc$base_ver
%endif

%define _prefix /opt/cross

EOF
sed -n -e '/COMMON-BEGIN/,/COMMON-END/p' $outfile | sed -n -e '1,/%description/p' 
cat << EOF
This compiler supports the C language on $cross_arch microprocessors.
Also install cross-$cross_arch-binutils and $cross_arch-libc.


EOF
sed -n -e '/%description/,$p' $outfile | sed -n -e '/COMMON-BEGIN/,/COMMON-END/p'

cat << EOF

make %{?jobs:-j%jobs} 

%install
cd obj-%{GCCDIST}
make install DESTDIR=\$RPM_BUILD_ROOT
rm -rf \$RPM_BUILD_ROOT%{_prefix}/share
rm -f \$RPM_BUILD_ROOT%{_prefix}/bin/*-gccbug
find \$RPM_BUILD_ROOT -name libiberty.a | xargs rm

%clean
rm -rf \$RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%{_prefix}

EOF