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