LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File cross-armv7l-gcc44-obs.spec of Package orig-gcc44 (Project Ports:ARM:Base:build:cross)

#
# 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 gcc_for_opt 0
%define gcc_target_arch armv7l

Name:         cross-armv7l-gcc44-obs
BuildRequires: cross-armv7l-linux-kernel-headers
BuildRequires: cross-armv7l-gcc
BuildRequires: cross-armv7l-binutils
BuildRequires: glibc-cross_armv7
BuildRequires: glibc-devel-cross_armv7
BuildRequires: bison flex gettext-devel glibc-devel texinfo zlib-devel
BuildRequires: dejagnu expect perl mpfr-devel gmp-devel libstdc++44 
ExclusiveArch: i586
AutoReqProv:   off
# cloog-devel ppl-devel ppl-devel-static
Source990:    cross-gcc.rpmlintrc
# COMMON-BEGIN
%define biarch_targets x86_64 s390x powerpc64 powerpc

URL:          http://gcc.gnu.org/
Version: 4.4.1_20090817
Release:      1
%define gcc_version %(echo %version | sed 's/_.*//')
%define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
%define snapshot_date %(echo %version | sed 's/[34]\.[0-4]\.[0-6]//' | sed 's/_/-/')
%define binsuffix -4.4
# COMMON-END
# COMMON-BEGIN
Autoreqprov:    off
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
Source:		gcc-%{gcc_version}%{snapshot_date}.tar.bz2
Source1:	change_spec
Source2:	libgcj44-rpmlintrc
Source3:	gcc44-rpmlintrc
Source4:	ecj.jar
Source5:	README.First-for.SuSE.packagers
Source6:	classpath-fixes.tar
Patch1:		gcc-dir-version.patch
Patch2:		gcc-sles-version.patch
Patch3:		gcc-noalias-warn.diff
Patch5:		boehm-gc-strict-aliasing.patch
Patch6:		suse-record-gcc-opts.diff
Patch7:		acats-timeout.patch
Patch8:		Wunprototyped-calls.diff
Patch9:		gcc44-lfs.diff
Patch10:	program-transform-name.diff
Patch12:	gcc4-ppc64-m32-m64-multilib-only.patch
Patch23:	libjava-no-multilib.diff
Patch24:	tls-no-direct.diff
Patch25:	pr27880.diff
Patch28:	pr33763.diff
Patch29:	build-id.diff
Patch30:	gcc43-no-unwind-tables.diff
Patch31:	gcc44-arm-boehm.patch
Patch32:	nvl544794.patch
# A set of patches from the RH srpm
Patch51:	gcc41-ia64-stack-protector.patch
Patch55:	gcc41-java-slow_pthread_self.patch
Patch57:	gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
Patch60:	gcc44-textdomain.patch
Patch61:	gcc44-rename-info-files.patch
# Patches for SAP features
Patch130:	sap303956-uchar.diff

# LIBJAVA-DELETE-BEGIN
Group:		Development/Languages/C and C++
Summary:	The GNU C Compiler and Support Files
License:        GPL v3 or later

%description
This compiler supports the C language on armv7l microprocessors.
Also install cross-armv7l-binutils and armv7l-libc.


%prep
%setup -q -n gcc-%{gcc_version}%{snapshot_date}
tar xf %{SOURCE6}
%patch1
%patch2
%patch3
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%if !%{build_nof}
%patch12
%endif
%patch23
%patch24
%patch25
%patch28
%if 0%{suse_version} > 1100
%patch29
%endif
%patch30
%patch31
%patch32

%patch55
%patch57
%patch60
%patch61
%patch130

%build
# Avoid rebuilding of generated files
contrib/gcc_update --touch

# Split version file into version used for directories (X.Y) and
# version to report with --version (X.Y.Z).
# See also gcc-dir-version.patch.
# Also decrement the patchlevel version by one
if test `cat gcc/DEV-PHASE` == "prerelease"; then
  ( cat gcc/BASE-VER | cut -d '.' -f 1-2 | tr -d '\n'; echo -n .; cat gcc/BASE-VER | cut -d '.' -f 3 | tr '0123456789' '0012345678' ) > gcc/FULL-VER
else
  mv gcc/BASE-VER gcc/FULL-VER
fi
cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER

%define HOST %(echo %{_target_cpu}|sed -e "s/parisc/hppa/" -e "s/i.86/i586/" -e "s/ppc/powerpc/")-suse-linux
%if "%{name}" != "gcc"
%define TARGET %(echo %{name} | sed -e "s/cross-\\(.*\\)-gcc44-obs/\\1/;s/-/_/g;s/parisc/hppa/;s/i.86/i586/;s/ppc/powerpc/")
%else
%define TARGET %{_target_cpu}
%endif

