File cross-avr-gcc.spec of Package gcc41
#
# spec file for package cross-avr-gcc (Version 4.1.2_20070115)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%define build_ada 0
%define build_java 0
%define build_libjava 0
%define build_fortran 0
%define build_objcp 0
%define build_nof 0
%define gcc_for_opt 0
%define gcc_target_arch avr
Name: cross-avr-gcc
BuildRequires: bison cross-avr-binutils flex gettext-devel glibc-devel texinfo zlib-devel
Requires: cross-avr-binutils
%define _prefix /opt/cross
# COMMON-BEGIN
%define biarch_targets x86_64 s390x powerpc64 powerpc
Url: http://gcc.gnu.org/
License: GPL
Version: 4.1.2_20070115
Release: 11
%define gcc_version %(echo %version | sed 's/_.*//')
%define snapshot_date %(echo %version | sed 's/[34]\.[0-4]\.[0-6]//' | sed 's/_/-/')
%define binsuffix -4.1
%if %{gcc_for_opt}
%define versionspecificlibs 1
%else
%define versionspecificlibs 0
%endif
# COMMON-END
# COMMON-BEGIN
Group: Development/Languages/C and C++
AutoReqProv: on
Summary: The GNU C Compiler and Support Files
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: gcc-%{gcc_version}%{snapshot_date}.tar.bz2
Source1: change_spec
Source2: gcc41-rpmlintrc
Patch1: bug-reporting.patch
Patch2: gcc-noalias-warn.diff
Patch5: boehm-gc-strict-aliasing.patch
Patch7: acats-timeout.patch
Patch8: gcc41-makeinfo.patch
Patch9: gcc41-binutils-version.patch
Patch10: program-transform-name.diff
Patch12: gcc4-ppc64-m32-m64-multilib-only.patch
Patch23: libjava-no-multilib.diff
Patch24: tls-no-direct.diff
Patch37: pr20425.patch
Patch38: large-gcc.diff
Patch43: generic-cpu-model-1.patch
Patch44: generic-cpu-model-2.patch
Patch45: generic-cpu-model-3.patch
Patch47: partial-flag-regstall.patch
Patch39: tree_expr_nonzero.patch
Patch40: vrp.patch
Patch46: force_fit_type.patch
Patch48: pr24879.patch
Patch82: pr13212.patch
Patch93: nvl161673.patch
Patch95: pr26399.patch
Patch96: nov189571.diff
Patch97: nov189571-2.diff
Patch98: nvl199137.patch
Patch100: pr28755.patch
Patch101: pr30113.patch
Patch102: ia64-bad-prologue-generation.patch
Patch103: pr34130.patch
Patch104: nov480052.diff
Patch105: pr34641.patch
Patch107: fix-ada-build.diff
Patch108: pr20218.patch
Patch109: pr29558.patch
Patch110: pr29512.patch
Patch111: nov495844.diff
Patch123: gcc41-no-unwind-tables.diff
Patch124: pr28460.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
Patch54: gcc41-ldbl-default.patch
Patch50: gcc41-ldbl-default-libstdc++.patch
Patch52: note-gnu-stack.diff
Patch53: gcc41-strncat-chk.patch
# general improvement patches
Patch60: pr25626.patch
Patch61: fortran-matmul.patch
Patch62: gcc41-fortran-where-opt.patch
Patch63: emmintr.patch
Patch64: libstdcxx-bitset.patch
Patch65: stack-protect-kernel.patch
Patch66: pr26208.patch
Patch67: dwarf3-constants.patch
Patch68: dwarf3-unwind.patch
Patch69: gcc41-ssse3.patch
Patch70: pr27880.diff
Patch72: Wprofile-mismatch.patch
Patch73: fpreserve-function-arguments4.patch
Patch74: warn-enum.diff
Patch75: nov277135.diff
Patch76: nov376357.diff
Patch77: nov394409.diff
Patch78: nov354405.diff
Patch79: nov494022.diff
Patch80: nov415378.diff
Patch81: nov465381.diff
Patch90: parentheses-mathematical-5.diff
Patch91: Wuninitialized.patch
# Greyhound (aka AMD Family 10h) support
Patch200: gcc-amdfam10-suse-1.patch
Patch201: gcc-amdfam10-suse-2.patch
Patch202: gcc-amdfam10-suse-3.patch
Patch203: gcc-amdfam10-suse-4.patch
Patch204: gcc-amdfam10-suse-5.patch
Patch205: gcc-amdfam10-suse-6.patch
Patch206: gcc-amdfam10-suse-7.patch
Patch207: gcc-amdfam10-suse-8.patch
Patch208: gcc-amdfam10-suse-9.patch
Patch209: gcc-amdfam10-suse-10.patch
Patch210: gcc-amdfam10-suse-11.patch
Patch211: gcc-amdfam10-suse-12.patch
Patch212: gcc-amdfam10-suse-20.patch
Patch213: gcc-amdfam10-alignloop.diff
Patch214: barcelona.patch
Patch215: sse5-suse.patch01
# POWER6 support
Patch300: gcc-4.1.0-power6.diff
Patch301: nov341254-pic.diff
Patch302: nov341254-altivec.diff
%if "%{gcc_target_arch}" == "avr"
# Joerg Wunsch places his cross-avr-gcc-patches there:
# http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/avr-gcc/files
# grab what has not yet made it into upstream
Patch1000: cross-avr-patch-0b-constants.patch
Patch1001: cross-avr-patch-attribute_alias.patch
Patch1002: cross-avr-patch-bug25672.patch
Patch1003: cross-avr-patch-dwarf.patch
Patch1004: cross-avr-patch-newdevices.patch
Patch1005: cross-avr-patch-zz-atmega256x.patch
%endif
# LIBJAVA-DELETE-BEGIN
%description
This compiler supports the C language on avr microprocessors.
Also install cross-avr-binutils and avr-libc.
%if 0%{?gcc_target_arch:1}
%define CONFIGURE_TARGET %{gcc_target_arch}
%define TARGET_ARCH %(echo %{gcc_target_arch} | cut -d - -f 1 | sed -e "s/i.86/i586/;s/ppc/powerpc/")
%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
%define CONFIGURE_TARGET powerpc64-linux
%endif
%else
%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/")
%endif
%define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/")
%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
%ifarch ppc
%define GCCDIST powerpc64-suse-linux
%else
%define GCCDIST %{HOST_ARCH}-suse-linux
%endif
%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_version}
%define gxxinclude %{_prefix}/include/c++/%{gcc_version}
# COMMON-END
# COMMON-BEGIN
%prep
%setup -q -n gcc-%{gcc_version}%{snapshot_date}
%patch1
%patch2
%patch5
%patch7
%patch8
%patch9
%patch10
%if !%{build_nof}
%patch12
%endif
%patch23
%patch24
%patch37
%patch38
%patch43
%patch44
%patch45
%patch47
%patch39
%patch40
%patch46
%patch48
%patch82
%patch93
%patch95
%patch96
%patch97
%patch98 -p1
%patch100
%patch101
%patch102 -p1
%patch103
%patch104
%patch105
%patch107
%patch108
%patch109
%patch110
%patch111
%patch123
%patch124
%patch51
%patch55
%patch57
%patch54
%patch50
%patch52
%patch53
cd libstdc++-v3
%patch60
%patch64
cd ..
%patch61
%patch62 -p1
%patch63
%patch65
%patch66
%patch67
%patch68
%patch69
%patch70
%patch72
%patch73
%patch74
%patch75
%patch76
%patch77
%patch78
%patch79
%patch80
%patch81
%patch90
%patch91
%patch200
%patch201
%patch202
%patch203
%patch204
%patch205
%patch206
%patch207
%patch208
%patch209
%patch210
%patch211
%patch212
%patch213 -p1
%patch214
%patch215
%patch300
%patch301 -p1
%patch302 -p1
%if "%{gcc_target_arch}" == "avr"
%patch1000
%patch1001
%patch1002
%patch1003
%patch1004
%patch1005
%endif
%build
# Avoid conflict with commercial libjawt.so
sed -i -e 's/libjawt/libgcjawt/g' libjava/Makefile.{am,in}
# Avoid rebuilding of generated files
contrib/gcc_update --touch
rm -rf obj-%{GCCDIST}
mkdir obj-%{GCCDIST}
cd obj-%{GCCDIST}
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector//g' -e 's/-ffortify=.//g'`
%ifarch %ix86
# -mcpu is superceded by -mtune but -mtune is not supported by
# our bootstrap compiler. -mcpu gives a warning that stops
# the build process, so remove it for now.
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g'`
%endif
%ifarch s390 s390x
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
%endif
%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
# Kill all -march/tune/cpu because that screws building the target libs
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
%endif
# Replace 2 spaces by one finally
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
languages=c,c++,objc
%if %{build_fortran}
languages=$languages,fortran
%endif
%if %{build_objcp}
languages=$languages,obj-c++
%endif
%if %{build_java}
languages=$languages,java
%endif
%if %{build_ada}
languages=$languages,ada
%endif
# override for cross targets until we have build_objc
%if 0%{?gcc_target_arch:1}
languages=c,c++
%endif
J=%{?jobs:%jobs}
if test -z "$J"; then
J=$(getconf _NPROCESSORS_CONF)
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"
# we don't want some miscompiles in the testsuite, or some fault in
# the compiler to kill the machine. Hence we limit the amount of memory
# by the physical RAM plus half of swap
#MEM=$(free -m | awk '/^Mem:/ {print $2}')
#SWAP=$(free -m | awk '/^Swap:/ {print $2}')
#ulimit -v $(((MEM + SWAP/2)*1024))
# In general we want to ship release checking enabled compilers
# and run BETA with checking enabled.
#ENABLE_CHECKING=--enable-checking
ENABLE_CHECKING="--enable-checking=release"
%if "%{name}" != "gcc41"
export PATH=/opt/cross/bin:$PATH
%endif
# Work around tail/head -1 changes
export _POSIX2_VERSION=199209
# configure tries to parse include/features.h to detect
# if glibc supports SSP. When cross compiling we would need
# to install a cross glibc, which we don't, or make the whole
# thing point to the native glibc, which is in /, hence the
# --with-sysroot=/
%if %{build_ada}
# Using the host gnatmake like
# CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
# GNATMAKE="gnatmake%{hostsuffix}"
# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
# available
mkdir -p host-tools/bin
cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
ln -sf /usr/%{_lib} host-tools/%{_lib}
export PATH="`pwd`/host-tools/bin:$PATH"
%endif
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
../configure \
%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
%else
--enable-threads=posix \
%endif
--prefix=%{_prefix} --with-local-prefix=/usr/local \
--infodir=%{_infodir} --mandir=%{_mandir} \
--libdir=%{_libdir} --libexecdir=%{_libdir} \
--enable-languages=$languages $ENABLE_CHECKING \
--with-gxx-include-dir=/usr/include/c++/%{gcc_version} \
--enable-ssp --disable-libssp \
%if !%{build_libjava}
--disable-libgcj \
%else
--enable-java-awt=gtk --enable-gtk-cairo \
%if !%{biarch_libjava}
--disable-libjava-multilib \
%endif
%endif
--with-slibdir=/%{_lib} --with-system-zlib \
--enable-shared --enable-__cxa_atexit \
--enable-libstdcxx-allocator=new \
%if 0%{?gcc_target_arch:1}
%if 0%{?gcc_icecream:1}
--with-as=/opt/cross/%{TARGET_ARCH}-linux/bin/as \
--with-ld=/opt/cross/%{TARGET_ARCH}-linux/bin/ld \
--with-sysroot=/ \
%endif
--disable-nls --disable-shared \
--target=%{CONFIGURE_TARGET} \
%else
--program-suffix=%{binsuffix} \
--enable-version-specific-runtime-libs \
%ifarch ia64
--with-system-libunwind \
%else
--without-system-libunwind \
%endif
%endif
%if "%{TARGET_ARCH}" == "powerpc"
--with-cpu=default32 \
--enable-secureplt \
--with-long-double-128 \
%endif
%if "%{TARGET_ARCH}" == "powerpc64"
--enable-secureplt \
--with-long-double-128 \
%endif
%if "%{TARGET_ARCH}" == "i586"
--with-cpu=generic \
%endif
%if "%{TARGET_ARCH}" == "x86_64"
--with-cpu=generic \
%endif
%if "%{TARGET_ARCH}" == "s390"
--with-tune=z9-109 --with-arch=z900 \
--with-long-double-128 \
%endif
%if "%{TARGET_ARCH}" == "s390x"
--with-tune=z9-109 --with-arch=z900 \
--with-long-double-128 \
%endif
--host=%{GCCDIST}
# COMMON-END
make %{?jobs:-j%jobs}
%install
cd obj-%{GCCDIST}
make install DESTDIR=$RPM_BUILD_ROOT
# ln -s avr-elf-gcc $RPM_BUILD_ROOT/%{_prefix}/bin/avr-gcc
rm -rf $RPM_BUILD_ROOT/%{_prefix}/share
rm $RPM_BUILD_ROOT/%{_libdir}/libiberty.a
# The libgcc.a that is not inside an avr* subdirectory is for avr2.
# rm $RPM_BUILD_ROOT/%{_libdir}/gcc/*/*/{libgcc.a,libgcov.a}
rmdir $RPM_BUILD_ROOT/%{_prefix}/include
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_prefix}
%changelog