s/TERMUX_PKG_BUILD_REVISION/TERMUX_PKG_REVISION/
[termux-packages] / packages / zsh / build.sh
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=1
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 for module in files regex curses zprof socket system deltochar mathfunc; do
28 perl -p -i -e "s|${module}.mdd link=no|${module}.mdd link=static|" $TERMUX_PKG_BUILDDIR/config.modules
29 done
30 }
31
32 termux_step_post_make_install () {
33 # /etc/zshrc - Run for interactive shells (http://zsh.sourceforge.net/Guide/zshguide02.html):
34 sed "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" $TERMUX_PKG_BUILDER_DIR/etc-zshrc > $TERMUX_PREFIX/etc/zshrc
35
36 # Remove zsh.new/zsh.old/zsh-$version if any exists:
37 rm -f $TERMUX_PREFIX/{zsh-*,zsh.*}
38
39 # This should perhaps be done in a more general way? Doing it here
40 # to silence "compaudit" warnings:
41 chmod 700 $TERMUX_PREFIX/share/{zsh,zsh/$_FOLDERVERSION}
42 }
43
44 termux_step_create_debscripts () {
45 # For already installed packages:
46 echo "chmod 700 $TERMUX_PREFIX/share/zsh" > postinst
47 echo "exit 0" >> postinst
48 chmod 0755 postinst
49 }