Subject: [alpine-aports] [PATCH] main/nano: split syntax definitions into a subpackage

From: Sören Tempel <[email-masked]>
Date: Sun, 14 Feb 2016 12:00:36 +0100

---
 main/nano/APKBUILD | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/main/nano/APKBUILD b/main/nano/APKBUILD
index 727bb44..4efd82b 100644
--- a/main/nano/APKBUILD
+++ b/main/nano/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Michael Zhou <[email-masked]>
 pkgname=nano
 pkgver=2.5.2
-pkgrel=0
+pkgrel=1
 pkgdesc="Text Editor. GNU nano is designed to be a free replacement for the Pico text editor."
 url="http://www.nano-editor.org/"
 arch="all"
@@ -10,11 +10,11 @@ license="GPL"
 depends=
 makedepends="ncurses-dev"
 install=
-subpackages="$pkgname-doc"
+subpackages="$pkgname-doc $pkgname-syntax"
 source="http://www.nano-editor.org/dist/v${pkgver%.*}/$pkgname-$pkgver.tar.gz
 	"
 
-_builddir="$srcdir/$pkgname-$pkgver"
+_builddir="$srcdir"/$pkgname-$pkgver
 prepare() {
 	cd "$_builddir"
 	for i in $source; do
@@ -41,12 +41,22 @@ build() {
 package() {
 	cd "$_builddir"
 	make DESTDIR="$pkgdir" install
-
-	install -Dm644 "$_builddir"/doc/nanorc.sample \
+	install -Dm644 doc/nanorc.sample \
 		"$pkgdir"/etc/nanorc || return 1
 
-	sed -i 's:# include:include:g' "$pkgdir"/etc/nanorc
-	sed -i "/syntax/s/\"$/\" \"APKBUILD&/" "$pkgdir"/usr/share/nano/sh.nanorc
+	# Proper syntax highlighting for APKBUILDs
+	sed -i "/syntax/s/\"$/\" \"APKBUILD&/" \
+		"$pkgdir"/usr/share/nano/sh.nanorc || return 1
+}
+
+syntax() {
+	pkgdesc="Syntax highlighting definitions for $pkgname"
+	arch="noarch"
+	depends=""
+
+	mkdir -p "$subpkgdir"/usr/share/$pkgname/
+	mv "$pkgdir"/usr/share/$pkgname/*.nanorc \
+		"$subpkgdir"/usr/share/$pkgname/ || return 1
 }
 
 md5sums="036830de22b8a76a0e6f84c0cb36ff12  nano-2.5.2.tar.gz"
-- 
2.7.1

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