1 |
%define major 0 |
2 |
%define libname %mklibname vpx %major |
3 |
%define develname %mklibname -d vpx |
4 |
%define snapshot 0 |
5 |
|
6 |
# disable to build without php and doxygen |
7 |
%define build_doc 0 |
8 |
|
9 |
Name: libvpx |
10 |
Summary: VP8 Video Codec SDK |
11 |
Version: 0.9.5 |
12 |
Release: %mkrel 2 |
13 |
License: BSD |
14 |
Group: System/Libraries |
15 |
Source0: http://webm.googlecode.com/files/%{name}-v%{version}.tar.bz2 |
16 |
Source1: libvpx.pc |
17 |
# Thanks to debian. |
18 |
Source2: libvpx.ver |
19 |
Patch0: libvpx-0.9.0-no-explicit-dep-on-static-lib.patch |
20 |
URL: http://www.webmproject.org/tools/vp8-sdk/ |
21 |
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot |
22 |
%ifarch %{ix86} x86_64 |
23 |
BuildRequires: yasm |
24 |
%endif |
25 |
%if %build_doc |
26 |
BuildRequires: doxygen, php-cli |
27 |
%endif |
28 |
|
29 |
%description |
30 |
libvpx provides the VP8 SDK, which allows you to integrate your applications |
31 |
with the VP8 video codec, a high quality, royalty free, open source codec |
32 |
deployed on millions of computers and devices worldwide. |
33 |
|
34 |
%package -n %libname |
35 |
Summary: VP8 Video Codec SDK |
36 |
Group: System/Libraries |
37 |
|
38 |
%description -n %libname |
39 |
libvpx provides the VP8 SDK, which allows you to integrate your applications |
40 |
with the VP8 video codec, a high quality, royalty free, open source codec |
41 |
deployed on millions of computers and devices worldwide. |
42 |
|
43 |
|
44 |
|
45 |
%package -n %develname |
46 |
Summary: Development files for libvpx |
47 |
Group: Development/C |
48 |
Requires: %{libname} = %{version}-%{release} |
49 |
Provides: %name-devel = %version-%release |
50 |
|
51 |
%description -n %develname |
52 |
Development libraries and headers for developing software against |
53 |
libvpx. |
54 |
|
55 |
%package utils |
56 |
Summary: VP8 utilities and tools |
57 |
Group: Video |
58 |
Requires: %{libname} = %{version}-%{release} |
59 |
|
60 |
%description utils |
61 |
A selection of utilities and tools for VP8, including a sample encoder |
62 |
and decoder. |
63 |
|
64 |
%prep |
65 |
%setup -q -n %name-v%version |
66 |
%patch0 -p1 -b .no-static-lib |
67 |
|
68 |
%build |
69 |
%ifarch %{ix86} |
70 |
%global vpxtarget x86-linux-gcc |
71 |
%else |
72 |
%ifarch x86_64 |
73 |
%global vpxtarget x86_64-linux-gcc |
74 |
%else |
75 |
%global vpxtarget generic-gnu |
76 |
%endif |
77 |
%endif |
78 |
|
79 |
./configure --target=%{vpxtarget} --enable-pic --disable-install-srcs |
80 |
|
81 |
# Hack our optflags in. |
82 |
sed -i "s|\"vpx_config.h\"|\"vpx_config.h\" %{optflags} -fPIC|g" libs-%{vpxtarget}.mk |
83 |
sed -i "s|\"vpx_config.h\"|\"vpx_config.h\" %{optflags} -fPIC|g" examples-%{vpxtarget}.mk |
84 |
sed -i "s|\"vpx_config.h\"|\"vpx_config.h\" %{optflags} -fPIC|g" docs-%{vpxtarget}.mk |
85 |
|
86 |
%make verbose=true target=libs |
87 |
|
88 |
# Really? You couldn't make this a shared library? Ugh. |
89 |
# Oh well, I'll do it for you. |
90 |
mkdir tmp |
91 |
cd tmp |
92 |
ar x ../libvpx_g.a |
93 |
cd .. |
94 |
gcc -fPIC -shared -pthread -lm -Wl,--no-undefined -Wl,-soname,libvpx.so.0 -Wl,--version-script,%{SOURCE2} -Wl,-z,noexecstack -o libvpx.so.0.0.0 tmp/*.o |
95 |
rm -rf tmp |
96 |
|
97 |
# Temporarily dance the static libs out of the way |
98 |
mv libvpx.a libNOTvpx.a |
99 |
mv libvpx_g.a libNOTvpx_g.a |
100 |
|
101 |
# We need to do this so the examples can link against it. |
102 |
ln -sf libvpx.so.0.0.0 libvpx.so |
103 |
|
104 |
%make verbose=true target=examples |
105 |
%make verbose=true target=docs |
106 |
|
107 |
# Put them back so the install doesn't fail |
108 |
mv libNOTvpx.a libvpx.a |
109 |
mv libNOTvpx_g.a libvpx_g.a |
110 |
|
111 |
%install |
112 |
rm -rf %buildroot |
113 |
make DIST_DIR=%{buildroot}%{_prefix} install |
114 |
|
115 |
cp simple_decoder %buildroot%_bindir/vp8_simple_decoder |
116 |
cp simple_encoder %buildroot%_bindir/vp8_simple_encoder |
117 |
cp twopass_encoder %buildroot%_bindir/vp8_twopass_encoder |
118 |
|
119 |
# Install the pkg-config file |
120 |
mkdir -p %{buildroot}%{_libdir}/pkgconfig/ |
121 |
install -m0644 %{SOURCE1} %{buildroot}%{_libdir}/pkgconfig/ |
122 |
# Fill in the variables |
123 |
sed -i "s|@PREFIX@|%{_prefix}|g" %{buildroot}%{_libdir}/pkgconfig/libvpx.pc |
124 |
sed -i "s|@LIBDIR@|%{_libdir}|g" %{buildroot}%{_libdir}/pkgconfig/libvpx.pc |
125 |
sed -i "s|@INCLUDEDIR@|%{_includedir}|g" %{buildroot}%{_libdir}/pkgconfig/libvpx.pc |
126 |
|
127 |
mkdir -p %{buildroot}%{_includedir}/vpx/ |
128 |
install -p libvpx.so.0.0.0 %{buildroot}%{_libdir} |
129 |
pushd %{buildroot}%{_libdir} |
130 |
ln -sf libvpx.so.0.0.0 libvpx.so |
131 |
ln -sf libvpx.so.0.0.0 libvpx.so.0 |
132 |
ln -sf libvpx.so.0.0.0 libvpx.so.0.0 |
133 |
popd |
134 |
pushd %{buildroot} |
135 |
# Stuff we don't need. |
136 |
rm -rf usr/build/ usr/md5sums.txt usr/lib*/*.a usr/CHANGELOG usr/README |
137 |
# Fix the binary permissions |
138 |
chmod 755 usr/bin/* |
139 |
popd |
140 |
|
141 |
%clean |
142 |
rm -rf %{buildroot} |
143 |
|
144 |
%files -n %libname |
145 |
%defattr(-,root,root,-) |
146 |
%doc AUTHORS CHANGELOG LICENSE README |
147 |
%{_libdir}/libvpx.so.%{major}* |
148 |
|
149 |
%files -n %develname |
150 |
%defattr(-,root,root,-) |
151 |
%if %build_doc |
152 |
# These are SDK docs, not really useful to an end-user. |
153 |
%doc docs/html |
154 |
%endif |
155 |
%{_includedir}/vpx/ |
156 |
%{_libdir}/pkgconfig/libvpx.pc |
157 |
%{_libdir}/libvpx.so |
158 |
|
159 |
%files utils |
160 |
%defattr(-,root,root,-) |
161 |
%{_bindir}/* |
162 |
|
163 |
|
164 |
|