]>
Commit | Line | Data |
---|---|---|
e7982b05 | 1 | # TODO: |
a7ec8c50 | 2 | # - RPC/NFS with uClibc doesn't build (due to tirpc linking), so it's currently disabled |
a54ace54 CM |
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) | |
598da0d3 | 8 | # |
2678f462 | 9 | # Conditional build: |
b5011fd7 | 10 | # alternative busybox config file (replaces default one) you should |
4a69c6c5 | 11 | # define cfgfile macro, i.e. |
d635bde0 | 12 | # |
6f6b5afa | 13 | # rpm --rebuild busybox.*.src.rpm --with altconfig --define "cfgfile bb-emb-config.h" |
a54ace54 | 14 | # |
2678f462 JB |
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 | |
63de0802 | 17 | %bcond_without dynamic # don't build dynamic (base) version |
3637c580 JR |
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 | |
494a100b | 22 | %bcond_without verbose # verbose build |
d635bde0 | 23 | # Options below are useful, when you want fileutils and grep providing. |
24 | # For example, ash package requires fileutils and grep. | |
2678f462 JB |
25 | %bcond_with fileutl_prov # adds fileutils providing |
26 | %bcond_with grep_prov # adds grep providing | |
d635bde0 | 27 | # Option below is useful, when busybox is built with shell support. |
2678f462 | 28 | %bcond_with sh_prov # adds /bin/sh providing |
6b50dd3e | 29 | # WARNING! Shell, fileutils and grep providing may depend on config file! |
d635bde0 | 30 | # Fileutils, grep and shell provided with busybox have not such |
31 | # functionality as their GNU countenders. | |
2678f462 | 32 | # |
c15e3058 | 33 | %ifnarch %{ix86} %{x8664} ppc |
4ec69b2b JR |
34 | %define with_glibc 1 |
35 | %endif | |
36 | %ifarch x32 | |
37 | # until uClibc builds on x32 | |
38 | %undefine with_static | |
1735ff25 | 39 | %endif |
dce89576 | 40 | Summary: Set of common Unix utilities for embeded systems |
718bff43 ER |
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 | |
ee61dafa | 43 | Name: busybox |
586f52e3 | 44 | # stable line only |
36e1d67e | 45 | Version: 1.35.0 |
a7f0a442 | 46 | Release: 0.1 |
bbbc183d | 47 | License: GPL v2 |
d79d7625 | 48 | Group: Applications |
693dc2a0 | 49 | Source0: http://www.busybox.net/downloads/%{name}-%{version}.tar.bz2 |
36e1d67e | 50 | # Source0-md5: 585949b1dd4292b604b7d199866e9913 |
4f8fe04f AM |
51 | Source1: %{name}.config |
52 | Source2: %{name}-initrd.config | |
8f98fac8 | 53 | %{?with_altconfig:Source3: %{cfgfile}} |
aad3a7f3 | 54 | Patch0: x32.patch |
b2b9509f | 55 | Patch1: %{name}-logconsole.patch |
56 | Patch2: %{name}-printf-gettext.patch | |
57 | Patch3: %{name}-loadfont.patch | |
29a4a582 JR |
58 | Patch4: %{name}-kernel_headers.patch |
59 | Patch5: %{name}-insmod-morearchs.patch | |
60 | Patch6: %{name}-dhcp.patch | |
61 | Patch7: %{name}-fix_64_archs.patch | |
7a6bf0ae | 62 | Patch8: busybox-1.31.1-stime-fix.patch |
29a4a582 | 63 | Patch9: %{name}-ash-export-PATH.patch |
459c400e | 64 | Patch10: 0001-modutils-check-ELF-header-before-calling-finit_module.patch |
87902b66 | 65 | URL: http://www.busybox.net/ |
255676bf | 66 | BuildRequires: gcc >= 3.2 |
839c36a5 | 67 | BuildRequires: perl-tools-pod |
d41f35db | 68 | BuildRequires: rpmbuild(macros) >= 1.652 |
6648e383 JP |
69 | %if %{with glibc} |
70 | BuildRequires: libtirpc-devel | |
71 | BuildRequires: pkgconfig | |
72 | %endif | |
ef0df9c1 | 73 | %if %{with initrd} || %{with static} |
6f6b5afa | 74 | %if %{with dietlibc} |
1735ff25 | 75 | BuildRequires: dietlibc-static |
6f6b5afa | 76 | %else |
77 | %if %{with glibc} | |
1735ff25 | 78 | BuildRequires: glibc-static |
6648e383 | 79 | BuildRequires: libtirpc-static |
6f6b5afa | 80 | %else |
cbbddfaa | 81 | %if "%{_target_base_arch}" != "%{_host_base_arch}" |
9922ba41 | 82 | BuildRequires: cross%{_target_base_arch}-uClibc-static |
9a45af3a | 83 | %else |
9922ba41 | 84 | %ifarch ppc %{x8664} |
c574afd9 | 85 | BuildRequires: uClibc-static >= 3:0.9.30.1 |
9922ba41 | 86 | %else |
c574afd9 | 87 | BuildRequires: uClibc-static >= 3:0.9.30.1 |
9922ba41 | 88 | %endif |
9a45af3a | 89 | %endif |
6f6b5afa | 90 | %endif |
91 | %endif | |
1735ff25 | 92 | %endif |
a54ace54 | 93 | %{?with_sh_prov:Provides: /bin/sh} |
2678f462 JB |
94 | %{?with_fileutl_prov:Provides: fileutils} |
95 | %{?with_grep_prov:Provides: grep} | |
0f80cc3e | 96 | Provides: busybox-implementation = %{version}-%{release} |
ee61dafa MM |
97 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
98 | ||
a7ec8c50 AM |
99 | %define _enable_debug_packages 0 |
100 | ||
e7982b05 | 101 | %define _bindir /bin |
fc11b50f | 102 | |
cbbddfaa | 103 | %if "%{_target_base_arch}" != "%{_host_base_arch}" |
9922ba41 | 104 | %define CrossOpts CROSS="%{_target_cpu}-pld-linux-" |
105 | %else | |
106 | %define CrossOpts %{nil} | |
107 | %endif | |
108 | ||
558ca139 JR |
109 | %define filterout_ld -Wl,-z,(combreloc|relro) |
110 | ||
6648e383 JP |
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 | ||
ee61dafa | 121 | %description |
65512310 | 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). | |
ee61dafa | 137 | |
c499e458 JR |
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 | |
b7f899e9 | 141 | zawartych w pakietach fileutils, shellutils, findutils, grep, gzip, |
c499e458 JR |
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 | |
b7f899e9 JB |
145 | systemu potrzeba jeszcze tylko kernela, shella (np. ash) oraz edytora |
146 | (np. elvis-tiny albo ae). | |
147 | ||
c499e458 JR |
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 | |
68092394 | 154 | implementadas comportam-se de maneira similar aos equivalentes GNU. |
155 | ||
34ec6041 JB |
156 | %package static |
157 | Summary: Static busybox | |
718bff43 | 158 | Summary(pl.UTF-8): Statycznie skonsolidowany busybox |
34ec6041 | 159 | Group: Applications |
34ec6041 JB |
160 | |
161 | %description static | |
162 | Static busybox. | |
163 | ||
c499e458 | 164 | %description static -l pl.UTF-8 |
dfafd31f | 165 | Statycznie skonsolidowany busybox. |
34ec6041 | 166 | |
52db7bd4 MM |
167 | %package initrd |
168 | Summary: Static busybox for initrd | |
718bff43 | 169 | Summary(pl.UTF-8): Statycznie skonsolidowany busybox dla initrd |
11aa4d91 | 170 | Group: Base |
1857f402 | 171 | Conflicts: geninitrd < 10000.20 |
0f80cc3e | 172 | Provides: busybox-implementation = %{version}-%{release} |
52db7bd4 MM |
173 | |
174 | %description initrd | |
175 | Static busybox for initrd. | |
176 | ||
c499e458 | 177 | %description initrd -l pl.UTF-8 |
dfafd31f | 178 | Statycznie skonsolidowany busybox dla initrd. |
52db7bd4 | 179 | |
ee61dafa | 180 | %prep |
693dc2a0 | 181 | %setup -q |
aad3a7f3 | 182 | %patch0 -p1 |
0b555ee8 JB |
183 | %patch1 -p1 |
184 | %patch2 -p1 | |
a54ace54 | 185 | #%patch3 -p1 |
0cf45dc5 | 186 | %patch4 -p1 |
0b555ee8 | 187 | %patch5 -p1 |
5a7abf9a | 188 | %patch6 -p1 |
0b555ee8 | 189 | %patch7 -p1 |
7a6bf0ae | 190 | %patch8 -p1 |
586f52e3 | 191 | %patch9 -p1 |
459c400e | 192 | %patch10 -p1 |
ea0cda84 | 193 | |
ee61dafa | 194 | %build |
839c36a5 | 195 | install -d built |
52db7bd4 | 196 | %if %{with initrd} |
4f8fe04f | 197 | install %{SOURCE2} .config |
6648e383 | 198 | echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config |
4f8fe04f | 199 | %{__make} oldconfig |
52db7bd4 | 200 | %{__make} \ |
91a4c8e3 | 201 | %{?with_verbose:V=1} \ |
002194f6 | 202 | EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} -Os -D_GNU_SOURCE %{!?with_glibc:-fno-stack-protector}" \ |
fb8bb2b8 | 203 | EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack" \ |
27ca3ce9 | 204 | %if %{with dietlibc} |
52db7bd4 | 205 | LIBRARIES="-lrpc" \ |
661e2e64 | 206 | CC="diet %{__cc}" |
1735ff25 MM |
207 | %else |
208 | %if %{with glibc} | |
9922ba41 | 209 | %{CrossOpts} \ |
1735ff25 | 210 | CC="%{__cc}" |
27ca3ce9 | 211 | %else |
cbbddfaa | 212 | %if "%{_target_base_arch}" != "%{_host_base_arch}" |
9922ba41 | 213 | CROSS="%{_target_cpu}-uclibc-" \ |
a54ace54 | 214 | %endif |
27ca3ce9 AM |
215 | CC="%{_target_cpu}-uclibc-gcc" |
216 | %endif | |
1735ff25 MM |
217 | %endif |
218 | ||
839c36a5 | 219 | mv -f busybox built/busybox.initrd |
52db7bd4 | 220 | %{__make} clean |
52db7bd4 MM |
221 | %endif |
222 | ||
6648e383 | 223 | %if %{with static} |
1735ff25 MM |
224 | %if %{with altconfig} |
225 | install %{SOURCE3} .config | |
13fc95fb ER |
226 | %else |
227 | install %{SOURCE1} .config | |
6648e383 | 228 | echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config |
1735ff25 | 229 | %endif |
4f8fe04f | 230 | %{__make} oldconfig |
6f6b5afa | 231 | %{__make} \ |
91a4c8e3 | 232 | %{?with_verbose:V=1} \ |
002194f6 | 233 | EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} -Os -D_GNU_SOURCE %{!?with_glibc:-fno-stack-protector}" \ |
fb8bb2b8 | 234 | EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack" \ |
ef0df9c1 JR |
235 | %if %{with dietlibc} |
236 | LIBRARIES="-lrpc" \ | |
661e2e64 | 237 | CC="diet %{__cc}" |
ef0df9c1 JR |
238 | %else |
239 | %if %{with glibc} | |
240 | %{CrossOpts} \ | |
52db7bd4 | 241 | CC="%{__cc}" |
ef0df9c1 | 242 | %else |
cbbddfaa | 243 | %if "%{_target_base_arch}" != "%{_host_base_arch}" |
ef0df9c1 | 244 | CROSS="%{_target_cpu}-uclibc-" \ |
a54ace54 | 245 | %endif |
ef0df9c1 JR |
246 | CC="%{_target_cpu}-uclibc-gcc" |
247 | %endif | |
248 | %endif | |
249 | ||
839c36a5 | 250 | mv -f busybox built/busybox.static |
2481202a | 251 | %{__make} clean |
34ec6041 | 252 | %endif |
2481202a | 253 | |
63de0802 | 254 | %if %{with dynamic} |
6648e383 JP |
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 | |
b5011fd7 | 261 | %{__make} oldconfig |
b7f899e9 | 262 | %{__make} \ |
91a4c8e3 | 263 | %{?with_verbose:V=1} \ |
9922ba41 | 264 | %{CrossOpts} \ |
a7ec8c50 | 265 | EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} %{!?with_glibc:-fno-stack-protector}" \ |
fb8bb2b8 | 266 | EXTRA_LDFLAGS="%{rpmldflags} -Wl,-z,noexecstack" \ |
f5ad7fd6 | 267 | CC="%{__cc}" |
bf1f4257 | 268 | %{__make} busybox.links docs/busybox.1 |
63de0802 | 269 | %endif |
4e2ab1f5 | 270 | |
ee61dafa MM |
271 | %install |
272 | rm -rf $RPM_BUILD_ROOT | |
b7f899e9 | 273 | |
63de0802 JB |
274 | %if %{with static} |
275 | install -d $RPM_BUILD_ROOT%{_bindir} | |
276 | install built/busybox.static $RPM_BUILD_ROOT%{_bindir} | |
277 | %endif | |
278 | ||
a71afd72 JR |
279 | %if %{with initrd} |
280 | install -d $RPM_BUILD_ROOT%{_libdir}/initrd | |
1857f402 | 281 | install built/busybox.initrd $RPM_BUILD_ROOT%{_libdir}/initrd/busybox |
a71afd72 | 282 | %endif |
34ec6041 | 283 | |
63de0802 JB |
284 | %if %{with dynamic} |
285 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,%{_libdir}/busybox} | |
b7f899e9 | 286 | install busybox.links $RPM_BUILD_ROOT%{_libdir}/busybox |
bf1f4257 | 287 | install docs/busybox.1 $RPM_BUILD_ROOT%{_mandir}/man1 |
ee61dafa | 288 | |
d635bde0 | 289 | # install links to busybox binary, when linkfl is defined |
4a69c6c5 | 290 | %if %{with linkfl} |
2678f462 | 291 | %{__make} install \ |
5a7abf9a | 292 | PREFIX=$RPM_BUILD_ROOT |
4a69c6c5 MM |
293 | %else |
294 | install busybox $RPM_BUILD_ROOT%{_bindir} | |
295 | %endif | |
63de0802 | 296 | %endif |
d635bde0 | 297 | |
ee61dafa MM |
298 | %clean |
299 | rm -rf $RPM_BUILD_ROOT | |
300 | ||
63de0802 | 301 | %if %{with dynamic} |
ee61dafa MM |
302 | %files |
303 | %defattr(644,root,root,755) | |
a230e0df | 304 | %doc AUTHORS README .config |
d635bde0 | 305 | |
4a69c6c5 | 306 | %if %{with linkfl} |
77109ddb | 307 | %attr(755,root,root) /bin/* |
d635bde0 | 308 | %attr(755,root,root) /sbin/* |
309 | %attr(755,root,root) %{_bindir}/* | |
310 | %attr(755,root,root) %{_sbindir}/* | |
4a69c6c5 MM |
311 | %else |
312 | %attr(755,root,root) %{_bindir}/busybox | |
d635bde0 | 313 | %endif |
314 | ||
65512310 | 315 | %{_libdir}/busybox |
77109ddb | 316 | %{_mandir}/man1/busybox.1* |
63de0802 | 317 | %endif |
bb4ca08e | 318 | |
4a69c6c5 | 319 | %if %{with static} |
34ec6041 JB |
320 | %files static |
321 | %defattr(644,root,root,755) | |
322 | %attr(755,root,root) %{_bindir}/busybox.static | |
323 | %endif | |
52db7bd4 MM |
324 | |
325 | %if %{with initrd} | |
326 | %files initrd | |
327 | %defattr(644,root,root,755) | |
1857f402 | 328 | %attr(755,root,root) %{_libdir}/initrd/busybox |
52db7bd4 | 329 | %endif |