Package zsh with loadable editor, completion, PCRE2 and capability modules
@@ -0,0 +1,49 @@
1+; 5.9.2 supports PCRE2 and keeps the /bin/zsh and /etc/zsh layout used by Vinix.
2+defpkgbuild(zsh,
3+ #:pkgname, "zsh",
4+ #:pkgver, "5.9.2",
5+ #:pkgrel, 1,
6+ #:pkgdesc, "Interactive shell with line editing, completions and loadable modules",
7+ #:arch, [#:x86-64],
8+ #:url, "https://www.zsh.org/",
9+ #:license, "MIT-Modern-Variant AND GPL-2.0-only",
10+ #:depends, ["musl", "ncurses", "pcre2", "libcap"],
11+ #:makedepends, ["linux-headers"],
12+ #:backup, ["etc/zsh/zshenv", "etc/zsh/zprofile", "etc/zsh/zshrc"],
13+ #:source, ["https://distfiles.alpinelinux.org/distfiles/edge/zsh-5.9.2.tar.xz",
14+ "zprofile", "zshenv", "zshrc"],
15+ #:sha256sums, ["36fa734374b44783582cec09bcd67822e2f992c779ec1624ab5596df078d2f81",
16+ "5b7382c22b140b2d1027d2c1cc1805498bcd12ea508b1b76c333b952da52599a",
17+ "798b8e41ed0ed2ffdc4a2d6fabf3099063e40b74b51fe03631305edeb7607e07",
18+ "75fb7b825e3f7a3d63257c98ef5d55819179902585a3ec6459c2b4fbb20ed38f"],
19+ #:build, fn() {
20+ root := get-environment-variable("VINIX_SYSROOT")
21+ run("test", "-e", string-append(root, "/usr/lib/libncursesw.so"))
22+ ; Define ELF symbol properties that configure cannot test by executing
23+ ; a target program on the build host. The package phase loads the modules.
24+ run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH",
25+ "-C", "zsh-5.9.2", "PKG_CONFIG_PATH=", string-append("PKG_CONFIG_SYSROOT_DIR=", root),
26+ string-append("PKG_CONFIG_LIBDIR=", root, "/usr/lib/pkgconfig"),
27+ string-append("PCRE_CONFIG=", root, "/usr/bin/pcre2-config"),
28+ "CC=vinix-cc", "CFLAGS=-O2", "zsh_cv_shared_environ=yes", "zsh_cv_shared_tgetent=yes",
29+ "zsh_cv_shared_tigetstr=yes", "zsh_cv_sys_dynamic_execsyms=yes",
30+ "zsh_cv_sys_dynamic_rtld_global=yes", "zsh_cv_sys_dynamic_clash_ok=yes",
31+ "./configure", "--build=x86_64-pc-linux-gnu", "--host=x86_64-linux-musl",
32+ "--prefix=/usr", "--bindir=/bin", "--sysconfdir=/etc", "--enable-etcdir=/etc/zsh",
33+ "--with-term-lib=ncursesw", "--enable-multibyte", "--enable-function-subdirs",
34+ "--enable-pcre", "--enable-cap", "--enable-zsh-secure-free", "--with-tcsetpgrp")
35+ run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", "make", "-C", "zsh-5.9.2")
36+ },
37+ #:package, fn() {
38+ root := get-environment-variable("VINIX_SYSROOT")
39+ run("make", "-j1", "-C", "zsh-5.9.2", string-append("DESTDIR=", pkgdir()), "install")
40+ for-each(fn(file) {
41+ run("install", "-Dm644", file, string-append(pkgdir(), "/etc/zsh/", file))
42+ }, list("zprofile", "zshenv", "zshrc"))
43+ run("install", "-d", string-append(pkgdir(), "/etc/zsh/zshrc.d"), string-append(pkgdir(), "/usr/share/zsh/plugins"))
44+ run("install", "-Dm644", "zsh-5.9.2/LICENCE", string-append(pkgdir(), "/usr/share/licenses/zsh/LICENCE"))
45+ run(string-append(root, "/lib/ld-musl-x86_64.so.1"), "--library-path",
46+ string-append(root, "/usr/lib:", root, "/lib"), string-append(pkgdir(), "/bin/zsh"),
47+ "-fc", "module_path=($1); zmodload zsh/zle && zmodload zsh/complete && zmodload zsh/terminfo && zmodload zsh/pcre && zmodload zsh/cap && setopt RE_MATCH_PCRE && [[ ab =~ '^(?=a)a' ]]",
48+ "zsh", string-append(pkgdir(), "/usr/lib/zsh/5.9.2"))
49+ })
@@ -0,0 +1,10 @@
1+# System-wide .zprofile file for zsh(1) - sourced only for login shells.
2+#
3+# Global Order: zshenv, zprofile, zshrc, zlogin
4+
5+# Source /etc/profile to the current shell.
6+if [ -f /etc/profile ]; then
7+ emulate sh -c 'source /etc/profile'
8+fi
9+
10+# vim: set ft=zsh ts=4:
@@ -0,0 +1,13 @@
1+# System-wide .zshenv file for zsh(1), sourced on all invocations of the shell.
2+#
3+# Global order: zshenv, zprofile, zshrc, zlogin
4+
5+# If $ZDOTDIR is not set and none of .zshenv, .zprofile, .zshrc, .zlogin exist
6+# in $HOME, read ZSH startup files from $XDG_CONFIG_HOME/zsh/ instead of $HOME.
7+# The point is to promote XDG-based location, but don't break existing setups.
8+if [[ -z "${ZDOTDIR-}" ]] && _x=("$HOME"/.z{shenv,profile,shrc,login}(N)) && (( ! $#_x )); then
9+ ZDOTDIR=${XDG_CONFIG_HOME:-$HOME/.config}/zsh
10+fi
11+unset _x
12+
13+# vim: set ft=zsh ts=4:
@@ -0,0 +1,63 @@
1+# System-wide .zshrc file for zsh(1), sourced only for interactive shells.
2+#
3+# Global order: zshenv, zprofile, zshrc, zlogin
4+
5+# If ZSH startup files exist both in $HOME and XDG-based config directory,
6+# print a warning (but only if running as a login shell). Note that XDG-based
7+# config directory is used only when no ZSH startup files are found in $HOME
8+# (see /etc/zsh/zshenv).
9+if [[ -z "${ZDOTDIR-}" && -o login ]]; then
10+ _xdgdir=${XDG_CONFIG_HOME:-$HOME/.config}/zsh
11+ if _xdgrcs=("$_xdgdir"/.z{shenv,profile,shrc,login}(N)) && (( $#_xdgrcs )); then
12+ _homercs=("$HOME"/.z{shenv,profile,shrc,login}(N:t))
13+ print "Warning: Found Zsh startup files both in ~/ and ${_xdgdir/$HOME/\~}/, the latter will\n" \
14+ " be ignored (tip: move $_homercs to ${_xdgdir/$HOME/\~}/)." >&2
15+ fi
16+ unset _xdgdir _xdgrcs _homercs
17+fi
18+
19+# TIP: If you don't want any plugins to be automatically loaded here, add
20+# `zsh_plugin_dirs=()` to your $ZDOTDIR/.zshenv.
21+if (( ! ${+zsh_plugin_dirs} )); then
22+ zsh_plugin_dirs=("${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins")
23+fi
24+
25+# TIP: If you want to automatically use all ZSH plugins installed from Alpine
26+# packages, add `ZSH_LOAD_SYSTEM_PLUGINS=yes` to your $ZDOTDIR/.zshenv.
27+if [[ "${ZSH_LOAD_SYSTEM_PLUGINS-}" = [1ty]* ]]; then
28+ zsh_plugin_dirs+=('/usr/share/zsh/plugins')
29+fi
30+
31+# Find plugins (per Oh-My-Zsh convention) under $zsh_plugin_dirs (array of
32+# paths) and add them to $fpath.
33+_plugins=()
34+for _dir ($zsh_plugin_dirs); do
35+ for _name ("$_dir"/*(N:t)); do # equivalent of 'basename $i'
36+ if [[ -f "$_dir/$_name/$_name.plugin.zsh" ]]; then
37+ _plugins+=("$_dir/$_name/$_name.plugin.zsh")
38+ fpath=("$_dir/$_name" $fpath)
39+ fi
40+ done
41+done
42+
43+# Source each <name>.zsh script in /etc/zsh/zshrc.d/ which <name> is not
44+# included in $zshrcd_blacklist.
45+#
46+# TIP: If you want to prevent some scripts in /etc/zsh/zshrc.d from being
47+# loaded, say a.zsh and b.zsh, add `zshrcd_blacklist=(a b)` to your
48+# $ZDOTDIR/.zshenv ($XDG_CONFIG_HOME/zsh/.zshenv).
49+zshrcd_blacklist+=()
50+_scripts=(/etc/zsh/zshrc.d/*.zsh(N:t:r)) # equivalent of 'basename $i .zsh'
51+for _name (${_scripts:|zshrcd_blacklist}); do # :| is a set difference A \ B
52+ source "/etc/zsh/zshrc.d/$_name.zsh"
53+done
54+
55+# Source all plugins found in $zsh_plugin_dirs.
56+for _plugin ($_plugins); do
57+ source "$_plugin"
58+done
59+
60+unset _dir _name _plugin _plugins _scripts
61+unset zsh_plugin_dirs zshrcd_blacklist ZSH_LOAD_SYSTEM_PLUGINS
62+
63+# vim: set ft=zsh ts=4: