ExclusiveArch: ppc ppc64 %ix86 x86_64 ia64
%define _binary_payload w.ufdio
-# COMMON-BEGIN
-# COMMON-BEGIN
-%define biarch_targets x86_64
+%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
URL: http://gcc.gnu.org/
Version: 4.8.1
%define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
%define snapshot_date %(echo %version | sed 's/[34]\.[0-9]\.[0-6]//' | sed 's/_/-/')
%define binsuffix -4.8
-# COMMON-END
-# COMMON-BEGIN
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-#Source: gcc-%{gcc_version}%{snapshot_date}.tar.bz2
-Source: gcc-%{version}.tar.bz2
-
+Source: gcc-%{version}.tar.bz2
Source1: change_spec
-Source2: libgcj47-rpmlintrc
-Source3: gcc47-rpmlintrc
+Source3: gcc48-rpmlintrc
Source4: ecj.jar
Source6: baselibs.conf
-# Patches auto-generated by git-buildpackage:
-Patch0: 0001-dir-version.patch
-Patch1: 0002-textdomain.patch
-Patch2: 0003-rename-info-files.patch
-Patch3: 0004-ARM-linker.patch
-
-# GCC-TESTSUITE-DELETE-BEGIN
-# LIBFFI-DELETE-BEGIN
-# LIBJAVA-DELETE-BEGIN
+
+
Group: Development/Toolchain
Summary: The GNU C Compiler and Support Files
License: GPL-3.0+
-# COMMON-END
-# COMMON-BEGIN
# Define the canonical target and host architecture
# %gcc_target_arch is supposed to be the full target triple
%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/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
+%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
+%define CONFIGURE_TARGET powerpc64-tizen-linux
+%endif
+%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc64"
+%define CONFIGURE_TARGET powerpc64-tizen-linux
+%endif
%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
%define CONFIGURE_TARGET i586-tizen-linux
%endif
%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
%define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
%endif
-%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7el"
-%define CONFIGURE_TARGET armv7el-tizen-linux-gnueabi
-%endif
-%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5el"
-%define CONFIGURE_TARGET armv5el-tizen-linux-gnueabi
+%if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5tel"
+%define CONFIGURE_TARGET armv5tel-tizen-linux-gnueabi
%endif
%else
%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
+%ifarch ppc
+%define GCCDIST powerpc64-tizen-linux
+%else
+%ifarch %sparc
+%define GCCDIST sparc64-tizen-linux
+%else
%ifarch %arm
%define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
%else
%define GCCDIST %{HOST_ARCH}-tizen-linux
%endif
+%endif
+%endif
%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
-# COMMON-END
-# COMMON-BEGIN
%prep
-#%setup -q -n gcc-%{gcc_version}%{snapshot_date}
%setup -q -n gcc-%{version}
-# 0001-dir-version.patch
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
+
+
+# We are configuring ppc as ppc64 but with switched multilibs. Adjust
+# the libstdc++ abi testsuite baseline files accordingly
+%ifarch ppc
+if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
+ mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
+ mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt \
+ libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64/
+ mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt \
+ libstdc++-v3/config/abi/post/powerpc64-linux-gnu/
+fi
+%endif
%build
# Avoid rebuilding of generated files
# default compiler settings now.
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=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'`
# 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=/
+# --with-build-sysroot=/
%if %{build_ada}
# Using the host gnatmake like
# --enable-threads=posix \
#%endif
# --enable-shared \
+%if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
+# temporary workaround for a miscompilation of hash functions in java code
+GCJ_EXTRA_FLAGS="-marm"
+%endif
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
-TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
+TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS $GCJ_EXTRA_FLAGS" \
../configure \
--prefix=%{_prefix} \
--infodir=%{_infodir} \
--mandir=%{_mandir} \
--libdir=%{_libdir} \
--libexecdir=%{_libdir} \
+ --disable-bootstrap \
--enable-languages=$languages \
$ENABLE_CHECKING \
--with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
--enable-ssp \
--disable-libssp \
- --disable-libitm \
-%if 0%{?fast_build}
- --disable-bootstrap \
-%endif
--disable-plugin \
--with-bugurl="http://bugs.tizen.org/" \
- --with-pkgversion="Tizen Linux" \
+ --with-pkgversion="Tizen" \
%if !%{build_libjava}
--disable-libgcj \
%else
%if 0%{?canonical_target:1}
--with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
%endif
+%if 0%{?sysroot:1}
+ --with-sysroot=%sysroot \
+%endif
%if 0%{?build_static:1}
--disable-shared \
%endif
%if "%{TARGET_ARCH}" == "spu"
- --with-sysroot=/usr/spu \
- --with-gxx-include-dir=%{_prefix}/spu/include/c++/%{gcc_dir_version} \
+ --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
--with-newlib \
%endif
--disable-nls \
%else
--program-suffix=%{binsuffix} \
--enable-linux-futex \
+%ifarch ia64
+ --with-system-libunwind \
+%else
--without-system-libunwind \
%endif
+%endif
%if "%{TARGET_ARCH}" == "armv5tel"
--with-arch=armv5te \
--with-float=soft \
--with-abi=aapcs-linux \
--disable-sjlj-exceptions \
%endif
-%if "%{TARGET_ARCH}" == "armv7el"
+%if "%{TARGET_ARCH}" == "armv7l"
--with-arch=armv7-a \
- --with-tune=cortex-a9 \
- --with-float=soft \
- --with-abi=softfp \
+ --with-tune=cortex-a8 \
+ --with-float=softfp \
--with-fpu=vfpv3 \
--disable-sjlj-exceptions \
%endif
-%if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
+%if "%{TARGET_ARCH}" == "armv7hl"
--with-arch=armv7-a \
--with-tune=cortex-a9 \
--with-float=hard \
--with-fpu=vfpv3-d16 \
--disable-sjlj-exceptions \
%endif
+%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
+%if "%{TARGET_ARCH}" == "powerpc"
+ --with-cpu=default32 \
+%endif
+ --with-cpu-64=power4 \
+ --enable-secureplt \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc64"
+ --with-cpu=ultrasparc \
+ --with-long-double-128 \
+%endif
+%if "%{TARGET_ARCH}" == "sparc"
+ --with-cpu=v8 \
+ --with-long-double-128 \
+%endif
%if "%{TARGET_ARCH}" == "i586"
--with-arch-32=i586 \
--with-tune=generic \
--with-arch-32=i586 \
--with-tune=generic \
%endif
+%if "%{TARGET_ARCH}" == "s390"
+ --with-tune=z196 --with-arch=z10 \
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
+%if "%{TARGET_ARCH}" == "s390x"
+ --with-tune=z196 --with-arch=z10 \
+ --with-long-double-128 \
+ --enable-decimal-float \
+%endif
--build=%{GCCDIST}
-# COMMON-END
-# COMMON-END
-make %{?jobs:-j%jobs} all-gcc TARGET-gcc="cc1 cc1plus gcc-cross g++ native"
+make %{?jobs:-j%jobs} all-gcc TARGET-gcc="cc1 cc1plus gcc-cross xg++ native"
%install
cd obj-%{GCCDIST}