|
|
|
%global gh_commit 943d27267fbf6da6b4d225f344f4731aec0c671b
|
|
|
|
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
|
|
|
|
%global gh_owner msgpack
|
|
|
|
%global gh_project msgpack-php
|
|
|
|
%global pecl_name msgpack
|
|
|
|
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
|
|
|
|
%global ini_name 40-%{pecl_name}.ini
|
|
|
|
|
|
|
|
%global upstream_version 2.2.0
|
|
|
|
%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever}
|
|
|
|
%global _configure ../%{sources}/configure
|
|
|
|
|
|
|
|
%bcond_with msgpack
|
|
|
|
%bcond_without tests
|
|
|
|
|
|
|
|
|
|
|
|
Name: php-pecl-msgpack
|
|
|
|
License: BSD-3-Clause
|
|
|
|
Version: 2.2.0
|
|
|
|
Release: 1%{?dist}
|
|
|
|
URL: https://pecl.php.net/package/msgpack
|
|
|
|
Summary: API for communicating with MessagePack serialization
|
|
|
|
Source: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
|
|
|
|
Patch0: 174.patch
|
|
|
|
BuildRequires: make
|
|
|
|
BuildRequires: gcc
|
|
|
|
BuildRequires: php-devel >= 7.0
|
|
|
|
BuildRequires: php-pear
|
|
|
|
%if %{with msgpack}
|
|
|
|
BuildRequires: msgpack-devel
|
|
|
|
%else
|
|
|
|
Provides: bundled(msgpack) = 3.2.0
|
|
|
|
%endif
|
|
|
|
|
|
|
|
Requires: php(zend-abi) = %{php_zend_api}
|
|
|
|
Requires: php(api) = %{php_core_api}
|
|
|
|
|
|
|
|
Provides: php-%{pecl_name} = %{version}
|
|
|
|
Provides: php-%{pecl_name}%{?_isa} = %{version}
|
|
|
|
Provides: php-pecl(%{pecl_name}) = %{version}
|
|
|
|
Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}
|
|
|
|
|
|
|
|
|
|
|
|
%description
|
|
|
|
This extension provide API for communicating with MessagePack serialization.
|
|
|
|
|
|
|
|
MessagePack is an efficient binary serialization format. It lets you exchange
|
|
|
|
data among multiple languages like JSON but it's faster and smaller.
|
|
|
|
For example, small integers (like flags or error code) are encoded into a
|
|
|
|
single byte, and typical short strings only require an extra byte in addition
|
|
|
|
to the strings themselves.
|
|
|
|
|
|
|
|
If you ever wished to use JSON for convenience (storing an image with metadata)
|
|
|
|
but could not for technical reasons (encoding, size, speed...), MessagePack is
|
|
|
|
a perfect replacement.
|
|
|
|
|
|
|
|
This extension is still EXPERIMENTAL.
|
|
|
|
|
|
|
|
|
|
|
|
%package devel
|
|
|
|
Summary: MessagePack developer files (header)
|
|
|
|
Group: Development/Libraries
|
|
|
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
|
Requires: php-devel%{?_isa}
|
|
|
|
These are the files needed to compile programs using MessagePack serializer.
|
|
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -qc
|
|
|
|
|
|
|
|
sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml
|
|
|
|
|
|
|
|
cd %{sources}
|
|
|
|
%patch -P0 -p1
|
|
|
|
|
|
|
|
%if %{with msgpack}
|
|
|
|
# use system library
|
|
|
|
rm -rf msgpack
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# Sanity check, really often broken
|
|
|
|
extver=$(sed -n '/#define PHP_MSGPACK_VERSION/{s/.* "//;s/".*$//;p}' php_msgpack.h)
|
|
|
|
if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:-dev}"; then
|
|
|
|
: Error: Upstream extension version is ${extver}, expecting %{upstream_version}%{?upstream_prever}%{?gh_date:-dev}.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
mkdir NTS
|
|
|
|
%if %{with_zts}
|
|
|
|
mkdir ZTS
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# Drop in the bit of configuration
|
|
|
|
cat > %{ini_name} << 'EOF'
|
|
|
|
; Enable MessagePack extension module
|
|
|
|
extension = %{pecl_name}.so
|
|
|
|
|
|
|
|
; Configuration options
|
|
|
|
|
|
|
|
;msgpack.error_display = On
|
|
|
|
;msgpack.illegal_key_insert = Off
|
|
|
|
;msgpack.php_only = On
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
cd %{sources}
|
|
|
|
%{__phpize}
|
|
|
|
|
|
|
|
cd ../NTS
|
|
|
|
%configure --with-php-config=%{__phpconfig}
|
|
|
|
make %{?_smp_mflags}
|
|
|
|
|
|
|
|
%if %{with_zts}
|
|
|
|
cd ../ZTS
|
|
|
|
%configure --with-php-config=%{__ztsphpconfig}
|
|
|
|
make %{?_smp_mflags}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
%{?dtsenable}
|
|
|
|
|
|
|
|
# Install the NTS stuff
|
|
|
|
make -C NTS install INSTALL_ROOT=%{buildroot}
|
|
|
|
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
|
|
|
|
|
|
|
|
%if %{with_zts}
|
|
|
|
# Install the ZTS stuff
|
|
|
|
make -C ZTS install INSTALL_ROOT=%{buildroot}
|
|
|
|
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# Install the package XML file
|
|
|
|
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
|
|
|
|
|
|
|
|
# Test & Documentation
|
|
|
|
cd %{sources}
|
|
|
|
for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
|
|
|
|
do [ -f tests/$i ] && install -Dpm 644 tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i
|
|
|
|
[ -f $i ] && install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
|
|
|
|
done
|
|
|
|
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
|
|
|
|
# Erratic results, segfauilt and mark as XFAIL
|
|
|
|
rm */tests/034.phpt
|
|
|
|
%ifarch aarch64
|
|
|
|
# too slow
|
|
|
|
rm */tests/035.phpt
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if "%{php_version}" > "7.4"
|
|
|
|
OPT="-q --show-diff %{?_smp_mflags}"
|
|
|
|
%else
|
|
|
|
OPT="-q --show-diff"
|
|
|
|
%endif
|
|
|
|
|
|
|
|
cd %{sources}
|
|
|
|
: Minimal load test for NTS extension
|
|
|
|
%{__php} --no-php-ini \
|
|
|
|
--define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
|
|
|
|
--modules | grep %{pecl_name}
|
|
|
|
|
|
|
|
%if %{with tests}
|
|
|
|
: Upstream test suite for NTS extension
|
|
|
|
TEST_PHP_EXECUTABLE=%{__php} \
|
|
|
|
TEST_PHP_ARGS="-n -d extension_dir=$PWD/../NTS/modules -d extension=%{pecl_name}.so" \
|
|
|
|
REPORT_EXIT_STATUS=1 \
|
|
|
|
%{__php} -n run-tests.php $OPT
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %{with_zts}
|
|
|
|
: Minimal load test for ZTS extension
|
|
|
|
%{__ztsphp} --no-php-ini \
|
|
|
|
--define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
|
|
|
|
--modules | grep %{pecl_name}
|
|
|
|
|
|
|
|
%if %{with tests}
|
|
|
|
: Upstream test suite for ZTS extension
|
|
|
|
TEST_PHP_EXECUTABLE=%{__ztsphp} \
|
|
|
|
TEST_PHP_ARGS="-n -d extension_dir=$PWD/../ZTS/modules -d extension=%{pecl_name}.so" \
|
|
|
|
REPORT_EXIT_STATUS=1 \
|
|
|
|
%{__ztsphp} -n run-tests.php $OPT
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
%license %{sources}/LICENSE
|
|
|
|
%{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
|
|
|
|
|
|
|
|
|
|
|
|
%files devel
|
|
|
|
%{php_incldir}/ext/%{pecl_name}
|
|
|
|
|
|
|
|
%if %{with_zts}
|
|
|
|
%{php_ztsincldir}/ext/%{pecl_name}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|