Fixed package groups
[platform/upstream/gcc48.git] / packaging / libffi47.spec
1 %define building_libffi 1
2 %define fast_build 1
3
4 # Ada currently fails to build on a few platforms, enable it only
5 # on those that work
6 # Note that AdaCore only supports %ix86, x86_64 and ia64
7 %ifarch %ix86 x86_64
8 %define build_ada !0%{?building_libjava:1}%{?building_libffi:1}
9 %else
10 %define build_ada 0
11 %endif
12
13 %define quadmath_arch %ix86 x86_64 
14
15 # We don't want to build java
16 %define build_java 1
17 %define build_libjava 0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
18
19 %define build_cp 1
20 %define build_fortran 1
21 %define build_objc 1
22 %define build_objcp !0%{?building_libjava:1}%{?building_libffi:1}
23 %define build_with_mudflap 0
24
25 %if %{build_objcp}
26 %define build_cp 1
27 %define build_objc 1
28 %endif
29
30 %if %{build_libjava}
31 %define build_cp 1
32 %endif
33
34 # For optional compilers only build C, C++ and Fortran
35 ##%if 0%{?build_optional_compiler:1}%{?build_optional_compiler_languages:1}
36 %if 0%{!?building_libffi:1}
37 %define build_ada 0
38 %define build_java 0
39 %define build_libjava 0
40 %define build_objc 1
41 %define build_objcp 1
42 %endif
43
44
45 Name: libffi47
46 BuildRequires: bison
47 BuildRequires: flex
48 BuildRequires: gettext-tools
49 BuildRequires: makeinfo
50 BuildRequires: glibc-devel-32bit
51 BuildRequires: mpc-devel
52 BuildRequires: mpfr-devel
53 BuildRequires: perl
54 BuildRequires: texinfo
55 BuildRequires: zlib-devel
56 %ifarch %ix86 x86_64 %arm
57 BuildRequires: cloog-devel
58 BuildRequires: ppl-devel
59 %endif
60 %if %{build_ada}
61 %define hostsuffix -4.7
62 BuildRequires: gcc47-ada
63 %endif
64 %if 0%{?building_libjava:1}%{?building_testsuite:1}
65 BuildRequires: fastjar
66 BuildRequires: unzip
67 %endif
68 %if 0%{?building_libffi:1}
69 BuildRequires: pkg-config
70 %endif
71 %if 0%{?run_tests:1}
72 BuildRequires: dejagnu
73 BuildRequires: expect
74 BuildRequires: gdb
75 %endif
76
77 # Define version number of libgcc_s
78 %define libgcc_s 1
79 %define build_nof 0
80
81 %define separate_bi32 0
82 %define separate_bi64 0
83 %ifarch x86_64 
84 %define separate_bi32 1
85 %endif
86
87 # Define two macros to trigger -32bit or -64bit package variants
88 %define separate_biarch 0
89 %if %{separate_bi32}
90 %define separate_biarch 1
91 %define separate_biarch_suffix -32bit
92 %endif
93 %if %{separate_bi64}
94 %define separate_biarch 1
95 %define separate_biarch_suffix -64bit
96 %endif
97
98 %ifarch x86_64
99 # 64-bit is primary build target
100 %define build_primary_64bit 1
101 %else
102 %define build_primary_64bit 0
103 %endif
104
105 %define biarch_libjava 0
106
107 # COMMON-BEGIN
108 %define biarch_targets x86_64 
109
110 URL:          http://gcc.gnu.org/
111 Version: 4.7.2
112 Release:      1
113 %define gcc_version %(echo %version | sed 's/_.*//')
114 %define gcc_dir_version %(echo %gcc_version | cut -d '.' -f 1-2)
115 %define snapshot_date %(echo %version | sed 's/[34]\.[0-9]\.[0-6]//' | sed 's/_/-/')
116 %define binsuffix -4.7
117 # COMMON-END
118
119 %if !0%{?building_libjava:1}%{?building_libffi:1}%{?building_testsuite:1}
120 Requires: binutils glibc-devel
121 Requires: cpp47 = %{version}-%{release}
122 %if 0%{!?build_optional_compiler:1}
123 Requires: libgcc%{libgcc_s} >= %{version}-%{release}
124 Requires: libgomp1 >= %{version}-%{release}
125 %if %{build_with_mudflap}
126 Requires: libmudflap0 >= %{version}-%{release}
127 Requires: libmudflapth0 >= %{version}-%{release}
128 %endif
129 %else
130 Requires: libgcc47 = %{version}-%{release}
131 Requires: libgomp47 = %{version}-%{release}
132 %endif
133 %endif
134
135 # COMMON-BEGIN
136 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
137 #Source:                gcc-%{gcc_version}%{snapshot_date}.tar.bz2
138 Source:     gcc-%{version}.tar.bz2
139
140 Source1:        change_spec
141 Source2:        libgcj47-rpmlintrc
142 Source3:        gcc47-rpmlintrc
143 Source4:        ecj.jar
144 Source6:        baselibs.conf
145 # Patches auto-generated by git-buildpackage:
146 Patch0:     0001-dir-version.patch
147 Patch1:     0002-textdomain.patch
148 Patch2:     0003-rename-info-files.patch
149 Patch3:     0004-ARM-linker.patch
150
151 # GCC-TESTSUITE-DELETE-BEGIN
152 # PACKAGE-BEGIN
153 # PACKAGE-BEGIN
154 Summary:      Foreign Function Interface library
155 License:        BSD-3-Clause
156 Group:        Base/Libraries
157 Provides: g-wrap:/usr/lib/libffi.so.4
158 Provides: libffi4 = %{version}-%{release}
159 Conflicts: libffi4 < %{version}-%{release}
160
161 %description 
162 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
163
164 %post 
165 /sbin/ldconfig
166
167 %postun 
168 /sbin/ldconfig
169 # PACKAGE-END
170 # PACKAGE-BEGIN
171 # PACKAGE-BEGIN
172 %package -n libffi47-32bit
173 Summary:      Foreign Function Interface library
174 License:        BSD-3-Clause
175 Group:        Base/Libraries
176 Provides: g-wrap:/usr/lib/libffi.so.4
177 Provides: libffi4-32bit = %{version}-%{release}
178 Conflicts: libffi4-32bit < %{version}-%{release}
179
180 %description -n libffi47-32bit
181 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
182
183 %post -n libffi47-32bit
184 /sbin/ldconfig
185
186 %postun -n libffi47-32bit
187 /sbin/ldconfig
188 # PACKAGE-END
189 # PACKAGE-BEGIN
190 # PACKAGE-BEGIN
191 %package -n libffi47-64bit
192 Summary:      Foreign Function Interface library
193 License:        BSD-3-Clause
194 Group:        Base/Libraries
195 Provides: g-wrap:/usr/lib/libffi.so.4
196 Provides: libffi4-64bit = %{version}-%{release}
197 Conflicts: libffi4-64bit < %{version}-%{release}
198
199 %description -n libffi47-64bit
200 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
201
202 %post -n libffi47-64bit
203 /sbin/ldconfig
204
205 %postun -n libffi47-64bit
206 /sbin/ldconfig
207 # PACKAGE-END
208
209 # PACKAGE-BEGIN
210 # PACKAGE-BEGIN
211 %package -n libffi47-devel
212 Summary:      Foreign Function Interface library development files
213 License:        BSD 3-Clause
214 Group:        Development/Toolchain
215 Requires: libffi4 >= %{version}-%{release}
216 Provides: libffi-devel = %{version}-%{release}
217 Conflicts: libffi-devel < %{version}-%{release}
218
219 %description -n libffi47-devel
220 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
221 # PACKAGE-END
222 # PACKAGE-BEGIN
223 # PACKAGE-BEGIN
224 %package -n libffi47-devel-32bit
225 Summary:      Foreign Function Interface library development files
226 License:        BSD 3-Clause
227 Group:        Development/Toolchain
228 Requires: libffi4-32bit >= %{version}-%{release}
229 Provides: libffi-devel-32bit = %{version}-%{release}
230 Conflicts: libffi-devel-32bit < %{version}-%{release}
231
232 %description -n libffi47-devel-32bit
233 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
234 # PACKAGE-END
235 # PACKAGE-BEGIN
236 # PACKAGE-BEGIN
237 %package -n libffi47-devel-64bit
238 Summary:      Foreign Function Interface library development files
239 License:        BSD 3-Clause
240 Group:        Development/Toolchain
241 Requires: libffi4-64bit >= %{version}-%{release}
242 Provides: libffi-devel-64bit = %{version}-%{release}
243 Conflicts: libffi-devel-64bit < %{version}-%{release}
244
245 %description -n libffi47-devel-64bit
246 A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language.
247 # PACKAGE-END
248
249 %package -n gcc47-testresults
250 # GCC-TESTSUITE-DELETE-END
251 Summary:      Testsuite results
252 License:        Public-Domain
253 Group:        Development/Toolchain
254
255 %description -n gcc47-testresults
256 Results from running the gcc and target library testsuites.
257
258
259 # COMMON-BEGIN
260
261 # Define the canonical target and host architecture
262 #   %gcc_target_arch  is supposed to be the full target triple
263 #   %TARGET_ARCH      is the canonicalized CPU part
264 #   %CONFIGURE_TARGET is the target triple used for --target=
265 %if 0%{?gcc_target_arch:1}
266 %define CONFIGURE_TARGET %{gcc_target_arch}
267 %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/;")
268 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
269 %define CONFIGURE_TARGET i586-tizen-linux
270 %endif
271 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
272 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
273 %endif
274 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
275 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
276 %endif
277 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7el"
278 %define CONFIGURE_TARGET armv7el-tizen-linux-gnueabi
279 %endif
280 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5el"
281 %define CONFIGURE_TARGET armv5el-tizen-linux-gnueabi
282 %endif
283 %else
284 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
285 %endif
286 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
287
288 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
289
290 %ifarch %arm
291 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
292 %else
293 %define GCCDIST %{HOST_ARCH}-tizen-linux
294 %endif
295
296 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
297 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
298
299 # COMMON-END
300
301 # Versionspecific directories
302 %define versmainlibdir %{libsubdir}
303 %define versmainlibdirbi32 %{libsubdir}/32
304 %define versmainlibdirbi64 %{libsubdir}/64
305 %if %{build_primary_64bit}
306 %define versmainlibdirbi %{versmainlibdirbi32}
307 %else
308 %define versmainlibdirbi %{versmainlibdirbi64}
309 %endif
310
311 %if 0%{?build_optional_compiler:1}
312 %define mainlibdir %{versmainlibdir}
313 %define mainlibdirbi32 %{versmainlibdirbi32}
314 %define mainlibdirbi64 %{versmainlibdirbi64}
315 %define noflibdir %{versnoflibdir}
316 %define mainlibdirbi %{versmainlibdirbi}
317 %else
318 %define mainlibdir %{_libdir}
319 %define mainlibdirbi32 %{_prefix}/lib
320 %define mainlibdirbi64 %{_prefix}/lib64
321 %define noflibdir %{_prefix}/lib/nof
322 %if %{build_primary_64bit}
323 %define mainlibdirbi %{mainlibdirbi32}
324 %else
325 %define mainlibdirbi %{mainlibdirbi64}
326 %endif
327 %endif
328
329
330 # Now define a few macros that make it easy to package libs and
331 # related files just to the right package, without caring for the
332 # exact path the files are in.
333 #   %mainlib  package X from all dirs that belong to the main package
334 #   %biarchlib   package X from all dirs that belong to the -32/64bit package
335 # by default, nof libs go where the 32bit libs go.
336 %if %{build_nof}
337 %define mainlib() %{mainlibdir}/%1\
338 %{noflibdir}/%1\
339 %{nil}
340 %else
341 %define mainlib() %{mainlibdir}/%1\
342 %{nil}
343 %endif
344 %define biarchlib() %{nil}
345 %if %{biarch}
346 %if !%{separate_biarch}
347 %if %{build_nof}
348 %define mainlib() %{mainlibdir}/%1\
349 %{mainlibdirbi}/%1\
350 %{noflibdir}/%1\
351 %{nil}
352 %else
353 %define mainlib() %{mainlibdir}/%1\
354 %{mainlibdirbi}/%1\
355 %{nil}
356 %endif
357 %else
358 %if %{build_nof}
359 %define biarchlib() %{mainlibdirbi}/%1\
360 %{noflibdir}/%1\
361 %{nil}
362 %define mainlib() %{mainlibdir}/%1\
363 %{nil}
364 %else
365 %define biarchlib() %{mainlibdirbi}/%1\
366 %{nil}
367 %endif
368 %endif
369 %endif
370
371 %if %{build_nof}
372 %define versmainlib() %{versmainlibdir}/%1\
373 %{versnoflibdir}/%1\
374 %{nil}
375 %else
376 %define versmainlib() %{versmainlibdir}/%1\
377 %{nil}
378 %endif
379 %define versbiarchlib() %{nil}
380 %if %{biarch}
381 %if !%{separate_biarch}
382 %if %{build_nof}
383 %define versmainlib() %{versmainlibdir}/%1\
384 %{versmainlibdirbi}/%1\
385 %{versnoflibdir}/%1\
386 %{nil}
387 %else
388 %define versmainlib() %{versmainlibdir}/%1\
389 %{versmainlibdirbi}/%1\
390 %{nil}
391 %endif
392 %else
393 %if %{build_nof}
394 %define versbiarchlib() %{versmainlibdirbi}/%1\
395 %{versnoflibdir}/%1\
396 %{nil}
397 %define versmainlib() %{versmainlibdir}/%1\
398 %{nil}
399 %else
400 %define versbiarchlib() %{versmainlibdirbi}/%1\
401 %{nil}
402 %endif
403 %endif
404 %endif
405
406
407 # COMMON-BEGIN
408
409 %prep
410 #%setup -q -n gcc-%{gcc_version}%{snapshot_date}
411 %setup -q -n gcc-%{version}
412 # 0001-dir-version.patch
413 %patch0 -p1
414 %patch1 -p1
415 %patch2 -p1
416 %patch3 -p1
417
418 %build
419 # Avoid rebuilding of generated files
420 contrib/gcc_update --touch
421 # Avoid fucking up testsuite results with Java and indirect dispatch
422 export LD_AS_NEEDED=0
423 # Split version file into version used for directories (X.Y) and
424 # version to report with --version (X.Y.Z).
425 # See also gcc-dir-version.patch.
426 # Also decrement the patchlevel version by one
427 if test `cat gcc/DEV-PHASE` == "prerelease"; then
428   ( 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
429 else
430   mv gcc/BASE-VER gcc/FULL-VER
431 fi
432 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
433
434 rm -rf obj-%{GCCDIST}
435 mkdir obj-%{GCCDIST}
436 cd obj-%{GCCDIST}
437 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
438 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'`
439 %ifarch %ix86
440 # -mcpu is superceded by -mtune but -mtune is not supported by
441 # our bootstrap compiler.  -mcpu gives a warning that stops
442 # the build process, so remove it for now.  Also remove all other
443 # -march and -mtune flags.  They are superseeded by proper
444 # default compiler settings now.
445 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'`
446 %endif
447 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
448 # Kill all -march/tune/cpu because that screws building the target libs
449 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
450 %endif
451 # Replace 2 spaces by one finally
452 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  / /g'`
453
454 languages=c
455 %if %{build_cp}
456 languages=$languages,c++
457 %endif
458 %if %{build_objc}
459 languages=$languages,objc
460 %endif
461 %if %{build_fortran}
462 languages=$languages,fortran
463 %endif
464 %if %{build_objcp}
465 languages=$languages,obj-c++
466 %endif
467 %if %{build_java}
468 languages=$languages,java
469 %endif
470 %if %{build_ada}
471 languages=$languages,ada
472 %endif
473
474 J=%{?jobs:%jobs}
475 if test -z "$J"; then
476   J=$(getconf _NPROCESSORS_CONF)
477   JL=$(($J * 2))
478 else
479   test 1 -gt "$J" && J=1
480   JL=$(($(getconf _NPROCESSORS_CONF)*2))
481 fi
482 if test "$J" == "0"; then
483   J=1
484 fi
485 if test "$JL" == "0"; then
486   JL=1
487 fi
488 PARALLEL="-j$J -l$JL"
489
490 # we don't want some miscompiles in the testsuite, or some fault in
491 # the compiler to kill the machine.  Hence we limit the amount of memory
492 # by the physical RAM plus half of swap
493 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
494 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
495 #ulimit -v $(((MEM + SWAP/2)*1024))
496
497 # In general we want to ship release checking enabled compilers
498 # and run BETA with checking enabled.
499 #ENABLE_CHECKING="--enable-checking=yes"
500 ENABLE_CHECKING="--enable-checking=release"
501
502 # Work around tail/head -1 changes
503 export _POSIX2_VERSION=199209
504
505 # configure tries to parse include/features.h to detect
506 # if glibc supports SSP.  When cross compiling we would need
507 # to install a cross glibc, which we don't, or make the whole
508 # thing point to the native glibc, which is in /, hence the
509 # --with-sysroot=/
510
511 %if %{build_ada}
512 # Using the host gnatmake like
513 #   CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
514 #   GNATMAKE="gnatmake%{hostsuffix}"
515 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
516 # available
517 mkdir -p host-tools/bin
518 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
519 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
520 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
521 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
522 ln -sf /usr/%{_lib} host-tools/%{_lib}
523 export PATH="`pwd`/host-tools/bin:$PATH"
524 %endif
525 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
526 #%else
527 #       --enable-threads=posix \
528 #%endif
529 #       --enable-shared \
530 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
531 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS" \
532 ../configure \
533         --prefix=%{_prefix} \
534         --infodir=%{_infodir} \
535         --mandir=%{_mandir} \
536         --libdir=%{_libdir} \
537         --libexecdir=%{_libdir} \
538         --enable-languages=$languages \
539         $ENABLE_CHECKING \
540         --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
541         --enable-ssp \
542         --disable-libssp \
543         --disable-libitm \
544 %if 0%{?fast_build}
545         --disable-bootstrap \
546 %endif
547         --disable-plugin \
548         --with-bugurl="http://bugs.tizen.org/" \
549         --with-pkgversion="Tizen Linux" \
550 %if !%{build_libjava}
551         --disable-libgcj \
552 %else
553         --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
554         --with-ecj-jar=%{libsubdir}/ecj.jar \
555         --disable-java-awt \
556 %if !%{biarch_libjava}
557         --disable-libjava-multilib \
558 %endif
559 %endif
560 %if !%{build_with_mudflap}
561         --disable-libmudflap \
562 %endif
563         --with-slibdir=/%{_lib} \
564         --with-system-zlib \
565         --enable-__cxa_atexit \
566         --enable-libstdcxx-allocator=new \
567         --disable-libstdcxx-pch \
568         --enable-version-specific-runtime-libs \
569         --enable-linker-build-id \
570 %if 0%{?gcc_target_arch:1}
571 %if 0%{?gcc_icecream:1}
572         --with-build-sysroot=/ \
573         --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
574         --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
575         --enable-linux-futex \
576 %endif
577 %if 0%{?canonical_target:1}
578         --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
579 %endif
580 %if 0%{?build_static:1}
581         --disable-shared \
582 %endif
583 %if "%{TARGET_ARCH}" == "spu"
584         --with-sysroot=/usr/spu \
585         --with-gxx-include-dir=%{_prefix}/spu/include/c++/%{gcc_dir_version} \
586         --with-newlib \
587 %endif
588         --disable-nls \
589         --target=%{CONFIGURE_TARGET} \
590 %else
591         --program-suffix=%{binsuffix} \
592         --enable-linux-futex \
593         --without-system-libunwind \
594 %endif
595 %if "%{TARGET_ARCH}" == "armv5tel"
596         --with-arch=armv5te \
597         --with-float=soft \
598         --with-mode=arm \
599         --with-abi=aapcs-linux \
600         --disable-sjlj-exceptions \
601 %endif
602 %if "%{TARGET_ARCH}" == "armv7el" 
603         --with-arch=armv7-a \
604         --with-tune=cortex-a9 \
605         --with-float=soft \
606         --with-abi=softfp \
607         --with-fpu=vfpv3 \
608         --disable-sjlj-exceptions \
609 %endif
610 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
611         --with-arch=armv7-a \
612         --with-tune=cortex-a9 \
613         --with-float=hard \
614         --with-abi=aapcs-linux \
615         --with-fpu=vfpv3-d16 \
616         --disable-sjlj-exceptions \
617 %endif
618 %if "%{TARGET_ARCH}" == "i586"
619         --with-arch-32=i586 \
620         --with-tune=generic \
621 %endif
622 %if "%{TARGET_ARCH}" == "x86_64"
623         --with-arch-32=i586 \
624         --with-tune=generic \
625 %endif
626         --build=%{GCCDIST}
627
628 # COMMON-END
629
630 %if 0%{?building_libffi:1}
631 make stage1-bubble $PARALLEL
632 make all-target-libffi $PARALLEL
633 %else
634 # Only run profiled bootstrap on archs where it works
635 #%ifarch %ix86 x86_64 
636 #make profiledbootstrap-lean STAGE1_CFLAGS="-O -g" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
637 #%else
638 %ifarch %arm
639 STAGE1_FLAGS="-O0"
640 %else
641 STAGE1_FLAGS="-O -g"
642 %endif
643 #make bootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
644 make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
645 #%endif
646 #make -C gcc proto
647 make info
648 %if 0%{?run_tests:1}
649 echo "Run testsuite"
650 (make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
651 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
652 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
653 make -k check $PARALLEL || true
654 mkdir ../testresults
655 ../contrib/test_summary | tee ../testresults/test_summary.txt
656 %endif
657 %endif
658
659 %install
660 export NO_BRP_CHECK_BYTECODE_VERSION=true
661 cd obj-%{GCCDIST}
662 # GCC-TESTSUITE-DELETE-BEGIN
663 # Work around tail/head -1 changes
664 export _POSIX2_VERSION=199209
665 export LIBRARY_PATH=$RPM_BUILD_ROOT%{libsubdir}:$RPM_BUILD_ROOT%{mainlibdirbi}
666 %if 0%{?building_libffi:1}
667 make -C %{GCCDIST}/libffi install DESTDIR=$RPM_BUILD_ROOT
668 %else
669 %if 0%{?building_libjava:1}
670 make -C %{GCCDIST}/libjava install DESTDIR=$RPM_BUILD_ROOT
671 make -C gcc java.install-man DESTDIR=$RPM_BUILD_ROOT
672 make -C gcc java.install-common DESTDIR=$RPM_BUILD_ROOT
673 make -C gcc install-common DESTDIR=$RPM_BUILD_ROOT COMPILERS='jc1$(exeext) jvgenmain$(exeext)'
674 # install-common also installs collect2, gcov and the g++ and gfortran driver
675 %if %{build_cp}
676 rm $RPM_BUILD_ROOT%{_prefix}/bin/g++%{binsuffix}
677 %endif
678 %if %{build_fortran}
679 rm $RPM_BUILD_ROOT%{_prefix}/bin/gfortran%{binsuffix}
680 %endif
681 rm $RPM_BUILD_ROOT%{_prefix}/bin/gcov%{binsuffix}
682 rm $RPM_BUILD_ROOT%{libsubdir}/collect2
683 %else
684 make install DESTDIR=$RPM_BUILD_ROOT
685 %if %{build_java}
686 make -C gcc java.uninstall DESTDIR=$RPM_BUILD_ROOT
687 make -C gcc java.install-info DESTDIR=$RPM_BUILD_ROOT
688 rm $RPM_BUILD_ROOT%{_prefix}/bin/jcf-dump%{binsuffix}
689 rm $RPM_BUILD_ROOT%{_mandir}/man1/jcf-dump%{binsuffix}.1
690 rm $RPM_BUILD_ROOT%{libsubdir}/jc1
691 rm $RPM_BUILD_ROOT%{libsubdir}/jvgenmain
692 %endif
693 %endif
694 %endif
695
696 # Remove libffi installed files if we did not want to build it
697 %if !0%{?building_libffi:1}
698 rm -f $RPM_BUILD_ROOT%{mainlibdir}/libffi.*
699 %if %{biarch}
700   rm -f $RPM_BUILD_ROOT%{mainlibdirbi}/libffi.*
701 %endif
702 rm -f $RPM_BUILD_ROOT%{libsubdir}/include/ffi.h
703 rm -f $RPM_BUILD_ROOT%{libsubdir}/include/ffitarget.h
704 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi%{binsuffix}.3*
705 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi_call%{binsuffix}.3*
706 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi_prep_cif%{binsuffix}.3*
707 %endif
708
709 # Remove some useless .la files
710 for lib in libobjc libgfortran libgfortranbegin libquadmath libcaf_single \
711     libmudflap libmudflapth libgomp libstdc++ libsupc++ libgcj-tools libgij; do
712   rm -f $RPM_BUILD_ROOT%{versmainlibdir}/$lib.la
713 %if %{biarch}
714   rm -f $RPM_BUILD_ROOT%{versmainlibdirbi}/$lib.la
715 %endif
716 done
717
718 mkdir -p $RPM_BUILD_ROOT%{_libdir}
719 %if %{biarch}
720 %if %{build_primary_64bit}
721 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
722 %else
723 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib64
724 %endif
725 %endif
726
727
728 %if %{build_ada}
729 mv $RPM_BUILD_ROOT%{libsubdir}/adalib/lib*-*.so $RPM_BUILD_ROOT%{_libdir}
730 ln -sf %{_libdir}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnarl.so
731 ln -sf %{_libdir}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnat.so
732 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libgna*-*.so
733 %if %{biarch}
734 mv $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/lib*-*.so $RPM_BUILD_ROOT%{mainlibdirbi}/
735 ln -sf %{mainlibdirbi}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnarl.so
736 ln -sf %{mainlibdirbi}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnarl.so
737 chmod a+x $RPM_BUILD_ROOT%{mainlibdirbi}/libgna*-*.so
738 %endif
739 %endif
740
741 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/c++%{binsuffix}
742
743 # Remove some crap from the .la files:
744 for l in `find $RPM_BUILD_ROOT -name '*.la'`; do
745   echo "changing $l"
746 # -e '/^dependency_libs/s|%{libsubdir}/\([^.]*\)\.la |%{_libdir}/\1\.la |g'
747   sed -e '/^dependency_libs/s| -L%{_builddir}/[^ ]*||g' \
748       -e '/^dependency_libs/s| -L/usr/%{GCCDIST}/bin||g' \
749       -e '/^dependency_libs/s|-lm \(-lm \)*|-lm |' \
750       -e '/^dependency_libs/s|-L[^ ]* ||g' \
751 %if %{biarch}
752 %if %{build_primary_64bit}
753       -e '/^libdir/s|%{_libdir}/32|%{_prefix}/lib|' \
754       -e '/^libdir/s|lib64/\.\./||' \
755 %else
756       -e '/^libdir/s|%{_libdir}/64|%{_prefix}/lib64|' \
757 %endif
758 %endif
759       < $l  > $l.new
760   mv $l.new $l
761 done
762
763 # GCC-TESTSUITE-DELETE-END
764 %if 0%{?run_tests:1} 
765 cp `find . -name "*.sum"` ../testresults/
766 cp `find . -name "*.log"  \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
767 chmod 644 ../testresults/*
768 %endif
769 # GCC-TESTSUITE-DELETE-BEGIN
770 # Remove files that we do not need to clean up filelist
771 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{GCCDIST}-*
772 rm -rf $RPM_BUILD_ROOT%{libsubdir}/install-tools
773 #rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libgcj%{binsuffix}.pc
774 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/root
775 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/curses.h
776 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/asm-*
777 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/linux
778 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sound
779 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/features.h
780 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/ncurses.h
781 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/stdio.h
782 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/zutil.h
783 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/X11
784 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits
785 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/obstack.h
786 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/spe.h
787 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/tgmath.h
788 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits
789 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sys
790 # no plugins
791 rm -rf $RPM_BUILD_ROOT%{libsubdir}/plugin
792 rm -f  $RPM_BUILD_ROOT%{_infodir}/dir
793 rm -f  $RPM_BUILD_ROOT%{_prefix}/bin/gccbug%{binsuffix}
794
795 %if !0%{?building_libjava:1}%{?building_libffi:1}
796 # delete compile flag tracking from crt files
797 crt_list=$RPM_BUILD_ROOT%{versmainlibdir}/crt*.o
798 %if %{biarch}
799 %if %{build_primary_64bit}
800 crt32_list=$RPM_BUILD_ROOT%{versmainlibdirbi32}/crt*.o
801 %else
802 crt64_list=$RPM_BUILD_ROOT%{versmainlibdirbi64}/crt*.o
803 %endif
804 %endif
805 %endif
806
807 %if 0%{?building_libjava:1}
808 # gcj -static doesn't work properly anyway, unless using --whole-archive
809 # let's save the space instead.
810 find $RPM_BUILD_ROOT -name libgcj.a \
811         -o -name libgcj-tools.a \
812         -o -name libgij.a \
813         -o -name libjvm.a \
814         -o -name libgcj_bc.a \
815   | xargs rm -f
816
817 find $RPM_BUILD_ROOT -name libgcj.spec | xargs \
818   sed -i -e 's/lib: /&%%{static:%%eJava programs cannot be linked statically}/'
819
820 # security files have broken install locations, also they cause conflicts
821 # between libgcj versions.  Simply delete them here, libgcj will use its
822 # defaults in this case (which is what these files contain anyway).
823 rm $RPM_BUILD_ROOT%{_libdir}/logging.properties
824 rm -r $RPM_BUILD_ROOT%{_libdir}/security
825 %endif
826
827 %if 0%{?building_libffi:1}
828 # Move libffi headers, remove empty libffi libtool file
829 mkdir -p $RPM_BUILD_ROOT%{_prefix}/include
830 mv $RPM_BUILD_ROOT%{libsubdir}/include/ffitarget.h $RPM_BUILD_ROOT%{_prefix}/include/
831 mv $RPM_BUILD_ROOT%{libsubdir}/include/ffi.h $RPM_BUILD_ROOT%{_prefix}/include/
832 rm -f $RPM_BUILD_ROOT%{mainlibdir}/libffi.la
833 %if %{biarch}
834 rm -f $RPM_BUILD_ROOT%{mainlibdirbi}/libffi.la
835 %endif
836 # Generate a simple pkg-config file
837 mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
838 echo -e 'Name: libffi\nVersion: 3.0.9\nDescription: libffi\nLibs: -lffi' > $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libffi.pc
839 %endif
840
841 %if %{build_java}
842 %if !%{build_libjava}
843 rm $RPM_BUILD_ROOT%{_mandir}/man1/jv-convert%{binsuffix}.1
844 rm $RPM_BUILD_ROOT%{_mandir}/man1/gcj-dbtool%{binsuffix}.1
845 rm $RPM_BUILD_ROOT%{_mandir}/man1/gij%{binsuffix}.1
846 rm $RPM_BUILD_ROOT%{_mandir}/man1/grmic%{binsuffix}.1
847 rm $RPM_BUILD_ROOT%{_mandir}/man1/gc-analyze%{binsuffix}.1
848 rm $RPM_BUILD_ROOT%{_mandir}/man1/aot-compile%{binsuffix}.1
849 rm $RPM_BUILD_ROOT%{_mandir}/man1/rebuild-gcj-db%{binsuffix}.1
850 %endif
851 rm -f $RPM_BUILD_ROOT%{_datadir}/gcc%{binsuffix}/python/libjava/aotcompile.py
852 rm -f $RPM_BUILD_ROOT%{_datadir}/gcc%{binsuffix}/python/libjava/classfile.py
853 %endif
854 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/fsf-funding.7
855 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gfdl.7
856 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gpl.7
857 rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
858 %if %{build_nof}
859 rm -f $RPM_BUILD_ROOT%{_prefix}/lib/nof/libiberty.a
860 %endif
861 %if %{biarch}
862 %if %{build_primary_64bit}
863 rm -f $RPM_BUILD_ROOT%{_prefix}/lib/libiberty.a
864 %else
865 rm -f $RPM_BUILD_ROOT%{_prefix}/lib64/libiberty.a
866 %endif
867 %endif
868 rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.a
869 rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.la
870
871
872 %if %{build_java}
873 %if 0%{?building_libffi:1}
874 %files 
875 %defattr(-,root,root)
876 %mainlib libffi.so.*
877
878 %if %{separate_biarch}
879 %files -n libffi47%{separate_biarch_suffix}
880 %defattr(-,root,root)
881 %biarchlib libffi.so.*
882 %endif
883
884 %files -n libffi47-devel
885 %defattr(-,root,root)
886 %{_prefix}/include/ffi.h
887 %{_prefix}/include/ffitarget.h
888 %mainlib libffi.so
889 %mainlib libffi.a
890 %{_libdir}/pkgconfig/libffi.pc
891 %doc %{_mandir}/man3/ffi%{binsuffix}.3.gz
892 %doc %{_mandir}/man3/ffi_call%{binsuffix}.3.gz
893 %doc %{_mandir}/man3/ffi_prep_cif%{binsuffix}.3.gz
894
895 %if %{separate_biarch}
896 %files -n libffi47-devel%{separate_biarch_suffix}
897 %defattr(-,root,root)
898 %biarchlib libffi.so
899 %biarchlib libffi.a
900 %endif
901 %endif
902 %endif
903 # GCC-TESTSUITE-DELETE-END
904
905 %if 0%{?run_tests:1}
906 %files -n gcc47-testresults
907 %defattr(-,root,root)
908 %doc testresults/test_summary.txt
909 %doc testresults/*.sum
910 %doc testresults/*.log
911 %endif
912
913
914 %changelog