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