Date: Saturday, January 9, 2021 @ 21:35:52
  Author: dvzrv
Revision: 816805

upgpkg: php-imagick 3.4.4.r66.g448c1cd-1: Rebuild against php >=8.

Introduce a split-package to make imagick also available for php7.
NOTE: At the time of writing the upstream support for php >=8 is not yet
finalized and might contain bugs: https://github.com/Imagick/imagick/issues/358
As the last release has been done in 2019, picking the latest commit seems more
stable than cherry-picking various single commits.
Drop threading fix, as it is now included.

Modified:
  php-imagick/trunk/PKGBUILD

----------+
 PKGBUILD |   91 ++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 66 insertions(+), 25 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2021-01-09 21:28:08 UTC (rev 816804)
+++ PKGBUILD    2021-01-09 21:35:52 UTC (rev 816805)
@@ -1,47 +1,75 @@
 # Maintainer: David Runge <dv...@archlinux.org>
 
-pkgname=php-imagick
 _name=imagick
-pkgver=3.4.4
-pkgrel=8
+pkgbase=php-imagick
+pkgname=('php-imagick' 'php7-imagick')
+_commit="448c1cd0d58ba2838b9b6dff71c9b7e70a401b90"
+pkgver=3.4.4.r66.g448c1cd
+pkgrel=1
 pkgdesc="PHP extension to create and modify images using the ImageMagick 
library"
 arch=('x86_64')
-url="https://github.com/mkoppanen/imagick";
+url="https://github.com/imagick/imagick";
 license=('PHP')
-depends=('php' 'imagemagick' 'ttf-font')
+depends=('imagemagick' 'ttf-font')
+makedepends=('git' 'php' 'php7')
 checkdepends=('librsvg' 'ttf-dejavu')
-backup=("etc/php/conf.d/${_name}.ini")
-source=("$pkgname-$pkgver.tar.gz::https://github.com/mkoppanen/${_name}/archive/${pkgver}.tar.gz";
-        
"${pkgname}-3.4.4-imagemagick_threading.patch::https://github.com/Imagick/imagick/pull/296.patch";)
-sha512sums=('f3d3c74b4d0bb5c2dd986a8b960096ff200daa82e60fdd1467a54944be06810923b4e68a4f70194e25c8176afd9a609b9f2545054520ec759202e5fc3f1e827b'
-            
'd11a08b6a6a4a5e6d9b9cf9e87a6c0bb29ba632d6318ac237fe59910d70b07ef8df5af775451c89c5a81d45e609b9aa69611ecb562bfcbda832d5f0ae1207d55')
+source=("${pkgbase}::git+https://github.com/${_name}/${_name}#commit=${_commit}";)
+sha512sums=('SKIP')
+b2sums=('SKIP')
 
+pkgver() {
+  cd "$pkgbase"
+  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
 prepare() {
-  mv -v "${_name}-$pkgver" "$pkgname-$pkgver"
-  cd "$pkgname-$pkgver"
-  # fix imagemagick threading issues when building against php >= 7.4
-  patch -Np1 -i "../${pkgname}-3.4.4-imagemagick_threading.patch"
   # setting package version: https://bugs.archlinux.org/task/64185
   sed -e "s/@PACKAGE_VERSION@/${pkgver}/" \
-      -i php_imagick.h package.xml
-  echo ";extension=${_name}" > "${_name}.ini"
-  phpize
+      -i "${pkgbase}/php_imagick.h" "${pkgbase}/package.xml"
+  echo ";extension=${_name}" > "${pkgbase}/${_name}.ini"
+
+  cp -av "${pkgbase}" "${pkgname[1]}"
+  (
+    cd "$pkgname"
+    phpize
+  )
+  (
+    cd "${pkgname[1]}"
+    phpize7
+  )
 }
 
 build() {
-  cd "$pkgname-$pkgver"
-  ./configure --prefix=/usr
-  make
+  (
+    cd "$pkgname"
+    ./configure --prefix=/usr
+    make
+  )
+  (
+    cd "${pkgname[1]}"
+    ./configure --prefix=/usr
+    make
+  )
 }
 
 check() {
-  cd "$pkgname-$pkgver"
-  export NO_INTERACTION="true"
-  make -k test
+  (
+    cd "$pkgname"
+    export NO_INTERACTION="true"
+    make -k test
+  )
+  (
+    cd "${pkgname[1]}"
+    export NO_INTERACTION="true"
+    make -k test
+  )
 }
 
-package() {
-  cd "$pkgname-$pkgver"
+package_php-imagick() {
+  depends+=('php')
+  backup=("etc/php/conf.d/${_name}.ini")
+
+  cd "$pkgname"
   make INSTALL_ROOT="$pkgdir/" install
   install -vDm 644 "${_name}.ini" -t "${pkgdir}/etc/php/conf.d/"
   install -vDm 644 {ChangeLog,CREDITS,README.md} \
@@ -49,3 +77,16 @@
   install -vDm 644 examples/*.php \
     -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
 }
+
+package_php7-imagick() {
+  depends+=('php7')
+  backup=("etc/php7/conf.d/${_name}.ini")
+
+  cd "$pkgname"
+  make INSTALL_ROOT="$pkgdir/" install
+  install -vDm 644 "${_name}.ini" -t "${pkgdir}/etc/php7/conf.d/"
+  install -vDm 644 {ChangeLog,CREDITS,README.md} \
+    -t "${pkgdir}/usr/share/doc/${pkgname}/"
+  install -vDm 644 examples/*.php \
+    -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
+}

Reply via email to