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