fix build for generic arch targets

This commit is contained in:
Tom Callaway 2010-06-24 19:04:55 +00:00
parent e333565c2f
commit e1f7bb3703

View File

@ -1,11 +1,13 @@
Name: libvpx
Summary: VP8 Video Codec SDK
Version: 0.9.1
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD
Group: System Environment/Libraries
Source0: http://webm.googlecode.com/files/%{name}-%{version}.tar.bz2
Source1: libvpx.pc
# Thanks to debian.
Source2: libvpx.ver
Patch0: libvpx-0.9.0-no-explicit-dep-on-static-lib.patch
URL: http://www.webmproject.org/tools/vp8-sdk/
%ifarch %{ix86} x86_64
@ -51,7 +53,19 @@ and decoder.
%endif
%endif
./configure --target=%{vpxtarget} --enable-pic --disable-install-srcs --enable-shared --prefix=%{_prefix} --libdir=%{_libdir}
# The configure script will reject the shared flag on the generic target
# This means we need to fall back to the manual creation we did before. :P
%if "%{vpxtarget}" == "generic-gnu"
%global generic_target 1
%else
%global generic_target 0
%endif
./configure --target=%{vpxtarget} --enable-pic --disable-install-srcs \
%if ! %{generic_target}
--enable-shared \
%endif
--prefix=%{_prefix} --libdir=%{_libdir}
# Hack our optflags in.
sed -i "s|-O3|%{optflags}|g" libs-%{vpxtarget}.mk
@ -60,6 +74,16 @@ sed -i "s|-O3|%{optflags}|g" docs-%{vpxtarget}.mk
make %{?_smp_mflags} verbose=true target=libs
%if %{generic_target}
# Manual shared library creation
mkdir tmp
cd tmp
ar x ../libvpx_g.a
cd ..
gcc -fPIC -shared -pthread -lm -Wl,--no-undefined -Wl,-soname,libvpx.so.0 -Wl,--version-script,%{SOURCE2} -Wl,-z,noexecstack -o libvpx.so.%{version} tmp/*.o
rm -rf tmp
%endif
# Temporarily dance the static libs out of the way
mv libvpx.a libNOTvpx.a
mv libvpx_g.a libNOTvpx_g.a
@ -88,6 +112,15 @@ sed -i "s|@INCLUDEDIR@|%{_includedir}|g" %{buildroot}%{_libdir}/pkgconfig/libvpx
# Simpler to label the dir as %doc.
mv %{buildroot}/usr/docs doc/
%if %{generic_target}
install -p libvpx.so.%{version} %{buildroot}%{_libdir}
pushd %{buildroot}%{_libdir}
ln -sf libvpx.so.%{version} libvpx.so
ln -sf libvpx.so.%{version} libvpx.so.0
ln -sf libvpx.so.%{version} libvpx.so.0.9
popd
%endif
pushd %{buildroot}
# Stuff we don't need.
rm -rf usr/build/ usr/md5sums.txt usr/lib*/*.a usr/CHANGELOG usr/README
@ -124,6 +157,9 @@ rm -rf %{buildroot}
%{_bindir}/*
%changelog
* Thu Jun 24 2010 Tom "spot" Callaway <tcallawa@redhat.com> 0.9.1-2
- build shared library the old way for generic arches
* Thu Jun 24 2010 Tom "spot" Callaway <tcallawa@redhat.com> 0.9.1-1
- update to 0.9.1