termux-packages/packages/busybox/build.sh

86 lines
3.2 KiB
Bash
Raw Normal View History

TERMUX_PKG_HOMEPAGE=https://busybox.net/
2015-06-12 23:03:31 +00:00
TERMUX_PKG_DESCRIPTION="Tiny versions of many common UNIX utilities into a single small executable"
2019-01-20 21:39:59 +00:00
TERMUX_PKG_LICENSE="GPL-2.0"
2019-02-15 23:34:30 +00:00
TERMUX_PKG_VERSION=1.30.1
TERMUX_PKG_REVISION=9
TERMUX_PKG_SRCURL=https://busybox.net/downloads/busybox-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=3d1d04a4dbd34048f4794815a5c48ebb9eb53c5277e09ffffc060323b95dfbdc
TERMUX_PKG_BUILD_IN_SRC=true
# We replace env in the old coreutils package:
TERMUX_PKG_CONFLICTS="coreutils (<< 8.25-4)"
TERMUX_PKG_CONFFILES="var/service/telnetd/run var/service/telnetd/log/run var/service/ftpd/run var/service/ftpd/log/run"
2015-06-12 23:03:31 +00:00
termux_step_pre_configure() {
# Certain packages are not safe to build on device because their
# build.sh script deletes specific files in $TERMUX_PREFIX.
if $TERMUX_ON_DEVICE_BUILD; then
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
fi
2016-09-03 21:48:41 +00:00
}
2015-06-12 23:03:31 +00:00
termux_step_configure() {
sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \
-e "s|@TERMUX_SYSROOT@|$TERMUX_STANDALONE_TOOLCHAIN/sysroot|g" \
-e "s|@TERMUX_HOST_PLATFORM@|${TERMUX_HOST_PLATFORM}|g" \
-e "s|@TERMUX_CFLAGS@|$CFLAGS|g" \
-e "s|@TERMUX_LDFLAGS@|$LDFLAGS|g" \
-e "s|@TERMUX_LDLIBS@|-llog|g" \
$TERMUX_PKG_BUILDER_DIR/busybox.config > .config
unset CFLAGS LDFLAGS
2015-06-12 23:03:31 +00:00
make oldconfig
}
termux_step_post_make_install() {
if $TERMUX_DEBUG; then
install -Dm700 busybox_unstripped $PREFIX/bin/busybox
fi
2015-06-12 23:03:31 +00:00
# Utilities diff, mv, rm, rmdir are necessary to assist with package upgrading
# after https://github.com/termux/termux-packages/issues/4070.
#
# Other utilities (like crond/crontab) are useful but not available
# as standalone package in Termux.
#
# Few notes:
#
2019-07-22 11:23:56 +00:00
# * runsv, runsvdir, sv - for things like in https://github.com/termux/termux-packages/pull/3460.
# * tcpsvd - required for ftpd applet.
# * vi - replaced by vim, but it still good to have basic text editor in bootstrap.
2019-07-22 11:36:06 +00:00
# * which - replaced by debianutils, but still good to have in bootstrap.
#
rm -Rf $TERMUX_PREFIX/bin/applets
mkdir -p $TERMUX_PREFIX/bin/applets
cd $TERMUX_PREFIX/bin/applets
for f in crond crontab diff ftpd ftpget ftpput hostname inotifyd \
iostat lsof lsusb mpstat mv nmeter rm rmdir runsv runsvdir \
2019-07-22 11:36:06 +00:00
sendmail start-stop-daemon sv svlogd tcpsvd uptime usleep \
vi which; do
ln -s ../busybox $f
done
unset f
2015-06-12 23:03:31 +00:00
# Install busybox man page
mkdir -p $TERMUX_PREFIX/share/man/man1
cp $TERMUX_PKG_SRCDIR/docs/busybox.1 $TERMUX_PREFIX/share/man/man1
2015-07-26 12:59:22 +00:00
# Needed for 'crontab -e' to work out of the box:
local _CRONTABS=$TERMUX_PREFIX/var/spool/cron/crontabs
mkdir -p $_CRONTABS
echo "Used by the busybox crontab and crond tools" > $_CRONTABS/README.termux
# Setup some services
mkdir -p $TERMUX_PREFIX/var/service
cd $TERMUX_PREFIX/var/service
mkdir -p ftpd/log telnetd/log
echo "#!$TERMUX_PREFIX/bin/sh" > ftpd/run
echo 'exec busybox tcpsvd -vE 0.0.0.0 8021 ftpd /data/data/com.termux/files/home' >> ftpd/run
echo "#!$TERMUX_PREFIX/bin/sh" > telnetd/run
echo 'exec busybox telnetd -F' >> telnetd/run
chmod +x */run
touch telnetd/down ftpd/down
ln -sf $PREFIX/share/termux-services/svlogger telnetd/log/run
ln -sf $PREFIX/share/termux-services/svlogger ftpd/log/run
2015-06-12 23:03:31 +00:00
}