5bfbe3f78e4657f23ee7b167463879528ebaff07
[platform/upstream/gcc48.git] / packaging / cross-armv7el-gcc47-icecream-backend.spec
1 #
2 # spec file for package gcc (Version 4.0.1)
3 #
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.
7 #
8 # Please submit bugfixes or comments via http://www.suse.de/feedback/
9 #
10
11 %define build_cp 1
12 %define build_ada 0
13 %define build_libjava 0
14 %define build_java 0
15 %define build_fortran 0
16 %define build_objc 0
17 %define build_objcp 0
18 %define build_nof 0
19 %define build_with_mudflap 0
20 %define gcc_target_arch armv7el-tizen-linux
21 %define gcc_icecream 1
22
23 %define binutils_target armv7el
24 %if %{binutils_target} == "armv7l" || %{binutils_target} == "armv7hl" || %{binutils_target} == "armv7el"
25 %define binutils_target arm
26 %endif
27 %if %{binutils_target} == "armv5el"
28 %define binutils_target arm
29 %endif
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
33 %endif
34
35 Name:         cross-armv7el-gcc47-icecream-backend
36 BuildRequires: cross-%{binutils_target}-binutils
37 BuildRequires: bison
38 BuildRequires: flex
39 BuildRequires: gettext-devel
40 BuildRequires: glibc-devel-32bit
41 BuildRequires: mpc-devel
42 BuildRequires: mpfr-devel
43 BuildRequires: perl
44 BuildRequires: makeinfo
45 BuildRequires: zlib-devel
46 %ifarch %ix86 x86_64  %arm
47 BuildRequires: cloog-devel
48 BuildRequires: ppl-devel
49 %endif
50 %ifarch ia64
51 BuildRequires: libunwind-devel
52 %endif
53 ExclusiveArch: ppc ppc64 %ix86 x86_64 ia64 
54 %define _binary_payload w.ufdio
55
56 # COMMON-BEGIN
57 # COMMON-BEGIN
58 %define biarch_targets x86_64 
59
60 URL:          http://gcc.gnu.org/
61 Version: 4.7.2
62 Release:      1
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
67 # COMMON-END
68 # COMMON-BEGIN
69 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
70 #Source:                gcc-%{gcc_version}%{snapshot_date}.tar.bz2
71 Source:     gcc-%{version}.tar.bz2
72
73 Source1:        change_spec
74 Source2:        libgcj47-rpmlintrc
75 Source3:        gcc47-rpmlintrc
76 Source4:        ecj.jar
77 Source6:        baselibs.conf
78 # Patches auto-generated by git-buildpackage:
79 Patch0:     0001-dir-version.patch
80 Patch1:     0002-textdomain.patch
81 Patch2:     0003-rename-info-files.patch
82
83 # GCC-TESTSUITE-DELETE-BEGIN
84 # LIBFFI-DELETE-BEGIN
85 # LIBJAVA-DELETE-BEGIN
86 Group:          Development/Languages/C and C++
87 Summary:        The GNU C Compiler and Support Files
88 License:        GPL-3.0+
89
90 %description
91 Core package for the GNU Compiler Collection, including the C language
92 frontend.
93
94 Language frontends other than C are split to different sub-packages,
95 namely gcc-ada, gcc-c++, gcc-fortran, gcc-java, gcc-objc and
96 gcc-obj-c++.
97
98
99
100 # COMMON-END
101 # COMMON-BEGIN
102
103 # Define the canonical target and host architecture
104 #   %gcc_target_arch  is supposed to be the full target triple
105 #   %TARGET_ARCH      is the canonicalized CPU part
106 #   %CONFIGURE_TARGET is the target triple used for --target=
107 %if 0%{?gcc_target_arch:1}
108 %define CONFIGURE_TARGET %{gcc_target_arch}
109 %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/;")
110 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
111 %define CONFIGURE_TARGET i586-tizen-linux
112 %endif
113 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
114 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
115 %endif
116 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
117 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
118 %endif
119 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7el"
120 %define CONFIGURE_TARGET armv7el-tizen-linux-gnueabi
121 %endif
122 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5el"
123 %define CONFIGURE_TARGET armv5el-tizen-linux-gnueabi
124 %endif
125 %else
126 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
127 %endif
128 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
129
130 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
131
132 %ifarch %arm
133 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
134 %else
135 %define GCCDIST %{HOST_ARCH}-tizen-linux
136 %endif
137
138 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
139 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
140
141 # COMMON-END
142 # COMMON-BEGIN
143
144 %prep
145 #%setup -q -n gcc-%{gcc_version}%{snapshot_date}
146 %setup -q -n gcc-%{version}
147 # 0001-dir-version.patch
148 %patch0 -p1
149 %patch1 -p1
150 %patch2 -p1
151
152 %build
153 # Avoid rebuilding of generated files
154 contrib/gcc_update --touch
155 # Avoid fucking up testsuite results with Java and indirect dispatch
156 export LD_AS_NEEDED=0
157 # Split version file into version used for directories (X.Y) and
158 # version to report with --version (X.Y.Z).
159 # See also gcc-dir-version.patch.
160 # Also decrement the patchlevel version by one
161 if test `cat gcc/DEV-PHASE` == "prerelease"; then
162   ( 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
163 else
164   mv gcc/BASE-VER gcc/FULL-VER
165 fi
166 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
167
168 rm -rf obj-%{GCCDIST}
169 mkdir obj-%{GCCDIST}
170 cd obj-%{GCCDIST}
171 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
172 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'`
173 %ifarch %ix86
174 # -mcpu is superceded by -mtune but -mtune is not supported by
175 # our bootstrap compiler.  -mcpu gives a warning that stops
176 # the build process, so remove it for now.  Also remove all other
177 # -march and -mtune flags.  They are superseeded by proper
178 # default compiler settings now.
179 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'`
180 %endif
181 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
182 # Kill all -march/tune/cpu because that screws building the target libs
183 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
184 %endif
185 # Replace 2 spaces by one finally
186 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  / /g'`
187
188 languages=c
189 %if %{build_cp}
190 languages=$languages,c++
191 %endif
192 %if %{build_objc}
193 languages=$languages,objc
194 %endif
195 %if %{build_fortran}
196 languages=$languages,fortran
197 %endif
198 %if %{build_objcp}
199 languages=$languages,obj-c++
200 %endif
201 %if %{build_java}
202 languages=$languages,java
203 %endif
204 %if %{build_ada}
205 languages=$languages,ada
206 %endif
207
208 J=%{?jobs:%jobs}
209 if test -z "$J"; then
210   J=$(getconf _NPROCESSORS_CONF)
211   JL=$(($J * 2))
212 else
213   test 1 -gt "$J" && J=1
214   JL=$(($(getconf _NPROCESSORS_CONF)*2))
215 fi
216 if test "$J" == "0"; then
217   J=1
218 fi
219 if test "$JL" == "0"; then
220   JL=1
221 fi
222 PARALLEL="-j$J -l$JL"
223
224 # we don't want some miscompiles in the testsuite, or some fault in
225 # the compiler to kill the machine.  Hence we limit the amount of memory
226 # by the physical RAM plus half of swap
227 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
228 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
229 #ulimit -v $(((MEM + SWAP/2)*1024))
230
231 # In general we want to ship release checking enabled compilers
232 # and run BETA with checking enabled.
233 #ENABLE_CHECKING="--enable-checking=yes"
234 ENABLE_CHECKING="--enable-checking=release"
235
236 # Work around tail/head -1 changes
237 export _POSIX2_VERSION=199209
238
239 # configure tries to parse include/features.h to detect
240 # if glibc supports SSP.  When cross compiling we would need
241 # to install a cross glibc, which we don't, or make the whole
242 # thing point to the native glibc, which is in /, hence the
243 # --with-sysroot=/
244
245 %if %{build_ada}
246 # Using the host gnatmake like
247 #   CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
248 #   GNATMAKE="gnatmake%{hostsuffix}"
249 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
250 # available
251 mkdir -p host-tools/bin
252 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
253 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
254 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
255 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
256 ln -sf /usr/%{_lib} host-tools/%{_lib}
257 export PATH="`pwd`/host-tools/bin:$PATH"
258 %endif
259 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
260 #%else
261 #       --enable-threads=posix \
262 #%endif
263 #       --enable-shared \
264 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
265 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
266 ../configure \
267         --prefix=%{_prefix} \
268         --infodir=%{_infodir} \
269         --mandir=%{_mandir} \
270         --libdir=%{_libdir} \
271         --libexecdir=%{_libdir} \
272         --enable-languages=$languages \
273         $ENABLE_CHECKING \
274         --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
275         --enable-ssp \
276         --disable-libssp \
277         --disable-libitm \
278 %if 0%{?fast_build}
279         --disable-bootstrap \
280 %endif
281         --disable-plugin \
282         --with-bugurl="http://bugs.tizen.org/" \
283         --with-pkgversion="Tizen Linux" \
284 %if !%{build_libjava}
285         --disable-libgcj \
286 %else
287         --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
288         --with-ecj-jar=%{libsubdir}/ecj.jar \
289         --disable-java-awt \
290 %if !%{biarch_libjava}
291         --disable-libjava-multilib \
292 %endif
293 %endif
294 %if !%{build_with_mudflap}
295         --disable-libmudflap \
296 %endif
297         --with-slibdir=/%{_lib} \
298         --with-system-zlib \
299         --enable-__cxa_atexit \
300         --enable-libstdcxx-allocator=new \
301         --disable-libstdcxx-pch \
302         --enable-version-specific-runtime-libs \
303         --enable-linker-build-id \
304 %if 0%{?gcc_target_arch:1}
305 %if 0%{?gcc_icecream:1}
306         --with-build-sysroot=/ \
307         --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
308         --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
309         --enable-linux-futex \
310 %endif
311 %if 0%{?canonical_target:1}
312         --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
313 %endif
314 %if 0%{?build_static:1}
315         --disable-shared \
316 %endif
317 %if "%{TARGET_ARCH}" == "spu"
318         --with-sysroot=/usr/spu \
319         --with-gxx-include-dir=%{_prefix}/spu/include/c++/%{gcc_dir_version} \
320         --with-newlib \
321 %endif
322         --disable-nls \
323         --target=%{CONFIGURE_TARGET} \
324 %else
325         --program-suffix=%{binsuffix} \
326         --enable-linux-futex \
327 %ifarch ia64
328         --with-system-libunwind \
329 %else
330         --without-system-libunwind \
331 %endif
332 %endif
333 %if "%{TARGET_ARCH}" == "armv5tel"
334         --with-arch=armv5te \
335         --with-float=soft \
336         --with-mode=arm \
337         --with-abi=aapcs-linux \
338         --disable-sjlj-exceptions \
339 %endif
340 %if "%{TARGET_ARCH}" == "armv7el" 
341         --with-arch=armv7-a \
342         --with-tune=cortex-a9 \
343         --with-float=soft \
344         --with-abi=softfp \
345         --with-fpu=vfpv3 \
346         --disable-sjlj-exceptions \
347 %endif
348 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
349         --with-arch=armv7-a \
350         --with-tune=cortex-a9 \
351         --with-float=hard \
352         --with-abi=aapcs-linux \
353         --with-fpu=vfpv3-d16 \
354         --disable-sjlj-exceptions \
355 %endif
356 %if "%{TARGET_ARCH}" == "i586"
357         --with-arch-32=i586 \
358         --with-tune=generic \
359 %endif
360 %if "%{TARGET_ARCH}" == "x86_64"
361         --with-arch-32=i586 \
362         --with-tune=generic \
363 %endif
364         --build=%{GCCDIST}
365
366 # COMMON-END
367 # COMMON-END
368
369 make %{?jobs:-j%jobs} all-gcc TARGET-gcc="cc1 cc1plus gcc-cross g++ native"
370
371 %install
372 cd obj-%{GCCDIST}
373 rm -rf $RPM_BUILD_ROOT
374 make -C gcc DESTDIR=$RPM_BUILD_ROOT/inst install-driver install-common
375 make DESTDIR=$RPM_BUILD_ROOT/inst maybe-install-lto-plugin
376
377 # But the assembler comes from the cross-binutils, and hence is _not_
378 # named funnily, not even on ppc, so there we need the original target
379 install -s -D %{_prefix}/bin/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}-as \
380         $RPM_BUILD_ROOT/env/usr/bin/as
381 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-g++ \
382         $RPM_BUILD_ROOT/env/usr/bin/g++
383 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-gcc \
384         $RPM_BUILD_ROOT/env/usr/bin/gcc
385
386 %define targetlibsubdir %{_libdir}/gcc/%{CONFIGURE_TARGET}/%{gcc_dir_version}
387 for back in cc1 cc1plus; do 
388         install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/$back \
389                 $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
390 done
391 if test -f $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so; then
392   install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so \
393                 $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
394 fi
395
396 libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do \
397   ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }'  ;\
398 done | sort -u `
399 for lib in $libs; do
400    # Check wether the same library also exists in the parent directory,
401    # and prefer that on the assumption that it is a more generic one.
402    baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
403    test -f "$baselib" && lib=$baselib
404    install -s -D $lib $RPM_BUILD_ROOT/env$lib
405 done
406 rm -rf $RPM_BUILD_ROOT/inst
407 cd $RPM_BUILD_ROOT/env
408 tar cvzf ../%{name}_%{_arch}.tar.gz *
409 cd ..
410 mkdir -p usr/share/icecream-envs
411 mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
412 rpm -q --changelog glibc >  usr/share/icecream-envs/%{name}_%{_arch}.glibc
413 rpm -q --changelog binutils >  usr/share/icecream-envs/%{name}_%{_arch}.binutils
414 rm -r env
415 cd $RPM_BUILD_DIR
416
417 %clean
418 rm -rf $RPM_BUILD_ROOT
419
420 %files
421 %defattr(-,root,root)
422 /usr/share/icecream-envs
423
424 %changelog -n cross-armv7el-gcc47-icecream-backend