From 88bd0cc578dc32d8c3880062a5bb9ddc270a144a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 19 Dec 2023 13:51:11 +0100 Subject: initial package for version 1.0.0 (PHP 8.4) --- .gitignore | 9 + Makefile | 4 + PHPINFO | 9 + REFLECTION | 747 +++++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-imap.spec | 194 ++++++++++++++ 5 files changed, 963 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 PHPINFO create mode 100644 REFLECTION create mode 100644 php-pecl-imap.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01f0400 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +clog +package-*.xml +*.tgz +*.tar.bz2 +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/PHPINFO b/PHPINFO new file mode 100644 index 0000000..77444d9 --- /dev/null +++ b/PHPINFO @@ -0,0 +1,9 @@ + +imap + +IMAP c-Client Version => 2007f +SSL Support => enabled +Kerberos Support => enabled + +Directive => Local Value => Master Value +imap.enable_insecure_rsh => Off => Off diff --git a/REFLECTION b/REFLECTION new file mode 100644 index 0000000..aebab77 --- /dev/null +++ b/REFLECTION @@ -0,0 +1,747 @@ +Extension [ extension #18 imap version 1.0.0 ] { + + - Dependencies { + Dependency [ standard (Required) ] + } + + - INI { + Entry [ imap.enable_insecure_rsh ] + Current = '0' + } + } + + - Constants [68] { + Constant [ int NIL ] { 0 } + Constant [ int IMAP_OPENTIMEOUT ] { 1 } + Constant [ int IMAP_READTIMEOUT ] { 2 } + Constant [ int IMAP_WRITETIMEOUT ] { 3 } + Constant [ int IMAP_CLOSETIMEOUT ] { 4 } + Constant [ int OP_DEBUG ] { 1 } + Constant [ int OP_READONLY ] { 2 } + Constant [ int OP_ANONYMOUS ] { 4 } + Constant [ int OP_SHORTCACHE ] { 8 } + Constant [ int OP_SILENT ] { 16 } + Constant [ int OP_PROTOTYPE ] { 32 } + Constant [ int OP_HALFOPEN ] { 64 } + Constant [ int OP_EXPUNGE ] { 128 } + Constant [ int OP_SECURE ] { 256 } + Constant [ int CL_EXPUNGE ] { 32768 } + Constant [ int FT_UID ] { 1 } + Constant [ int FT_PEEK ] { 2 } + Constant [ int FT_NOT ] { 4 } + Constant [ int FT_INTERNAL ] { 8 } + Constant [ int FT_PREFETCHTEXT ] { 32 } + Constant [ int ST_UID ] { 1 } + Constant [ int ST_SILENT ] { 2 } + Constant [ int ST_SET ] { 4 } + Constant [ int CP_UID ] { 1 } + Constant [ int CP_MOVE ] { 2 } + Constant [ int SE_UID ] { 1 } + Constant [ int SE_FREE ] { 2 } + Constant [ int SE_NOPREFETCH ] { 4 } + Constant [ int SO_FREE ] { 8 } + Constant [ int SO_NOSERVER ] { 8 } + Constant [ int SA_MESSAGES ] { 1 } + Constant [ int SA_RECENT ] { 2 } + Constant [ int SA_UNSEEN ] { 4 } + Constant [ int SA_UIDNEXT ] { 8 } + Constant [ int SA_UIDVALIDITY ] { 16 } + Constant [ int SA_ALL ] { 31 } + Constant [ int LATT_NOINFERIORS ] { 1 } + Constant [ int LATT_NOSELECT ] { 2 } + Constant [ int LATT_MARKED ] { 4 } + Constant [ int LATT_UNMARKED ] { 8 } + Constant [ int LATT_REFERRAL ] { 16 } + Constant [ int LATT_HASCHILDREN ] { 32 } + Constant [ int LATT_HASNOCHILDREN ] { 64 } + Constant [ int SORTDATE ] { 0 } + Constant [ int SORTARRIVAL ] { 1 } + Constant [ int SORTFROM ] { 2 } + Constant [ int SORTSUBJECT ] { 3 } + Constant [ int SORTTO ] { 4 } + Constant [ int SORTCC ] { 5 } + Constant [ int SORTSIZE ] { 6 } + Constant [ int TYPETEXT ] { 0 } + Constant [ int TYPEMULTIPART ] { 1 } + Constant [ int TYPEMESSAGE ] { 2 } + Constant [ int TYPEAPPLICATION ] { 3 } + Constant [ int TYPEAUDIO ] { 4 } + Constant [ int TYPEIMAGE ] { 5 } + Constant [ int TYPEVIDEO ] { 6 } + Constant [ int TYPEMODEL ] { 7 } + Constant [ int TYPEOTHER ] { 8 } + Constant [ int ENC7BIT ] { 0 } + Constant [ int ENC8BIT ] { 1 } + Constant [ int ENCBINARY ] { 2 } + Constant [ int ENCBASE64 ] { 3 } + Constant [ int ENCQUOTEDPRINTABLE ] { 4 } + Constant [ int ENCOTHER ] { 5 } + Constant [ int IMAP_GC_ELT ] { 1 } + Constant [ int IMAP_GC_ENV ] { 2 } + Constant [ int IMAP_GC_TEXTS ] { 4 } + } + + - Functions { + Function [ function imap_open ] { + + - Parameters [6] { + Parameter #0 [ string $mailbox ] + Parameter #1 [ string $user ] + Parameter #2 [ string $password ] + Parameter #3 [ int $flags = 0 ] + Parameter #4 [ int $retries = 0 ] + Parameter #5 [ array $options = [] ] + } + - Return [ IMAP\Connection|false ] + } + Function [ function imap_reopen ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + Parameter #2 [ int $flags = 0 ] + Parameter #3 [ int $retries = 0 ] + } + - Return [ bool ] + } + Function [ function imap_close ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $flags = 0 ] + } + - Return [ true ] + } + Function [ function imap_is_open ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ bool ] + } + Function [ function imap_num_msg ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ int|false ] + } + Function [ function imap_num_recent ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ int ] + } + Function [ function imap_headers ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ array|false ] + } + Function [ function imap_headerinfo ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ int $from_length = 0 ] + Parameter #3 [ int $subject_length = 0 ] + } + - Return [ stdClass|false ] + } + Function [ function imap_rfc822_parse_headers ] { + + - Parameters [2] { + Parameter #0 [ string $headers ] + Parameter #1 [ string $default_hostname = "UNKNOWN" ] + } + - Return [ stdClass ] + } + Function [ function imap_rfc822_write_address ] { + + - Parameters [3] { + Parameter #0 [ string $mailbox ] + Parameter #1 [ string $hostname ] + Parameter #2 [ string $personal ] + } + - Return [ string|false ] + } + Function [ function imap_rfc822_parse_adrlist ] { + + - Parameters [2] { + Parameter #0 [ string $string ] + Parameter #1 [ string $default_hostname ] + } + - Return [ array ] + } + Function [ function imap_body ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ int $flags = 0 ] + } + - Return [ string|false ] + } + Function [ function imap_fetchtext ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ int $flags = 0 ] + } + - Return [ string|false ] + } + Function [ function imap_bodystruct ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ string $section ] + } + - Return [ stdClass|false ] + } + Function [ function imap_fetchbody ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ string $section ] + Parameter #3 [ int $flags = 0 ] + } + - Return [ string|false ] + } + Function [ function imap_fetchmime ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ string $section ] + Parameter #3 [ int $flags = 0 ] + } + - Return [ string|false ] + } + Function [ function imap_savebody ] { + + - Parameters [5] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ $file ] + Parameter #2 [ int $message_num ] + Parameter #3 [ string $section = "" ] + Parameter #4 [ int $flags = 0 ] + } + - Return [ bool ] + } + Function [ function imap_fetchheader ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ int $flags = 0 ] + } + - Return [ string|false ] + } + Function [ function imap_fetchstructure ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + Parameter #2 [ int $flags = 0 ] + } + - Return [ stdClass|false ] + } + Function [ function imap_gc ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $flags ] + } + - Return [ true ] + } + Function [ function imap_expunge ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ true ] + } + Function [ function imap_delete ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $message_nums ] + Parameter #2 [ int $flags = 0 ] + } + - Return [ true ] + } + Function [ function imap_undelete ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $message_nums ] + Parameter #2 [ int $flags = 0 ] + } + - Return [ true ] + } + Function [ function imap_check ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ stdClass|false ] + } + Function [ function imap_listscan ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + Parameter #3 [ string $content ] + } + - Return [ array|false ] + } + Function [ function imap_scan ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + Parameter #3 [ string $content ] + } + - Return [ array|false ] + } + Function [ function imap_scanmailbox ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + Parameter #3 [ string $content ] + } + - Return [ array|false ] + } + Function [ function imap_mail_copy ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $message_nums ] + Parameter #2 [ string $mailbox ] + Parameter #3 [ int $flags = 0 ] + } + - Return [ bool ] + } + Function [ function imap_mail_move ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $message_nums ] + Parameter #2 [ string $mailbox ] + Parameter #3 [ int $flags = 0 ] + } + - Return [ bool ] + } + Function [ function imap_mail_compose ] { + + - Parameters [2] { + Parameter #0 [ array $envelope ] + Parameter #1 [ array $bodies ] + } + - Return [ string|false ] + } + Function [ function imap_createmailbox ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + } + - Return [ bool ] + } + Function [ function imap_create ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + } + - Return [ bool ] + } + Function [ function imap_renamemailbox ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $from ] + Parameter #2 [ string $to ] + } + - Return [ bool ] + } + Function [ function imap_rename ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $from ] + Parameter #2 [ string $to ] + } + - Return [ bool ] + } + Function [ function imap_deletemailbox ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + } + - Return [ bool ] + } + Function [ function imap_subscribe ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + } + - Return [ bool ] + } + Function [ function imap_unsubscribe ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + } + - Return [ bool ] + } + Function [ function imap_append ] { + + - Parameters [5] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $folder ] + Parameter #2 [ string $message ] + Parameter #3 [ ?string $options = null ] + Parameter #4 [ ?string $internal_date = null ] + } + - Return [ bool ] + } + Function [ function imap_ping ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ bool ] + } + Function [ function imap_base64 ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string|false ] + } + Function [ function imap_qprint ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string|false ] + } + Function [ function imap_8bit ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string|false ] + } + Function [ function imap_binary ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string|false ] + } + Function [ function imap_utf8 ] { + + - Parameters [1] { + Parameter #0 [ string $mime_encoded_text ] + } + - Return [ string ] + } + Function [ function imap_status ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + Parameter #2 [ int $flags ] + } + - Return [ stdClass|false ] + } + Function [ function imap_mailboxmsginfo ] { + + - Parameters [1] { + Parameter #0 [ IMAP\Connection $imap ] + } + - Return [ stdClass ] + } + Function [ function imap_setflag_full ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $sequence ] + Parameter #2 [ string $flag ] + Parameter #3 [ int $options = 0 ] + } + - Return [ true ] + } + Function [ function imap_clearflag_full ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $sequence ] + Parameter #2 [ string $flag ] + Parameter #3 [ int $options = 0 ] + } + - Return [ true ] + } + Function [ function imap_sort ] { + + - Parameters [6] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $criteria ] + Parameter #2 [ bool $reverse ] + Parameter #3 [ int $flags = 0 ] + Parameter #4 [ ?string $search_criteria = null ] + Parameter #5 [ ?string $charset = null ] + } + - Return [ array|false ] + } + Function [ function imap_uid ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_num ] + } + - Return [ int|false ] + } + Function [ function imap_msgno ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $message_uid ] + } + - Return [ int ] + } + Function [ function imap_list ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + } + - Return [ array|false ] + } + Function [ function imap_listmailbox ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + } + - Return [ array|false ] + } + Function [ function imap_lsub ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + } + - Return [ array|false ] + } + Function [ function imap_listsubscribed ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + } + - Return [ array|false ] + } + Function [ function imap_getsubscribed ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + } + - Return [ array|false ] + } + Function [ function imap_getmailboxes ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $reference ] + Parameter #2 [ string $pattern ] + } + - Return [ array|false ] + } + Function [ function imap_fetch_overview ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $sequence ] + Parameter #2 [ int $flags = 0 ] + } + - Return [ array|false ] + } + Function [ function imap_alerts ] { + + - Parameters [0] { + } + - Return [ array|false ] + } + Function [ function imap_errors ] { + + - Parameters [0] { + } + - Return [ array|false ] + } + Function [ function imap_last_error ] { + + - Parameters [0] { + } + - Return [ string|false ] + } + Function [ function imap_search ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $criteria ] + Parameter #2 [ int $flags = SE_FREE ] + Parameter #3 [ string $charset = "" ] + } + - Return [ array|false ] + } + Function [ function imap_utf7_decode ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string|false ] + } + Function [ function imap_utf7_encode ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string ] + } + Function [ function imap_utf8_to_mutf7 ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string|false ] + } + Function [ function imap_mutf7_to_utf8 ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ string|false ] + } + Function [ function imap_mime_header_decode ] { + + - Parameters [1] { + Parameter #0 [ string $string ] + } + - Return [ array|false ] + } + Function [ function imap_thread ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ int $flags = SE_FREE ] + } + - Return [ array|false ] + } + Function [ function imap_timeout ] { + + - Parameters [2] { + Parameter #0 [ int $timeout_type ] + Parameter #1 [ int $timeout = -1 ] + } + - Return [ int|bool ] + } + Function [ function imap_get_quota ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $quota_root ] + } + - Return [ array|false ] + } + Function [ function imap_get_quotaroot ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + } + - Return [ array|false ] + } + Function [ function imap_set_quota ] { + + - Parameters [3] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $quota_root ] + Parameter #2 [ int $mailbox_size ] + } + - Return [ bool ] + } + Function [ function imap_setacl ] { + + - Parameters [4] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + Parameter #2 [ string $user_id ] + Parameter #3 [ string $rights ] + } + - Return [ bool ] + } + Function [ function imap_getacl ] { + + - Parameters [2] { + Parameter #0 [ IMAP\Connection $imap ] + Parameter #1 [ string $mailbox ] + } + - Return [ array|false ] + } + Function [ function imap_mail ] { + + - Parameters [7] { + Parameter #0 [ string $to ] + Parameter #1 [ string $subject ] + Parameter #2 [ string $message ] + Parameter #3 [ ?string $additional_headers = null ] + Parameter #4 [ ?string $cc = null ] + Parameter #5 [ ?string $bcc = null ] + Parameter #6 [ ?string $return_path = null ] + } + - Return [ bool ] + } + } + + - Classes [1] { + Class [ final class IMAP\Connection ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [0] { + } + } + } +} + diff --git a/php-pecl-imap.spec b/php-pecl-imap.spec new file mode 100644 index 0000000..2cb8e52 --- /dev/null +++ b/php-pecl-imap.spec @@ -0,0 +1,194 @@ +# remirepo spec file for php-pecl-imap +# +# Copyright (c) 2023 Remi Collet +# License: CC-BY-SA-4.0 +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +%{?scl:%scl_package php-pecl-imap} + +%bcond_without tests + +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global pecl_name imap +%global ini_name 30-%{pecl_name}.ini +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure + +Summary: Extension to operate with the IMAP protocol +Name: %{?scl_prefix}php-pecl-%{pecl_name} +Version: 1.0.0 +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License: PHP-3.01 +URL: https://pecl.php.net/package/%{pecl_name} + +Source0: https://pecl.php.net/get/%{sources}.tgz + +BuildRequires: make +BuildRequires: %{?dtsprefix}gcc +# 8.3+ is supported by upstream but part of php-src until 8.4 +BuildRequires: %{?scl_prefix}php-devel >= 8.4 +BuildRequires: pkgconfig(krb5) +BuildRequires: pkgconfig(krb5-gssapi) +BuildRequires: openssl-devel >= 1.0.2 +BuildRequires: libc-client-devel +BuildRequires: %{?scl_prefix}php-pear + +Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} +Requires: %{?scl_prefix}php(api) = %{php_core_api} + +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +# Set epoch so provides is > 0:8.4 +Obsoletes: %{?scl_prefix}php-%{pecl_name} < 8.4 +Provides: %{?scl_prefix}php-%{pecl_name} = 1:%{version}-%{release} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = 1:%{version}-%{release} + + +%description +An extension to operate with the IMAP protocol, as well as the NNTP, +POP3, and local mailbox access methods. + +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{scl_vendor})}. + + +%prep +%setup -c -q + +# Don't install/register tests +sed -e 's/role="test"/role="src"/' \ + %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ + -i package.xml + +cd %{sources} +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_IMAP_VERSION/{s/.* "//;s/".*$//;p}' php_imap.h) +if test "x${extver}" != "x%{version}%{?prever}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever}. + exit 1 +fi +cd .. + +: Create the configuration file +cat >%{ini_name} << 'EOF' +; Enable %{pecl_name} extension module +extension=%{pecl_name} +EOF + +mkdir NTS +%if %{with_zts} +mkdir ZTS +%endif + + +%build +%{?dtsenable} + +peclconf() { +%configure \ + --with-imap \ + --with-kerberos \ + --with-imap-ssl \ + --with-libdir=%{_lib} \ + --with-php-config=$1 +} +cd %{sources} +%{__phpize} + +cd ../NTS +peclconf %{__phpconfig} + +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +peclconf %{__ztsphpconfig} + +make %{?_smp_mflags} +%endif + + +%install +%{?dtsenable} + +make -C NTS install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} + +# Install XML package description +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +%if %{with_zts} +make -C ZTS install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} +%endif + +# Documentation +cd %{sources} +for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%check +cd %{sources} +: minimal load test of NTS extension +%{__php} --no-php-ini \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' + +OPT="%{?_smp_mflags} -q --show-diff" + +%if %{with tests} +: upstream test suite for NTS extension +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ +%{__php} -n run-tests.php $OPT +%endif + +%if %{with_zts} +: minimal load test of ZTS extension +%{__ztsphp} --no-php-ini \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' +%endif + + +%if 0%{?fedora} < 24 && 0%{?rhel} < 8 +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +%postun +if [ $1 -eq 0 -a -x %{__pecl} ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi +%endif + + +%files +%{?_licensedir:%license %{sources}/LICENSE} +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml + +%config(noreplace) %{php_inidir}/%{ini_name} +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%{php_ztsextdir}/%{pecl_name}.so +%endif + + +%changelog +* Tue Dec 19 2023 Remi Collet - 1.0.0-1 +- initial package for version 1.0.0 (PHP 8.4) -- cgit