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