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