packaging: fix testsuite build.
[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:  ncurses-devel
38 BuildRequires:  zlib-devel
39 BuildRequires:  gcc-c++
40 %if 0%{?binutils_run_tests}
41 BuildRequires:  dejagnu
42 BuildRequires:  gdb
43 BuildRequires:  glibc-devel-static
44 %endif
45 Version:        2.27
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
84 %prep
85 %setup -q -n binutils-%{version}
86 cp %{SOURCE1001} .
87
88
89 %build
90 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
91 export CFLAGS="${RPM_OPT_FLAGS}"
92 export CXXFLAGS="${RPM_OPT_FLAGS}"
93
94 mkdir build-dir
95 cd build-dir
96
97 ../configure \
98         --prefix=%{_prefix} --libdir=%{_libdir} \
99         --infodir=%{_infodir} --mandir=%{_mandir} \
100         --with-bugurl=http://bugs.tizen.org/ \
101         --with-sysroot=/ \
102         --disable-nls \
103         --with-separate-debug-dir=%{_prefix}/lib/debug \
104         --with-pic \
105         --build=%{host_arch} --target=%{target_arch} \
106         --host=%{host_arch} \
107 %{?cross: \
108         --enable-targets=%{target_arch} \
109         --enable-64-bit-bfd \
110 } \
111 %{!?cross: \
112         --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux \
113 } \
114         --enable-plugins \
115         --enable-gold \
116         --enable-shared \
117         --enable-new-dtags
118
119 make %{?_smp_mflags}
120
121 %check
122 %{?binutils_run_tests:
123     make %{?_smp_mflags} -C build-dir check -k
124 }
125
126 %install
127 cd build-dir
128 make DESTDIR=$RPM_BUILD_ROOT install
129
130 # Copy instead of hardlinks
131 for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
132 do
133   rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
134 %{!?cross:
135   cp %{buildroot}%{_bindir}/$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
136 }
137 %{?cross:
138   cp %{buildroot}%{_bindir}/%{target_arch}-$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
139 }
140 done
141
142 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
143 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
144
145 # Remove unwanted files to shut up rpm
146 %{remove_docs}
147 rm -rf %{buildroot}%{_bindir}/gcore
148 rm -rf %{buildroot}%{_bindir}/gdb*
149 rm -rf %{buildroot}%{_datadir}/gdb
150 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
151 %{?cross:
152 rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
153 rm -rf %{buildroot}%{_prefix}/%{host_arch}
154 rm -rf %{buildroot}%{_includedir}
155 rm -rf %{buildroot}%{_prefix}/lib*
156 rm -rf %{buildroot}%{_datadir}
157 }
158
159 %files
160 %manifest binutils.manifest
161 %defattr(-,root,root)
162 %{_bindir}/*
163 %{_prefix}/%{target_arch}/bin/*
164 %{!?cross:
165 %exclude %{_bindir}/ld.gold
166 %exclude %{_prefix}/%{target_arch}/bin/ld.gold
167 %{_libdir}/*.so
168 %{_prefix}/%{host_arch}/lib/ldscripts
169
170 %files devel
171 %manifest binutils.manifest
172 %defattr(-,root,root)
173 %{_includedir}/*.h
174 %{_includedir}/gdb/*.h
175 %{_libdir}/*.a
176
177 %files gold
178 %manifest binutils.manifest
179 %defattr(-,root,root)
180 %{_bindir}/ld.gold
181 %{_prefix}/%{target_arch}/bin/ld.gold
182 }
183
184 %changelog