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