Subject: [alpine-aports] [PATCH] main/perl: fixes and cleanups in apkbuild

From: Valery Kartel <[email-masked]>
Date: Thu, 19 Jan 2017 17:37:06 +0200

- remove one-time used variables
- move *.pod files to -doc subpackage
- move development scripts and modules to -dev subpackage
- move all other scripts to -utils subpackage
---
 main/perl/APKBUILD | 99 +++++++++++++++++++++++++++++++++---------------------
 1 file changed, 60 insertions(+), 39 deletions(-)

diff --git a/main/perl/APKBUILD b/main/perl/APKBUILD
index a969bcd854..c69a816340 100644
--- a/main/perl/APKBUILD
+++ b/main/perl/APKBUILD
@@ -1,41 +1,34 @@
 # Maintainer: Natanael Copa <[email-masked]>
 # Contributor: Leonardo Arena <[email-masked]>
+# Contributor: Valery Kartel <[email-masked]>
 pkgname=perl
 pkgver=5.24.0
-pkgrel=0
+pkgrel=1
 pkgdesc="Larry Wall's Practical Extraction and Report Language"
-url=http://www.perl.org
+url="http://www.perl.org/"
 arch="all"
 license="Artistic GPL2"
-source="http://www.cpan.org/src/5.0/perl-$pkgver.tar.gz
-	"
 options="!fhs"
+depends=""
+depends_dev="perl-utils"
+makedepends=""
+subpackages="$pkgname-doc $pkgname-dev $pkgname-utils::noarch miniperl"
+source="http://www.cpan.org/src/5.0/$pkgname-$pkgver.tar.gz"
+builddir="$srcdir/$pkgname-$pkgver"
 
-depends=
-depends_dev="perl"
-makedepends=
-subpackages="$pkgname-dev $pkgname-doc miniperl"
-
-_builddir="$srcdir/$pkgname-$pkgver"
+_privlib=/usr/share/perl5/core_perl
+_archlib=/usr/lib/perl5/core_perl
 
 prepare() {
-	cd $_builddir
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
-	sed -i -e 's/less -R/less/g' ./Configure
-	sed -i -e 's/libswanted="\(.*\) nsl\(.*\)"/libswanted="\1\2"/g' ./Configure
+	default_prepare || return 1
+	cd "$builddir"
+	sed	-e 's/less -R/less/g' \
+		-e 's/libswanted="\(.*\) nsl\(.*\)"/libswanted="\1\2"/g' \
+		-i ./Configure || return 1
 }
 
-_privlib=/usr/share/perl5/core_perl
-_archlib=/usr/lib/perl5/core_perl
-_vendorlib=/usr/share/perl5/vendor_perl
-_vendorarch=/usr/lib/perl5/vendor_perl
-
 build() {
-	cd $_builddir
+	cd "$builddir"
 	./Configure -des \
 		-Dcccdlflags='-fPIC' \
 		-Dcccdlflags='-fPIC' \
@@ -44,16 +37,17 @@ build() {
 		-Dprivlib=$_privlib \
 		-Darchlib=$_archlib \
 		-Dvendorprefix=/usr \
-		-Dvendorlib=$_vendorlib \
-		-Dvendorarch=$_vendorarch \
+		-Dvendorlib=/usr/share/perl5/vendor_perl \
+		-Dvendorarch=/usr/lib/perl5/vendor_perl \
 		-Dsiteprefix=/usr/local \
 		-Dsitelib=/usr/local/share/perl5/site_perl \
 		-Dsitearch=/usr/local/lib/perl5/site_perl \
 		-Dlocincpth=' ' \
-		-Doptimize="${CFLAGS}" \
+		-Doptimize="$CFLAGS" \
 		-Duselargefiles \
 		-Dusethreads \
 		-Duseshrplib \
+		-Duselongdouble \
 		-Dd_semctl_semun \
 		-Dman1dir=/usr/share/man/man1 \
 		-Dman3dir=/usr/share/man/man3 \
@@ -61,38 +55,65 @@ build() {
 		-Dinstallman3dir=/usr/share/man/man3 \
 		-Dman1ext='1' \
 		-Dman3ext='3pm' \
-		-Dinc_version_list="$inclist" \
 		-Dcf_by='Alpine' \
 		-Ud_csh \
 		-Dusenm \
 		|| return 1
 	make libperl.so && make || return 1
-#	make check || return 1
 }
 
 package() {
-	cd "$srcdir/$pkgname-$pkgver"
-	make install DESTDIR="$pkgdir"
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install
 	if [ -n "$(find $pkgdir/usr/local -type f)" ]; then
 		error "files found under /usr/local"
 		return 1
 	fi
+	find "$pkgdir" -name '.*' -delete
 }
 
 miniperl() {
-	pkgname=miniperl
-	mkdir -p "$subpkgdir"/usr/bin
-	cp "$srcdir/perl-$pkgver"/miniperl "$subpkgdir/usr/bin"
+	install -Dm755 "$builddir"/$subpkgname \
+		"$subpkgdir"/usr/bin/$subpkgname || return 1
+}
+
+doc() {
+	default_doc
+	local file; for file in $(find "$pkgdir" -name "*.pod"); do
+		file=${file#$pkgdir/}
+		mkdir -p "$subpkgdir"/${file%/*} || return 1
+		mv "$pkgdir"/$file "$subpkgdir"/$file || return 1
+	done
 }
 
 dev() {
-	mkdir -p "$subpkgdir"/$_privlib
-	mv "$pkgdir"/$_privlib/Encode "$subpkgdir"/$_privlib/ || return 1
+	mkdir -p "$subpkgdir"/usr/bin \
+		"$subpkgdir"/$_archlib \
+		"$subpkgdir"/$_privlib
+	mv "$pkgdir"/$_archlib/Devel "$subpkgdir"/$_archlib/ || return 1
+	mv "$pkgdir"/$_privlib/ExtUtils \
+		"$pkgdir"/$_privlib/Encode \
+		"$pkgdir"/$_privlib/CPAN* \
+		"$subpkgdir"/$_privlib/ || return 1
+	local file
+	for file in c2ph corelist cpan enc2xs instmodsh h2ph h2xs libnetcfg perlbug \
+		perldoc perlivp perlthanks pl2pm pod2html pod2man pod2text pod2usage \
+		podchecker podselect prove pstruct xsubpp $pkgname$pkgver
+	do
+		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/ || return 1
+	done
 	default_dev
-	replaces="perl"
+}
+
+utils() {
+	pkgdesc="$pkgdesc (misc utilities)"
+	depends="$pkgname"
 	mkdir -p "$subpkgdir"/usr/bin
-	for i in enc2xs h2xs libnetcfg perlivp; do
-		mv "$pkgdir"/usr/bin/$i "$subpkgdir"/usr/bin/ || return 1
+	local file
+	for file in encguess json_pp piconv ptar ptardiff ptargrep shasum \
+		splain zipdetails
+	do
+		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/ || return 1
 	done
 }
 
-- 
2.11.0

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