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