From 090181a4c42cf8d422d7c6d482ce1876c2d44420 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 17 Sep 2012 07:04:20 +0200 Subject: php-ffmpeg-0.7.0-0.1.svn678 --- .gitignore | 1 + Makefile | 4 ++ php-ffmpeg-incl.patch | 34 +++++++++++++ php-ffmpeg-php54.patch | 39 ++++++++++++++ php-ffmpeg.patch | 23 --------- php-ffmpeg.spec | 136 +++++++++++++++++++++++++++++++------------------ 6 files changed, 164 insertions(+), 73 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 php-ffmpeg-incl.patch create mode 100644 php-ffmpeg-php54.patch delete mode 100644 php-ffmpeg.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7377d4a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.tbz2 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..91b0fd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../common/Makefile + diff --git a/php-ffmpeg-incl.patch b/php-ffmpeg-incl.patch new file mode 100644 index 0000000..1e7fea7 --- /dev/null +++ b/php-ffmpeg-incl.patch @@ -0,0 +1,34 @@ +diff -up ./config.m4.incl ./config.m4 +--- ./config.m4.incl 2009-07-02 19:15:48.000000000 +0200 ++++ ./config.m4 2012-09-17 06:31:46.733978790 +0200 +@@ -41,6 +41,18 @@ if test "$PHP_FFMPEG" != "no"; then + PHP_ADD_INCLUDE($i/include/libavdevice/) + FFMPEG_INC_FOUND=$i/include/libavcodec + break ++ elif test -f $i/libavcodec/avcodec.h; then ++ dnl ffmpeg svn revision 12194 and newer put each header in its own dir ++ dnl ffmpeg-devel RPM install in /usr/include/ffmpeg/* ++ PHP_ADD_INCLUDE($i) ++ PHP_ADD_INCLUDE($i/libavcodec/) ++ PHP_ADD_INCLUDE($i/libavformat/) ++ PHP_ADD_INCLUDE($i/libavutil/) ++ PHP_ADD_INCLUDE($i/libswscale/) ++ PHP_ADD_INCLUDE($i/libavfilter/) ++ PHP_ADD_INCLUDE($i/libavdevice/) ++ FFMPEG_INC_FOUND=$i ++ break + fi + done + +diff -up ./ffmpeg_frame.c.incl ./ffmpeg_frame.c +--- ./ffmpeg_frame.c.incl 2012-09-17 06:44:58.242810037 +0200 ++++ ./ffmpeg_frame.c 2012-09-17 06:44:07.729629307 +0200 +@@ -57,7 +57,7 @@ + allow ffmpeg-php to be built without access to the php sources + */ + #if HAVE_LIBGD20 +-#include "gd.h" ++#include "gd/libgd/gd.h" + + #define FFMPEG_PHP_FETCH_IMAGE_RESOURCE(gd_img, ret) { \ + ZEND_GET_RESOURCE_TYPE_ID(le_gd, "gd"); \ diff --git a/php-ffmpeg-php54.patch b/php-ffmpeg-php54.patch new file mode 100644 index 0000000..6a7e1ab --- /dev/null +++ b/php-ffmpeg-php54.patch @@ -0,0 +1,39 @@ +diff -up ffmpeg-php-svn678/ffmpeg_movie.c.php54 ffmpeg-php-svn678/ffmpeg_movie.c +--- ffmpeg-php-svn678/ffmpeg_movie.c.php54 2012-09-17 06:08:57.113312219 +0200 ++++ ffmpeg-php-svn678/ffmpeg_movie.c 2012-09-17 06:12:10.425069883 +0200 +@@ -36,7 +36,7 @@ + + #include + #include +-#include ++#include + #include + + #ifdef HAVE_CONFIG_H +@@ -315,7 +315,7 @@ FFMPEG_PHP_CONSTRUCTOR(ffmpeg_movie, __c + } + + if (persistent) { +- list_entry *le; ++ zend_rsrc_list_entry *le; + /* resolve the fully-qualified path name to use as the hash key */ + fullpath = expand_filepath(filename, NULL TSRMLS_CC); + +@@ -350,7 +350,7 @@ FFMPEG_PHP_CONSTRUCTOR(ffmpeg_movie, __c + } + + } else { /* no existing persistant movie, create one */ +- list_entry new_le; ++ zend_rsrc_list_entry new_le; + ffmovie_ctx = _php_alloc_ffmovie_ctx(1); + + if (_php_open_movie_file(ffmovie_ctx, filename)) { +@@ -364,7 +364,7 @@ FFMPEG_PHP_CONSTRUCTOR(ffmpeg_movie, __c + new_le.ptr = ffmovie_ctx; + + if (FAILURE == zend_hash_update(&EG(persistent_list), hashkey, +- hashkey_length+1, (void *)&new_le, sizeof(list_entry), ++ hashkey_length+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), + NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Failed to register persistent resource"); diff --git a/php-ffmpeg.patch b/php-ffmpeg.patch deleted file mode 100644 index 0d2761b..0000000 --- a/php-ffmpeg.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up ffmpeg-php-0.6.0/config.m4.orig ffmpeg-php-0.6.0/config.m4 ---- ffmpeg-php-0.6.0/config.m4.orig 2010-03-21 09:05:15.000000000 +0100 -+++ ffmpeg-php-0.6.0/config.m4 2010-03-21 09:12:32.000000000 +0100 -@@ -41,6 +41,18 @@ if test "$PHP_FFMPEG" != "no"; then - PHP_ADD_INCLUDE($i/include/libavdevice/) - FFMPEG_INC_FOUND=$i/include/libavcodec - break -+ elif test -f $i/libavcodec/avcodec.h; then -+ dnl ffmpeg svn revision 12194 and newer put each header in its own dir -+ dnl ffmpeg-devel RPM install in /usr/include/ffmpeg/* -+ PHP_ADD_INCLUDE($i) -+ PHP_ADD_INCLUDE($i/libavcodec/) -+ PHP_ADD_INCLUDE($i/libavformat/) -+ PHP_ADD_INCLUDE($i/libavutil/) -+ PHP_ADD_INCLUDE($i/libswscale/) -+ PHP_ADD_INCLUDE($i/libavfilter/) -+ PHP_ADD_INCLUDE($i/libavdevice/) -+ FFMPEG_INC_FOUND=$i -+ break - fi - done - - diff --git a/php-ffmpeg.spec b/php-ffmpeg.spec index 8e770ff..73d8bb0 100644 --- a/php-ffmpeg.spec +++ b/php-ffmpeg.spec @@ -1,12 +1,8 @@ -%global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1) -%global php_extdir %(php-config --extension-dir 2>/dev/null || echo "undefined") - -# 677 have undefined symbol: php_gd_gdImageSetPixel -%global svn 676 - +%global ext_name ffmpeg +%global svn 678 Name: php-ffmpeg -Version: 0.6.3 +Version: 0.7.0 %if 0%{?svn} Release: 0.1.svn%{svn}%{?dist} %else @@ -18,29 +14,31 @@ Group: Development/Languages License: GPLv2 URL: http://ffmpeg-php.sourceforge.net/ %if 0%{?svn} -# svn export -r 676 https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php/trunk/ffmpeg-php ffmpeg-php-svn676 -# tar cjf /home/rpmbuild/SOURCES/ffmpeg-php-svn676.tbz2 ffmpeg-php-svn676 +# svn export -r 678 https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php/trunk/ffmpeg-php ffmpeg-php-svn678 +# tar cjf ffmpeg-php-svn678.tbz2 ffmpeg-php-svn678 Source0: ffmpeg-php-svn%{svn}.tbz2 %else Source0: http://downloads.sourceforge.net/%{name}/ffmpeg-php-%{version}.tbz2 %endif -Patch0: php-ffmpeg.patch +# Fix include path +Patch0: php-ffmpeg-incl.patch +# Fix PHP 5.4 build +Patch1: php-ffmpeg-php54.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: ffmpeg-devel >= 0.5, php-devel, php-gd -Requires: php-gd -Obsoletes: ffmpeg-php <= %{version} +BuildRequires: ffmpeg-devel >= 0.10, php-devel, php-gd +Obsoletes: ffmpeg-php < %{version} Provides: ffmpeg-php = %{version}-%{release} -%if %{?php_zend_api}0 -# for fedora >= 6 +Requires: php-gd%{?_isa} Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} -%else -# for fedora <= 5 -Requires: php-api = %{php_apiver} -%endif + +# Filter private shared object +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} %description @@ -54,66 +52,104 @@ many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...). %prep -%if 0%{?svn} -%setup -q -n ffmpeg-php-svn%{svn} -%else -%setup -q -n ffmpeg-php-%{version} -%endif +%setup -q -c +mv ffmpeg* %{ext_name}-nts + +cd %{ext_name}-nts +%patch0 -p1 -b .incl +%patch1 -p1 -b .php54 -%patch0 -p1 -b .orig +# Sanity check, really often broken +extver=$(sed -n '/#define FFMPEG_PHP_VERSION/{s/.* "//;s/".*$//;p}' ffmpeg-php.c) +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. + exit 1 +fi # we will use include from php-devel rm gd.h gd_io.h +cd .. +cat > %{ext_name}.ini << 'EOF' +; --- Enable %{name} extension module +extension=%{ext_name}.so + +; --- options for %{name} +;ffmpeg.allow_persistent = 0 +;ffmpeg.show_warnings = 0 +EOF + +# duplicate for ZTS build +cp -r %{ext_name}-nts %{ext_name}-zts + %build +cd %{ext_name}-nts phpize %configure \ --with-libdir=%{_lib} \ --with-ffmpeg=%{_includedir}/ffmpeg \ - CFLAGS=-I%{_includedir}/php/ext/gd/libgd + --with-php-config=%{_bindir}/php-config +make %{?_smp_mflags} + +cd ../%{ext_name}-zts +zts-phpize +%configure \ + --with-libdir=%{_lib} \ + --with-ffmpeg=%{_includedir}/ffmpeg \ + --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} %install -rm -rf $RPM_BUILD_ROOT -make install INSTALL_ROOT=$RPM_BUILD_ROOT +rm -rf %{buildroot} +# Install the NTS stuff +make -C %{ext_name}-nts install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ext_name}.ini %{buildroot}%{php_inidir}/%{ext_name}.ini -# install config file -install -d $RPM_BUILD_ROOT%{_sysconfdir}/php.d -cat > $RPM_BUILD_ROOT%{_sysconfdir}/php.d/%{name}.ini << 'EOF' -; --- Enable %{name} extension module -extension=ffmpeg.so - -; --- options for %{name} -;ffmpeg.allow_persistent = 0 -;ffmpeg.show_warnings = 0 -EOF +# Install the ZTS stuff +make -C %{ext_name}-zts install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ext_name}.ini %{buildroot}%{php_ztsinidir}/%{ext_name}.ini %check -# should be run after install -#ldd modules/ffmpeg.so -#TEST_PHP_EXECUTABLE=$(which php) NO_INTERACTION=1 php -q -n \ -# -dextension_dir=$PWD/modules -dextension=gd.so -dextension=ffmpeg.so \ -# run-tests.php -# I know some tests fails -true +# simple module load test +%{__php} --no-php-ini \ + --define extension_dir=%{ext_name}-nts/modules \ + --define extension=%{ext_name}.so \ + --modules | grep %{ext_name} + +%{__ztsphp} --no-php-ini \ + --define extension_dir=%{ext_name}-zts/modules \ + --define extension=%{ext_name}.so \ + --modules | grep %{ext_name} + %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc ChangeLog CREDITS EXPERIMENTAL LICENSE TODO test_ffmpeg.php -%config(noreplace) %{_sysconfdir}/php.d/%{name}.ini -%{php_extdir}/ffmpeg.so +%doc %{ext_name}-nts/{ChangeLog,CREDITS,EXPERIMENTAL,LICENSE,TODO,test_ffmpeg.php} + +%config(noreplace) %{php_inidir}/%{ext_name}.ini +%{php_extdir}/%{ext_name}.so + +%config(noreplace) %{php_ztsinidir}/%{ext_name}.ini +%{php_ztsextdir}/%{ext_name}.so %changelog -* Sun Mar 21 2010 Remi Collet 0.6.3-1.svn676 +* Mon Sep 17 2010 Remi Collet 0.7.0-0.1.svn678 +- update to 0.7.0 svn snapshot revision 678 +- add patch for php 5.4 +- add ZTS extension +- cleanup spec +- build with ffmpeg 0.10 + +* Sun Mar 21 2010 Remi Collet 0.6.3-0.1.svn676 - update to 0.6.3 svn snapshot revision 676 * Wed Apr 23 2008 Remi Collet 0.5.2.1-1 -- cgit