chiark / gitweb /
postgresql: Patch away /bin/sh
[termux-packages] / packages / busybox / build.sh
1 TERMUX_PKG_HOMEPAGE=https://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.26.2
5 TERMUX_PKG_REVISION=3
6 TERMUX_PKG_SRCURL=https://busybox.net/downloads/busybox-${TERMUX_PKG_VERSION}.tar.bz2
7 TERMUX_PKG_SHA256=da3e44913fc1a9c9b7c5337ea5292da518683cbff32be630777f565d6036af16
8 TERMUX_PKG_BUILD_IN_SRC=yes
9 # We replace env in the old coreutils package:
10 TERMUX_PKG_CONFLICTS="coreutils (<< 8.25-4)"
11
12 # NOTE: sed on mac does not work for building busybox, install gnu-sed with
13 #       homebrew using the --with-default-names option.
14
15 termux_step_pre_configure () {
16         CFLAGS+=" -llog -DTERMUX_EXPOSE_MEMPCPY=1" # Android system liblog.so for syslog
17 }
18
19 termux_step_configure () {
20         cp $TERMUX_PKG_BUILDER_DIR/busybox.config .config
21         echo "CONFIG_SYSROOT=\"$TERMUX_STANDALONE_TOOLCHAIN/sysroot\"" >> .config
22         echo "CONFIG_PREFIX=\"$TERMUX_PREFIX\"" >> .config
23         echo "CONFIG_CROSS_COMPILER_PREFIX=\"${TERMUX_HOST_PLATFORM}-\"" >> .config
24         echo "CONFIG_FEATURE_CROND_DIR=\"$TERMUX_PREFIX/var/spool/cron\"" >> .config
25         echo "CONFIG_SV_DEFAULT_SERVICE_DIR=\"$TERMUX_PREFIX/var/service\"" >> .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 'env' applet is special in that it go into $PREFIX/bin:
37         cd $TERMUX_PREFIX/bin
38         ln -f -s busybox env
39
40         # Install busybox man page
41         mkdir -p $TERMUX_PREFIX/share/man/man1
42         cp $TERMUX_PKG_SRCDIR/docs/busybox.1 $TERMUX_PREFIX/share/man/man1
43
44         # Needed for 'crontab -e' to work out of the box:
45         local _CRONTABS=$TERMUX_PREFIX/var/spool/cron/crontabs
46         mkdir -p $_CRONTABS
47         echo "Used by the busybox crontab and crond tools" > $_CRONTABS/README.termux
48
49         # Setup some services
50         mkdir -p $TERMUX_PREFIX/var/service
51         cd $TERMUX_PREFIX/var/service
52         mkdir -p ftpd telnetd
53         echo '#!/bin/sh' > ftpd/run
54         echo 'exec tcpsvd -vE 0.0.0.0 8021 ftpd /data/data/com.termux/files/home' >> ftpd/run
55         echo '#!/bin/sh' > telnetd/run
56         echo 'exec telnetd -F' >> telnetd/run
57         chmod +x */run
58 }
59