#
# TARGET-TUPLE
#
%if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
%define TARGET_OS %{TARGET}
%else
%define TARGET_OS %{TARGET}-suse-linux-gnu
%endif
%if "%{TARGET}" == "armv5tel"
%define TARGET_OS %{TARGET}-suse-linux-gnueabi
%endif
%if "%{TARGET}" == "armv7l"
%define TARGET_OS %{TARGET}-suse-linux-gnueabi
%endif
%if "%{TARGET}" == "mips"
%define TARGET_OS %{TARGET}-suse-linux-gnueabi
%endif

#
# HOST TUPLE
#
%define HOST_OS %{HOST}-gnu

%if "%{HOST}" == "arm-suse-linux"
%define HOST_OS %{HOST}-gnueabi
%endif
%if "%{HOST}" == "mips-suse-linux"
%define HOST_OS %{HOST}-gnueabi
%endif


%define TARGET_SYSROOT /opt/cross/%{TARGET_OS}/sys-root
%define TARGET_HEADERS /opt/cross/%{TARGET_OS}/sys-root/usr/include
%define _prefix /usr

export PATH=/opt/cross/%{TARGET_OS}/bin:$PATH

J=%{?jobs:%jobs}
if test -z "$J"; then
  J=8
  JL=$(($J * 2))
else
  test 1 -gt "$J" && J=1
  JL=$(($(getconf _NPROCESSORS_CONF)*2))
fi
if test "$J" == "0"; then
  J=1
fi
if test "$JL" == "0"; then
  JL=1
fi
PARALLEL="-j$J -l$JL"


#%#if "%{TARGET}" == "i586"
# force cross-compilation even on i586 host/target !
#for i in `find . -type f -executable -name configure` ; do sed -i $i -e 's/cross_compiling=no/cross_compiling=yes/' ; sed -i $i -e 's/is_cross_compiler=no/is_cross_compiler=yes/'; done
#sed -i libgcc/configure -e 's/gcc_no_link=no/gcc_no_link=yes/'
#%#define HOST i686-suse-linux
#%#endif

mkdir gcc-build
export CFLAGS="-O2 -g -static -Wl,-static"
# -Wl,-rpath -Wl,/emul/ia32-linux/usr/lib:/emul/ia32-linux/lib -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables  -fPIC -DPIC"
#export BOOT_CFLAGS="-Wl,-rpath -Wl,/emul/ia32-linux/usr/lib:/emul/ia32-linux/lib -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fPIC -DPIC"
#export CFLAGS_FOR_TARGET="-Wl,-rpath -Wl,/emul/ia32-linux/usr/lib:/emul/ia32-linux/lib -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables  -fPIC -DPIC"
export AS_FOR_TARGET="/opt/cross/%{TARGET_OS}/bin/%{TARGET_OS}-as"
export LD_FOR_TARGET="/opt/cross/%{TARGET_OS}/bin/%{TARGET_OS}-ld"
export NM_FOR_TARGET="/opt/cross/%{TARGET_OS}/bin/%{TARGET_OS}-nm"
export AR_FOR_TARGET="/opt/cross/%{TARGET_OS}/bin/%{TARGET_OS}-ar"
export RANLIB_FOR_TARGET="/opt/cross/%{TARGET_OS}/bin/%{TARGET_OS}-ranlib"

cd gcc-build

    CC="gcc" \
    ../configure \
        --prefix=%{_prefix} \
        --infodir=%{_infodir} \
        --mandir=%{_mandir} \
        --libdir=%{_prefix}/lib \
        --libexecdir=%{_prefix}/lib \
        --build=%{HOST} \
        --host=%{HOST} \
        --target=%{TARGET_OS} \
        --enable-languages=c,c++ \
        --enable-checking=release \
        --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
        --enable-ssp \
        --disable-libssp \
        --with-bugurl=http://bugs.opensuse.org/ \
        --with-pkgversion='SUSE Linux' \
        --disable-libgcj \
        --disable-libmudflap \
        --with-slibdir=/lib \
        --enable-__cxa_atexit \
        --disable-libstdcxx-pch \
        --enable-libstdcxx-allocator=new \
        --enable-version-specific-runtime-libs \
        --enable-threads=posix \
        --without-system-libunwind \
        --enable-linux-futex \
        --program-transform-name='s/%{TARGET_OS}-//' \
        --program-suffix=-4.4 \
        --enable-c99 \
        --enable-long-long \
        --with-sysroot=/ \
        --with-build-sysroot=%{TARGET_SYSROOT}

