create the collect2 utility for cross toolchain
[platform/upstream/gcc48.git] / packaging / cross-icecream.spec.in
1 #
2 # spec file for package gcc (Version 4.0.1)
3 #
4 # Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany.
5 # This file and all modifications and additions to the pristine
6 # package are under the same license as the package itself.
7 #
8 # Please submit bugfixes or comments via http://www.suse.de/feedback/
9 #
10
11 %define build_cp 1
12 %define build_ada 0
13 %define build_libjava 0
14 %define build_java 0
15 %define build_fortran 0
16 %define build_objc 0
17 %define build_objcp 0
18 %define build_nof 0
19 %define build_with_mudflap 0
20 %define gcc_target_arch @cross_arch@-tizen-linux
21 %define gcc_icecream 1
22
23 %define binutils_target @cross_arch@
24 %if %{binutils_target} == "armv7l" || %{binutils_target} == "armv7hl" || %{binutils_target} == "armv7el"
25 %define binutils_target arm
26 %endif
27 %if %{binutils_target} == "armv5el"
28 %define binutils_target arm
29 %endif
30 %define canonical_target %(echo %{binutils_target} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
31 %if %{binutils_target} == "arm"
32 %define canonical_target_abi -gnueabi
33 %endif
34
35 Name:         cross-@cross_arch@-gcc@base_ver@-icecream-backend
36 BuildRequires: cross-%{binutils_target}-binutils
37 BuildRequires: bison
38 BuildRequires: flex
39 BuildRequires: gettext-devel
40 BuildRequires: glibc-devel-32bit
41 BuildRequires: mpc-devel
42 BuildRequires: mpfr-devel
43 BuildRequires: perl
44 BuildRequires: makeinfo
45 BuildRequires: zlib-devel
46 %ifarch %ix86 x86_64  %arm
47 BuildRequires: cloog-devel
48 BuildRequires: ppl-devel
49 %endif
50 %ifarch ia64
51 BuildRequires: libunwind-devel
52 %endif
53 ExclusiveArch: ppc ppc64 %ix86 x86_64 ia64 
54 %define _binary_payload w.ufdio
55
56 # COMMON-BEGIN
57 # COMMON-END
58
59 make %{?jobs:-j%jobs} all-gcc TARGET-gcc="cc1 cc1plus collect2 gcc-cross xg++ native"
60
61 %install
62 cd obj-%{GCCDIST}
63 rm -rf $RPM_BUILD_ROOT
64 make -C gcc DESTDIR=$RPM_BUILD_ROOT/inst install-driver install-common
65 make DESTDIR=$RPM_BUILD_ROOT/inst maybe-install-lto-plugin
66
67 # But the assembler comes from the cross-binutils, and hence is _not_
68 # named funnily, not even on ppc, so there we need the original target
69 install -s -D %{_prefix}/bin/%{canonical_target}-tizen-linux%{?canonical_target_abi:%canonical_target_abi}-as \
70         $RPM_BUILD_ROOT/env/usr/bin/as
71 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-g++ \
72         $RPM_BUILD_ROOT/env/usr/bin/g++
73 install -s $RPM_BUILD_ROOT/inst%{_prefix}/bin/%{CONFIGURE_TARGET}-gcc \
74         $RPM_BUILD_ROOT/env/usr/bin/gcc
75
76 %define targetlibsubdir %{_libdir}/gcc/%{CONFIGURE_TARGET}/%{gcc_dir_version}
77 for back in cc1 cc1plus collect2; do 
78         install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/$back \
79                 $RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
80 done
81 if test -f $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so; then
82   install -s -D $RPM_BUILD_ROOT/inst%{targetlibsubdir}/liblto_plugin.so \
83                 $RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
84 fi
85
86 libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do \
87   ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }'  ;\
88 done | sort -u `
89 for lib in $libs; do
90    # Check wether the same library also exists in the parent directory,
91    # and prefer that on the assumption that it is a more generic one.
92    baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
93    test -f "$baselib" && lib=$baselib
94    install -s -D $lib $RPM_BUILD_ROOT/env$lib
95 done
96 rm -rf $RPM_BUILD_ROOT/inst
97 cd $RPM_BUILD_ROOT/env
98 tar cvzf ../%{name}_%{_arch}.tar.gz *
99 cd ..
100 mkdir -p usr/share/icecream-envs
101 mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
102 rpm -q --changelog glibc >  usr/share/icecream-envs/%{name}_%{_arch}.glibc
103 rpm -q --changelog binutils >  usr/share/icecream-envs/%{name}_%{_arch}.binutils
104 rm -r env
105 cd $RPM_BUILD_DIR
106
107 %clean
108 rm -rf $RPM_BUILD_ROOT
109
110 %files
111 %defattr(-,root,root)
112 /usr/share/icecream-envs
113
114 %changelog -n cross-@cross_arch@-gcc@base_ver@-icecream-backend