Mail archive
alpine-aports

[alpine-aports] [PATCH] new aport

From: Aaron Vodney <aavoddev_at_gmail.com>
Date: Wed, 2 Aug 2017 03:53:35 +0000

I had to duplicate and modify the default_doc function due to where
9base stores its manpages. I also moved it from /usr/local/plan9 to
/usr/lib/plan9 to comply with fhs.
---
 testing/9base/APKBUILD     | 119 +++++++++++++++++++++++++++++++++++++++++++++
 testing/9base/config.patch |  11 +++++
 testing/9base/musl.patch   |  17 +++++++
 3 files changed, 147 insertions(+)
 create mode 100644 testing/9base/APKBUILD
 create mode 100644 testing/9base/config.patch
 create mode 100644 testing/9base/musl.patch
diff --git a/testing/9base/APKBUILD b/testing/9base/APKBUILD
new file mode 100644
index 0000000000..1221240331
--- /dev/null
+++ b/testing/9base/APKBUILD
_at_@ -0,0 +1,119 @@
+# Contributor: Aaron Vodney <aavoddev_at_gmail.com>
+# Maintainer: Aaron Vodney <aavoddev_at_gmail.com>
+pkgname=9base
+pkgver=6
+pkgrel=0
+pkgdesc="Suckless' Plan9 utilities"
+url="tools.suckless.org/9base"
+arch="all"
+license="custom:LPL MIT"
+depends="musl"
+makedepends="musl-dev linux-headers"
+install=""
+subpackages="$pkgname-doc"
+options=""
+source="http://dl.suckless.org/tools/${pkgname}-${pkgver}.tar.gz
+	musl.patch
+	config.patch"
+builddir="$srcdir/${pkgname}-${pkgver}"
+
+doc() {
+	depends="$depends_doc"
+	pkgdesc="$pkgdesc (documentation)"
+	install_if="docs $pkgname=$pkgver-r$pkgrel"
+	docroot=/usr/lib/plan9
+
+	local i
+	for i in doc man info html sgml licenses gtk-doc ri help; do
+		if [ -d "${pkgdir}${docroot}/share/$i" ]; then
+			mkdir -p "${subpkgdir}${docroot}/share"
+			mv "${pkgdir}${docroot}/share/$i" "${subpkgdir}${docroot}/share/"
+		fi
+	done
+
+	# compress man pages
+	local mandir="${subpkgdir}${docroot}"/share/man
+	[ -d "$mandir" ] && find "$mandir" -type l \
+		-a \( -name \*.[0-8n] -o -name \*.[0-8][a-z]* \) \
+		-a \! \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' \) \
+		| while read symlink; do
+
+		ln -s $(readlink $symlink).gz "$symlink".gz
+		rm -f "$symlink"
+	done
+	[ -d "$mandir" ] && find "$mandir" -type f \
+		-a \( -name \*.[0-8n] -o -name \*.[0-8][a-z]* \) \
+		-a \! \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' \) \
+		-exec stat -c "%i %n" \{\} \+ | while read inode name; do
+
+		# Skip hardlinks removed in last iteration.
+		[ -f "$name" ] || continue
+
+		local islink=0
+		find "$mandir" -type f -links +1 \
+			-a \( -name \*.[0-8n] -o -name \*.[0-8][a-z]* \) \
+			-a \! \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' \) \
+			-exec stat -c "%i %n" \{\} \+ | while read linode lname; do
+			if [ "$linode" = "$inode" -a "$lname" != "$name" ]; then
+				islink=1
+				rm -f "$lname"
+				ln -s "${name##*/}".gz "$lname".gz
+			fi
+		done
+
+		[ $islink -eq 0 ] && gzip -9 "$name"
+	done
+
+	rm -f "$subpkgdir/usr/share/info/dir"
+
+	# remove if empty, ignore error (not empty)
+	rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null || :
+}
+
+dev(){
+	local i= j=
+	depends="$depends_dev"
+	pkgdesc="$pkgdesc (development files)"
+
+	cd "$pkgdir" || return 0
+	local libdirs=usr/
+	[ -d lib/ ] && libdirs="lib/ $libdirs"
+	for i in usr/include usr/lib/pkgconfig usr/share/aclocal\
+			usr/share/gettext usr/bin/*-config	\
+			usr/share/vala/vapi usr/share/gir-[0-9]*\
+			usr/share/qt*/mkspecs			\
+			usr/lib/qt*/mkspecs			\
+			usr/lib/cmake				\
+			$(find . -name include -type d) 	\
+			$(find $libdirs -name '*.[acho]' \
+				-o -name '*.prl' 2>/dev/null); do
+		if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then
+			d="$subpkgdir/${i%/*}"	# dirname $i
+			mkdir -p "$d"
+			mv "$pkgdir/$i" "$d"
+			rmdir "$pkgdir/${i%/*}" 2>/dev/null || :
+		fi
+	done
+	# move *.so links needed when linking the apps to -dev packages
+	for i in lib/*.so usr/lib/*.so; do
+		if [ -L "$i" ]; then
+			mkdir -p "$subpkgdir"/"${i%/*}"
+			mv "$i" "$subpkgdir/$i" || return 1
+		fi
+	done
+	return 0
+}
+
+build() {
+	cd "$builddir"
+	make || return 1
+}
+
+package() {
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install || return 1
+}
+
+sha512sums="38108a94118b56c6f3982e692beb1068c52f9aecd74447d6b552b77fae5e365eab72b4781bdf07d9696ac89d54371c1cae8cc0363de510b53988302acef50dba  9base-6.tar.gz
+7365533289e4e64b0379099d2cea38926739afe7ad958b217d1130ddee367d086c9f3503d12018fff75e05bdafe62ab9e2117d6449cb1718bffac801993ca4e4  musl.patch
+f888dc5d4dc5af6e953d9ca77310350389692fb1d6d50db09cdca1969583b80ac933ca7852f9c3e97bbc87eeb72c46004b95c4205bc5108915d337569e7adad4  config.patch"
diff --git a/testing/9base/config.patch b/testing/9base/config.patch
new file mode 100644
index 0000000000..30abcc1e4c
--- /dev/null
+++ b/testing/9base/config.patch
_at_@ -0,0 +1,11 @@
+--- a/config.mk
++++ b/config.mk
+_at_@ -1,7 +1,7 @@
+ # Customize to fit your system
+ 
+ # paths
+-PREFIX      = /usr/local/plan9
++PREFIX      = /usr/lib/plan9
+ MANPREFIX   = ${PREFIX}/share/man
+ 
+ VERSION     = 6
diff --git a/testing/9base/musl.patch b/testing/9base/musl.patch
new file mode 100644
index 0000000000..9c2f24d740
--- /dev/null
+++ b/testing/9base/musl.patch
_at_@ -0,0 +1,17 @@
+--- a/lib9/dirread.c
++++ b/lib9/dirread.c
+_at_@ -10,13 +10,7 @@
+ static int
+ mygetdents(int fd, struct dirent *buf, int n)
+ {
+-	off_t off;
+-	int nn;
+-
+-	/* This doesn't match the man page, but it works in Debian with a 2.2 kernel */
+-	off = p9seek(fd, 0, 1);
+-	nn = getdirentries(fd, (void*)buf, n, &off);
+-	return nn;
++	return getdents(fd, (void*)buf, n);
+ }
+ #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+ static int
-- 
2.13.3
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Aug 02 2017 - 03:53:35 GMT