3f54955604382e2afe00a196313bdc5da20a964c
[platform/upstream/gcc48.git] / packaging / libgcj48.spec
1 %define building_libjava 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: libgcj48
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 Summary:      Java Runtime Library for gcc
216 License:      GPL-2.0-with-classpath-exception
217 Group:        System/Libraries
218
219 %description 
220 This library is needed if you want to use the GNU Java compiler, gcj.
221 Source code for this package is in gcc.
222
223 %post 
224 /sbin/ldconfig
225
226 %postun 
227 /sbin/ldconfig
228
229
230 %package -n gcc48-java
231 Summary:      The GNU Java Compiler
232 License:        GPL-3.0+
233 Group:        Development/Languages/Java
234 Requires: gcc48 = %{version}
235 Requires: libgcj48-devel = %{version}-%{release}
236
237 %description -n gcc48-java
238 The Java compiler from the GCC-tools-suite.
239
240
241 %package -n libgcj_bc%{libgcj_bc_sover}%{libgcj_bc_suffix}
242 Summary:      Fake library for BC-ABI compatibility.
243 License:        GPL-2.0-with-classpath-exception
244 Group:        Development/Libraries/Java
245 # libgcj_bc is special in that it just contains a symlink to
246 # a proper libgcj version.  So require that library and add
247 # provides for the shlib version as created at link time
248 Requires: libgcj%{libgcj_sover} >= %{version}-%{release}
249 %ifarch x86_64 ia64 ppc64 s390x sparc64 aarch64
250 Provides: libgcj_bc.so.%{libgcj_bc_sover}()(64bit)
251 %else
252 Provides: libgcj_bc.so.%{libgcj_bc_sover}
253 %endif
254
255 %description -n libgcj_bc%{libgcj_bc_sover}%{libgcj_bc_suffix}
256 A fake library that is used at link time only. It ensures that
257 binaries built with the BC-ABI link against a constant SONAME.
258 This way, BC-ABI binaries continue to work if the SONAME underlying
259 libgcj.so changes.
260
261
262 %package -n libgcj48-jar
263 Summary:      Java runtime library (jar files).
264 License:        GPL-2.0-with-classpath-exception
265 Group:        Development/Libraries/Java
266
267 %description -n libgcj48-jar
268 These are the jar files that go along with the gcj front end to gcc.
269
270
271 %package -n libgcj48-devel
272 Summary:      Include Files and Libraries mandatory for Development.
273 License:        GPL-2.0-with-classpath-exception
274 Group:        Development/Libraries/Java
275 Requires: libstdc++48-devel = %{version}
276 Requires: libgcj%{libgcj_sover} >= %{version}-%{release}
277 Requires: libgcj_bc%{libgcj_bc_sover} >= %{version}-%{release}
278 Requires: libgcj48-jar = %{version}-%{release}
279 Requires: gtk2-devel
280 Requires: libart_lgpl-devel
281 Requires: glibc-devel
282 Requires: zlib-devel
283 %ifarch ia64
284 Requires: libunwind-devel
285 %endif
286
287 %description -n libgcj48-devel
288 This package contains all necessary include files and libraries needed
289 to develop applications that require these.
290
291
292 %package -n gcc48-gij
293 Summary:      Java Bytecode Interpreter for gcc
294 License:      GPL-2.0-with-classpath-exception
295 Group:        Development/Libraries/Java
296 Requires: libgcj%{libgcj_sover} >= %{version}-%{release}
297
298 %description -n gcc48-gij
299 This package contains the java bytecode interpreter gij and related tools.
300
301 %package -n libffi%{libffi_sover}%{libffi_suffix}
302 Summary:      Foreign Function Interface library
303 License:        BSD-3-Clause
304 Group:        Development/Languages/C and C++
305
306 %description -n libffi%{libffi_sover}%{libffi_suffix}
307 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.
308
309 %post -n libffi%{libffi_sover}%{libffi_suffix}
310 /sbin/ldconfig
311
312 %postun -n libffi%{libffi_sover}%{libffi_suffix}
313 /sbin/ldconfig
314 %package -n libffi%{libffi_sover}%{libffi_suffix}-32bit
315 Summary:      Foreign Function Interface library
316 License:        BSD-3-Clause
317 Group:        Development/Languages/C and C++
318
319 %description -n libffi%{libffi_sover}%{libffi_suffix}-32bit
320 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.
321
322 %post -n libffi%{libffi_sover}%{libffi_suffix}-32bit
323 /sbin/ldconfig
324
325 %postun -n libffi%{libffi_sover}%{libffi_suffix}-32bit
326 /sbin/ldconfig
327 %package -n libffi%{libffi_sover}%{libffi_suffix}-64bit
328 Summary:      Foreign Function Interface library
329 License:        BSD-3-Clause
330 Group:        Development/Languages/C and C++
331
332 %description -n libffi%{libffi_sover}%{libffi_suffix}-64bit
333 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.
334
335 %post -n libffi%{libffi_sover}%{libffi_suffix}-64bit
336 /sbin/ldconfig
337
338 %postun -n libffi%{libffi_sover}%{libffi_suffix}-64bit
339 /sbin/ldconfig
340
341 %package -n libffi48-devel
342 Summary:      Foreign Function Interface library development files
343 License:        BSD 3-Clause
344 Group:        Development/Languages/C and C++
345 Requires: libffi%{libffi_sover} >= %{version}-%{release}
346
347 %description -n libffi48-devel
348 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.
349 %package -n libffi48-devel-32bit
350 Summary:      Foreign Function Interface library development files
351 License:        BSD 3-Clause
352 Group:        Development/Languages/C and C++
353 Requires: libffi%{libffi_sover}-32bit >= %{version}-%{release}
354
355 %description -n libffi48-devel-32bit
356 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.
357 %package -n libffi48-devel-64bit
358 Summary:      Foreign Function Interface library development files
359 License:        BSD 3-Clause
360 Group:        Development/Languages/C and C++
361 Requires: libffi%{libffi_sover}-64bit >= %{version}-%{release}
362
363 %description -n libffi48-devel-64bit
364 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.
365
366 %package -n gcc48-testresults
367 Summary:      Testsuite results
368 License:        SUSE-Public-Domain
369 Group:        Development/Languages/C and C++
370
371 %description -n gcc48-testresults
372 Results from running the gcc and target library testsuites.
373
374
375
376 # Define the canonical target and host architecture
377 #   %gcc_target_arch  is supposed to be the full target triple
378 #   %TARGET_ARCH      is the canonicalized CPU part
379 #   %CONFIGURE_TARGET is the target triple used for --target=
380 %if 0%{?gcc_target_arch:1}
381 %define CONFIGURE_TARGET %{gcc_target_arch}
382 %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/;")
383 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc"
384 %define CONFIGURE_TARGET powerpc64-tizen-linux
385 %endif
386 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "powerpc64"
387 %define CONFIGURE_TARGET powerpc64-tizen-linux
388 %endif
389 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "i586"
390 %define CONFIGURE_TARGET i586-tizen-linux
391 %endif
392 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7l"
393 %define CONFIGURE_TARGET armv7l-tizen-linux-gnueabi
394 %endif
395 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv7hl"
396 %define CONFIGURE_TARGET armv7hl-tizen-linux-gnueabi
397 %endif
398 %if 0%{?gcc_icecream:1} && %{TARGET_ARCH} == "armv5tel"
399 %define CONFIGURE_TARGET armv5tel-tizen-linux-gnueabi
400 %endif
401 %else
402 %define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
403 %endif
404 %define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
405
406 %define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
407
408 %ifarch ppc
409 %define GCCDIST powerpc64-tizen-linux
410 %else
411 %ifarch %sparc
412 %define GCCDIST sparc64-tizen-linux
413 %else
414 %ifarch %arm
415 %define GCCDIST %{HOST_ARCH}-tizen-linux-gnueabi
416 %else
417 %define GCCDIST %{HOST_ARCH}-tizen-linux
418 %endif
419 %endif
420 %endif
421
422 %define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
423 %define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
424
425
426 # Versionspecific directories
427 %define versmainlibdir %{libsubdir}
428 %define versmainlibdirbi32 %{libsubdir}/32
429 %define versmainlibdirbi64 %{libsubdir}/64
430 %ifarch ppc
431 %define versmainlibdirbi32 %{libsubdir}
432 %define versmainlibdirbi64 %{libsubdir}/64
433 %endif
434 %if %{build_primary_64bit}
435 %define versmainlibdirbi %{versmainlibdirbi32}
436 %else
437 %define versmainlibdirbi %{versmainlibdirbi64}
438 %endif
439
440 %define mainlibdir %{_libdir}
441 %define mainlibdirbi32 %{_prefix}/lib
442 %define mainlibdirbi64 %{_prefix}/lib64
443 %if %{build_primary_64bit}
444 %define mainlibdirbi %{mainlibdirbi32}
445 %else
446 %define mainlibdirbi %{mainlibdirbi64}
447 %endif
448
449
450 # Now define a few macros that make it easy to package libs and
451 # related files just to the right package, without caring for the
452 # exact path the files are in.
453 #   %mainlib  package X from all dirs that belong to the main package
454 #   %biarchlib   package X from all dirs that belong to the -32/64bit package
455 %define mainlib() %{mainlibdir}/%1\
456 %{nil}
457 %define biarchlib() %{nil}
458 %if %{biarch}
459 %if !%{separate_biarch}
460 %define mainlib() %{mainlibdir}/%1\
461 %{mainlibdirbi}/%1\
462 %{nil}
463 %else
464 %define biarchlib() %{mainlibdirbi}/%1\
465 %{nil}
466 %endif
467 %endif
468
469 %define versmainlib() %{versmainlibdir}/%1\
470 %{nil}
471 %define versbiarchlib() %{nil}
472 %if %{biarch}
473 %if !%{separate_biarch}
474 %define versmainlib() %{versmainlibdir}/%1\
475 %{versmainlibdirbi}/%1\
476 %{nil}
477 %else
478 %define versbiarchlib() %{versmainlibdirbi}/%1\
479 %{nil}
480 %endif
481 %endif
482
483
484
485 %prep
486 %setup -q -n gcc-%{version}
487
488
489 # We are configuring ppc as ppc64 but with switched multilibs.  Adjust
490 # the libstdc++ abi testsuite baseline files accordingly
491 %ifarch ppc
492 if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
493   mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
494   mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt \
495         libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64/
496   mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt \
497         libstdc++-v3/config/abi/post/powerpc64-linux-gnu/
498 fi
499 %endif
500
501 %build
502 # Avoid rebuilding of generated files
503 contrib/gcc_update --touch
504 # Avoid fucking up testsuite results with Java and indirect dispatch
505 export LD_AS_NEEDED=0
506 # Split version file into version used for directories (X.Y) and
507 # version to report with --version (X.Y.Z).
508 # See also gcc-dir-version.patch.
509 # Also decrement the patchlevel version by one
510 if test `cat gcc/DEV-PHASE` == "prerelease"; then
511   ( 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
512 else
513   mv gcc/BASE-VER gcc/FULL-VER
514 fi
515 cat gcc/FULL-VER | cut -d '.' -f 1-2 > gcc/BASE-VER
516
517 rm -rf obj-%{GCCDIST}
518 mkdir obj-%{GCCDIST}
519 cd obj-%{GCCDIST}
520 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
521 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'`
522 %ifarch %ix86
523 # -mcpu is superceded by -mtune but -mtune is not supported by
524 # our bootstrap compiler.  -mcpu gives a warning that stops
525 # the build process, so remove it for now.  Also remove all other
526 # -march and -mtune flags.  They are superseeded by proper
527 # default compiler settings now.
528 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'`
529 %endif
530 %ifarch s390 s390x
531 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
532 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
533 %endif
534 %if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
535 # Kill all -march/tune/cpu because that screws building the target libs
536 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
537 %endif
538 # Replace 2 spaces by one finally
539 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  / /g'`
540
541 languages=c
542 %if %{build_cp}
543 languages=$languages,c++
544 %endif
545 %if %{build_objc}
546 languages=$languages,objc
547 %endif
548 %if %{build_fortran}
549 languages=$languages,fortran
550 %endif
551 %if %{build_objcp}
552 languages=$languages,obj-c++
553 %endif
554 %if %{build_java}
555 languages=$languages,java
556 %endif
557 %if %{build_ada}
558 languages=$languages,ada
559 %endif
560
561 J=%{?jobs:%jobs}
562 if test -z "$J"; then
563   J=$(getconf _NPROCESSORS_CONF)
564   JL=$(($J * 2))
565 else
566   test 1 -gt "$J" && J=1
567   JL=$(($(getconf _NPROCESSORS_CONF)*2))
568 fi
569 if test "$J" == "0"; then
570   J=1
571 fi
572 if test "$JL" == "0"; then
573   JL=1
574 fi
575 PARALLEL="-j$J -l$JL"
576
577 # we don't want some miscompiles in the testsuite, or some fault in
578 # the compiler to kill the machine.  Hence we limit the amount of memory
579 # by the physical RAM plus half of swap
580 #MEM=$(free -m | awk '/^Mem:/ {print $2}')
581 #SWAP=$(free -m | awk '/^Swap:/ {print $2}')
582 #ulimit -v $(((MEM + SWAP/2)*1024))
583
584 # In general we want to ship release checking enabled compilers
585 # and run BETA with checking enabled.
586 #ENABLE_CHECKING="--enable-checking=yes"
587 ENABLE_CHECKING="--enable-checking=release"
588
589 # Work around tail/head -1 changes
590 export _POSIX2_VERSION=199209
591
592 # configure tries to parse include/features.h to detect
593 # if glibc supports SSP.  When cross compiling we would need
594 # to install a cross glibc, which we don't, or make the whole
595 # thing point to the native glibc, which is in /, hence the
596 # --with-build-sysroot=/
597
598 %if %{build_ada}
599 # Using the host gnatmake like
600 #   CC="gcc%{hostsuffix}" GNATBIND="gnatbind%{hostsuffix}"
601 #   GNATMAKE="gnatmake%{hostsuffix}"
602 # doesn't work due to PR33857, so an un-suffixed gnatmake has to be
603 # available
604 mkdir -p host-tools/bin
605 cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
606 cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
607 cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
608 cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
609 ln -sf /usr/%{_lib} host-tools/%{_lib}
610 export PATH="`pwd`/host-tools/bin:$PATH"
611 %endif
612 #%if 0%{?gcc_target_arch:1} && 0%{!?gcc_icecream:1}
613 #%else
614 #       --enable-threads=posix \
615 #%endif
616 #       --enable-shared \
617 %if "%{TARGET_ARCH}" == "armv7l" || "%{TARGET_ARCH}" == "armv7hl"
618 # temporary workaround for a miscompilation of hash functions in java code
619 GCJ_EXTRA_FLAGS="-marm"
620 %endif
621 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
622 TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_OPT_FLAGS $GCJ_EXTRA_FLAGS" \
623 ../configure \
624         --prefix=%{_prefix} \
625         --infodir=%{_infodir} \
626         --mandir=%{_mandir} \
627         --libdir=%{_libdir} \
628         --libexecdir=%{_libdir} \
629     --disable-bootstrap \
630         --enable-languages=$languages \
631         $ENABLE_CHECKING \
632         --with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
633         --enable-ssp \
634         --disable-libssp \
635         --disable-plugin \
636         --with-bugurl="http://bugs.tizen.org/" \
637         --with-pkgversion="Tizen" \
638 %if !%{build_libjava}
639         --disable-libgcj \
640 %else
641         --with-java-home=%{_libdir}/jvm/java-1.5.0-gcj%{binsuffix}-1.5.0.0/jre \
642         --with-ecj-jar=%{libsubdir}/ecj.jar \
643         --disable-java-awt \
644 %if !%{biarch_libjava}
645         --disable-libjava-multilib \
646 %endif
647 %endif
648 %if !%{build_with_mudflap}
649         --disable-libmudflap \
650 %endif
651         --with-slibdir=/%{_lib} \
652         --with-system-zlib \
653         --enable-__cxa_atexit \
654         --enable-libstdcxx-allocator=new \
655         --disable-libstdcxx-pch \
656         --enable-version-specific-runtime-libs \
657         --enable-linker-build-id \
658 %if 0%{?gcc_target_arch:1}
659 %if 0%{?gcc_icecream:1}
660         --with-build-sysroot=/ \
661         --with-sysroot=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi} \
662         --with-gxx-include-dir=%{_prefix}/%{gcc_target_arch}%{?canonical_target_abi:%canonical_target_abi}/usr/include/c++/%{gcc_dir_version} \
663         --enable-linux-futex \
664 %endif
665 %if 0%{?canonical_target:1}
666         --with-build-time-tools=/usr/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}/bin \
667 %endif
668 %if 0%{?sysroot:1}
669         --with-sysroot=%sysroot \
670 %endif
671 %if 0%{?build_static:1}
672         --disable-shared \
673 %endif
674 %if "%{TARGET_ARCH}" == "spu"
675         --with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
676         --with-newlib \
677 %endif
678         --disable-nls \
679         --target=%{CONFIGURE_TARGET} \
680 %else
681         --program-suffix=%{binsuffix} \
682         --enable-linux-futex \
683 %ifarch ia64
684         --with-system-libunwind \
685 %else
686         --without-system-libunwind \
687 %endif
688 %endif
689 %if "%{TARGET_ARCH}" == "armv5tel"
690         --with-arch=armv5te \
691         --with-float=soft \
692         --with-mode=arm \
693         --with-abi=aapcs-linux \
694         --disable-sjlj-exceptions \
695 %endif
696 %if "%{TARGET_ARCH}" == "armv7l" 
697         --with-arch=armv7-a \
698         --with-tune=cortex-a9 \
699     --with-float=soft \
700         --with-fpu=vfpv3-d16 \
701         --disable-sjlj-exceptions \
702 %endif
703 %if  "%{TARGET_ARCH}" == "armv7hl"
704         --with-arch=armv7-a \
705         --with-tune=cortex-a9 \
706         --with-float=hard \
707         --with-abi=aapcs-linux \
708         --with-fpu=vfpv3-d16 \
709         --disable-sjlj-exceptions \
710 %endif
711 %if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
712 %if "%{TARGET_ARCH}" == "powerpc"
713         --with-cpu=default32 \
714 %endif
715         --with-cpu-64=power4 \
716         --enable-secureplt \
717         --with-long-double-128 \
718 %endif
719 %if "%{TARGET_ARCH}" == "sparc64"
720         --with-cpu=ultrasparc \
721         --with-long-double-128 \
722 %endif
723 %if "%{TARGET_ARCH}" == "sparc"
724         --with-cpu=v8 \
725         --with-long-double-128 \
726 %endif
727 %if "%{TARGET_ARCH}" == "i586"
728         --with-arch-32=i586 \
729         --with-tune=generic \
730 %endif
731 %if "%{TARGET_ARCH}" == "x86_64"
732         --with-arch-32=i586 \
733         --with-tune=generic \
734 %endif
735 %if "%{TARGET_ARCH}" == "s390"
736         --with-tune=z196 --with-arch=z10 \
737         --with-long-double-128 \
738         --enable-decimal-float \
739 %endif
740 %if "%{TARGET_ARCH}" == "s390x"
741         --with-tune=z196 --with-arch=z10 \
742         --with-long-double-128 \
743         --enable-decimal-float \
744 %endif
745         --build=%{GCCDIST}
746
747
748 %if 0%{?building_libffi:1}
749 make stage1-bubble $PARALLEL
750 make all-target-libffi $PARALLEL
751 %else
752 STAGE1_FLAGS="-g"
753 # Only run profiled bootstrap on archs where it works
754 #%ifarch %ix86 x86_64 ppc ppc64 ia64
755 #make profiledbootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
756 #%else
757 #make bootstrap-lean STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
758 make STAGE1_CFLAGS="$STAGE1_FLAGS" BOOT_CFLAGS="$RPM_OPT_FLAGS" $PARALLEL
759 #%endif
760 #make -C gcc proto
761 make info
762 %if 0%{?run_tests:1}
763 echo "Run testsuite"
764 (make -C %{GCCDIST}/libstdc++-v3 check-abi || true)
765 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.log %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.log
766 mv %{GCCDIST}/libstdc++-v3/testsuite/libstdc++.sum %{GCCDIST}/libstdc++-v3/testsuite/libstdc++-abi.sum
767 # asan needs a whole shadow address space
768 ulimit -v unlimited || true
769 make -k check $PARALLEL || true
770 mkdir ../testresults
771 ../contrib/test_summary | tee ../testresults/test_summary.txt
772 %endif
773 %endif
774
775 %install
776 export NO_BRP_CHECK_BYTECODE_VERSION=true
777 cd obj-%{GCCDIST}
778 # Work around tail/head -1 changes
779 export _POSIX2_VERSION=199209
780 export LIBRARY_PATH=$RPM_BUILD_ROOT%{libsubdir}:$RPM_BUILD_ROOT%{mainlibdirbi}
781 %if 0%{?building_libffi:1}
782 make -C %{GCCDIST}/libffi install DESTDIR=$RPM_BUILD_ROOT
783 %else
784 %if 0%{?building_libjava:1}
785 make -C %{GCCDIST}/libjava install DESTDIR=$RPM_BUILD_ROOT
786 make -C gcc java.install-man DESTDIR=$RPM_BUILD_ROOT
787 make -C gcc java.install-common DESTDIR=$RPM_BUILD_ROOT
788 make -C gcc install-common DESTDIR=$RPM_BUILD_ROOT COMPILERS='jc1$(exeext) jvgenmain$(exeext)'
789 # install-common also installs collect2, gcov and the g++ and gfortran driver
790 %if %{build_cp}
791 rm $RPM_BUILD_ROOT%{_prefix}/bin/g++%{binsuffix}
792 %endif
793 %if %{build_fortran}
794 rm $RPM_BUILD_ROOT%{_prefix}/bin/gfortran%{binsuffix}
795 %endif
796 rm $RPM_BUILD_ROOT%{_prefix}/bin/gcov%{binsuffix}
797 rm $RPM_BUILD_ROOT%{libsubdir}/collect2
798 %else
799 make install DESTDIR=$RPM_BUILD_ROOT
800 %if %{build_java}
801 make -C gcc java.uninstall DESTDIR=$RPM_BUILD_ROOT
802 make -C gcc java.install-info DESTDIR=$RPM_BUILD_ROOT
803 rm $RPM_BUILD_ROOT%{_prefix}/bin/jcf-dump%{binsuffix}
804 rm $RPM_BUILD_ROOT%{_mandir}/man1/jcf-dump%{binsuffix}.1
805 rm $RPM_BUILD_ROOT%{libsubdir}/jc1
806 rm $RPM_BUILD_ROOT%{libsubdir}/jvgenmain
807 %endif
808 %endif
809 %endif
810
811 # Remove libffi installed files if we did not want to build it
812 %if !0%{?building_libffi:1}
813 rm -f $RPM_BUILD_ROOT%{mainlibdir}/libffi.*
814 %if %{biarch}
815   rm -f $RPM_BUILD_ROOT%{mainlibdirbi}/libffi.*
816 %endif
817 rm -f $RPM_BUILD_ROOT%{libsubdir}/include/ffi.h
818 rm -f $RPM_BUILD_ROOT%{libsubdir}/include/ffitarget.h
819 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi%{binsuffix}.3*
820 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi_call%{binsuffix}.3*
821 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi_prep_cif%{binsuffix}.3*
822 rm -f $RPM_BUILD_ROOT%{_mandir}/man3/ffi_prep_cif_var%{binsuffix}.3*
823 %endif
824
825 # Remove some useless .la files
826 for lib in libobjc libgfortran libgfortranbegin libquadmath libcaf_single \
827     libmudflap libmudflapth libgomp libstdc++ libsupc++ libgcj-tools libgij \
828     libasan libatomic libitm libtsan; do
829   rm -f $RPM_BUILD_ROOT%{versmainlibdir}/$lib.la
830 %if %{biarch}
831   rm -f $RPM_BUILD_ROOT%{versmainlibdirbi}/$lib.la
832 %endif
833 done
834
835 mkdir -p $RPM_BUILD_ROOT%{_libdir}
836 %if %{biarch}
837 %if %{build_primary_64bit}
838 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
839 %else
840 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib64
841 %endif
842 %endif
843
844
845 # move shared libs from versionspecific dir to main libdir
846 for libname in \
847 %if 0%{?building_libjava:1}
848   libgcj libgij libgcj-tools \
849 %else
850 %if %{build_fortran}
851   libgfortran \
852 %ifarch %quadmath_arch
853   libquadmath \
854 %endif
855 %endif
856 %if %{build_objc}
857   libobjc \
858 %endif
859 %if %{build_cp}
860   libstdc++ \
861 %endif
862   libgomp \
863 %ifarch %atomic_arch
864   libatomic \
865 %endif
866 %ifarch %itm_arch
867   libitm \
868 %endif
869 %ifarch %asan_arch
870   libasan \
871 %endif
872 %ifarch %tsan_arch
873   libtsan \
874 %endif
875 %if %{build_with_mudflap}
876   libmudflap libmudflapth \
877 %endif
878 %endif
879     ; do
880   for lib in `find $RPM_BUILD_ROOT%{versmainlibdir} -maxdepth 1 -name $libname.so.*`; do
881     mv $lib $RPM_BUILD_ROOT%{mainlibdir}/
882   done
883   ln -sf %{mainlibdir}/`readlink $RPM_BUILD_ROOT%{versmainlibdir}/$libname.so | sed -e 's/\(.*\.so\.[^\.]*\).*/\1/'`  \
884          $RPM_BUILD_ROOT%{versmainlibdir}/$libname.so
885 %if %{biarch}
886   if test -d $RPM_BUILD_ROOT%{versmainlibdirbi}; then
887     for lib in `find $RPM_BUILD_ROOT%{versmainlibdirbi} -maxdepth 1 -name "$libname.so.*"`; do
888       mv $lib $RPM_BUILD_ROOT%{mainlibdirbi}/
889     done
890     ln -sf %{mainlibdirbi}/`readlink $RPM_BUILD_ROOT%{versmainlibdirbi}/$libname.so | sed -e 's/\(.*\.so\.[^\.]*\).*/\1/'`  \
891          $RPM_BUILD_ROOT%{versmainlibdirbi}/$libname.so
892   fi
893 %endif
894 done
895 # FIXME, tsan is not multilib
896 %ifarch %tsan_arch
897 %if %{biarch}
898 rm -f $RPM_BUILD_ROOT%{versmainlibdirbi}/libtsan.so
899 %endif
900 %endif
901 %if %{build_cp}
902 %if !0%{?building_libjava:1}
903 # And we want to move the shlib gdb pretty printers to a more sane
904 # place so ldconfig does not complain
905 mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdir}
906 mv $RPM_BUILD_ROOT%{mainlibdir}/libstdc++.so.*-gdb.py $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdir}/
907 sed -i -e '/^libdir/s/\/gcc\/%{GCCDIST}\/%{gcc_dir_version}//g' $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdir}/libstdc++.so.*-gdb.py
908 %if %{biarch}
909   if test -d $RPM_BUILD_ROOT%{versmainlibdirbi}; then
910     mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdirbi}
911     mv $RPM_BUILD_ROOT%{mainlibdirbi}/libstdc++.so.*-gdb.py $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdirbi}/
912     sed -i -e '/^libdir/s/\/gcc\/%{GCCDIST}\/%{gcc_dir_version}//g' $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{mainlibdirbi}/libstdc++.so.*-gdb.py
913   fi
914 %endif
915 %endif
916 %endif
917 %if 0%{?building_libjava:1}
918 # libgcj_bc is special as the .so file is actually a different
919 # library as the library refered to by the SONAME which should
920 # be a simple link to our libgcj.
921 for lib in `find $RPM_BUILD_ROOT%{versmainlibdir} -maxdepth 1 -name libgcj_bc.so.*`; do
922   rm $lib
923 done
924 ln -s libgcj.so.%{libgcj_sover} $RPM_BUILD_ROOT%{mainlibdir}/libgcj_bc.so.%{libgcj_bc_sover}
925 %if %{biarch_libjava}
926 for lib in `find $RPM_BUILD_ROOT%{versmainlibdirbi} -maxdepth 1 -name libgcj_bc.so.*`; do
927   rm $lib
928 done
929 ln -s libgcj.so.%{libgcj_sover} $RPM_BUILD_ROOT%{mainlibdirbi}/libgcj_bc.so.%{libgcj_bc_sover}
930 %endif
931 %endif
932
933
934 %if %{build_ada}
935 mv $RPM_BUILD_ROOT%{libsubdir}/adalib/lib*-*.so $RPM_BUILD_ROOT%{_libdir}
936 ln -sf %{_libdir}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnarl.so
937 ln -sf %{_libdir}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{libsubdir}/adalib/libgnat.so
938 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libgna*-*.so
939 %if %{biarch}
940 mv $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/lib*-*.so $RPM_BUILD_ROOT%{mainlibdirbi}/
941 ln -sf %{mainlibdirbi}/libgnarl%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnarl.so
942 ln -sf %{mainlibdirbi}/libgnat%{binsuffix}.so $RPM_BUILD_ROOT%{versmainlibdirbi}/adalib/libgnarl.so
943 chmod a+x $RPM_BUILD_ROOT%{mainlibdirbi}/libgna*-*.so
944 %endif
945 %endif
946
947 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/c++%{binsuffix}
948
949 # Remove some crap from the .la files:
950 for l in `find $RPM_BUILD_ROOT -name '*.la'`; do
951   echo "changing $l"
952 # -e '/^dependency_libs/s|%{libsubdir}/\([^.]*\)\.la |%{_libdir}/\1\.la |g'
953   sed -e '/^dependency_libs/s| -L%{_builddir}/[^ ]*||g' \
954       -e '/^dependency_libs/s| -L/usr/%{GCCDIST}/bin||g' \
955       -e '/^dependency_libs/s|-lm \(-lm \)*|-lm |' \
956       -e '/^dependency_libs/s|-L[^ ]* ||g' \
957 %if %{biarch}
958 %if %{build_primary_64bit}
959       -e '/^libdir/s|%{_libdir}/32|%{_prefix}/lib|' \
960       -e '/^libdir/s|lib64/\.\./||' \
961 %else
962       -e '/^libdir/s|%{_libdir}/64|%{_prefix}/lib64|' \
963 %endif
964 %endif
965       < $l  > $l.new
966   mv $l.new $l
967 done
968
969 %if 0%{?run_tests:1} 
970 cp `find . -name "*.sum"` ../testresults/
971 cp `find . -name "*.log"  \! -name "config.log" | grep -v 'acats.\?/tests' ` ../testresults/
972 chmod 644 ../testresults/*
973 %endif
974 %if %{build_cp}
975 # Find C++ and Java headers
976 find $RPM_BUILD_ROOT%{_prefix}/include/c++ \
977   -regex ".*/\(org\|gcj\|gnu\|java\|javax\)" -prune \
978   -o \( -type d -printf "%%%%dir " , \
979         -printf "%{_prefix}/include/c++/%%P\n" \) > ../c++-headers
980 %endif
981 # Remove files that we do not need to clean up filelist
982 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{GCCDIST}-*
983 rm -rf $RPM_BUILD_ROOT%{libsubdir}/install-tools
984 #rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libgcj%{binsuffix}.pc
985 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/root
986 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/curses.h
987 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/asm-*
988 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/linux
989 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sound
990 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/features.h
991 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/ncurses.h
992 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/stdio.h
993 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/zutil.h
994 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/X11
995 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits
996 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/obstack.h
997 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/spe.h
998 rm -f $RPM_BUILD_ROOT%{libsubdir}/include-fixed/tgmath.h
999 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/bits
1000 rm -rf $RPM_BUILD_ROOT%{libsubdir}/include-fixed/sys
1001 # no plugins
1002 rm -rf $RPM_BUILD_ROOT%{libsubdir}/plugin
1003 rm -f  $RPM_BUILD_ROOT%{_infodir}/dir
1004 rm -f  $RPM_BUILD_ROOT%{_prefix}/bin/gccbug%{binsuffix}
1005
1006 %if !0%{?building_libjava:1}%{?building_libffi:1}
1007 # delete compile flag tracking from crt files
1008 crt_list=$RPM_BUILD_ROOT%{versmainlibdir}/crt*.o
1009 %if %{biarch}
1010 %if %{build_primary_64bit}
1011 crt32_list=$RPM_BUILD_ROOT%{versmainlibdirbi32}/crt*.o
1012 %else
1013 crt64_list=$RPM_BUILD_ROOT%{versmainlibdirbi64}/crt*.o
1014 %endif
1015 %endif
1016 for o in $crt_list $crt32_list $crt64_list; do
1017   objcopy -R ".comment.SUSE.OPTs" $o
1018 done
1019 %endif
1020
1021 %if 0%{?building_libjava:1}
1022 # gcj -static doesn't work properly anyway, unless using --whole-archive
1023 # let's save the space instead.
1024 find $RPM_BUILD_ROOT -name libgcj.a \
1025         -o -name libgcj-tools.a \
1026         -o -name libgij.a \
1027         -o -name libjvm.a \
1028         -o -name libgcj_bc.a \
1029   | xargs rm -f
1030
1031 find $RPM_BUILD_ROOT -name libgcj.spec | xargs \
1032   sed -i -e 's/lib: /&%%{static:%%eJava programs cannot be linked statically}/'
1033
1034 # security files have broken install locations, also they cause conflicts
1035 # between libgcj versions.  Simply delete them here, libgcj will use its
1036 # defaults in this case (which is what these files contain anyway).
1037 rm $RPM_BUILD_ROOT%{_libdir}/logging.properties
1038 rm -r $RPM_BUILD_ROOT%{_libdir}/security
1039 %endif
1040
1041 %if 0%{?building_libffi:1}
1042 # Move libffi headers, remove empty libffi libtool file
1043 mkdir -p $RPM_BUILD_ROOT%{_prefix}/include
1044 mv $RPM_BUILD_ROOT%{libsubdir}/include/ffitarget.h $RPM_BUILD_ROOT%{_prefix}/include/
1045 mv $RPM_BUILD_ROOT%{libsubdir}/include/ffi.h $RPM_BUILD_ROOT%{_prefix}/include/
1046 rm -f $RPM_BUILD_ROOT%{mainlibdir}/libffi.la
1047 %if %{biarch}
1048 rm -f $RPM_BUILD_ROOT%{mainlibdirbi}/libffi.la
1049 %endif
1050 # Generate a simple pkg-config file
1051 mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
1052 echo -e 'Name: libffi\nVersion: 3.0.9\nDescription: libffi\nLibs: -lffi' > $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libffi.pc
1053 %endif
1054
1055 %if %{build_java}
1056 %if !%{build_libjava}
1057 rm $RPM_BUILD_ROOT%{_mandir}/man1/jv-convert%{binsuffix}.1
1058 rm $RPM_BUILD_ROOT%{_mandir}/man1/gcj-dbtool%{binsuffix}.1
1059 rm $RPM_BUILD_ROOT%{_mandir}/man1/gij%{binsuffix}.1
1060 rm $RPM_BUILD_ROOT%{_mandir}/man1/grmic%{binsuffix}.1
1061 rm $RPM_BUILD_ROOT%{_mandir}/man1/gc-analyze%{binsuffix}.1
1062 rm $RPM_BUILD_ROOT%{_mandir}/man1/aot-compile%{binsuffix}.1
1063 rm $RPM_BUILD_ROOT%{_mandir}/man1/rebuild-gcj-db%{binsuffix}.1
1064 %endif
1065 rm -f $RPM_BUILD_ROOT%{_datadir}/gcc%{binsuffix}/python/libjava/aotcompile.py
1066 rm -f $RPM_BUILD_ROOT%{_datadir}/gcc%{binsuffix}/python/libjava/classfile.py
1067 %endif
1068 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/fsf-funding.7
1069 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gfdl.7
1070 rm -f $RPM_BUILD_ROOT%{_mandir}/man7/gpl.7
1071 rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
1072 %if %{biarch}
1073 %if %{build_primary_64bit}
1074 rm -f $RPM_BUILD_ROOT%{_prefix}/lib/libiberty.a
1075 %else
1076 rm -f $RPM_BUILD_ROOT%{_prefix}/lib64/libiberty.a
1077 %endif
1078 %endif
1079 rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.a
1080 rm -f $RPM_BUILD_ROOT%{libsubdir}/liblto_plugin.la
1081
1082 %if 0%{?building_libjava:1}
1083 # For building libjava only we need to delete other info docs
1084 rm $RPM_BUILD_ROOT%{_infodir}/cp-tools.info*
1085 # Remove stale manpages for binaries we do not build
1086 rm $RPM_BUILD_ROOT%{_mandir}/man1/gjdoc%{binsuffix}.1
1087 # For building the java frontend we need to copy the ecj jar
1088 mkdir -p $RPM_BUILD_ROOT%{libsubdir}
1089 cp $RPM_SOURCE_DIR/ecj.jar $RPM_BUILD_ROOT%{libsubdir}
1090 %else
1091 # For regular build, some info files do not get renamed properly.
1092 # Do so here.
1093 mv $RPM_BUILD_ROOT%{_infodir}/libgomp.info $RPM_BUILD_ROOT%{_infodir}/libgomp%{binsuffix}.info
1094 %ifarch %itm_arch
1095 mv $RPM_BUILD_ROOT%{_infodir}/libitm.info $RPM_BUILD_ROOT%{_infodir}/libitm%{binsuffix}.info
1096 %endif
1097 %if %{build_fortran} 
1098 %ifarch %quadmath_arch
1099 mv $RPM_BUILD_ROOT%{_infodir}/libquadmath.info $RPM_BUILD_ROOT%{_infodir}/libquadmath%{binsuffix}.info
1100 %endif
1101 %endif
1102 %if %{build_ada}
1103 mv $RPM_BUILD_ROOT%{_infodir}/gnat-style.info $RPM_BUILD_ROOT%{_infodir}/gnat-style%{binsuffix}.info
1104 mv $RPM_BUILD_ROOT%{_infodir}/gnat_rm.info $RPM_BUILD_ROOT%{_infodir}/gnat_rm%{binsuffix}.info
1105 mv $RPM_BUILD_ROOT%{_infodir}/gnat_ugn.info $RPM_BUILD_ROOT%{_infodir}/gnat_ugn%{binsuffix}.info
1106 %endif
1107 %endif
1108
1109
1110
1111 %if %{build_java}
1112 %if 0%{?building_libjava:1}
1113 %files -n gcc48-java
1114 %defattr(-,root,root)
1115 %{_prefix}/bin/gcj%{binsuffix}
1116 %{_prefix}/bin/gcjh%{binsuffix}
1117 %{_prefix}/bin/gcj-dbtool%{binsuffix}
1118 %{_prefix}/bin/jcf-dump%{binsuffix}
1119 %{_prefix}/bin/jv-convert%{binsuffix}
1120 %{_prefix}/bin/gc-analyze%{binsuffix}
1121 %{_prefix}/bin/aot-compile%{binsuffix}
1122 %{_prefix}/bin/rebuild-gcj-db%{binsuffix}
1123 %{libsubdir}/jc1
1124 %{libsubdir}/jvgenmain
1125 %{libsubdir}/ecj.jar
1126 %{libsubdir}/ecj1
1127 %doc %{_mandir}/man1/gcj%{binsuffix}.1.gz
1128 %doc %{_mandir}/man1/gcjh%{binsuffix}.1.gz
1129 %doc %{_mandir}/man1/gcj-dbtool%{binsuffix}.1.gz
1130 %doc %{_mandir}/man1/jcf-dump%{binsuffix}.1.gz
1131 %doc %{_mandir}/man1/jv-convert%{binsuffix}.1.gz
1132 %doc %{_mandir}/man1/gc-analyze%{binsuffix}.1.gz
1133 %doc %{_mandir}/man1/aot-compile%{binsuffix}.1.gz
1134 %doc %{_mandir}/man1/rebuild-gcj-db%{binsuffix}.1.gz
1135 %endif
1136 %endif
1137
1138 %if %{build_java}
1139 %if %{build_libjava}
1140 %files 
1141 %defattr(-,root,root)
1142 %dir %{_libdir}/gcj-%{gcc_dir_version}-%{libgcj_sover}
1143 %dir %{_libdir}/gcc
1144 %dir %{_libdir}/gcc/%{GCCDIST}
1145 %dir %{libsubdir}
1146 %{_libdir}/gcj-%{gcc_dir_version}-%{libgcj_sover}/classmap.db
1147 # We usually do not multilib libjava
1148 %if %{biarch_libjava}
1149 %versbiarchlib libgcj.la
1150 %biarchlib libgcj.so.*
1151 %biarchlib libgij.so.*
1152 %biarchlib libgcj-tools.so.*
1153 %else
1154 %versmainlib libgcj.la
1155 %mainlib libgcj.so.*
1156 %mainlib libgij.so.*
1157 %mainlib libgcj-tools.so.*
1158 %endif
1159 %{_libdir}/gcj-%{gcc_dir_version}-%{libgcj_sover}/libjvm.la
1160 %{_libdir}/gcj-%{gcc_dir_version}-%{libgcj_sover}/libjvm.so
1161 %{_libdir}/gcj-%{gcc_dir_version}-%{libgcj_sover}/libjavamath.la
1162 %{_libdir}/gcj-%{gcc_dir_version}-%{libgcj_sover}/libjavamath.so
1163
1164 %files -n libgcj_bc%{libgcj_bc_sover}%{libgcj_bc_suffix}
1165 %defattr(-,root,root)
1166 %if %{biarch_libjava}
1167 %biarchlib libgcj_bc.so.%{libgcj_bc_sover}*
1168 %else
1169 %mainlib libgcj_bc.so.%{libgcj_bc_sover}*
1170 %endif
1171
1172 %files -n libgcj48-jar
1173 %defattr(-,root,root)
1174 %{_prefix}/share/java/libgcj-%{gcc_dir_version}.jar
1175 %{_prefix}/share/java/libgcj-tools-%{gcc_dir_version}.jar
1176
1177 %files -n libgcj48-devel
1178 %defattr(-,root,root)
1179 %dir %{_prefix}/include/c++
1180 %dir %{libsubdir}
1181 %dir %{libsubdir}/include
1182 %dir %{gxxinclude}
1183 %{_libdir}/pkgconfig/libgcj%{binsuffix}.pc
1184 %{libsubdir}/include/jawt.h
1185 %{libsubdir}/include/jawt_md.h
1186 %{libsubdir}/include/jni.h
1187 %{libsubdir}/include/jni_md.h
1188 %{libsubdir}/include/jvmpi.h
1189 %{gxxinclude}/gnu
1190 %{gxxinclude}/gcj
1191 %{gxxinclude}/java
1192 %{gxxinclude}/javax
1193 %{gxxinclude}/org
1194 %{gxxinclude}/sun
1195 %{libsubdir}/include/gcj
1196 %if %{biarch_libjava}
1197 %versbiarchlib libgcj.so
1198 %versbiarchlib libgcj.spec
1199 %versbiarchlib libgcj-tools.so
1200 %versbiarchlib libgij.so
1201 %versbiarchlib libgcj_bc.so
1202 %else
1203 %versmainlib libgcj.so
1204 %versmainlib libgcj.spec
1205 %versmainlib libgcj-tools.so
1206 %versmainlib libgij.so
1207 %versmainlib libgcj_bc.so
1208 %endif
1209
1210 %files -n gcc48-gij
1211 %defattr(-,root,root)
1212 %{_prefix}/bin/gij%{binsuffix}
1213 %{_prefix}/bin/gappletviewer%{binsuffix}
1214 %{_prefix}/bin/gjar%{binsuffix}
1215 %{_prefix}/bin/gjarsigner%{binsuffix}
1216 %{_prefix}/bin/gjavah%{binsuffix}
1217 %{_prefix}/bin/gkeytool%{binsuffix}
1218 %{_prefix}/bin/gnative2ascii%{binsuffix}
1219 %{_prefix}/bin/gorbd%{binsuffix}
1220 %{_prefix}/bin/grmic%{binsuffix}
1221 %{_prefix}/bin/grmid%{binsuffix}
1222 %{_prefix}/bin/grmiregistry%{binsuffix}
1223 %{_prefix}/bin/gserialver%{binsuffix}
1224 %{_prefix}/bin/gtnameserv%{binsuffix}
1225 %doc %{_mandir}/man1/gij%{binsuffix}.1.gz
1226 %doc %{_mandir}/man1/gappletviewer%{binsuffix}.1.gz
1227 %doc %{_mandir}/man1/grmic%{binsuffix}.1.gz
1228 %doc %{_mandir}/man1/grmid%{binsuffix}.1.gz
1229 %doc %{_mandir}/man1/grmiregistry%{binsuffix}.1.gz
1230 %doc %{_mandir}/man1/gkeytool%{binsuffix}.1.gz
1231 %doc %{_mandir}/man1/gjar%{binsuffix}.1.gz
1232 %doc %{_mandir}/man1/gjarsigner%{binsuffix}.1.gz
1233 %doc %{_mandir}/man1/gjavah%{binsuffix}.1.gz
1234 %doc %{_mandir}/man1/gnative2ascii%{binsuffix}.1.gz
1235 %doc %{_mandir}/man1/gorbd%{binsuffix}.1.gz
1236 %doc %{_mandir}/man1/gserialver%{binsuffix}.1.gz
1237 %doc %{_mandir}/man1/gtnameserv%{binsuffix}.1.gz
1238 %endif
1239 %endif
1240
1241 %if %{build_java}
1242 %if 0%{?building_libffi:1}
1243 %files -n libffi%{libffi_sover}%{libffi_suffix}
1244 %defattr(-,root,root)
1245 %mainlib libffi.so.%{libffi_sover}*
1246
1247 %if %{separate_biarch}
1248 %files -n libffi%{libffi_sover}%{libffi_suffix}%{separate_biarch_suffix}
1249 %defattr(-,root,root)
1250 %biarchlib libffi.so.%{libffi_sover}*
1251 %endif
1252
1253 %post -n libffi48-devel
1254 %install_info --info-dir=%{_infodir} %{_infodir}/libffi%{binsuffix}.info.gz
1255 %postun -n libffi48-devel
1256 %install_info_delete --info-dir=%{_infodir} %{_infodir}/libffi%{binsuffix}.info.gz
1257
1258 %files -n libffi48-devel
1259 %defattr(-,root,root)
1260 %{_prefix}/include/ffi.h
1261 %{_prefix}/include/ffitarget.h
1262 %mainlib libffi.so
1263 %mainlib libffi.a
1264 %{_libdir}/pkgconfig/libffi.pc
1265 %doc %{_infodir}/libffi%{binsuffix}.info.gz
1266 %doc %{_mandir}/man3/ffi%{binsuffix}.3.gz
1267 %doc %{_mandir}/man3/ffi_call%{binsuffix}.3.gz
1268 %doc %{_mandir}/man3/ffi_prep_cif%{binsuffix}.3.gz
1269 %doc %{_mandir}/man3/ffi_prep_cif_var%{binsuffix}.3.gz
1270
1271 %if %{separate_biarch}
1272 %files -n libffi48-devel%{separate_biarch_suffix}
1273 %defattr(-,root,root)
1274 %biarchlib libffi.so
1275 %biarchlib libffi.a
1276 %endif
1277 %endif
1278 %endif
1279
1280 %if 0%{?run_tests:1}
1281 %files -n gcc48-testresults
1282 %defattr(-,root,root)
1283 %doc testresults/test_summary.txt
1284 %doc testresults/*.sum
1285 %doc testresults/*.log
1286 %endif
1287
1288
1289 %changelog