| 1 | TERMUX_PKG_HOMEPAGE=http://www.busybox.net/ |
| 2 | TERMUX_PKG_DESCRIPTION="Tiny versions of many common UNIX utilities into a single small executable" |
| 3 | TERMUX_PKG_ESSENTIAL=yes |
| 4 | TERMUX_PKG_VERSION=1.24.2 |
| 5 | TERMUX_PKG_BUILD_REVISION=5 |
| 6 | TERMUX_PKG_SRCURL=http://www.busybox.net/downloads/busybox-${TERMUX_PKG_VERSION}.tar.bz2 |
| 7 | TERMUX_PKG_BUILD_IN_SRC=yes |
| 8 | # We replace env in the old coreutils package: |
| 9 | TERMUX_PKG_CONFLICTS="coreutils (<< 8.25-4)" |
| 10 | |
| 11 | # NOTE: sed on mac does not work for building busybox, install gsed and symlink sed => gsed |
| 12 | |
| 13 | CFLAGS+=" -llog -DTERMUX_EXPOSE_MEMPCPY=1" # Android system liblog.so for syslog |
| 14 | |
| 15 | termux_step_configure () { |
| 16 | # Bug in gold linker with busybox in android r10e: |
| 17 | # https://sourceware.org/ml/binutils/2015-02/msg00386.html |
| 18 | CFLAGS+=" -fuse-ld=bfd" |
| 19 | LD+=.bfd |
| 20 | |
| 21 | cp $TERMUX_PKG_BUILDER_DIR/busybox.config .config |
| 22 | echo "CONFIG_SYSROOT=\"$TERMUX_STANDALONE_TOOLCHAIN/sysroot\"" >> .config |
| 23 | echo "CONFIG_PREFIX=\"$TERMUX_PREFIX\"" >> .config |
| 24 | echo "CONFIG_CROSS_COMPILER_PREFIX=\"${TERMUX_HOST_PLATFORM}-\"" >> .config |
| 25 | echo "CONFIG_FEATURE_CROND_DIR=\"$TERMUX_PREFIX/var/spool/cron\"" >> .config |
| 26 | make oldconfig |
| 27 | } |
| 28 | |
| 29 | termux_step_post_make_install () { |
| 30 | # Create symlinks in $PREFIX/bin/applets to $PREFIX/bin/busybox |
| 31 | rm -Rf $TERMUX_PREFIX/bin/applets |
| 32 | mkdir -p $TERMUX_PREFIX/bin/applets |
| 33 | cd $TERMUX_PREFIX/bin/applets |
| 34 | for f in `cat $TERMUX_PKG_SRCDIR/busybox.links`; do ln -s ../busybox `basename $f`; done |
| 35 | |
| 36 | # The 'ash' and 'env' applets are special in that they go into $PREFIX/bin: |
| 37 | cd $TERMUX_PREFIX/bin |
| 38 | ln -f -s busybox ash |
| 39 | ln -f -s busybox env |
| 40 | |
| 41 | # Install busybox man page |
| 42 | mkdir -p $TERMUX_PREFIX/share/man/man1 |
| 43 | cp $TERMUX_PKG_SRCDIR/docs/busybox.1 $TERMUX_PREFIX/share/man/man1 |
| 44 | |
| 45 | # Needed for 'crontab -e' to work out of the box: |
| 46 | local _CRONTABS=$TERMUX_PREFIX/var/spool/cron/crontabs |
| 47 | mkdir -p $_CRONTABS |
| 48 | echo "Used by the busybox crontab and crond tools" > $_CRONTABS/README.termux |
| 49 | } |
| 50 | |