summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cphalcon-rpm.patch44
-rw-r--r--d9ded2ae91afbf9a4b1f515c18c4a99760b2df5c.patch86
-rw-r--r--php-phalcon.spec41
-rwxr-xr-xstrip.sh37
4 files changed, 197 insertions, 11 deletions
diff --git a/cphalcon-rpm.patch b/cphalcon-rpm.patch
new file mode 100644
index 0000000..cd8d0cc
--- /dev/null
+++ b/cphalcon-rpm.patch
@@ -0,0 +1,44 @@
+diff -up ext/assets/filters/cssmin.c.rpm ext/assets/filters/cssmin.c
+--- ext/assets/filters/cssmin.c.rpm 2014-09-07 09:53:18.975164612 +0200
++++ ext/assets/filters/cssmin.c 2014-09-07 09:53:23.879188187 +0200
+@@ -18,11 +18,7 @@
+ */
+
+ #include "assets/filters/cssmin.h"
+-#ifdef PHALCON_NON_FREE
+-#include "assets/filters/cssminifier.h"
+-#else
+ #include "assets/filters/nocssminifier.h"
+-#endif
+ #include "assets/filterinterface.h"
+
+ #include "kernel/main.h"
+diff -up ext/assets/filters/jsmin.c.rpm ext/assets/filters/jsmin.c
+--- ext/assets/filters/jsmin.c.rpm 2014-09-07 09:53:10.325123035 +0200
++++ ext/assets/filters/jsmin.c 2014-09-07 09:53:29.054213063 +0200
+@@ -18,11 +18,7 @@
+ */
+
+ #include "assets/filters/jsmin.h"
+-#ifdef PHALCON_NON_FREE
+-#include "assets/filters/jsminifier.h"
+-#else
+ #include "assets/filters/nojsminifier.h"
+-#endif
+ #include "assets/filterinterface.h"
+
+ #include "kernel/main.h"
+diff -up build/_resource/config/phalcon_c_priority_files.php.rpm build/_resource/config/phalcon_c_priority_files.php
+--- build/_resource/config/phalcon_c_priority_files.php.rpm 2014-09-07 09:58:44.109729141 +0200
++++ build/_resource/config/phalcon_c_priority_files.php 2014-09-07 09:58:48.428749943 +0200
+@@ -3,8 +3,8 @@
+
+ return array(
+ // Header files
+- 'assets/filters/jsminifier.h',
+- 'assets/filters/cssminifier.h',
++ 'assets/filters/nojsminifier.h',
++ 'assets/filters/nocssminifier.h',
+ 'mvc/model/query/parser.h',
+ 'mvc/model/query/scanner.h',
+ 'mvc/model/query/phql.h',
diff --git a/d9ded2ae91afbf9a4b1f515c18c4a99760b2df5c.patch b/d9ded2ae91afbf9a4b1f515c18c4a99760b2df5c.patch
new file mode 100644
index 0000000..cc0e020
--- /dev/null
+++ b/d9ded2ae91afbf9a4b1f515c18c4a99760b2df5c.patch
@@ -0,0 +1,86 @@
+From d9ded2ae91afbf9a4b1f515c18c4a99760b2df5c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Olivier=20Garb=C3=A9?= <ogarbe@voyageprive.com>
+Date: Sat, 6 Sep 2014 23:54:53 +0200
+Subject: [PATCH] Fix #2774 - Non free minifiers build dont work
+
+---
+ ext/assets/filters/cssminifier.c | 3 +++
+ ext/assets/filters/jsminifier.c | 3 +++
+ ext/assets/filters/nocssminifier.c | 2 ++
+ ext/assets/filters/nojsminifier.c | 3 +++
+ ext/config.m4 | 13 +++++++++----
+ 5 files changed, 20 insertions(+), 4 deletions(-)
+
+diff --git a/ext/assets/filters/nocssminifier.c b/ext/assets/filters/nocssminifier.c
+index efebc82..2b42456 100644
+--- a/ext/assets/filters/nocssminifier.c
++++ b/ext/assets/filters/nocssminifier.c
+@@ -17,6 +17,7 @@
+
+ /* placeholder for non-free csssminifier.c */
+
++#ifndef PHALCON_NON_FREE
+
+ #include "php_phalcon.h"
+
+@@ -29,3 +30,4 @@ int phalcon_cssmin(zval *return_value, zval *style TSRMLS_DC) {
+ PHALCON_THROW_EXCEPTION_STRW(phalcon_assets_exception_ce, "Non-free csssminifier not available");
+ return FAILURE;
+ }
++#endif
+diff --git a/ext/assets/filters/nojsminifier.c b/ext/assets/filters/nojsminifier.c
+index 885035b..a858fbb 100644
+--- a/ext/assets/filters/nojsminifier.c
++++ b/ext/assets/filters/nojsminifier.c
+@@ -17,6 +17,7 @@
+
+ /* placeholder for non-free jsminifier.c */
+
++#ifndef PHALCON_NON_FREE
+
+ #include "php_phalcon.h"
+
+@@ -29,3 +30,5 @@ int phalcon_jsmin(zval *return_value, zval *script TSRMLS_DC) {
+ PHALCON_THROW_EXCEPTION_STRW(phalcon_assets_exception_ce, "Non-free jsminifier not available");
+ return FAILURE;
+ }
++
++#endif
+diff --git a/ext/config.m4 b/ext/config.m4
+index 2df6dcd..5ca9747 100644
+--- a/ext/config.m4
++++ b/ext/config.m4
+@@ -1,6 +1,14 @@
+ PHP_ARG_ENABLE(phalcon, whether to enable phalcon framework, [ --enable-phalcon Enable phalcon framework])
+ PHP_ARG_WITH(non-free, wheter to enable non-free css and js minifier, [ --without-non-free Disable non-free minifiers], yes, no)
+
++AC_MSG_CHECKING([Include non-free minifiers])
++if test "$PHP_NON_FREE" = "yes"; then
++ AC_DEFINE([PHALCON_NON_FREE], [1], [Whether non-free minifiers are available])
++ AC_MSG_RESULT([yes, css and js])
++else
++ AC_MSG_RESULT([no])
++fi
++
+ if test "$PHP_PHALCON" = "yes"; then
+ AC_DEFINE(HAVE_PHALCON, 1, [Whether you have Phalcon Framework])
+ phalcon_sources="phalcon.c \
+@@ -366,11 +374,8 @@ registry.c"
+ AC_MSG_CHECKING([Include non-free minifiers])
+ if test "$PHP_NON_FREE" = "yes"; then
+ phalcon_sources="$phalcon_sources assets/filters/jsminifier.c assets/filters/cssminifier.c "
+- AC_DEFINE([PHALCON_NON_FREE], [1], [Whether non-free minifiers are available])
+- AC_MSG_RESULT([yes, css and js])
+ else
+ phalcon_sources="$phalcon_sources assets/filters/nojsminifier.c assets/filters/nocssminifier.c "
+- AC_MSG_RESULT([no])
+ fi
+
+ PHP_NEW_EXTENSION(phalcon, $phalcon_sources, $ext_shared)
+@@ -529,4 +534,4 @@ fi
+
+ if test "$GCC" = "yes"; then
+ PHP_ADD_MAKEFILE_FRAGMENT([Makefile.frag.deps])
+-fi
+\ No newline at end of file
++fi
diff --git a/php-phalcon.spec b/php-phalcon.spec
index 1131886..0fba45b 100644
--- a/php-phalcon.spec
+++ b/php-phalcon.spec
@@ -25,17 +25,22 @@
Name: %{?scl_prefix}php-phalcon
Version: 1.3.2
-Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
Summary: Phalcon Framework
Group: Development/Libraries
License: MIT
URL: https://github.com/%{gh_owner}/%{gh_project}
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
+Source0: %{gh_project}-%{version}-strip.tar.bz2
+# Script to generate the stripped archive
+Source1: strip.sh
Patch1: https://github.com/phalcon/cphalcon/pull/2772.patch
Patch2: https://github.com/phalcon/cphalcon/pull/2774.patch
Patch3: https://github.com/phalcon/cphalcon/pull/2775.patch
+Patch4: https://github.com/vpg/cphalcon/commit/d9ded2ae91afbf9a4b1f515c18c4a99760b2df5c.patch
+# still need to drop all ref to striped non-free sources
+Patch5: %{gh_project}-rpm.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: %{?scl_prefix}php-devel > 5.3
@@ -90,9 +95,8 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%patch2 -p1 -b .2774
chmod 644 ext/assets/filters/*.2774
%patch3 -p1 -b .2775
-
-# Drop non-free stuff
-rm ext/assets/filters/{js,css}minifier.{c,h}
+%patch4 -p1 -b .build
+%patch5 -p0 -b .rpm
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_PHALCON_VERSION/{s/.* "//;s/".*$//;p}' ext/php_phalcon.h)
@@ -101,6 +105,11 @@ if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then
exit 1
fi
+# Generate the optimized sources
+cd build
+php gen-build.php
+cd ..
+
# Create configuration file
cat << 'EOF' | tee %{ini_name}
; Enable '%{summary}' extension module
@@ -117,10 +126,16 @@ extension=%{ext_name}.so
;phalcon.register_psr3_classes=0
EOF
-mv ext NTS
+# Use the optimized sources, is available
+if [ -d build/%{?__isa_bits}bits ]; then
+ mv build/%{__isa_bits}bits build/NTS
+else
+ mv build/safe build/NTS
+fi
+
%if %{with_zts}
# Duplicate source tree for NTS / ZTS build
-cp -r NTS ZTS
+cp -r build/NTS build/ZTS
%endif
@@ -132,7 +147,7 @@ peclconf() {
--with-libdir=%{_lib} \
--with-php-config=$1
}
-cd NTS
+cd build/NTS
%{_bindir}/phpize
peclconf %{_bindir}/php-config
make %{?_smp_mflags}
@@ -148,13 +163,13 @@ make %{?_smp_mflags}
%install
rm -rf %{buildroot}
-make -C NTS install INSTALL_ROOT=%{buildroot}
+make -C build/NTS install INSTALL_ROOT=%{buildroot}
# install config file (z-http.ini to be loaded after json)
install -Dpm644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
%if %{with_zts}
-make -C ZTS install INSTALL_ROOT=%{buildroot}
+make -C build/ZTS install INSTALL_ROOT=%{buildroot}
install -Dpm644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
%endif
@@ -176,7 +191,7 @@ done
%if %{with_tests}
: Upstream test suite NTS extension
-cd NTS
+cd build/NTS
SKIP_ONLINE_TESTS=1 \
TEST_PHP_EXECUTABLE=%{__php} \
TEST_PHP_ARGS="-n $modules -d extension=$PWD/modules/%{ext_name}.so" \
@@ -216,6 +231,10 @@ rm -rf %{buildroot}
%changelog
+* Sun Sep 7 2014 Remi Collet <remi@fedoraproject.org> - 1.3.2-2
+- use striped archive, without non-free sources
+- generate and use optimized sources
+
* Thu Sep 4 2014 Remi Collet <remi@fedoraproject.org> - 1.3.2-1
- initial package, version 1.3.2
- open https://github.com/phalcon/cphalcon/pull/2772 (merged)
diff --git a/strip.sh b/strip.sh
new file mode 100755
index 0000000..b0cfa29
--- /dev/null
+++ b/strip.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+if [ $# -lt 2 ]; then
+ echo usage $0 version commit
+ exit 1
+fi
+
+owner=phalcon
+project=cphalcon
+version=$1
+commit=$2
+upstream=$project-$version.tar.gz
+downstream=$project-$version-strip.tar.bz2
+list1=$(mktemp)
+list2=$(mktemp)
+
+if [ ! -f $upstream ]; then
+ wget https://github.com/$owner/$project/archive/$commit/$upstream
+fi
+if [ ! -f $upstream ]; then
+ echo missgin upstream archive
+else
+ echo Unpacking...
+ tar tf $upstream >$list1
+ tar xf $upstream
+ echo Cleaning non-free stuff...
+ rm $project-$commit/ext/assets/filters/jsminifier.? \
+ $project-$commit/ext/assets/filters/cssminifier.? \
+ $project-$commit/build/*/phalcon.?
+ echo Packing...
+ tar cjf $downstream $project-$commit
+ tar tf $downstream >$list2
+ echo "Diffing..."
+ diff $list1 $list2
+fi
+
+rm -f $list1 $list2 \ No newline at end of file