]> git.pld-linux.org Git - packages/busybox.git/blob - busybox.spec
_BSD_SOURCE is deprecated and causes warnings, so switch to _GNU_SOURCE
[packages/busybox.git] / busybox.spec
1 # TODO:
2 # - RPC/NFS with uClibc doesn't build (due to tirpc linking), so it's currently disabled
3 # - review patch 3. Updated to 1.17.3, but the code changed so much it's unclear
4 #   if it still serves a purpose
5 # - sparc64 modules support in sparc(32), x86_64 modules support in i386 version
6 # - make internal commands work even if busybox is not in /bin/busybox (initrd)
7 #   or when /proc is not mounted (static / normal)
8 #
9 # Conditional build:
10 # alternative busybox config file (replaces default one) you should
11 # define cfgfile macro, i.e.
12 #
13 #       rpm --rebuild busybox.*.src.rpm --with altconfig --define "cfgfile bb-emb-config.h"
14 #
15 %bcond_with     altconfig       # use alternative config (defined by cfgfile)
16 %bcond_with     linkfl          # creates links to busybox binary and puts them into file list
17 %bcond_without  dynamic         # don't build dynamic (base) version
18 %bcond_without  static          # don't build static version
19 %bcond_without  initrd          # don't build initrd version
20 %bcond_with     dietlibc        # build dietlibc-based initrd and static versions
21 %bcond_with     glibc           # build glibc-based initrd and static versions
22 %bcond_without  verbose         # verbose build
23 # Options below are useful, when you want fileutils and grep providing.
24 # For example, ash package requires fileutils and grep.
25 %bcond_with     fileutl_prov    # adds fileutils providing
26 %bcond_with     grep_prov       # adds grep providing
27 # Option below is useful, when busybox is built with shell support.
28 %bcond_with     sh_prov         # adds /bin/sh providing
29 # WARNING! Shell, fileutils and grep providing may depend on config file!
30 # Fileutils, grep and shell provided with busybox have not such
31 # functionality as their GNU countenders.
32 #
33 %ifnarch %{ix86} %{x8664} ppc
34 %define         with_glibc      1
35 %endif
36 %ifarch x32
37 # until uClibc builds on x32
38 %undefine       with_static
39 %endif
40 Summary:        Set of common Unix utilities for embeded systems
41 Summary(pl.UTF-8):      Zestaw narzędzi uniksowych dla systemów wbudowanych
42 Summary(pt_BR.UTF-8):   BusyBox é um conjunto de utilitários UNIX em um único binário
43 Name:           busybox
44 # stable line only
45 Version:        1.35.0
46 Release:        0.1
47 License:        GPL v2
48 Group:          Applications
49 Source0:        http://www.busybox.net/downloads/%{name}-%{version}.tar.bz2
50 # Source0-md5:  585949b1dd4292b604b7d199866e9913
51 Source1:        %{name}.config
52 Source2:        %{name}-initrd.config
53 %{?with_altconfig:Source3:      %{cfgfile}}
54 Patch0:         x32.patch
55 Patch1:         %{name}-logconsole.patch
56 Patch2:         %{name}-printf-gettext.patch
57 Patch3:         %{name}-loadfont.patch
58 Patch4:         %{name}-kernel_headers.patch
59 Patch5:         %{name}-insmod-morearchs.patch
60 Patch6:         %{name}-dhcp.patch
61 Patch7:         %{name}-fix_64_archs.patch
62 Patch8:         busybox-1.31.1-stime-fix.patch
63 Patch9:         %{name}-ash-export-PATH.patch
64 Patch10:        0001-modutils-check-ELF-header-before-calling-finit_module.patch
65 URL:            http://www.busybox.net/
66 BuildRequires:  gcc >= 3.2
67 BuildRequires:  perl-tools-pod
68 BuildRequires:  rpmbuild(macros) >= 1.652
69 %if %{with glibc}
70 BuildRequires:  libtirpc-devel
71 BuildRequires:  pkgconfig
72 %endif
73 %if %{with initrd} || %{with static}
74         %if %{with dietlibc}
75 BuildRequires:  dietlibc-static
76         %else
77                 %if %{with glibc}
78 BuildRequires:  glibc-static
79 BuildRequires:  libtirpc-static
80                 %else
81 %if "%{_target_base_arch}" != "%{_host_base_arch}"
82 BuildRequires:  cross%{_target_base_arch}-uClibc-static
83 %else
84         %ifarch ppc %{x8664}
85 BuildRequires:  uClibc-static >= 3:0.9.30.1
86         %else
87 BuildRequires:  uClibc-static >= 3:0.9.30.1
88         %endif
89 %endif
90                 %endif
91         %endif
92 %endif
93 %{?with_sh_prov:Provides:       /bin/sh}
94 %{?with_fileutl_prov:Provides:  fileutils}
95 %{?with_grep_prov:Provides:     grep}
96 Provides:       busybox-implementation = %{version}-%{release}
97 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
98
99 %define         _enable_debug_packages  0
100
101 %define         _bindir         /bin
102
103 %if "%{_target_base_arch}" != "%{_host_base_arch}"
104         %define CrossOpts CROSS="%{_target_cpu}-pld-linux-"
105 %else
106         %define CrossOpts %{nil}
107 %endif
108
109 %define         filterout_ld    -Wl,-z,(combreloc|relro)
110
111 %if %{with glibc}
112 %define         tirpccflags     %(pkg-config --cflags libtirpc)
113 %if %{with initrd} || %{with static}
114 %define         tirpcslibs      %(pkg-config --libs --static libtirpc|sed s/-l//g)
115 %endif
116 %if %{with dynamic}
117 %define         tirpcdlibs      %(pkg-config --libs libtirpc|sed s/-l//g)
118 %endif
119 %endif
120
121 %description
122 BusyBox combines tiny versions of many common UNIX utilities into a
123 single small executable. It provides minimalist replacements for most
124 of the utilities you usually find in fileutils, shellutils, findutils,
125 textutils, grep, gzip, tar, etc. BusyBox provides a fairly complete
126 POSIX environment for any small or embedded system. The utilities in
127 BusyBox generally have fewer options than their full-featured GNU
128 cousins; however, the options that are included provide the expected
129 functionality and behave very much like their GNU counterparts.
130
131 BusyBox has been written with size-optimization and limited resources
132 in mind. It is also extremely modular so you can easily include or
133 exclude commands (or features) at compile time. This makes it easy to
134 customize your embedded systems. To create a working system, just add
135 a kernel, a shell (such as ash), and an editor (such as elvis-tiny or
136 ae).
137
138 %description -l pl.UTF-8
139 BusyBox składa małe wersje wielu narzędzi uniksowych w jeden mały plik
140 wykonywalny. Zapewnia minimalne zastępniki większości narzędzi
141 zawartych w pakietach fileutils, shellutils, findutils, grep, gzip,
142 tar itp. BusyBox daje w miarę kompletne środowisko POSIX dla małych
143 lub wbudowanych systemów. Narzędzia mają mniej opcji niż ich pełne
144 odpowiedniki GNU, ale mają podstawową funkcjonalność. Do działającego
145 systemu potrzeba jeszcze tylko kernela, shella (np. ash) oraz edytora
146 (np. elvis-tiny albo ae).
147
148 %description -l pt_BR.UTF-8
149 BusyBox combina versões reduzidas de muitos utilitários UNIX num único
150 executável, fornecendo substitutos minimalistas para muitos dos
151 executáveis encontrados em pacotes como fileutils, shellutils,
152 findutils, textutils, grep, gzip, tar, etc. Os utilitários do BusyBox
153 em geral têm menos opções que os utilitários GNU, mas as opções
154 implementadas comportam-se de maneira similar aos equivalentes GNU.
155
156 %package static
157 Summary:        Static busybox
158 Summary(pl.UTF-8):      Statycznie skonsolidowany busybox
159 Group:          Applications
160
161 %description static
162 Static busybox.
163
164 %description static -l pl.UTF-8
165 Statycznie skonsolidowany busybox.
166
167 %package initrd
168 Summary:        Static busybox for initrd
169 Summary(pl.UTF-8):      Statycznie skonsolidowany busybox dla initrd
170 Group:          Base
171 Conflicts:      geninitrd < 10000.20
172 Provides:       busybox-implementation = %{version}-%{release}
173
174 %description initrd
175 Static busybox for initrd.
176
177 %description initrd -l pl.UTF-8
178 Statycznie skonsolidowany busybox dla initrd.
179
180 %prep
181 %setup -q
182 %patch0 -p1
183 %patch1 -p1
184 %patch2 -p1
185 #%patch3 -p1
186 %patch4 -p1
187 %patch5 -p1
188 %patch6 -p1
189 %patch7 -p1
190 %patch8 -p1
191 %patch9 -p1
192 %patch10 -p1
193
194 %build
195 install -d built
196 %if %{with initrd}
197 install %{SOURCE2} .config
198 echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config
199 %{__make} oldconfig
200 %{__make} \
201         %{?with_verbose:V=1} \
202         EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} -Os -D_GNU_SOURCE %{!?with_glibc:-fno-stack-protector}" \
203         EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack" \
204 %if %{with dietlibc}
205         LIBRARIES="-lrpc" \
206         CC="diet %{__cc}"
207 %else
208 %if %{with glibc}
209         %{CrossOpts} \
210         CC="%{__cc}"
211 %else
212         %if "%{_target_base_arch}" != "%{_host_base_arch}"
213         CROSS="%{_target_cpu}-uclibc-" \
214         %endif
215         CC="%{_target_cpu}-uclibc-gcc"
216 %endif
217 %endif
218
219 mv -f busybox built/busybox.initrd
220 %{__make} clean
221 %endif
222
223 %if %{with static}
224 %if %{with altconfig}
225 install %{SOURCE3} .config
226 %else
227 install %{SOURCE1} .config
228 echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config
229 %endif
230 %{__make} oldconfig
231 %{__make} \
232         %{?with_verbose:V=1} \
233         EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} -Os -D_GNU_SOURCE %{!?with_glibc:-fno-stack-protector}" \
234         EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack" \
235 %if %{with dietlibc}
236         LIBRARIES="-lrpc" \
237         CC="diet %{__cc}"
238 %else
239 %if %{with glibc}
240         %{CrossOpts} \
241         CC="%{__cc}"
242 %else
243         %if "%{_target_base_arch}" != "%{_host_base_arch}"
244         CROSS="%{_target_cpu}-uclibc-" \
245         %endif
246         CC="%{_target_cpu}-uclibc-gcc"
247 %endif
248 %endif
249
250 mv -f busybox built/busybox.static
251 %{__make} clean
252 %endif
253
254 %if %{with dynamic}
255 %if %{with altconfig}
256 install %{SOURCE3} .config
257 %else
258 install %{SOURCE1} .config
259 echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcdlibs}}"' >> .config
260 %endif
261 %{__make} oldconfig
262 %{__make} \
263         %{?with_verbose:V=1} \
264         %{CrossOpts} \
265         EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} %{!?with_glibc:-fno-stack-protector}" \
266         EXTRA_LDFLAGS="%{rpmldflags} -Wl,-z,noexecstack" \
267         CC="%{__cc}"
268 %{__make} busybox.links docs/busybox.1
269 %endif
270
271 %install
272 rm -rf $RPM_BUILD_ROOT
273
274 %if %{with static}
275 install -d $RPM_BUILD_ROOT%{_bindir}
276 install built/busybox.static $RPM_BUILD_ROOT%{_bindir}
277 %endif
278
279 %if %{with initrd}
280 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
281 install built/busybox.initrd $RPM_BUILD_ROOT%{_libdir}/initrd/busybox
282 %endif
283
284 %if %{with dynamic}
285 install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,%{_libdir}/busybox}
286 install busybox.links $RPM_BUILD_ROOT%{_libdir}/busybox
287 install docs/busybox.1 $RPM_BUILD_ROOT%{_mandir}/man1
288
289 # install links to busybox binary, when linkfl is defined
290 %if %{with linkfl}
291 %{__make} install \
292         PREFIX=$RPM_BUILD_ROOT
293 %else
294 install busybox $RPM_BUILD_ROOT%{_bindir}
295 %endif
296 %endif
297
298 %clean
299 rm -rf $RPM_BUILD_ROOT
300
301 %if %{with dynamic}
302 %files
303 %defattr(644,root,root,755)
304 %doc AUTHORS README .config
305
306 %if %{with linkfl}
307 %attr(755,root,root) /bin/*
308 %attr(755,root,root) /sbin/*
309 %attr(755,root,root) %{_bindir}/*
310 %attr(755,root,root) %{_sbindir}/*
311 %else
312 %attr(755,root,root) %{_bindir}/busybox
313 %endif
314
315 %{_libdir}/busybox
316 %{_mandir}/man1/busybox.1*
317 %endif
318
319 %if %{with static}
320 %files static
321 %defattr(644,root,root,755)
322 %attr(755,root,root) %{_bindir}/busybox.static
323 %endif
324
325 %if %{with initrd}
326 %files initrd
327 %defattr(644,root,root,755)
328 %attr(755,root,root) %{_libdir}/initrd/busybox
329 %endif
This page took 0.079908 seconds and 3 git commands to generate.