summaryrefslogtreecommitdiffstats
path: root/php-ffmpeg.spec
blob: 9bf9ddff3f572ba937f64d0bf29b074ee3df25b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# spec file for php-ffmpeg
#
# Copyright (c) 2007-2017 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global ext_name   ffmpeg
%global svn        678
%if "%{php_version}" < "5.6"
%global ini_name   %{ext_name}.ini
%else
%global ini_name   40-%{ext_name}.ini
%endif

Name:           php-ffmpeg
Version:        0.7.0
%if 0%{?svn}
Release:        0.4.svn%{svn}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
%else
Release:        1%{svn}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
%endif
Summary:        Extension to manipulate movie in PHP

Group:          Development/Languages
License:        GPLv2+
URL:            http://ffmpeg-php.sourceforge.net/
%if 0%{?svn}
# 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

# Fix include path
Patch0:         php-ffmpeg-incl.patch
# Fix PHP 5.4 build
Patch1:         php-ffmpeg-php54.patch
# Recent ffmpeg
Patch2:         php-ffmpeg-build.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  ffmpeg-devel >= 0.10
BuildRequires:  php-devel
BuildRequires:  php-gd

Obsoletes:      ffmpeg-php < %{version}
Provides:       ffmpeg-php = %{version}-%{release}
Provides:       ffmpeg-php%{?_isa} = %{version}-%{release}

Requires:       php-gd%{?_isa}
Requires:       php(zend-abi) = %{php_zend_api}
Requires:       php(api) = %{php_core_api}

%if 0%{?fedora} < 20 && 0%{?rhel} < 7
# Filter private shared object
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
%endif


%description
ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented
API for accessing and retrieving information from video and audio files. 
It has methods for returning frames from movie files as images that can be 
manipulated using PHP's image functions. This works well for automatically 
creating thumbnail images from movies. ffmpeg-php is also useful for reporting
the duration and bitrate of audio files (mp3, wma...). ffmpeg-php can access
many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...).


%prep
%setup -q -c
mv ffmpeg* %{ext_name}-nts

cd %{ext_name}-nts
%patch0 -p1 -b .incl
%patch1 -p1 -b .php54
%patch2 -p1 -b .build

# 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 > %{ini_name} << '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 \
    --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 %{buildroot}
# Install the NTS stuff
make -C %{ext_name}-nts install INSTALL_ROOT=%{buildroot}
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}

# Install the ZTS stuff
make -C %{ext_name}-zts install INSTALL_ROOT=%{buildroot}
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}


%check
: Simple module load test
%{__php} --no-php-ini \
    --define extension=%{buildroot}%{php_extdir}/%{ext_name}.so \
    --modules | grep %{ext_name}

%{__ztsphp} --no-php-ini \
    --define extension=%{buildroot}%{php_ztsextdir}/%{ext_name}.so \
    --modules | grep %{ext_name}


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc %{ext_name}-nts/{ChangeLog,CREDITS,EXPERIMENTAL,LICENSE,TODO,test_ffmpeg.php}

%config(noreplace) %{php_inidir}/%{ini_name}
%{php_extdir}/%{ext_name}.so

%config(noreplace) %{php_ztsinidir}/%{ini_name}
%{php_ztsextdir}/%{ext_name}.so


%changelog
* Wed Apr 16 2014 Remi Collet <remi@fedoraproject.org> - 0.7.0-0.4.svn678
- add numerical prefix to extension configuration file (php 5.6)

* Mon Mar 17 2014 Remi Collet <rpms@famillecollet.com> 0.7.0-0.3.svn678
- cleanups

* Wed Jan  2 2013 Remi Collet <rpms@famillecollet.com> 0.7.0-0.2.svn678
- rewrite patch for include using explicit path of each header
  because of conflicts with system headers (time.h)

* Mon Sep 17 2012 Remi Collet <rpms@famillecollet.com> 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 <rpms@famillecollet.com> 0.6.3-0.1.svn676
- update to 0.6.3 svn snapshot revision 676

* Wed Apr 23 2008 Remi Collet <rpms@famillecollet.com> 0.5.2.1-1
- update to 0.5.1.1

* Thu Nov 15 2007 Remi Collet <rpms@famillecollet.com> 0.5.1-2
- F8 rebuild

* Mon Aug 27 2007 Remi Collet <rpms@famillecollet.com> 0.5.1-2
- rename from ffmpeg-php to php-ffmpeg
- fix License

* Sat Jul 07 2007 Remi Collet <rpms@famillecollet.com> 0.5.1-1
- initial SPEC