133 lines
3.1 KiB
Bash
133 lines
3.1 KiB
Bash
# Template file for 'busybox'
|
|
pkgname=busybox
|
|
version=1.31.1
|
|
revision=1
|
|
hostmakedepends="perl"
|
|
checkdepends="zip"
|
|
short_desc="Swiss Army Knife of Embedded Linux"
|
|
maintainer="Cameron Nemo <cnemo@tutanota.com>"
|
|
license="GPL-2.0-only"
|
|
homepage="http://www.busybox.net"
|
|
distfiles="${homepage}/downloads/busybox-${version}.tar.bz2"
|
|
checksum=d0f940a72f648943c1f2211e0e3117387c31d765137d92bd8284a3fb9752a998
|
|
|
|
_alternatives_core="
|
|
ash:ash:/usr/bin/busybox
|
|
awk:awk:/usr/bin/busybox
|
|
hostname:hostname:/usr/bin/busybox
|
|
sh:sh:/usr/bin/busybox
|
|
vi:vi:/usr/bin/busybox
|
|
logger:logger:/usr/bin/busybox"
|
|
|
|
_alternatives="
|
|
${_alternatives_core}
|
|
ntpd:ntpd:/usr/bin/busybox
|
|
ntpd:ntpd:/etc/sv/busybox-ntpd"
|
|
|
|
alternatives="${_alternatives}"
|
|
register_shell="/usr/bin/ash"
|
|
|
|
_patch_config() {
|
|
local t="$1"
|
|
shift
|
|
while [ "$1" ]; do
|
|
local p="$1"
|
|
shift
|
|
patch "${t}/.config" <"${FILESDIR}/dotconfig.d/${p}.patch"
|
|
done
|
|
}
|
|
|
|
do_configure() {
|
|
mkdir -p src
|
|
mv * src || true
|
|
|
|
local t
|
|
for t in busybox busybox-static busybox-core busybox-huge; do
|
|
mkdir -p $t
|
|
cp -f ${FILESDIR}/dotconfig ${t}/.config
|
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl) sed -i -e /CONFIG_FEATURE_VI_REGEX_SEARCH/s/y/n/ \
|
|
-e /CONFIG_FEATURE_MOUNT_NFS/s/y/n/ \
|
|
${t}/.config;;
|
|
esac
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
sed -i -e \
|
|
"s,\(CONFIG_CROSS_COMPILER_PREFIX\).*,\1=\"${XBPS_CROSS_TRIPLET}-\",g" \
|
|
${t}/.config
|
|
fi
|
|
done
|
|
|
|
_patch_config busybox udhcpc ntpd
|
|
_patch_config busybox-static udhcpc ntpd static
|
|
_patch_config busybox-huge udhcpc ntpd httpd mdev sysklogd
|
|
|
|
for t in busybox-core busybox busybox-static busybox-huge; do
|
|
make -C "${t}" KBUILD_SRC="${wrksrc}/src" -f "${wrksrc}/src/Makefile" prepare "${makejobs}"
|
|
done
|
|
|
|
if [ "$SOURCE_DATE_EPOCH" ]; then
|
|
# rewrite date with the one from the date wrapper.
|
|
d=$(date +"%F %T %Z")
|
|
sed -i "s/\(#define AUTOCONF_TIMESTAMP\).*/\1 \"$d\"/" */include/autoconf.h
|
|
fi
|
|
}
|
|
|
|
do_build() {
|
|
for t in busybox-core busybox busybox-static busybox-huge; do
|
|
make -C "${t}" SKIP_STRIP=y "${makejobs}"
|
|
done
|
|
}
|
|
|
|
do_check() {
|
|
for t in busybox-core busybox busybox-static busybox-huge; do
|
|
# Copy the testsuite over
|
|
cp -r src/testsuite "${t}"
|
|
# Required by the testsuite
|
|
cp src/scripts/echo.c "${t}/scripts"
|
|
# Run the testsuite
|
|
(
|
|
cd "${t}"
|
|
SKIP_KNOWN_BUGS=yes ./runtest -v
|
|
)
|
|
done
|
|
}
|
|
|
|
do_install() {
|
|
vbin busybox/busybox_unstripped busybox
|
|
vman busybox/docs/busybox.1
|
|
vsv busybox-ntpd
|
|
}
|
|
|
|
busybox-core_package() {
|
|
short_desc+=" (essential applets)"
|
|
conflicts="busybox>=0 busybox-huge>=0"
|
|
alternatives="${_alternatives_core}"
|
|
register_shell="/usr/bin/ash"
|
|
pkg_install() {
|
|
vbin busybox-core/busybox_unstripped busybox
|
|
vman busybox-core/docs/busybox.1
|
|
}
|
|
}
|
|
|
|
busybox-static_package() {
|
|
short_desc+=" (statically linked)"
|
|
pkg_install() {
|
|
vbin busybox-static/busybox busybox.static
|
|
}
|
|
}
|
|
|
|
busybox-huge_package() {
|
|
short_desc+=" (extra applets)"
|
|
conflicts="busybox>=0 busybox-core>=0"
|
|
alternatives="${_alternatives}"
|
|
register_shell="/usr/bin/ash"
|
|
pkg_install() {
|
|
vbin busybox-huge/busybox_unstripped busybox
|
|
vman busybox-huge/docs/busybox.1
|
|
vsv busybox-syslogd
|
|
vsv busybox-klogd
|
|
}
|
|
}
|