# TODO:
-# - RPC/NFS with uClibc doesn't build (due to tirpc linking), so it's currently disabled
# - review patch 3. Updated to 1.17.3, but the code changed so much it's unclear
# if it still serves a purpose
# - sparc64 modules support in sparc(32), x86_64 modules support in i386 version
%bcond_without dynamic # don't build dynamic (base) version
%bcond_without static # don't build static version
%bcond_without initrd # don't build initrd version
-%bcond_with dietlibc # build dietlibc-based initrd and static versions
+%bcond_with musl # build musl-based initrd and static versions
%bcond_with glibc # build glibc-based initrd and static versions
%bcond_without verbose # verbose build
# Options below are useful, when you want fileutils and grep providing.
# functionality as their GNU countenders.
#
%ifnarch %{ix86} %{x8664} ppc
-%define with_glibc 1
-%endif
-%ifarch x32
-# until uClibc builds on x32
-%undefine with_static
+%define with_musl 1
%endif
Summary: Set of common Unix utilities for embeded systems
Summary(pl.UTF-8): Zestaw narzędzi uniksowych dla systemów wbudowanych
Name: busybox
# stable line only
Version: 1.35.0
-Release: 0.1
+Release: 2
License: GPL v2
Group: Applications
Source0: http://www.busybox.net/downloads/%{name}-%{version}.tar.bz2
Patch8: busybox-1.31.1-stime-fix.patch
Patch9: %{name}-ash-export-PATH.patch
Patch10: 0001-modutils-check-ELF-header-before-calling-finit_module.patch
+Patch11: strip-quotes.patch
URL: http://www.busybox.net/
BuildRequires: gcc >= 3.2
BuildRequires: perl-tools-pod
BuildRequires: rpmbuild(macros) >= 1.652
-%if %{with glibc}
+%if %{with glibc} || %{with dynamic}
BuildRequires: libtirpc-devel
BuildRequires: pkgconfig
%endif
%if %{with initrd} || %{with static}
- %if %{with dietlibc}
-BuildRequires: dietlibc-static
+ %if %{with musl}
+BuildRequires: linux-musl-headers
+BuildRequires: musl-devel
+BuildRequires: libtirpc-musl-devel
%else
%if %{with glibc}
BuildRequires: glibc-static
+BuildRequires: libcom_err-static
BuildRequires: libtirpc-static
+BuildRequires: openssl-static
+BuildRequires: sqlite3-static
%else
%if "%{_target_base_arch}" != "%{_host_base_arch}"
BuildRequires: cross%{_target_base_arch}-uClibc-static
%define filterout_ld -Wl,-z,(combreloc|relro)
-%if %{with glibc}
%define tirpccflags %(pkg-config --cflags libtirpc)
+%if %{with glibc}
%if %{with initrd} || %{with static}
-%define tirpcslibs %(pkg-config --libs --static libtirpc|sed s/-l//g)
+%define tirpcslibs %(pkg-config --libs --static libtirpc krb5 krb5-gssapi openssl sqlite3|sed 's/-l//g')
+%endif
%endif
+
%if %{with dynamic}
-%define tirpcdlibs %(pkg-config --libs libtirpc|sed s/-l//g)
+%define tirpcdlibs %(pkg-config --libs libtirpc|sed s/-l//g)
%endif
+
+%if %{with musl}
+%define tirpcslibs %(pkg-config --libs libtirpc|sed s/-l//g)
%endif
%description
%patch8 -p1
%patch9 -p1
%patch10 -p1
+%patch11 -p1
%build
install -d built
%if %{with initrd}
install %{SOURCE2} .config
-echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config
+%if %{with musl}
+sed -i -e 's|CONFIG_FEATURE_VI_REGEX_SEARCH=y|# CONFIG_FEATURE_VI_REGEX_SEARCH is not set|g' .config
+%endif
+echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}} %{?with_musl:%{tirpcslibs}}"' >> .config
%{__make} oldconfig
%{__make} \
%{?with_verbose:V=1} \
- EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} -Os -D_BSD_SOURCE %{!?with_glibc:-fno-stack-protector}" \
- EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack" \
-%if %{with dietlibc}
- LIBRARIES="-lrpc" \
- CC="diet %{__cc}"
+ EXTRA_CFLAGS="%{rpmcflags} %{tirpccflags} -Os -D_GNU_SOURCE %{?with_musl:-I%{_includedir}/musl} %{!?with_glibc:-fno-stack-protector}" \
+ EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack %{?with_musl:-L%{_libdir}/musl}" \
+%if %{with musl}
+ CC="musl-gcc"
%else
%if %{with glibc}
%{CrossOpts} \
install %{SOURCE3} .config
%else
install %{SOURCE1} .config
-echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}}"' >> .config
+echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcslibs}} %{?with_musl:%{tirpcslibs}}""' >> .config
+%endif
+%if %{with musl}
+sed -i -e 's|CONFIG_FEATURE_VI_REGEX_SEARCH=y|# CONFIG_FEATURE_VI_REGEX_SEARCH is not set|g' .config
+sed -i -e 's|CONFIG_EXTRA_COMPAT=y|# CONFIG_EXTRA_COMPAT is not set|g' .config
%endif
%{__make} oldconfig
%{__make} \
%{?with_verbose:V=1} \
- EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} -Os -D_BSD_SOURCE %{!?with_glibc:-fno-stack-protector}" \
- EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack" \
-%if %{with dietlibc}
- LIBRARIES="-lrpc" \
- CC="diet %{__cc}"
+ EXTRA_CFLAGS="%{rpmcflags} %{tirpccflags} -Os -D_GNU_SOURCE %{?with_musl:-I%{_includedir}/musl} %{!?with_glibc:-fno-stack-protector}" \
+ EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack %{?with_musl:-L%{_libdir}/musl}" \
+%if %{with musl}
+ CC="musl-gcc"
%else
%if %{with glibc}
%{CrossOpts} \
install %{SOURCE3} .config
%else
install %{SOURCE1} .config
-echo 'CONFIG_EXTRA_LDLIBS="%{?with_glibc:%{tirpcdlibs}}"' >> .config
+echo 'CONFIG_EXTRA_LDLIBS="%{tirpcdlibs}"' >> .config
%endif
%{__make} oldconfig
%{__make} \
%{?with_verbose:V=1} \
%{CrossOpts} \
- EXTRA_CFLAGS="%{rpmcflags} %{?with_glibc:%{tirpccflags}} %{!?with_glibc:-fno-stack-protector}" \
+ EXTRA_CFLAGS="%{rpmcflags} %{tirpccflags} %{!?with_glibc:-fno-stack-protector}" \
EXTRA_LDFLAGS="%{rpmldflags} -Wl,-z,noexecstack" \
CC="%{__cc}"
%{__make} busybox.links docs/busybox.1