aapt: Patch in a default platform package (-I)
[termux-packages] / packages / busybox / build.sh
CommitLineData
59f0d218
FF
1TERMUX_PKG_HOMEPAGE=http://www.busybox.net/
2TERMUX_PKG_DESCRIPTION="Tiny versions of many common UNIX utilities into a single small executable"
3TERMUX_PKG_ESSENTIAL=yes
1df4a885 4TERMUX_PKG_VERSION=1.24.2
6b14aeb8 5TERMUX_PKG_BUILD_REVISION=7
59f0d218
FF
6TERMUX_PKG_SRCURL=http://www.busybox.net/downloads/busybox-${TERMUX_PKG_VERSION}.tar.bz2
7TERMUX_PKG_BUILD_IN_SRC=yes
e4ba46a8 8# We replace env in the old coreutils package:
324ea7ac 9TERMUX_PKG_CONFLICTS="coreutils (<< 8.25-4)"
59f0d218 10
ed021630
FF
11# NOTE: sed on mac does not work for building busybox, install gnu-sed with
12# homebrew using the --with-default-names option.
59f0d218 13
385c8aef
FF
14termux_step_pre_configure () {
15 CFLAGS+=" -llog -DTERMUX_EXPOSE_MEMPCPY=1" # Android system liblog.so for syslog
16}
59f0d218
FF
17
18termux_step_configure () {
19 # Bug in gold linker with busybox in android r10e:
20 # https://sourceware.org/ml/binutils/2015-02/msg00386.html
21 CFLAGS+=" -fuse-ld=bfd"
22 LD+=.bfd
23
24 cp $TERMUX_PKG_BUILDER_DIR/busybox.config .config
25 echo "CONFIG_SYSROOT=\"$TERMUX_STANDALONE_TOOLCHAIN/sysroot\"" >> .config
26 echo "CONFIG_PREFIX=\"$TERMUX_PREFIX\"" >> .config
27 echo "CONFIG_CROSS_COMPILER_PREFIX=\"${TERMUX_HOST_PLATFORM}-\"" >> .config
28 echo "CONFIG_FEATURE_CROND_DIR=\"$TERMUX_PREFIX/var/spool/cron\"" >> .config
6b14aeb8 29 echo "CONFIG_SV_DEFAULT_SERVICE_DIR=\"$TERMUX_PREFIX/var/service\"" >> .config
59f0d218
FF
30 make oldconfig
31}
32
33termux_step_post_make_install () {
34 # Create symlinks in $PREFIX/bin/applets to $PREFIX/bin/busybox
35 rm -Rf $TERMUX_PREFIX/bin/applets
36 mkdir -p $TERMUX_PREFIX/bin/applets
37 cd $TERMUX_PREFIX/bin/applets
38 for f in `cat $TERMUX_PKG_SRCDIR/busybox.links`; do ln -s ../busybox `basename $f`; done
39
385c8aef 40 # The 'ash' and 'env' applets are special in that they go into $PREFIX/bin:
59f0d218 41 cd $TERMUX_PREFIX/bin
e4ba46a8
FF
42 ln -f -s busybox ash
43 ln -f -s busybox env
59f0d218
FF
44
45 # Install busybox man page
46 mkdir -p $TERMUX_PREFIX/share/man/man1
47 cp $TERMUX_PKG_SRCDIR/docs/busybox.1 $TERMUX_PREFIX/share/man/man1
f6b57934
FF
48
49 # Needed for 'crontab -e' to work out of the box:
50 local _CRONTABS=$TERMUX_PREFIX/var/spool/cron/crontabs
51 mkdir -p $_CRONTABS
52 echo "Used by the busybox crontab and crond tools" > $_CRONTABS/README.termux
6b14aeb8
FF
53
54 # Setup some services
55 mkdir -p $TERMUX_PREFIX/var/service
56 cd $TERMUX_PREFIX/var/service
57 mkdir -p ftpd telnetd
58 echo '#!/bin/sh' > ftpd/run
59 echo 'exec tcpsvd -vE 0.0.0.0 8021 ftpd /data/data/com.termux/files/home' >> ftpd/run
60 echo '#!/bin/sh' > telnetd/run
61 echo 'exec telnetd -F' >> telnetd/run
62 chmod +x */run
59f0d218
FF
63}
64