summaryrefslogtreecommitdiffstats
path: root/php-pggi.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-06-11 15:01:31 +0200
committerRemi Collet <remi@remirepo.net>2018-06-11 15:01:31 +0200
commit2a395f3465760fbad4dd6fed3de7bcc8d247d89c (patch)
tree50007b563335f10573fc70896d0c3d2b107ba744 /php-pggi.spec
new package, version 0.3.0
open https://github.com/Letargie/pggi/pull/8 [-Wformat=] open https://github.com/Letargie/pggi/pull/9 [-Wimplicit-function-declaration] open https://github.com/Letargie/pggi/pull/11 [-Werror=format-security]
Diffstat (limited to 'php-pggi.spec')
-rw-r--r--php-pggi.spec181
1 files changed, 181 insertions, 0 deletions
diff --git a/php-pggi.spec b/php-pggi.spec
new file mode 100644
index 0000000..5e3881c
--- /dev/null
+++ b/php-pggi.spec
@@ -0,0 +1,181 @@
+# remirepo spec file for php-pggi
+#
+# Copyright (c) 2018 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+%{?scl: %scl_package php-pggi}
+
+%global gh_commit ce862932b556d76851c1cd31913e64434bf3768a
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner Letargie
+%global gh_project pggi
+%global pecl_name pggi
+%global with_zts 0
+
+Summary: GTK bindings
+Name: %{?scl_prefix}php-pggi
+Version: 0.3.0
+Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+License: BSD
+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
+
+# https://github.com/Letargie/pggi/pull/8
+Patch0: https://patch-diff.githubusercontent.com/raw/Letargie/pggi/pull/8.patch
+# https://github.com/Letargie/pggi/pull/9
+Patch1: https://patch-diff.githubusercontent.com/raw/Letargie/pggi/pull/9.patch
+# https://github.com/Letargie/pggi/pull/11
+Patch2: https://patch-diff.githubusercontent.com/raw/Letargie/pggi/pull/11.patch
+
+BuildRequires: gcc
+BuildRequires: gtk3-devel
+BuildRequires: %{?scl_prefix}php-devel > 7
+BuildRequires: %{?scl_prefix}php-pear
+
+Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
+Requires: %{?scl_prefix}php(api) = %{php_core_api}
+Requires: %{?scl_prefix}php-tokenizer%{?_isa}
+%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
+
+%if "%{?scl_prefix}" != "%{?sub_prefix}"
+Provides: %{?scl_prefix}php-%{pecl_name} = %{version}-%{release}
+Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}-%{release}
+%endif
+
+%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+Obsoletes: php70u-%{pecl_name} <= %{version}
+Obsoletes: php70w-%{pecl_name} <= %{version}
+%if "%{php_version}" > "7.1"
+Obsoletes: php71u-%{pecl_name} <= %{version}
+Obsoletes: php71w-%{pecl_name} <= %{version}
+%endif
+%if "%{php_version}" > "7.2"
+Obsoletes: php72u-%{pecl_name} <= %{version}
+Obsoletes: php72w-%{pecl_name} <= %{version}
+%endif
+%endif
+
+%if 0%{?fedora} < 20 && 0%{?rhel} < 7
+# Filter shared private
+%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
+%{?filter_setup}
+%endif
+
+
+%description
+PHP extension providing a small langage binding for GTK+ 3 toolkit allowing
+to write GUI Applications.
+
+This extension exposes the abstract syntax tree generated by PHP 7.
+
+Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}.
+
+
+%prep
+%setup -qc
+mv %{gh_project}-%{gh_commit} NTS
+
+cd NTS
+%patch0 -p1 -b .pr8
+%patch1 -p1 -b .pr9
+%patch2 -p1 -b .pr11
+# https://github.com/Letargie/pggi/issues/10
+sed -e '/PGGI_VERSION/s/0.4.0-dev/%{version}/' -i src/pggi.h
+
+# Sanity check, really often broken
+extver=$(sed -n '/#define PGGI_VERSION/{s/.* "//;s/".*$//;p}' src/pggi.h)
+if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then
+ : Error: Upstream extension version is ${extver}, expecting %{version}%{?gh_date:-dev}.
+ exit 1
+fi
+cd ..
+
+: Create launcher
+cat << 'EOF' | tee pggi
+#!/bin/sh
+exec %{__php} -d extension=pggi.so -d phar.readonly=0 "$@"
+EOF
+
+%if %{with_zts}
+cat << 'EOF' | tee zts-pggi
+#!/bin/sh
+exec %{__ztsphp} -d extension=pggi.so -d phar.readonly=0 "$@"
+EOF
+%endif
+
+
+%build
+%{?dtsenable}
+
+cd NTS
+%{_bindir}/phpize
+%configure \
+ --with-php-config=%{_bindir}/php-config \
+ --enable-pggi
+make %{?_smp_mflags}
+
+%if %{with_zts}
+cd ../ZTS
+%{_bindir}/zts-phpize
+%configure \
+ --with-php-config=%{_bindir}/zts-php-config \
+ --enable-pggi
+make %{?_smp_mflags}
+%endif
+
+
+%install
+%{?dtsenable}
+
+: Install the NTS stuff
+make -C NTS install INSTALL_ROOT=%{buildroot}
+
+: Install the launcher
+install -D -m 755 pggi %{buildroot}%{_bindir}/pggi
+
+%if %{with_zts}
+: Install the ZTS stuff
+make -C ZTS install INSTALL_ROOT=%{buildroot}
+install -D -m 755 zts-pggi %{buildroot}%{_bindir}/zts-pggi
+%endif
+
+
+%check
+cd NTS
+: Minimal load test for NTS extension
+%{__php} --no-php-ini \
+ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+
+%if %{with_zts}
+cd ../ZTS
+: Minimal load test for ZTS extension
+%{__ztsphp} --no-php-ini \
+ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+%endif
+
+
+%files
+%{?_licensedir:%license NTS/LICENCE}
+%doc NTS/*md
+%doc NTS/examples
+%{php_extdir}/%{pecl_name}.so
+%{_bindir}/pggi
+
+%if %{with_zts}
+%{php_ztsextdir}/%{pecl_name}.so
+%{_bindir}/zts-pggi
+%endif
+
+
+%changelog
+* Mon Jun 11 2018 Remi Collet <remi@remirepo.net> - 0.3.0-1
+- new package, version 0.3.0
+- open https://github.com/Letargie/pggi/pull/8 [-Wformat=]
+- open https://github.com/Letargie/pggi/pull/9 [-Wimplicit-function-declaration]
+- open https://github.com/Letargie/pggi/pull/11 [-Werror=format-security]