summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-11-19 16:24:19 +0100
committerRemi Collet <remi@remirepo.net>2018-11-19 16:24:19 +0100
commitdcef13ee1e4e097043565e7e7ec7f8d04269ff94 (patch)
tree461dc1e5ba7aaea7a1303e768450449f6804de71
parent4d2e0024a4ccff815dce711c57dd1365b4c1179e (diff)
update to 0.11.4
raise minimal PHP version to 5.6 add dependency on league/container 2.4 add dependency on league/flysystem 1.0 add dependency on symfony/console 3.4
-rw-r--r--composer.json31
-rw-r--r--zephir-rpm.patch71
-rw-r--r--zephir.spec127
3 files changed, 166 insertions, 63 deletions
diff --git a/composer.json b/composer.json
index cb4f925..b8e242a 100644
--- a/composer.json
+++ b/composer.json
@@ -21,38 +21,53 @@
}
],
"require": {
- "php": ">=5.5",
+ "php": ">=5.6.0 <8.0",
+ "ext-SPL": "*",
"ext-ctype": "*",
"ext-hash": "*",
"ext-json": "*",
+ "ext-mbstring": "*",
+ "ext-pcre": "*",
"ext-xml": "*",
- "ext-mbstring": "*"
+ "league/container": "^2.4 || ^3.2",
+ "league/flysystem": "1.0.*",
+ "symfony/console": "3.4.*"
},
"require-dev": {
"ext-gmp": "*",
"ext-pdo": "*",
"ext-pdo_sqlite": "*",
- "phpunit/phpunit": "^4.8 || ^5.7",
- "squizlabs/php_codesniffer": "^3.2"
+ "phpunit/phpunit": "~5.7",
+ "squizlabs/php_codesniffer": "~3.2"
+ },
+ "config": {
+ "optimize-autoloader": true,
+ "platform": {},
+ "preferred-install": "dist",
+ "sort-packages": true
},
"autoload": {
"psr-4": {
"Zephir\\": "Library"
- }
+ },
+ "files": [
+ "Library/functions.php"
+ ]
},
"autoload-dev": {
"psr-4": {
- "Zephir\\Stubs\\": "unit-tests/Zephir/Stubs/",
"Zephir\\Test\\": "unit-tests/Zephir/Test/",
"Zephir\\Support\\": "unit-tests/Zephir/Support/",
"Extension\\": "unit-tests/Extension/"
},
"classmap": [
- "unit-tests/Data/"
+ "unit-tests/fixtures/mocks/"
]
},
+ "minimum-stability": "dev",
+ "prefer-stable": true,
"bin": [
- "bin/zephir"
+ "zephir"
],
"support": {
"issues": "https://github.com/phalcon/zephir/issues?state=open",
diff --git a/zephir-rpm.patch b/zephir-rpm.patch
index 9598e20..45e07cb 100644
--- a/zephir-rpm.patch
+++ b/zephir-rpm.patch
@@ -1,33 +1,42 @@
-diff -up ./bin/zephir.rpm ./bin/zephir
---- ./bin/zephir.rpm 2017-10-23 07:02:31.781050845 +0200
-+++ ./bin/zephir 2017-10-23 07:04:04.955553874 +0200
-@@ -1,26 +1,10 @@
- #!/bin/sh
- if [ -z "$ZEPHIRDIR" ]; then
-- ZEPHIRDIR="%ZEPHIRDIR%"
-- if [ "$ZEPHIRDIR" = "%""ZEPHIRDIR""%" ]; then
-- if [ -h $0 ]; then
-- REALPATH="`dirname $0`/`readlink $0`"
-- CURDIR=`dirname $REALPATH`
-- else
-- CURDIR=`dirname $0`
-- fi
-- PARENTDIR=`cd $CURDIR/..; pwd`
+diff -up ./zephir.rpm ./zephir
+--- ./zephir.rpm 2018-11-18 10:28:31.000000000 +0100
++++ ./zephir 2018-11-19 15:44:52.976871411 +0100
+@@ -1,4 +1,3 @@
+-#!/usr/bin/env php
+ <?php
+
+ /**
+@@ -22,32 +21,7 @@ if (PHP_SAPI !== 'cli') {
+ );
+ }
+
+-if (class_exists('Composer\Autoload\ClassLoader', false) == false) {
+- if (\substr(__FILE__, 0, 5) === 'phar:') {
+- $solution = 'Try to reinstall Zephir to solve this problem.' . PHP_EOL;
+- } else {
+- $solution =
+- 'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
+- ' composer install' . PHP_EOL . PHP_EOL .
+- 'You can learn all about Composer:' . PHP_EOL .
+- ' - https://getcomposer.org' . PHP_EOL;
+- }
+-
+- fprintf(
+- STDERR,
+- 'Unable to locate system dependencies.' . PHP_EOL .
+- '%s' . PHP_EOL .
+- 'If the problem remains, ask for help on the forum:' . PHP_EOL .
+- ' - https://forum.zephir-lang.com ' . PHP_EOL . PHP_EOL .
+- 'Or file an issue at GitHub:' . PHP_EOL .
+- ' - https://github.com/phalcon/zephir' . PHP_EOL . PHP_EOL,
+- $solution
+- );
+-
+- exit(1);
+-}
-
-- if [ -f $PARENTDIR/compiler.php ]; then
-- export ZEPHIRDIR=$PARENTDIR
-- else
-- echo "Environment variable ZEPHIRDIR is not set"
-- exit 1
-- fi
-- fi
-+ export ZEPHIRDIR="@DATADIR@/zephir"
- fi
+-$app = new Application(__DIR__);
++$app = new Application("@DATADIR@/zephir");
- if [ ! -z $1 ] && [ ! -z $2 ] && [ ! -z $3 ] && [ "$1" = "-c" ]; then
-- php -d timecop.func_override=0 -c $2 $ZEPHIRDIR/compiler.php ${*:3}
-+ @BINDIR@/php -d timecop.func_override=0 -d memory_limit=1G -d extension=zephir_parser.so -c $2 $ZEPHIRDIR/compiler.php ${*:3}
- else
-- php -d timecop.func_override=0 $ZEPHIRDIR/compiler.php $*
-+ @BINDIR@/php -d timecop.func_override=0 -d memory_limit=1G -d extension=zephir_parser.so $ZEPHIRDIR/compiler.php $*
- fi
+ $app->add(new Zephir\Command\InitCommand());
+ $app->add(new Zephir\Command\GenerateCommand());
diff --git a/zephir.spec b/zephir.spec
index 3b7c8fe..2557a16 100644
--- a/zephir.spec
+++ b/zephir.spec
@@ -21,7 +21,7 @@
# Get commit from PHP_PHALCON_ZEPVERSION in
# https://github.com/phalcon/cphalcon/blob/master/ext/php_phalcon.h
-%global gh_commit ab3551da612b837cbeb2dc228052a6d35bec5778
+%global gh_commit d0a6a8af0b78240a0f3e1f05d39baf73699a5570
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
#global gh_date 20161126
%global gh_owner phalcon
@@ -30,7 +30,7 @@
%global parser_ver 1.1.1
Name: %{?scl_prefix}%{gh_project}
-Version: 0.11.1
+Version: 0.11.4
Release: 1%{?gh_date:.%{gh_date}.%{gh_short}}%{?dist}
Summary: Zephir language for creation of extensions for PHP.
@@ -43,46 +43,71 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit
Patch0: %{gh_project}-rpm.patch
BuildArch: noarch
-BuildRequires: %{?scl_prefix}php-devel > 5.5
+BuildRequires: %{?scl_prefix}php-devel > 5.6
BuildRequires: %{?scl_prefix}php-zephir-parser >= %{parser_ver}
%if %{with_tests}
BuildRequires: %{?scl_prefix}php-json
BuildRequires: %{?scl_prefix}php-hash
BuildRequires: %{?scl_prefix}php-ctype
+BuildRequires: %{?scl_prefix}php-psr
+BuildRequires: %{_bindir}/phpab
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(league/container) >= 2.4 with php-composer(league/container) < 3)
+BuildRequires: (php-composer(league/flysystem) >= 1.0 with php-composer(league/flysystem) < 1.1)
+BuildRequires: (php-composer(symfony/console) >= 3.4 with php-composer(symfony/console) < 4)
+%else
+BuildRequires: php-league-flysystem
+BuildRequires: php-league-container
+BuildRequires: php-symfony3-console
+%endif
# From composer.json, "require-dev"
# "ext-gmp": "*",
# "ext-pdo": "*",
# "ext-pdo_sqlite": "*",
-# "phpunit/phpunit": "^4.8 || ^5.7,
-# "squizlabs/php_codesniffer": "^3.2"
+# "phpunit/phpunit": "~5.7",
+# "squizlabs/php_codesniffer": "~3.2"
BuildRequires: %{?scl_prefix}php-gmp
BuildRequires: %{?scl_prefix}php-pdo
BuildRequires: %{?scl_prefix}php-pdo_sqlite
-BuildRequires: %{?scl_prefix}php-composer(phpunit/phpunit) >= 4.8
+BuildRequires: %{?scl_prefix}php-composer(phpunit/phpunit) >= 5.7
%endif
Requires: %{?scl_prefix}php-cli
Requires: %{?scl_prefix}php-zephir-parser >= %{parser_ver}
# From composer.json, "require"
-# "php": ">=5.5",
+# "php": ">=5.6.0 <8.0",
+# "ext-SPL": "*",
# "ext-ctype": "*",
# "ext-hash": "*",
# "ext-json": "*",
+# "ext-mbstring": "*",
+# "ext-pcre": "*",
# "ext-xml": "*"
-# "ext-mbstring": "*"
-Requires: %{?scl_prefix}php(language) >= 5.5
+# "league/container": "^2.4 || ^3.2",
+# "league/flysystem": "1.0.*",
+# "symfony/console": "3.4.*"
+Requires: %{?scl_prefix}php(language) >= 5.6
+Requires: %{?scl_prefix}php-spl
Requires: %{?scl_prefix}php-ctype
Requires: %{?scl_prefix}php-hash
Requires: %{?scl_prefix}php-json
-Requires: %{?scl_prefix}php-xml
Requires: %{?scl_prefix}php-mbstring
+Requires: %{?scl_prefix}php-pcre
+Requires: %{?scl_prefix}php-xml
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(league/container) >= 2.4 with php-composer(league/container) < 3)
+Requires: (php-composer(league/flysystem) >= 1.0 with php-composer(league/flysystem) < 1.1)
+Requires: (php-composer(symfony/console) >= 3.4 with php-composer(symfony/console) < 4)
+%else
+Requires: php-league-flysystem
+Requires: php-league-container
+Requires: php-symfony3-console
+%endif
# From phpcompatinfo
Requires: %{?scl_prefix}php-reflection
Requires: %{?scl_prefix}php-date
Requires: %{?scl_prefix}php-gmp
-Requires: %{?scl_prefix}php-pcre
Requires: %{?scl_prefix}php-pdo
-Requires: %{?scl_prefix}php-spl
Provides: %{?scl_prefix}php-composer(%{gh_owner}/%{gh_project}) = %{version}
@@ -111,14 +136,43 @@ Compiler design goals:
%setup -q -n %{gh_project}-%{gh_commit}
%patch0 -p0 -b .rpm
+
sed -e 's:@DATADIR@:%{_datadir}:;s:@BINDIR@:%{_bindir}:' \
- -i bin/%{gh_project}
+ -i %{gh_project}
+
+sed -e 's/\$Id\$/%{gh_short}/' \
+ -e 's/0.11.5/0.11.4/' \
+ -i Library/Zephir.php
find . -name \*.php -exec chmod -x {} \;
+cat << 'EOF' >autoload.php
+<?php
+/* Autoloader for %{name} and its dependencies */
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('Zephir\\', __DIR__ . '/Library');
+\Fedora\Autoloader\Dependencies::required([
+ __DIR__ . '/Library/functions.php',
+ '%{_datadir}/php/Symfony3/Component/Console/autoload.php',
+ '%{_datadir}/php/League/Flysystem/autoload.php',
+ '%{_datadir}/php/League/Container/autoload.php',
+]);
+EOF
+
+mv %{gh_project} %{gh_project}.php
+cat << 'EOF' | tee zephir.sh
+#!/bin/sh
+%{_bindir}/php -d memory_limit=2G -d extension=zephir_parser.so %{_datadir}/%{gh_project}/%{gh_project}.php $*
+
%build
-# nothing
+: test extension
+cd ext
+%{_bindir}/phpize
+%configure
+make %{?_smp_mflags}
+
%install
@@ -130,23 +184,41 @@ do
done
: Command
-install -Dpm 755 bin/%{gh_project} %{buildroot}%{_bindir}/%{gh_project}
+install -Dpm 755 %{gh_project}.sh %{buildroot}%{_bindir}/%{gh_project}
%check
-sed -e 's:%ZEPHIRDIR%:%{buildroot}%{_datadir}/%{gh_project}:g' \
- -e 's: php:%{_bindir}/php:' \
- bin/%{gh_project}.rpm > bin/%{gh_project}.test
-sh ./bin/%{gh_project}.test version
-sh ./bin/%{gh_project}.test version | grep %{version}
+sed -e 's:%{_datadir}:%{buildroot}%{_datadir}:' \
+ %{gh_project}.php > %{gh_project}.test
+%{_bindir}/php %{gh_project}.test --version
+%{_bindir}/php %{gh_project}.test --version | grep %{version}-%{gh_short}
+
+%{_bindir}/php %{_bindir}/phpab -o bs.php unit-tests/fixtures/mocks
+cat << 'EOF' | tee -a bs.php
+require '%{buildroot}%{_datadir}/%{gh_project}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Zephir\\Test\\', __DIR__ . '/unit-tests/Zephir/Test/');
+\Fedora\Autoloader\Autoload::addPsr4('Zephir\\Support\\', __DIR__ . '/unit-tests/Zephir/Support/');
+\Fedora\Autoloader\Autoload::addPsr4('Extension\\', __DIR__ . '/unit-tests/Extension/');
+require __DIR__ . '/unit-tests/bootstrap.php';
+EOF
%if %{with_tests}
: Run test suite
-%{_bindir}/php -d extension=zephir_parser.so \
- %{_bindir}/phpunit \
- --bootstrap %{buildroot}%{_datadir}/%{gh_project}/bootstrap.php \
- --verbose unit-tests/Zephir
+%{_bindir}/php \
+ -d extension=zephir_parser.so \
+ -d extension=ext/modules/test.so \
+ %{_bindir}/phpunit \
+ --bootstrap bs.php \
+ --no-coverage \
+ --verbose unit-tests/Zephir
+%{_bindir}/php \
+ -d extension=zephir_parser.so \
+ -d extension=ext/modules/test.so \
+ %{_bindir}/phpunit \
+ --bootstrap bs.php \
+ --no-coverage \
+ --verbose unit-tests/Extension
%else
: Test suite disabled
%endif
@@ -162,6 +234,13 @@ sh ./bin/%{gh_project}.test version | grep %{version}
%changelog
+* Mon Nov 19 2018 Remi Collet <remi@remirepo.net> - 0.11.4-1
+- update to 0.11.4
+- raise minimal PHP version to 5.6
+- add dependency on league/container 2.4
+- add dependency on league/flysystem 1.0
+- add dependency on symfony/console 3.4
+
* Sat Oct 20 2018 Remi Collet <remi@remirepo.net> - 0.11.1-1
- update to 0.11.1