Subject: [alpine-aports] [PATCH] main/vim: add gvim subpackage

From: Drew DeVault <[email-masked]>
Date: Mon, 15 Jan 2018 20:50:52 -0500

---
 main/vim/APKBUILD | 43 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/main/vim/APKBUILD b/main/vim/APKBUILD
index b75d607d5a..5d0f66b0e7 100644
--- a/main/vim/APKBUILD
+++ b/main/vim/APKBUILD
@@ -1,6 +1,7 @@
 # Contributor: Sergei Lukin <[email-masked]>
 # Contributor: Łukasz Jendrysik <[email-masked]>
 # Contributor: Sören Tempel <[email-masked]>
+# Contributor: Drew DeVault <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=vim
 pkgver=8.0.1424
@@ -11,12 +12,12 @@ arch="all"
 license="custom"
 depends=""
 options="!check"  # no tests available
-makedepends="ncurses-dev lua5.3-dev python3-dev"
-subpackages="$pkgname-doc ${pkgname}diff::noarch"
+makedepends="ncurses-dev lua5.3-dev python3-dev gtk+3.0-dev libx11-dev libxt-dev"
+subpackages="$pkgname-doc ${pkgname}diff::noarch gvim"
 source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/v$pkgver.tar.gz
 	vimrc
 	"
-builddir="$srcdir/$pkgname-$pkgver"
+builddir="$srcdir"
 
 # secfixes:
 #   8.0.0329-r0:
@@ -25,13 +26,16 @@ builddir="$srcdir/$pkgname-$pkgver"
 #     - CVE-2016-1248
 
 prepare() {
-	cd "$builddir"
+	cd "$builddir"/vim-$pkgver
 	# Read vimrc from /etc/vim
 	echo '#define SYS_VIMRC_FILE "/etc/vim/vimrc"' >> src/feature.h
+	cd ..
+	# vim does not support out-of-tree builds so we have to copy the source tree
+	cp -r vim-$pkgver gvim-$pkgver
 }
 
 build() {
-	cd "$builddir"
+	cd "$builddir"/vim-$pkgver
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
@@ -45,10 +49,24 @@ build() {
 		--with-lua-prefix=/usr/lua5.3 \
 		--with-compiledby="Alpine Linux"
 	make
+	cd ../gvim-$pkgver
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr \
+		--enable-luainterp \
+		--enable-python3interp=dynamic \
+		--with-x \
+		--disable-nls \
+		--enable-multibyte \
+		--enable-gui=yes \
+		--with-lua-prefix=/usr/lua5.3 \
+		--with-compiledby="Alpine Linux"
+	make
 }
 
 package() {
-	cd "$builddir"
+	cd "$builddir"/vim-$pkgver
 	make -j1 DESTDIR="$pkgdir/" install
 
 	install -Dm644 runtime/doc/uganda.txt \
@@ -64,5 +82,18 @@ vimdiff() {
 	mv "$pkgdir"/usr/bin/vimdiff "$subpkgdir"/usr/bin
 }
 
+gvim() {
+	cd "$builddir"/gvim-$pkgver
+	provides="vim"
+	conflicts="vim"
+	pkgdesc="advanced text editor, with GUI"
+	make -j1 DESTDIR="$subpkgdir/" install
+
+	install -Dm644 runtime/doc/uganda.txt \
+		"$subpkgdir/usr/share/licenses/$pkgname/LICENSE"
+	install -Dm644 "$srcdir"/vimrc "$subpkgdir"/etc/vim/vimrc
+	rm -rf "$subpkgdir"/usr/share/man
+}
+
 sha512sums="774d380edf87ed0c807508a37ad68168cb9c468a37a3e8df96a503a3b257f55905e299c23d2d0bcd52b78a516e2374304ac96997602c11facf86a3f697099872  vim-8.0.1424.tar.gz
 d9586b777881973cb5e48e18750336a522ed72c3127b2d6b6991e2b943468ca5b694476e7fa39ab469178c1375fc8f52627484e0fe377aea5811a513e35a7b02  vimrc"
-- 
2.15.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---