2 # spec file for package gcc (Version 4.0.1)
4 # Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany.
5 # This file and all modifications and additions to the pristine
6 # package are under the same license as the package itself.
8 # Please submit bugfixes or comments via http://www.suse.de/feedback/
13 %define build_libjava 0
15 %define build_fortran 0
19 %define build_with_mudflap 0
20 %define gcc_target_arch armv7el-tizen-linux
21 %define gcc_icecream 1
23 %define binutils_target armv7el
24 %if %{binutils_target} == "armv7l" || %{binutils_target} == "armv7hl" || %{binutils_target} == "armv7el"
25 %define binutils_target arm
27 %if %{binutils_target} == "armv5el"
28 %define binutils_target arm
30 %define canonical_target %(echo %{binutils_target} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
31 %if %{binutils_target} == "arm"
32 %define canonical_target_abi -gnueabi
35 Name: cross-armv7el-gcc47-icecream-backend
36 BuildRequires: cross-%{binutils_target}-binutils
39 BuildRequires: gettext-devel
40 BuildRequires: glibc-devel-32bit
41 BuildRequires: mpc-devel
42 BuildRequires: mpfr-devel
44 BuildRequires: makeinfo
45 BuildRequires: zlib-devel
46 %ifarch %ix86 x86_64 %arm
47 BuildRequires: cloog-devel
48 BuildRequires: ppl-devel
51 BuildRequires: libunwind-devel
53 ExclusiveArch: ppc ppc64 %ix86 x86_64 ia64
54 %define _binary_payload w.ufdio
58 %define biarch_targets x86_64
60 URL: http://gcc.gnu.org/
63 %define gcc_version %(echo %version | sed 's/_.*//')
64 %define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
65 %define snapshot_date %(echo %version | sed 's/[34]\.[0-9]\.[0-6]//' | sed 's/_/-/')
66 %define binsuffix -4.7
69 BuildRoot: %{_tmppath}/%{name}-%{version}-build
70 Source: gcc-%{gcc_version}%{snapshot_date}.tar.bz2
72 Source2: libgcj47-rpmlintrc
73 Source3: gcc47-rpmlintrc
75 Source5: README.First-for.SuSE.packagers
76 Source6: baselibs.conf
78 # GCC-TESTSUITE-DELETE-BEGIN
80 # LIBJAVA-DELETE-BEGIN
81 Group: Development/Languages/C and C++
82 Summary: The GNU C Compiler and Support Files
86 Core package for the GNU Compiler Collection, including the C language
89 Language frontends other than C are split to different sub-packages,
90 namely gcc-ada, gcc-c++, gcc-fortran, gcc-java, gcc-objc and
98 # Define the canonical target and host architecture
99 # %gcc_target_arch is supposed to be the full target triple
100 # %TARGET_ARCH is the canonicalized CPU part
101 # %CONFIGURE_TARGET is the target triple used for --target=
102 %if 0%{?gcc_target_arch:1}
103 %define CONFIGURE_TARGET %{gcc_target_arch}
104 %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/;")
105 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
106 %define CONFIGURE_TARGET i586-tizen-linux
108 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
109 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
111 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
112 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
114 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7el"
115 %define CONFIGURE_TARGET armv7el-tizen-linux-gnueabi
117 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5el"
118 %define CONFIGURE_TARGET armv5el-tizen-linux-gnueabi
121 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
123 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
125 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
128 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
130 %define GCCDIST %{HOST_ARCH}-tizen-linux
133 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
134 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
140 %setup -q -n gcc-%{gcc_version}%{snapshot_date}
143 # Avoid rebuilding of generated files
144 contrib/gcc_update --touch
145 # Avoid fucking up testsuite results with Java and indirect dispatch
146 export LD_AS_NEEDED=0
147 # Split version file into version used for directories (X.Y) and
148 # version to report with --version (X.Y.Z).
149 # See also gcc-dir-version.patch.
150 # Also decrement the patchlevel version by one
151 if test `cat gcc/DEV-PHASE` == "prerelease"; then
152 ( 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
154 mv gcc/BASE-VER gcc/FULL-VER
156 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
158 rm -rf obj-%{GCCDIST}
161 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
162 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' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
164 # -mcpu is superceded by -mtune but -mtune is not supported by
165 # our bootstrap compiler. -mcpu gives a warning that stops
166 # the build process, so remove it for now. Also remove all other
167 # -march and -mtune flags. They are superseeded by proper
168 # default compiler settings now.
169 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'`
171 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
172 # Kill all -march/tune/cpu because that screws building the target libs
173 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
175 # Replace 2 spaces by one finally
176 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
180 languages=$languages,c++
183 languages=$languages,objc
186 languages=$languages,fortran
189 languages=$languages,obj-c++
192 languages=$languages,java
195 languages=$languages,ada
199 if test -z "$J"; then
200 J=$(getconf _NPROCESSORS_CONF)
203 test 1 -gt "$J" && J=1
204 JL=$(($(getconf _NPROCESSORS_CONF)*2))
206 if test "$J" == "0"; then
209 if test "$JL" == "0"; then
212 PARALLEL="-j$J -l$JL"
214 # we don't want some miscompiles in the testsuite, or some fault in
215 # the compiler to kill the machine. Hence we limit the amount of memory
216 # by the physical RAM plus half of swap
217 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
218 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
219 #ulimit -v $(((MEM + SWAP/2)*1024))
221 # In general we want to ship release checking enabled compilers
222 # and run BETA with checking enabled.
223 #ENABLE_CHECKING="--enable-checking=yes"
224 ENABLE_CHECKING="--enable-checking=release"
226 # Work around tail/head -1 changes
227 export _POSIX2_VERSION=199209
229 # configure tries to parse include/features.h to detect
230 # if glibc supports SSP. When cross compiling we would need
231 # to install a cross glibc, which we don't, or make the whole
232 # thing point to the native glibc, which is in /, hence the
236 # Using the host gnatmake like
237 # CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
238 # GNATMAKE="gnatmake%{hostsuffix}"
239 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
241 mkdir -p host-tools/bin
242 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
243 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
244 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
245 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
246 ln -sf /usr/%{_lib} host-tools/%{_lib}
247 export PATH="`pwd`/host-tools/bin:$PATH"
249 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
251 # --enable-threads=posix \
254 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
255 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
257 --prefix=%{_prefix} \
258 --infodir=%{_infodir} \
259 --mandir=%{_mandir} \
260 --libdir=%{_libdir} \
261 --libexecdir=%{_libdir} \
262 --enable-languages=$languages \
264 --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
269 --disable-bootstrap \
272 --with-bugurl="http://bugs.tizen.org/" \
273 --with-pkgversion="Tizen Linux" \
274 %if !%{build_libjava}
277 --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
278 --with-ecj-jar=%{libsubdir}/ecj.jar \
280 %if !%{biarch_libjava}
281 --disable-libjava-multilib \
284 %if !%{build_with_mudflap}
285 --disable-libmudflap \
287 --with-slibdir=/%{_lib} \
289 --enable-__cxa_atexit \
290 --enable-libstdcxx-allocator=new \
291 --disable-libstdcxx-pch \
292 --enable-version-specific-runtime-libs \
293 --enable-linker-build-id \
294 %if 0%{?gcc_target_arch:1}
295 %if 0%{?gcc_icecream:1}
296 --with-build-sysroot=/ \
297 --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
298 --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
299 --enable-linux-futex \
301 %if 0%{?canonical_target:1}
302 --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
304 %if 0%{?build_static:1}
307 %if "%{TARGET_ARCH}" == "spu"
308 --with-sysroot=/usr/spu \
309 --with-gxx-include-dir=%{_prefix}/spu/include/c++/%{gcc_dir_version} \
313 --target=%{CONFIGURE_TARGET} \
315 --program-suffix=%{binsuffix} \
316 --enable-linux-futex \
318 --with-system-libunwind \
320 --without-system-libunwind \
323 %if "%{TARGET_ARCH}" == "armv5tel"
324 --with-arch=armv5te \
327 --with-abi=aapcs-linux \
328 --disable-sjlj-exceptions \
330 %if "%{TARGET_ARCH}" == "armv7el"
331 --with-arch=armv7-a \
332 --with-tune=cortex-a9 \
336 --disable-sjlj-exceptions \
338 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
339 --with-arch=armv7-a \
340 --with-tune=cortex-a9 \
342 --with-abi=aapcs-linux \
343 --with-fpu=vfpv3-d16 \
344 --disable-sjlj-exceptions \
346 %if "%{TARGET_ARCH}" == "i586"
347 --with-arch-32=i586 \
348 --with-tune=generic \
350 %if "%{TARGET_ARCH}" == "x86_64"
351 --with-arch-32=i586 \
352 --with-tune=generic \
359 make %{?jobs:-j%jobs} all-gcc TARGET-gcc="cc1 cc1plus gcc-cross g++ native"
363 rm -rf $RPM_BUILD_ROOT
364 make -C gcc DESTDIR=$RPM_BUILD_ROOT/inst install-driver install-common
365 make DESTDIR=$RPM_BUILD_ROOT/inst maybe-install-lto-plugin
367 # But the assembler comes from the cross-binutils, and hence is _not_
368 # named funnily, not even on ppc, so there we need the original target
369 install -s -D %{_prefix}/bin/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}-as \
370 $RPM_BUILD_ROOT/env/usr/bin/as
371 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-g++ \
372 $RPM_BUILD_ROOT/env/usr/bin/g++
373 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-gcc \
374 $RPM_BUILD_ROOT/env/usr/bin/gcc
376 %define targetlibsubdir %{_libdir}/gcc/%{CONFIGURE_TARGET}/%{gcc_dir_version}
377 for back in cc1 cc1plus; do
378 install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/$back \
379 $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
381 if test -f $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so; then
382 install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so \
383 $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
386 libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do \
387 ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }' ;\
390 # Check wether the same library also exists in the parent directory,
391 # and prefer that on the assumption that it is a more generic one.
392 baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
393 test -f "$baselib" && lib=$baselib
394 install -s -D $lib $RPM_BUILD_ROOT/env$lib
396 rm -rf $RPM_BUILD_ROOT/inst
397 cd $RPM_BUILD_ROOT/env
398 tar cvzf ../%{name}_%{_arch}.tar.gz *
400 mkdir -p usr/share/icecream-envs
401 mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
402 rpm -q --changelog glibc > usr/share/icecream-envs/%{name}_%{_arch}.glibc
403 rpm -q --changelog binutils > usr/share/icecream-envs/%{name}_%{_arch}.binutils
408 rm -rf $RPM_BUILD_ROOT
411 %defattr(-,root,root)
412 /usr/share/icecream-envs
414 %changelog -n cross-armv7el-gcc47-icecream-backend