################ BIG FIXME !! ###########################
# * either something is broken in gcc makefiles or ?
# * something is broken in libtool ?
# * PEBCAK ?
# * underlying toolchain error ?
#
# Problem: although --with-build-sysroot is set, the libraries
#          aren't picked up by the linker in final stage
#          (the files are in /{/lib,/usr/lib}
# Workaround: copy in searchpath ...
#########################################################
mkdir gcc
cp %{TARGET_SYSROOT}/usr/lib/crt*.o gcc/
cp %{TARGET_SYSROOT}/usr/lib/libdl.* gcc/
cp %{TARGET_SYSROOT}/usr/lib/libc* gcc/
cp %{TARGET_SYSROOT}/lib/libc.* gcc/
cp %{TARGET_SYSROOT}/lib/ld-* gcc/
cp %{TARGET_SYSROOT}/usr/lib/librt* gcc/
cp %{TARGET_SYSROOT}/usr/lib/libpthr* gcc/
cp %{TARGET_SYSROOT}/lib/libpthr* gcc/


make $PARALLEL





%install
export PATH=/opt/cross/%{TARGET_OS}/bin:$PATH

cd gcc-build
make DESTDIR=%buildroot install

rm -rRf %buildroot/%{_libdir}/libiberty.a || true
rm -rRf %buildroot/%{_prefix}/share || true
rm -rRf %buildroot/%{_prefix}/bin/gccbug* || true
rm -rRf %buildroot/%{_prefix}/bin/c++-* || true
rm -rRf %buildroot/%{_prefix}/%{TARGET_OS} || true
rm -rRf %buildroot/lib/libgcc_s.so || true
ln -sf /lib/libgcc_s.so.1 %buildroot/%{_prefix}/lib/gcc/%{TARGET_OS}/%{gcc_dir_version}/libgcc_s.so
ln -s ../../../libgomp.so.1 %buildroot/%{_prefix}/lib/gcc/%{TARGET_OS}/%{gcc_dir_version}/libgomp.so
cp %buildroot/%{_prefix}/lib/gcc/%{TARGET_OS}/%{gcc_dir_version}/libstdc++.s* %buildroot/%{_prefix}/lib/

cat << MYEOF > remove
/usr/include
/lib/libgcc_s.so.1
/usr/bin/%{TARGET_OS}-gcc-4.4
/usr/lib/gcc/%{TARGET_OS}/4.4/include-fixed/linux
/usr/lib/gcc/%{TARGET_OS}/4.4/include-fixed/linux/a.out.h
/usr/lib/gcc/%{TARGET_OS}/4.4/include/mf-runtime.h
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/fixincl
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/fixinc_list
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/fixinc.sh
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/gsyslimits.h
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/include
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/include/limits.h
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/include/README
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/macro_list
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/mkheaders
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/mkheaders.conf
/usr/lib/gcc/%{TARGET_OS}/4.4/install-tools/mkinstalldirs
/usr/lib/gcc/%{TARGET_OS}/4.4/libgomp.la
/usr/lib/gcc/%{TARGET_OS}/4.4/libmudflap.a
/usr/lib/gcc/%{TARGET_OS}/4.4/libmudflap.la
/usr/lib/gcc/%{TARGET_OS}/4.4/libmudflapth.a
/usr/lib/gcc/%{TARGET_OS}/4.4/libmudflapth.la
/usr/lib/gcc/%{TARGET_OS}/4.4/libstdc++.a
/usr/lib/gcc/%{TARGET_OS}/4.4/libstdc++.la
/usr/lib/gcc/%{TARGET_OS}/4.4/libstdc++.so
/usr/lib/gcc/%{TARGET_OS}/4.4/libstdc++.so.6
/usr/lib/gcc/%{TARGET_OS}/4.4/libstdc++.so.6.0.12
/usr/lib/gcc/%{TARGET_OS}/4.4/libsupc++.a
/usr/lib/gcc/%{TARGET_OS}/4.4/libsupc++.la
/usr/lib/libstdc++.so
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.12
MYEOF

for i in $(cat remove) ; do
echo "removing: %buildroot/$i" ; rm -rRf %buildroot/$i || true ; done



%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root)
%{_bindir}/*
%{_prefix}/lib/*


%changelog -n cross-armv7l-gcc44-obs