| 1 | TERMUX_PKG_HOMEPAGE=https://www.zsh.org |
| 2 | TERMUX_PKG_DESCRIPTION="Shell with lots of features" |
| 3 | _FOLDERVERSION=5.3 |
| 4 | TERMUX_PKG_VERSION=${_FOLDERVERSION}.1 |
| 5 | TERMUX_PKG_REVISION=2 |
| 6 | TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/project/zsh/zsh/$_FOLDERVERSION/zsh-${_FOLDERVERSION}.tar.xz |
| 7 | TERMUX_PKG_SHA256=76f82cfd5ce373cf799a03b6f395283f128430db49202e3e3f512fb5a19d6f8a |
| 8 | TERMUX_PKG_RM_AFTER_INSTALL="bin/zsh-${_FOLDERVERSION}" |
| 9 | TERMUX_PKG_DEPENDS="libandroid-support, ncurses, termux-tools, command-not-found" |
| 10 | TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-etcdir=$TERMUX_PREFIX/etc --disable-gdbm --disable-pcre ac_cv_header_utmp_h=no" |
| 11 | TERMUX_PKG_CONFFILES="etc/zshrc" |
| 12 | |
| 13 | # Below needed to force dynamically loaded binary modules, but does not currently work: |
| 14 | # TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" zsh_cv_shared_environ=yes" |
| 15 | |
| 16 | termux_step_post_configure () { |
| 17 | # INSTALL file: "For a non-dynamic zsh, the default is to compile the complete, compctl, zle, |
| 18 | # computil, complist, sched, # parameter, zleparameter and rlimits modules into the shell, |
| 19 | # and you will need to edit config.modules to make any other modules available." |
| 20 | # Since we build zsh non-dynamically (since dynamic loading doesn't work on Android when enabled), |
| 21 | # we need to explicitly enable the additional modules we want. |
| 22 | # - The files module is needed by `compinstall` (https://github.com/termux/termux-packages/issues/61). |
| 23 | # - The regex module seems to be used by several extensions. |
| 24 | # - The curses, socket and zprof modules was desired by BrainDamage on IRC (#termux). |
| 25 | # - The deltochar and mathfunc modules is used by grml-zshrc (https://github.com/termux/termux-packages/issues/494). |
| 26 | # - The system module is needed by zplug (https://github.com/termux/termux-packages/issues/659). |
| 27 | # - The zpty is needed by zsh-async (https://github.com/termux/termux-packages/issues/672). |
| 28 | for module in files regex curses zprof socket system deltochar mathfunc zpty; do |
| 29 | perl -p -i -e "s|${module}.mdd link=no|${module}.mdd link=static|" $TERMUX_PKG_BUILDDIR/config.modules |
| 30 | done |
| 31 | } |
| 32 | |
| 33 | termux_step_post_make_install () { |
| 34 | # /etc/zshrc - Run for interactive shells (http://zsh.sourceforge.net/Guide/zshguide02.html): |
| 35 | sed "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" $TERMUX_PKG_BUILDER_DIR/etc-zshrc > $TERMUX_PREFIX/etc/zshrc |
| 36 | |
| 37 | # Remove zsh.new/zsh.old/zsh-$version if any exists: |
| 38 | rm -f $TERMUX_PREFIX/{zsh-*,zsh.*} |
| 39 | |
| 40 | # This should perhaps be done in a more general way? Doing it here |
| 41 | # to silence "compaudit" warnings: |
| 42 | chmod 700 $TERMUX_PREFIX/share/{zsh,zsh/$_FOLDERVERSION} |
| 43 | } |
| 44 | |
| 45 | termux_step_create_debscripts () { |
| 46 | # For already installed packages: |
| 47 | echo "chmod 700 $TERMUX_PREFIX/share/zsh" > postinst |
| 48 | echo "exit 0" >> postinst |
| 49 | chmod 0755 postinst |
| 50 | } |