From 8b784bd5f9ca60324d479c59cf259da6742e87c4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 28 Aug 2017 08:47:47 +0200 Subject: update to 0.1.8 with bundled libsnappy 1.1.7 --- REFLECTION | 2 +- makesrc.sh | 27 +++++++++++++++++++++++++++ php-snappy.spec | 48 +++++++++++++++++++++++++++++++++--------------- 3 files changed, 61 insertions(+), 16 deletions(-) create mode 100755 makesrc.sh diff --git a/REFLECTION b/REFLECTION index 601c473..2611d9d 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #126 snappy version 0.1.7 ] { +Extension [ extension #129 snappy version 0.1.8 ] { - Functions { Function [ function snappy_compress ] { diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..ea1e7e8 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" + +echo "Cloning..." +rm -rf $PROJECT-$COMMIT +git clone --recursive https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-snappy.spec b/php-snappy.spec index c23a464..bfcc9e2 100644 --- a/php-snappy.spec +++ b/php-snappy.spec @@ -7,15 +7,15 @@ # Please, preserve the changelog entries # %if 0%{?scl:1} -%if "%{scl}" == "rh-php56" -%global sub_prefix more-php56- -%else -%global sub_prefix %{scl_prefix} -%endif +%global sub_prefix %{scl_prefix} %scl_package php-snappy +%else +%global pkg_name %{name} %endif -%global gh_commit be30d1bf298f0369bab9c3dbeee3986260e698b1 +%global with_libsnappy 0 + +%global gh_commit eeaf10c34cbaf6953f61fd4b6ac57075c72fc8d6 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner kjdev %global gh_project php-ext-snappy @@ -26,20 +26,29 @@ Summary: Snappy Extension for PHP Name: %{?sub_prefix}php-snappy -Version: 0.1.7 +Version: 0.1.8 %if 0%{?gh_date:1} Release: 0.3.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %else Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %endif +%if %{?with_libsnappy} License: PHP +%else +License: PHP and BSD +%endif Group: Development/Languages URL: https://github.com/%{gh_owner}/%{gh_project} -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz +Source0: %{pkg_name}-%{version}-%{gh_short}.tgz +# retrieve a recursive git snapshot with submodule +Source1: makesrc.sh -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: %{?scl_prefix}php-devel +%if %{?with_libsnappy} BuildRequires: snappy-devel +%else +Provides: bundled(snappy) = 1.1.7 +%endif Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} @@ -91,8 +100,13 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO mv %{gh_project}-%{gh_commit} NTS cd NTS +%if %{?with_libsnappy} # Use the system library rm -r snappy +%else +# Refresh snappy License file +cp -r snappy/COPYING COPYING.snappy +%endif # Sanity check, really often broken extver=$(sed -n '/#define SNAPPY_EXT_VERSION/{s/.* "//;s/".*$//;p}' php_snappy.h) @@ -121,7 +135,9 @@ cd NTS %{_bindir}/phpize %configure \ --with-php-config=%{_bindir}/php-config \ +%if %{?with_libsnappy} --with-snappy-includedir=/usr \ +%endif --with-libdir=%{_lib} \ --enable-snappy make %{?_smp_mflags} @@ -131,7 +147,9 @@ cd ../ZTS %{_bindir}/zts-phpize %configure \ --with-php-config=%{_bindir}/zts-php-config \ +%if %{?with_libsnappy} --with-snappy-includedir=/usr \ +%endif --with-libdir=%{_lib} \ --enable-snappy make %{?_smp_mflags} @@ -139,7 +157,6 @@ make %{?_smp_mflags} %install -rm -rf %{buildroot} %{?dtsenable} # Install the NTS stuff @@ -184,14 +201,12 @@ REPORT_EXIT_STATUS=1 \ %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license NTS/LICENSE +%if ! %{?with_libsnappy} +%license NTS/COPYING.snappy +%endif %doc NTS/CREDITS %doc NTS/README.md @@ -205,6 +220,9 @@ rm -rf %{buildroot} %changelog +* Mon Aug 28 2017 Remi Collet - 0.1.8-1 +- update to 0.1.8 with bundled libsnappy 1.1.7 + * Wed Jul 19 2017 Remi Collet - 0.1.7-1 - update to 0.1.7 (no change) -- cgit