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