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