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)
10 # alternative busybox config file (replaces default one) you should
11 # define cfgfile macro, i.e.
13 # rpm --rebuild busybox.*.src.rpm --with altconfig --define "cfgfile bb-emb-config.h"
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.
33 %ifnarch %{ix86} %{x8664} ppc
37 # until uClibc builds on x32
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
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}}
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
70 BuildRequires: libtirpc-devel
71 BuildRequires: pkgconfig
73 %if %{with initrd} || %{with static}
75 BuildRequires: dietlibc-static
78 BuildRequires: glibc-static
79 BuildRequires: libtirpc-static
81 %if "%{_target_base_arch}" != "%{_host_base_arch}"
82 BuildRequires: cross%{_target_base_arch}-uClibc-static
85 BuildRequires: uClibc-static >= 3:0.9.30.1
87 BuildRequires: uClibc-static >= 3:0.9.30.1
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)
99 %define _enable_debug_packages 0
103 %if "%{_target_base_arch}" != "%{_host_base_arch}"
104 %define CrossOpts CROSS="%{_target_cpu}-pld-linux-"
106 %define CrossOpts %{nil}
109 %define filterout_ld -Wl,-z,(combreloc|relro)
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)
117 %define tirpcdlibs %(pkg-config --libs libtirpc|sed s/-l//g)
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.
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
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).
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.
157 Summary: Static busybox
158 Summary(pl.UTF-8): Statycznie skonsolidowany busybox
164 %description static -l pl.UTF-8
165 Statycznie skonsolidowany busybox.
168 Summary: Static busybox for initrd
169 Summary(pl.UTF-8): Statycznie skonsolidowany busybox dla initrd
171 Conflicts: geninitrd < 10000.20
172 Provides: busybox-implementation = %{version}-%{release}
175 Static busybox for initrd.
177 %description initrd -l pl.UTF-8
178 Statycznie skonsolidowany busybox dla initrd.
197 install %{SOURCE2} .config
198 echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config
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" \
212 %if "%{_target_base_arch}" != "%{_host_base_arch}"
213 CROSS="%{_target_cpu}-uclibc-" \
215 CC="%{_target_cpu}-uclibc-gcc"
219 mv -f busybox built/busybox.initrd
224 %if %{with altconfig}
225 install %{SOURCE3} .config
227 install %{SOURCE1} .config
228 echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config
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" \
243 %if "%{_target_base_arch}" != "%{_host_base_arch}"
244 CROSS="%{_target_cpu}-uclibc-" \
246 CC="%{_target_cpu}-uclibc-gcc"
250 mv -f busybox built/busybox.static
255 %if %{with altconfig}
256 install %{SOURCE3} .config
258 install %{SOURCE1} .config
259 echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcdlibs}}"' >> .config
263 %{?with_verbose:V=1} \
265 EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} %{!?with_glibc:-fno-stack-protector}" \
266 EXTRA_LDFLAGS="%{rpmldflags} -Wl,-z,noexecstack" \
268 %{__make} busybox.links docs/busybox.1
272 rm -rf $RPM_BUILD_ROOT
275 install -d $RPM_BUILD_ROOT%{_bindir}
276 install built/busybox.static $RPM_BUILD_ROOT%{_bindir}
280 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
281 install built/busybox.initrd $RPM_BUILD_ROOT%{_libdir}/initrd/busybox
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
289 # install links to busybox binary, when linkfl is defined
292 PREFIX=$RPM_BUILD_ROOT
294 install busybox $RPM_BUILD_ROOT%{_bindir}
299 rm -rf $RPM_BUILD_ROOT
303 %defattr(644,root,root,755)
304 %doc AUTHORS README .config
307 %attr(755,root,root) /bin/*
308 %attr(755,root,root) /sbin/*
309 %attr(755,root,root) %{_bindir}/*
310 %attr(755,root,root) %{_sbindir}/*
312 %attr(755,root,root) %{_bindir}/busybox
316 %{_mandir}/man1/busybox.1*
321 %defattr(644,root,root,755)
322 %attr(755,root,root) %{_bindir}/busybox.static
327 %defattr(644,root,root,755)
328 %attr(755,root,root) %{_libdir}/initrd/busybox