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