78051e2aeec50ea815b537a3e9f99b07123087b2
[external/binutils.git] / packaging / binutils.spec
1 %ifarch armv7l
2 %define ARCH armv7l
3 %define ABI eabi
4 %endif
5 %ifarch armv7hl
6 %define ARCH armv7hl
7 %define ABI eabihf
8 %endif
9 %ifarch %ix86
10 %define ARCH i586
11 %endif
12 %ifarch x86_64
13 %define ARCH x86_64
14 %endif
15 %ifarch aarch64
16 %define ARCH aarch64
17 %endif
18
19 %define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
20
21 %define target_cpu %{?cross}%{!?cross:%{ARCH}}
22 %define target_abi %{?cross:%{?armv7l:eabi}%{?armv7hl:eabihf}}%{!?cross:%{?ABI}}
23
24 %define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
25
26 %if 0%{?run_tests}
27 %define binutils_run_tests 1
28 %endif
29
30 Name:           binutils%{?cross:-%{cross}}
31 BuildRequires:  makeinfo
32 BuildRequires:  bison
33 BuildRequires:  flex
34 BuildRequires:  expat-devel
35 BuildRequires:  ncurses-devel
36 BuildRequires:  zlib-devel
37 BuildRequires:  gcc-c++
38 %if 0%{?binutils_run_tests}
39 BuildRequires:  dejagnu
40 BuildRequires:  glibc-devel-static
41 %endif
42 Version:        2.33.1
43 Release:        0
44 Url:            http://www.gnu.org/software/binutils/
45 Summary:        GNU Binutils
46 License:        GFDL-1.3 and GPL-3.0+
47 Group:          Development/Building
48 %{?cross:ExcludeArch: %{cross}}
49 Source:         binutils-%{version}.tar.bz2
50 Source1001:     binutils.manifest
51
52 %description
53 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
54 size, strings, and strip. These utilities are needed whenever you want
55 to compile a program or kernel.
56
57
58 %package gold
59 Summary:        The gold linker
60 License:        GPL-3.0+
61 Group:          Development/Building
62
63 %description gold
64 gold is an ELF linker.  It is intended to have complete support for ELF
65 and to run as fast as possible on modern systems.  For normal use it is
66 a drop-in replacement for the older GNU linker.
67
68
69 %package devel
70 Summary:        GNU binutils (BFD development files)
71 License:        GPL-3.0+
72 Group:          Development/Building
73 Requires: zlib-devel
74
75 %description devel
76 This package includes header files and static libraries necessary to
77 build programs which use the GNU BFD library, which is part of
78 binutils.
79
80 %{!?cross:
81 %package -n gdb
82 Summary:        A GNU source-level debugger for C, C++, Java and other languages
83 License:        GPL-3.0+
84 Group:          Development/Building
85 Requires:       python
86
87 %description -n gdb
88 GDB, the GNU debugger, allows you to debug programs written in C, C++,
89 Java, and other languages, by executing them in a controlled fashion
90 and printing their data.
91 }
92 %package -n gdb-server
93 Summary: A standalone server for GDB (the GNU source-level debugger)
94
95 %description -n gdb-server
96 GDB, the GNU debugger, allows you to debug programs written in C, C++,
97 Java, and other languages, by executing them in a controlled fashion
98 and printing their data.
99
100 This package provides a program that allows you to run GDB on a different machine than the one 
101 which is running the program being debugged.
102
103 %prep
104 %setup -q -n binutils-%{version}
105 cp %{SOURCE1001} .
106
107
108 %build
109 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
110 export CFLAGS="${RPM_OPT_FLAGS}"
111 export CXXFLAGS="${RPM_OPT_FLAGS}"
112
113 mkdir build-dir
114 cd build-dir
115
116 ../configure \
117         --prefix=%{_prefix} --libdir=%{_libdir} \
118         --infodir=%{_infodir} --mandir=%{_mandir} \
119         --with-bugurl=https://bugs.tizen.org/ \
120         --with-sysroot=/ \
121         --disable-nls \
122         --with-separate-debug-dir=%{_prefix}/lib/debug \
123         --with-pic \
124         --build=%{host_arch} --target=%{target_arch} \
125         --host=%{host_arch} \
126         %{?annobin_verification: --enable-annobin-verification=warn } \
127         %{?annobin_verification_strict: --enable-annobin-verification=strict } \
128 %{?cross: \
129         --enable-targets=%{target_arch} \
130         --enable-64-bit-bfd \
131 } \
132 %{!?cross: \
133         --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux \
134 } \
135         --enable-plugins \
136         --enable-gold \
137         --enable-shared \
138         --enable-new-dtags \
139         --with-gdb-datadir=%{_datadir}/gdb              \
140         --enable-gdb-build-warnings=,-Wno-unused        \
141         --with-separate-debug-dir=/usr/lib/debug        \
142         --disable-sim                                   \
143         --with-expat
144
145 make %{?_smp_mflags}
146
147 %check
148 %{?binutils_run_tests:
149     make %{?_smp_mflags} -C build-dir check -k
150 }
151
152 %install
153 cd build-dir
154 make DESTDIR=$RPM_BUILD_ROOT install
155
156 # Copy instead of hardlinks
157 for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
158 do
159   rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
160 %{!?cross:
161   cp %{buildroot}%{_bindir}/$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
162 }
163 %{?cross:
164   cp %{buildroot}%{_bindir}/%{target_arch}-$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
165 }
166 done
167
168 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
169 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
170
171 # Remove unwanted files to shut up rpm
172 %{remove_docs}
173 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
174 %{?cross:
175 rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
176 rm -rf %{buildroot}%{_prefix}/%{host_arch}
177 rm -rf %{buildroot}%{_includedir}
178 rm -rf %{buildroot}%{_prefix}/lib*
179 rm -rf %{buildroot}%{_datadir}
180 }
181
182 %files
183 %manifest binutils.manifest
184 %defattr(-,root,root)
185 %{_bindir}/*
186 %{_prefix}/%{target_arch}/bin/*
187 %{!?cross:
188 %exclude %{_bindir}/gdb*
189 %exclude %{_bindir}/ld.gold
190 %exclude %{_prefix}/%{target_arch}/bin/ld.gold
191 %{_libdir}/*.so
192 %{_prefix}/%{host_arch}/lib/ldscripts
193
194 %files devel
195 %manifest binutils.manifest
196 %defattr(-,root,root)
197 %{_includedir}/*.h
198 %{_includedir}/gdb/*.h
199 %{_libdir}/*.a
200
201 %files gold
202 %manifest binutils.manifest
203 %defattr(-,root,root)
204 %{_bindir}/ld.gold
205 %{_prefix}/%{target_arch}/bin/ld.gold
206
207 %files -n gdb
208 %{_datadir}/gdb
209 %{_bindir}/gcore
210 %{_bindir}/gdb
211 %{_bindir}/gdb-add-index
212
213 %files -n gdb-server
214 %{_bindir}/gdbserver
215 }
216
217 %changelog