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