summaryrefslogtreecommitdiff
path: root/system/zsh/APKBUILD
blob: abc6e8008b05b5a0f71243ae486c436da551e80c (plain) (blame)
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
# Contributor: <kalonji@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=zsh
pkgver=5.5.1
pkgrel=0
pkgdesc="A very advanced and programmable command interpreter (shell)"
url="http://www.zsh.org/"
arch="all"
license="Zsh AND BSD-3-Clause AND GPL-2.0+ AND GPL-2.0-only AND Artistic-1.0-Perl AND MIT AND GPL-1.0+"
depends="debianutils"  # add-shell
makedepends_host="ncurses-dev pcre-dev utmps-dev"
install="zsh.post-install zsh.post-upgrade zsh.pre-deinstall"
source="http://www.zsh.org/pub/$pkgname-$pkgver.tar.gz
	zprofile
	zshrc
	"
subpackages="$pkgname-doc
	     $pkgname-calendar::noarch
	     $pkgname-vcs::noarch
	     $pkgname-tcp::noarch"
[ "$CBUILD" != "$CHOST" ] || subpackages="$subpackages $pkgname-zftp"
builddir="$srcdir/$pkgname-$pkgver"

# secfixes:
#   5.4.1-r1:
#     - CVE-2018-1083
#     - CVE-2018-1100

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

# Move some bigger completion files to subpackages.
_comps="android-tools:Unix/_adb
	bzr:Unix/_bzr
	cvs:Unix/_cvs
	gcc:Unix/_gcc
	git:Unix/_git
	graphicsmagick:Unix/_graphicsmagick
	imagemagick:Unix/_imagemagick
	lynx:Unix/_lynx
	mercurial:Unix/_hg
	rsync:Unix/_rsync
	subversion:Unix/_subversion
	tmux:Unix/_tmux
	zfs:Unix/_zfs*:Unix/_zpool"
for _i in $_comps; do
	subpackages="$subpackages ${_i%%:*}-zsh-completion:_completion:noarch"
done

prepare() {
	cd "$builddir"

	default_prepare
	update_config_sub

	# Remove completions for other systems.
	cd 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 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 \
		_mencal _module _monotone _moosic _mysqldiff _nkf \
		_pack _perforce _pine _pkgadd _pkginfo _pkgrm _prcs \
		_quilt _raggle _rcs _rlogin _rubber _sablotron _sisu _socket \
		_stgit _surfraw _tardy _tin _tla _topgit _totd _twidge \
		_unace _unison _units _uzbl _vcsh _vux _wiggle _xmms2 _yodl
	cd ../../Linux/Command
	rm -f _mondo _tpb _tpconfig _uml _vserver
	cd ../../X/Command
	rm -f _acroread _dcop _gnome-gv _gqview _gv _kfmclient _matlab \
		_nautilus _netscape _qiv _vnc _xfig _xloadimage \
		_xournal _xv _xwit
}

build() {
	cd "$builddir"

	LIBS="-lutmps -lskarnet" ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--bindir=/bin \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--sysconfdir=/etc \
		--enable-etcdir=/etc/zsh \
		--enable-pcre \
		--enable-unicode9 \
		--enable-multibyte \
		--enable-function-subdirs \
		--enable-zsh-secure-free \
		--with-tcsetpgrp
	make
}

check() {
	cd "$builddir"
	# Does not work with musl due to UTF-8
	rm "$builddir"/Test/A03quoting.ztst
	# Does not work with musl due to locale
	rm "$builddir"/Test/B03print.ztst
	# Not guaranteed to work portably (requires atime)
	rm "$builddir"/Test/C02cond.ztst
	# PPC?
	rm "$builddir"/Test/V09datetime.ztst
	make test
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install
	install -Dm644 "$srcdir"/zprofile "$pkgdir"/etc/zsh/zprofile
	install -Dm644 "$srcdir"/zshrc "$pkgdir"/etc/zsh/zshrc
}

doc() {
	default_doc
	_submv $_sharedir/help
}

calendar() {
	pkgdesc="Calendar Function System for ZSH"
	depends="$pkgname"

	_submv $_sharedir/functions/Calendar
}

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

	_submv $_sharedir/functions/VCS_Info
}

tcp() {
	pkgdesc="Network I/O over TCP/IP from within the shell"
	depends="$pkgname"

	_submv $_sharedir/functions/TCP
}

zftp() {
	pkgdesc="Zftp Function System for ZSH"
	depends="$pkgname"

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

_completion() {
	local name="${subpkgname%-zsh-completion}"
	pkgdesc="Zsh completions for $name"
	depends="$pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel $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
		_submv $_sharedir/functions/Completion/$f
	done
}

_submv() {
	local path="$1"
	mkdir -p "$subpkgdir"/${path%/*}
	mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
}

sha512sums="c4f7327a3f5480bd9a169fb07e34812e0106fa9de3b5f7d38bb0db85a3e4d01b9a4a8f35553da03a15d7d819108305cfaa2811c945273e2cac84512219e69ebb  zsh-5.5.1.tar.gz
cbc184f0c4af1441eaad2a3f7255be9941c64bd5a05977aea5ca3a0a11a3d121c34c1fc9e633465eda087cd196dabf9591082117bbb42cc6e6bc9352ec2c207d  zprofile
cd3a8a6ada8f1ce97a6ca7af5a615092339cde00c20c657d7ce7bf4da57f7a774f2eb5c7d17bdf7e1a12e8b5d0d7878c977d87a0b068c2a869b91cec9ef8d69d  zshrc"