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