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