summaryrefslogtreecommitdiff
path: root/main/zsh/APKBUILD
blob: 83a52e9f7a7aed37ca1379a30d67a97fc6d7716c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Contributor: <kalonji@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
#
# secfixes:
#   5.8.1-r0:
#     - CVE-2021-45444
#   5.8-r0:
#     - CVE-2019-20044
#   5.4.2-r1:
#     - CVE-2018-1083
#     - CVE-2018-1071
#
pkgname=zsh
pkgver=5.9
pkgrel=0
pkgdesc="Very advanced and programmable command interpreter (shell)"
url="https://www.zsh.org/"
arch="all"
license="custom"
makedepends="
	diffutils
	libcap-dev
	pcre-dev
	ncurses-dev
	"
install="
	$pkgname.post-install
	$pkgname.post-upgrade
	$pkgname.pre-deinstall
	"
subpackages="
	$pkgname-doc
	$pkgname-calendar::noarch
	$pkgname-pcre
	$pkgname-vcs::noarch
	$pkgname-zftp
	"
source="https://sourceforge.net/projects/zsh/files/zsh/$pkgver/zsh-$pkgver.tar.xz
	skip-test-failing-on-musl.patch
	zsh-newuser-install-alpine.patch
	zprofile
	zshenv
	zshrc
	"

_libdir="usr/lib/zsh/$pkgver"
_sharedir="usr/share/zsh/$pkgver"

# Move some bigger completion files to subpackages.
# <pkgname-prefix>:[<revdep>]:<file1>[:<file2>...]
_comps="android-tools::Unix/_adb
	bzr::Unix/_bzr
	composer::Unix/_composer
	cvs::Unix/_cvs
	gcc::Unix/_gcc
	git::Unix/_git
	graphicsmagick::Unix/_graphicsmagick
	imagemagick::Unix/_imagemagick
	lynx::Unix/_lynx
	postgresql:postgresql-client:Unix/_postgresql
	rsync::Unix/_rsync
	subversion::Unix/_subversion
	tmux::Unix/_tmux
	zfs::Unix/_zfs*
	"
for _i in $_comps; do
	subpackages="$subpackages ${_i%%:*}-zsh-completion:_completion:noarch"
done

prepare() {
	default_prepare

	# Remove completions for other systems.
	cd "$builddir/Completion"
	rm -Rf AIX BSD Cygwin Darwin Debian Mandriva Redhat Solaris openSUSE

	# Remove completions for programs that are not available on Alpine
	# (just to decrease size of the package).
	cd "$builddir/Completion/Unix/Command"
	rm -f _aap _apm _baz _bittorrent _bpython _ccal _cdcd _chkconfig _clay \
		_cowsay _cplay _cssh _darcs _devtodo _dict _dsh _elfdump _elm \
		_enscript _finger _flasher _fsh _gnupod _guilt _initctl _lzop \
		_mencal _module _monotone _moosic _mysqldiff _nkf \
		_pack _pax _perforce _pine _pkgadd _pkginfo _pkgrm _prcs \
		_quilt _raggle _rcs _rlogin _rubber _sablotron _sisu _socket \
		_stgit _surfraw _tardy _telnet _tin _tla _topgit _totd _twidge \
		_unace _unison _units _uzbl _vcsh _vux _wiggle _xmms2
	cd "$builddir/Completion/Linux/Command"
	rm -f _acpitool _mondo _tpb _tpconfig _uml _vserver
	cd "$builddir/Completion/X/Command"
	rm -f _acroread _dcop _gnome-gv _gqview _gv _kfmclient _matlab \
		_nautilus _netscape _okular _qiv _vnc _xfig _xloadimage \
		_xournal _xv _xwit

	# remove the failing test suites
	cd "$builddir/Test"
	# SPLATTER: applet not found
	rm -f A01grammar.ztst
	# [[ $(strftime '%@' 0 2> /dev/null) == (%|)@ || $? != 0 ]]
	rm -f V09datetime.ztst

}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--bindir=/bin \
		--enable-etcdir=/etc/zsh \
		--enable-pcre \
		--enable-cap \
		--enable-multibyte \
		--enable-function-subdirs \
		--enable-zsh-secure-free \
		--sysconfdir=/etc \
		--with-tcsetpgrp \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make
}

check() {
	# See: https://www.zsh.org/mla/workers/2021/msg00805.html
	unset LC_ALL
	unset LC_COLLATE
	unset LC_NUMERIC
	unset LC_MESSAGES
	unset LANG

	make test
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 LICENCE "$pkgdir"/usr/share/licenses/$pkgname/LICENCE

	install -d "$pkgdir"/usr/share/zsh/plugins
	install -d "$pkgdir"/etc/zsh/zshrc.d

	cd "$srcdir"
	install -Dm644 -t "$pkgdir"/etc/zsh/ \
		zprofile \
		zshenv \
		zshrc
}

doc() {
	default_doc
	amove $_sharedir/help
}

calendar() {
	pkgdesc="Calendar Function System for ZSH"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove $_sharedir/functions/Calendar
}

pcre() {
	pkgdesc="PCRE module for ZSH"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="$pkgname=$pkgver-r$pkgrel pcre"

	amove $_libdir/zsh/pcre.so
}

vcs() {
	pkgdesc="Version Control Information module for ZSH (vcs_info)"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove $_sharedir/functions/VCS_Info
}

zftp() {
	pkgdesc="Zftp Function System for ZSH"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove $_libdir/zsh/zftp.so
	amove $_sharedir/functions/Zftp
}

_completion() {
	local name="${subpkgname%-zsh-completion}"
	pkgdesc="Zsh completions for $name"
	depends="$pkgname"

	local revdep="$(printf '%s\n' $_comps \
		| sed -En "s|^$name:([^:]*):.*|\1|p")"

	install_if="$pkgname=$pkgver-r$pkgrel ${revdep:-$name}"

	local files="$(printf '%s\n' $_comps \
		| sed -En "s|^$name:[^:]*:(.*)|\1|p" | tr : ' ')"
	test -n "$files" || { echo "$name not found in \$_comps" >&2; return 1; }

	local f; for f in $files; do
		amove $_sharedir/functions/Completion/$f
	done
}

sha512sums="
d9138b7f379ad942a5f46819d2dd52d31f3a1129f2a0d1b53d4c5cd43c318b60396da6d37c57c477b8e958fb750209aca0ae93f8c9dd42ac958de006a0ff067e  zsh-5.9.tar.xz
4fb6bf20f27ff4b36c5519dc0f7ac43b0cbf299ab0525c0f49920ed848166367207a58160eaa8d573e7ed0373540bde7a5363386e41a36945deba016a255a61d  skip-test-failing-on-musl.patch
3be36a30af2c33c5d4d0412acd30fbb52fbaad49c692f12ab1a9c57d87cee62ad0b4737127585e2dc5824b98428ff097977f610a4d1fa3d83c9370b7cf2956f7  zsh-newuser-install-alpine.patch
66a6bdf8d915c818a2c31c35c90c2a19f91d15e2d8547d050e980ef63080f27033ef1f59da5befb30dbf46050ce907690a680e48db11711d40930420f7ec1c2b  zprofile
e1c40649c940b91fb6dbcf9e7878e3c96d3729c8eee7b97cfe007d14d19add500863cef588ea4818ab83921fef9f9b4384c2003b26e9d753a8d59e9aca837d43  zshenv
a7f4f5267cf0a9d1e0c480e89ede0811435803e4822b522dfc0326a9015a44af5e3163160b5595dc055acfca28f56811521c728e020389c7a5e4e0e4b3811d38  zshrc
"