File php-mailparse.spec of Package php-mailparse

#
# spec file for package php-mailparse
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define pkg_name    mailparse
%define src_name    pecl-mail-%{pkg_name}

%define flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "" || (0%{?suse_version} >= 1550 && "%{flavor}" == "php7")
%define php_name php
ExclusiveArch:  do-not-build
%else
%define php_name %{flavor}
%endif

Name:           %{php_name}-%{pkg_name}
Version:        3.1.4
Release:        0
Summary:        Email Message Manipulation
License:        PHP-3.01
Group:          Productivity/Networking/Email/Servers
URL:            https://pecl.php.net/package/mailparse
Source:         https://github.com/php/%{src_name}/archive/refs/tags/v%{version}.tar.gz#/%{src_name}-%{version}.tar.gz
BuildRequires:  %{php_name}-devel
BuildRequires:  %{php_name}-mbstring
BuildRequires:  re2c
Requires:       %{php_name}-mbstring
Requires:       php(api) = %{php_core_api}
Requires:       php(zend-abi) = %{php_zend_api}
%if "%{php_name}" != "php7"
BuildRequires:  autoconf
%endif

%description
Mailparse is an extension for parsing and working with email messages.
It can deal with rfc822 and rfc2045 (MIME) compliant messages.

%prep
%setup -q -n %{src_name}-%{version}

%build
%__phpize
%configure
%make_build

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags} INSTALL_ROOT=%{buildroot}

install -d %{buildroot}%{php_cfgdir}
echo "extension=%{pkg_name}.so" >> %{buildroot}%{php_cfgdir}/%{pkg_name}.ini

%files
%doc CREDITS README.md
%{php_extdir}/%{pkg_name}.so
%config(noreplace) %{php_cfgdir}/%{pkg_name}.ini

%changelog

openSUSE Build Service is sponsored by