diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..c0d5a64
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,4 @@
+
+ php7
+
+
diff --git a/php-imagick-rpmlintrc b/php-imagick-rpmlintrc
new file mode 100644
index 0000000..0866836
--- /dev/null
+++ b/php-imagick-rpmlintrc
@@ -0,0 +1 @@
+addFilter("invalid-spec-name")
diff --git a/php7-imagick.changes b/php-imagick.changes
similarity index 98%
rename from php7-imagick.changes
rename to php-imagick.changes
index 3ca847b..2cb60dd 100644
--- a/php7-imagick.changes
+++ b/php-imagick.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Thu Feb 18 23:10:08 UTC 2021 - Arjen de Korte
+
+- Use _multibuild (prepare to build for php8)
+- Use php_cfgdir and php_extdir macros to determine location of files
+
-------------------------------------------------------------------
Fri Jan 8 07:22:07 UTC 2021 - Arjen de Korte
diff --git a/php7-imagick.spec b/php-imagick.spec
similarity index 74%
rename from php7-imagick.spec
rename to php-imagick.spec
index 99ec2b9..778eabf 100644
--- a/php7-imagick.spec
+++ b/php-imagick.spec
@@ -1,5 +1,5 @@
#
-# spec file for package php7-imagick
+# spec file for package php-imagick
#
# Copyright (c) 2021 SUSE LLC
#
@@ -17,7 +17,20 @@
%define pkg_name imagick
-Name: php7-%{pkg_name}
+
+%define flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == ""
+%define php_name php
+ExclusiveArch: do-not-build
+%else
+%define php_name %{flavor}
+%endif
+%if 0%{?suse_version} <= 1500
+%define php_extdir %(%{__php_config} --extension-dir)
+%define php_cfgdir %{_sysconfdir}/%{php_name}/conf.d
+%endif
+
+Name: %{php_name}-%{pkg_name}
Version: 3.4.4
Release: 0
Summary: Wrapper to the ImageMagick library
@@ -26,20 +39,17 @@ Group: Productivity/Networking/Web/Servers
URL: https://pecl.php.net/package/imagick
Source0: https://pecl.php.net/get/%{pkg_name}-%{version}.tgz
Source1: %{pkg_name}.ini
+Source2: php-%{pkg_name}-rpmlintrc
Patch0: imagick-reproducible.patch
BuildRequires: ImageMagick-devel >= 6.5.3.10
BuildRequires: ghostscript-fonts-std
-BuildRequires: php7-devel >= 7.0.1
+BuildRequires: %{php_name}-devel >= 7.0.1
BuildRequires: re2c
Conflicts: php7-gmagick
Provides: php-%{pkg_name} = %{version}
Obsoletes: php-%{pkg_name} < %{version}
-%if %{?php_zend_api}0
Requires: php(api) = %{php_core_api}
Requires: php(zend-abi) = %{php_zend_api}
-%else
-%requires_eq php7
-%endif
%description
PHP extension to create, modify and obtain meta information of images using
@@ -53,31 +63,28 @@ mkdir %{name}
rm tests/229_Tutorial_fxAnalyzeImage_case1.phpt
%build
-%{_bindir}/phpize
export CFLAGS="%{optflags} -fvisibility=hidden"
+%{__phpize}
%configure --with-%{pkg_name}=%{_usr}
-make %{?_smp_mflags}
+%make_build
%check
%if 0%{?qemu_user_space_build}
export TEST_TIMEOUT=600
%endif
-make %{?_smp_mflags} PHP_EXECUTABLE=%{__php} NO_INTERACTION=1 test \
+%make_build PHP_EXECUTABLE=%{__php} NO_INTERACTION=1 test \
|| { for f in tests/*.out; do cat $f; echo '------'; done; exit 1; }
%install
-make DESTDIR=%{buildroot} install INSTALL_ROOT=%{buildroot}
-mkdir -p %{buildroot}%{_sysconfdir}/php7/conf.d
-install --mode=0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/php7/conf.d/%{pkg_name}.ini
-
-# remove not used header file(s)
-rm -rf %{buildroot}/%{_includedir}/php7/ext/%{pkg_name}/
+make install-modules INSTALL_ROOT=%{buildroot}
+mkdir -p %{buildroot}%{php_cfgdir}
+install --mode=0644 %{SOURCE1} %{buildroot}%{php_cfgdir}/%{pkg_name}.ini
%files
%defattr(-,root,root,-)
-%{_libdir}/php7/extensions/%{pkg_name}.so
-%config(noreplace) %{_sysconfdir}/php7/conf.d/%{pkg_name}.ini
%license LICENSE
%doc ChangeLog CREDITS
+%config(noreplace) %{_sysconfdir}/php7/conf.d/%{pkg_name}.ini
+%{php_extdir}/%{pkg_name}.so
%changelog