Packaging added.
[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.25
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
105 make %{?_smp_mflags}
106
107 %install
108 cd build-dir
109 make DESTDIR=$RPM_BUILD_ROOT install
110
111 # Copy instead of hardlinks
112 for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
113 do
114   rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
115 %{!?cross:
116   cp %{buildroot}%{_bindir}/$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
117 }
118 %{?cross:
119   cp %{buildroot}%{_bindir}/%{target_arch}-$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
120 }
121 done
122
123 install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
124 install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
125
126 # Remove unwanted files to shut up rpm
127 %{remove_docs}
128 rm -rf %{buildroot}%{_bindir}/gcore
129 rm -rf %{buildroot}%{_bindir}/gdb*
130 rm -rf %{buildroot}%{_datadir}/gdb
131 rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
132 %{?cross:
133 rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
134 rm -rf %{buildroot}%{_prefix}/%{host_arch}
135 rm -rf %{buildroot}%{_includedir}
136 rm -rf %{buildroot}%{_prefix}/lib*
137 rm -rf %{buildroot}%{_datadir}
138 }
139
140 %files
141 %manifest binutils.manifest
142 %defattr(-,root,root)
143 %{_bindir}/*
144 %{_prefix}/%{target_arch}/bin/*
145 %{!?cross:
146 %exclude %{_bindir}/ld.gold
147 %exclude %{_prefix}/%{target_arch}/bin/ld.gold
148 %{_libdir}/*.so
149 %{_prefix}/%{host_arch}/lib/ldscripts
150
151 %files devel
152 %manifest binutils.manifest
153 %defattr(-,root,root)
154 %{_includedir}/*.h
155 %{_includedir}/gdb/*.h
156 %{_libdir}/*.a
157
158 %files gold
159 %manifest binutils.manifest
160 %defattr(-,root,root)
161 %{_bindir}/ld.gold
162 %{_prefix}/%{target_arch}/bin/ld.gold
163 }
164
165 %changelog