Mail archive
alpine-aports

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

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Mon, 23 Jan 2017 17:28:14 +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

[v2]
ExtUtils and CPAN stay at core
remove identical scripts and made symlinks
---
 main/perl/APKBUILD | 94 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 56 insertions(+), 38 deletions(-)
diff --git a/main/perl/APKBUILD b/main/perl/APKBUILD
index a969bcd854..cacd3a8ecd 100644
--- a/main/perl/APKBUILD
+++ b/main/perl/APKBUILD
_at_@ -1,41 +1,34 @@
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 # Contributor: Leonardo Arena <rnalrd_at_alpinelinux.org>
+# Contributor: Valery Kartel <valery.kartel_at_gmail.com>
 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' \
_at_@ -44,13 +37,13 @@ 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 \
_at_@ -61,38 +54,63 @@ 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
+	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/$_archlib "$subpkgdir"/$_privlib
+	mv "$pkgdir"/$_archlib/Devel "$subpkgdir"/$_archlib/ || return 1
 	mv "$pkgdir"/$_privlib/Encode "$subpkgdir"/$_privlib/ || return 1
+	local file
+	for file in c2ph corelist enc2xs instmodsh h2ph h2xs libnetcfg perldoc \
+		perlivp perlthanks pl2pm pod2html pod2man pod2text pod2usage \
+		podchecker podselect prove xsubpp $pkgname$pkgver
+	do
+		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/ || return 1
+	done
+	rm "$pkgdir"/usr/bin/pstruct "$pkgdir"/usr/bin/perlbug
+	ln -sf /usr/bin/c2ph "$subpkgdir"/usr/bin/pstruct
+	ln -sf /usr/bin/perlthanks "$subpkgdir"/usr/bin/perlbug
 	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 cpan 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:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon Jan 23 2017 - 17:28:14 GMT