From e0908b82bc7c2fc51cc19fef21fec1a22cac0b07 Mon Sep 17 00:00:00 2001
From: Celeste <20312-Celeste@users.gitlab.alpinelinux.org>
Date: Mon, 3 Jun 2024 01:43:13 +0000
Subject: [PATCH] community/imagemagick: fix perlmagick dir

closes https://gitlab.alpinelinux.org/alpine/aports/-/issues/16180

also, fix man pages not being installed to imagemagick-perlmagick-doc

since i am already modifying `--with-perl-options`,
also add NO_PACKLIST and NO_PERLLOCAL to that, so the
`find -delete` call in package() is no longer needed
---
 community/imagemagick/APKBUILD | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/community/imagemagick/APKBUILD b/community/imagemagick/APKBUILD
index 5839a455651b..2b38a4698239 100644
--- a/community/imagemagick/APKBUILD
+++ b/community/imagemagick/APKBUILD
@@ -4,7 +4,7 @@
 pkgname=imagemagick
 _pkgname=ImageMagick
 pkgver=7.1.1.32
-pkgrel=1
+pkgrel=2
 _pkgver=${pkgver%.*}-${pkgver##*.}
 _abiver=7
 pkgdesc="Collection of tools and libraries for many image formats"
@@ -190,7 +190,7 @@ build() {
 		--with-heic \
 		--with-modules \
 		--with-perl \
-		--with-perl-options="INSTALL_BASE=/usr INSTALLDIRS=vendor" \
+		--with-perl-options="INSTALLDIRS=vendor INSTALLVENDORARCH=/usr/lib/perl5/vendor_perl NO_PACKLIST=1 NO_PERLLOCAL=1" \
 		--with-png \
 		--with-rsvg \
 		--with-threads \
@@ -217,8 +217,9 @@ package() {
 	# for the modules
 	rm "$pkgdir"/usr/lib/*.la
 
-	find "$pkgdir" \( -name '.packlist' -o -name 'perllocal.pod' \
-		-o -name '*.bs' \) -delete
+	# perl installs man pages here, we make use of this wrong directory
+	# to isolate the perl man pages and move them in _perlmagick_doc()
+	gzip -9v "$pkgdir"/usr/man/man*/*
 }
 
 heic() {
@@ -291,9 +292,10 @@ _perlmagick() {
 
 _perlmagick_doc() {
 	pkgdesc="PerlMagick Perl Module Documentation for ImageMagick"
-	mkdir -p "$subpkgdir"
-	cd "$builddir"/PerlMagick
-	make DESTDIR="$subpkgdir" doc_vendor_install
+	install_if="docs $pkgname-perlmagick=$pkgver-r$pkgrel"
+
+	mkdir -p "$subpkgdir"/usr/share
+	mv -v "$pkgdir"/usr/man "$subpkgdir"/usr/share/
 }
 
 sha512sums="
-- 
GitLab