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