2.27 version
[external/binutils.git] / packaging / binutils.spec
1 %ifarch armv7l
2 %define ARCH armv7l
3 %define ABI eabi
4 %endif
5 %ifarch %ix86
6 %define ARCH i586
7 %endif
8 %ifarch x86_64
9 %define ARCH x86_64
10 %endif
11 %ifarch aarch64
12 %define ARCH aarch64
13 %endif
14
15 %define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
16
17 %define target_cpu %{?cross}%{!?cross:%{ARCH}}
18 %define target_abi %{?cross:%{?armv7l:eabi}}%{!?cross:%{?ABI}}
19
20 %define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
21
22 Name:           binutils%{?cross:-%{cross}}
23 BuildRequires:  makeinfo
24 BuildRequires:  bison
25 BuildRequires:  flex
26 BuildRequires:  ncurses-devel
27 BuildRequires:  zlib-devel
28 BuildRequires:  gcc-c++
29 Version:        2.27
30 Release:        0
31 Url:            http://www.gnu.org/software/binutils/
32 Summary:        GNU Binutils
33 License:        GFDL-1.3 and GPL-3.0+
34 Group:          Development/Building
35 %{?cross:ExcludeArch: %{cross}}
36 Source:         binutils-%{version}.tar.bz2
37 Source1001:     binutils.manifest
38
39 %description
40 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
41 size, strings, and strip. These utilities are needed whenever you want
42 to compile a program or kernel.
43
44
45 %package gold
46 Summary:        The gold linker
47 License:        GPL-3.0+
48 Group:          Development/Building
49
50 %description gold
51 gold is an ELF linker.  It is intended to have complete support for ELF
52 and to run as fast as possible on modern systems.  For normal use it is
53 a drop-in replacement for the older GNU linker.
54
55
56 %package devel
57 Summary:        GNU binutils (BFD development files)
58 License:        GPL-3.0+
59 Group:          Development/Building
60 Requires: zlib-devel
61
62 %description devel
63 This package includes header files and static libraries necessary to
64 build programs which use the GNU BFD library, which is part of
65 binutils.
66
67
68 %prep
69 %setup -q -n binutils-%{version}
70 cp %{SOURCE1001} .
71
72
73 %build
74 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
75 export CFLAGS="${RPM_OPT_FLAGS}"
76 export CXXFLAGS="${RPM_OPT_FLAGS}"
77
78 mkdir build-dir
79 cd build-dir
80
81 ../configure \
82         --prefix=%{_prefix} --libdir=%{_libdir} \
83         --infodir=%{_infodir} --mandir=%{_mandir} \
84         --with-bugurl=http://bugs.tizen.org/ \
85         --with-sysroot=/ \
86         --disable-nls \
87         --with-separate-debug-dir=%{_prefix}/lib/debug \
88         --with-pic \
89         --build=%{host_arch} --target=%{target_arch} \
90         --host=%{host_arch} \
91 %{?cross: \
92         --enable-targets=%{target_arch} \
93         --enable-64-bit-bfd \
94 } \
95 %{!?cross: \
96         --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux \
97 } \
98         --enable-plugins \
99         --enable-gold \
100         --enable-shared
101
102 make %{?_smp_mflags}
103
104 %install
105 cd build-dir
106 make DESTDIR=$RPM_BUILD_ROOT install
107
108 # Copy instead of hardlinks
109 for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
110 do
111   rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
112 %{!?cross:
113   cp %{buildroot}%{_bindir}/$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
114 }
115 %{?cross:
116   cp %{buildroot}%{_bindir}/%{target_arch}-$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
117 }
118 done
119
120 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
121 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
122
123 # Remove unwanted files to shut up rpm
124 %{remove_docs}
125 rm -rf %{buildroot}%{_bindir}/gcore
126 rm -rf %{buildroot}%{_bindir}/gdb*
127 rm -rf %{buildroot}%{_datadir}/gdb
128 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
129 %{?cross:
130 rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
131 rm -rf %{buildroot}%{_prefix}/%{host_arch}
132 rm -rf %{buildroot}%{_includedir}
133 rm -rf %{buildroot}%{_prefix}/lib*
134 rm -rf %{buildroot}%{_datadir}
135 }
136
137 %files
138 %manifest binutils.manifest
139 %defattr(-,root,root)
140 %{_bindir}/*
141 %{_prefix}/%{target_arch}/bin/*
142 %{!?cross:
143 %exclude %{_bindir}/ld.gold
144 %exclude %{_prefix}/%{target_arch}/bin/ld.gold
145 %{_libdir}/*.so
146 %{_prefix}/%{host_arch}/lib/ldscripts
147
148 %files devel
149 %manifest binutils.manifest
150 %defattr(-,root,root)
151 %{_includedir}/*.h
152 %{_includedir}/gdb/*.h
153 %{_libdir}/*.a
154
155 %files gold
156 %manifest binutils.manifest
157 %defattr(-,root,root)
158 %{_bindir}/ld.gold
159 %{_prefix}/%{target_arch}/bin/ld.gold
160 }
161
162 %changelog