mumble/mumble.spec

402 lines
12 KiB
RPMSpec

# norootforbuild
%if 0%{?suse_version} > 1100
%bcond_without pulseaudio
%else
%if 0%{?fedora_version} > 9
%bcond_without pulseaudio
%else
%bcond_with pulseaudio
%endif
%endif
%if 0%{?fedora_version} > 11
%bcond_without ice
%else
%bcond_with ice
%endif
%bcond_without mumble11x
%bcond_without bonjour
%bcond_with system_celt
%bcond_without system_speex
Name: mumble%{?snapshot:-unstable}
BuildRequires: protobuf-devel
%if %{with bonjour}
%if 0%{?suse_version}
%if 0%{?suse_version} > 1010
BuildRequires: avahi-compat-mDNSResponder-devel
%endif
%else
BuildRequires: avahi-compat-libdns_sd-devel
%endif
%endif
%if %{with system_celt}
BuildRequires: libcelt-devel
Requires: libcelt0 > 0.7.0
%endif
BuildRequires: libsndfile-devel
BuildRequires: libogg-devel
BuildRequires: libcap-devel
%if %{with system_speex}
BuildRequires: speex-devel
%endif
BuildRequires: boost-devel gcc-c++
%if 0%{?suse_version}
BuildRequires: libqt4-devel pkg-config update-desktop-files alsa-devel
%if 0%{?suse_version} > 1020
BuildRequires: libopenssl-devel
%else
BuildRequires: openssl-devel
%endif
%endif
%if 0%{?fedora_version}
BuildRequires: qt4-devel pkgconfig libXevie-devel openssl-devel alsa-lib-devel
%endif
%if %{with ice}
BuildRequires: ice-devel
%endif
%if 0%{?mandriva_version}
BuildRequires: qt4-devel qt4-linguist pkgconfig openssl-devel libxevie-devel alsa-lib-devel -alsa-plugins
BuildRequires: libxi-devel
%endif
%if %{with pulseaudio}
BuildRequires: pulseaudio-devel
%endif
Version: 1.2.2%{?snapshot:_%snapshot}
Release: 1
License: GPL v2 or later
Group: Productivity/Multimedia/Sound/Utilities
%if 0%{?snapshot:1}
Source: mumble-unstable-%{version}.tar.bz2
%else
Source: http://downloads.sourceforge.net/project/mumble/Mumble/%{version}/mumble-%{version}.tar.gz
Source1: http://downloads.sourceforge.net/project/mumble/Mumble/%{version}/mumble-%{version}.tar.gz.sig
%endif
Source2: mumble-server.init
Patch0: mumble-1.2.1-wizardpageorder.diff
Patch1: 0003-fix-long-username-query.patch
Patch2: 0004-fix-username-validation.patch
Patch50: mumble-1.2.2-buildcompare.diff
# hack, no clue about glx so no idea to fix this properly
Patch99: mumble-1.1.4-sle10glx.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://mumble.sourceforge.net/
Summary: Voice Communication Client for Gamers
%if 0%{?suse_version}
Requires: qt-sql-sqlite
%if 0%{?suse_version} == 1030
#XXX: qt4 bug on 10.3 (bnc#370942)
Requires: libqt4 > 4.3.1-23
%endif # 10.3
%if 0%{?suse_version} == 1100
# the version shipped on 11.0 is insufficient
Requires: libspeex > 1.1.99.3
%endif # 11.0
%endif # suse_version
%if 0%{?fedora_version}
Requires: qt4-sqlite
%endif
%if 0%{?suse_version} > 1010
%ifarch x86_64
Recommends: %{name}-32bit
Conflicts: %{name}-32bit < %{version}
%endif
%ifarch ppc
Recommends: %{name}-64bit
Conflicts: %{name}-64bit < %{version}
%endif
%endif
#
%if 0%{?snapshot:1}
Conflicts: mumble < %version
Provides: mumble = %version
#
%if !%{with system_celt}
Source50: http://downloads.xiph.org/releases/celt/celt-0.7.0.tar.gz
%endif
%endif
%description
Low-latency, high-quality voice communication for gamers. Includes game
linking, so voice from other players comes from the direction of their
characters, and has echo cancellation so the sound from your loudspeakers
won't be audible to other players.
%package server
Summary: Voice Communication Server for Gamers
Group: Productivity/Multimedia/Sound/Utilities
Requires: qt-sql-sqlite
PreReq: /usr/sbin/useradd
%if 0%{?snapshot:1}
Conflicts: mumble-server < %version
Provides: mumble-server = %version
%endif
%description server
Low-latency, high-quality voice communication for gamers. Includes game
linking, so voice from other players comes from the direction of their
characters, and has echo cancellation so the sound from your loudspeakers
won't be audible to other players.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
#
%patch50 -p1
%if 0%{?suse_version} && 0%{?suse_version} < 1020
%patch99 -p1
%endif
%if %{with system_celt}
# XXX celt 0.6 vs celt 0.7
#sed -i -e 's/celt_int32/celt_int32_t/g' src/mumble/Audio.*
#sed -i -e 's/celt_int16/celt_int16_t/g' src/mumble/Audio.*
%else
%if 0%{?snapshot:1}
tar -xzf %SOURCE50
sed -i -e 's/celt-0.6.1-build//;s/celt-0.6.2-build//' main.pro
rmdir celt-0.7.0-src
mv celt-0.7.0 celt-0.7.0-src
%endif
%endif
#
%if 0%{?mandriva_version}
#XXX: dirty hack. QT_REQUIRE_VERSION doesn't work with -Wformat-security. should be fixed qt really
sed -i -e '/QT_REQUIRE_VERSION/d' src/mumble/main.cpp src/mumble11x/main.cpp
%endif
#
%build
%if 0%{?fedora_version}
ln -s /usr/bin/qmake-qt4 qmake
ln -s /usr/bin/lrelease-qt4 lrelease
ln -s /usr/bin/lupdate-qt4 lupdate
export PATH=$PATH:$PWD
%endif
%if 0%{?mandriva_version} > 2006
export PATH=/usr/lib/qt4/bin:$PATH
export QTDIR=%{_prefix}/lib/qt4/
%endif
#
#
%if 0
# for not having to wait for compile when testing packaging stuff..
mkdir release
touch release/mumble release/murmurd release/libmumble.so.1.1.1
%else
%if 0%{?mandriva_version}
# HACK: mandriva forgot to package qt translations
if [ ! -e /usr/lib/qt4/translations/qt_de.qm ]; then
sed -i -e '/QMAKE_EXTRA_TARGETS/s/copytrans//;/PRE_TARGETDEPS/s/qt_de\.qm//' src/mumble/mumble.pro
sed -i -e '/qt_.*\.qm/d' src/mumble/mumble.qrc
fi
%endif
#
# temporary hack, remove!
sed -i -e '/QMAKE_CFLAGS/s/-Woverloaded-virtual -Wold-style-cast//' compiler.pri
qmake \
QMAKE_CFLAGS_RELEASE="%{optflags} -Wall" \
QMAKE_CXXFLAGS_RELEASE="%{optflags} -Wall" \
DEFINES*=NO_UPDATE_CHECK \
DEFINES*=MUMBLE_VERSION=%version \
DEFINES*=PLUGIN_PATH=%{_libdir}/mumble \
CONFIG*=packaged \
%if 0%{?suse_version}
DEFINES*=SYSTEM_CA_DIR=/etc/ssl/certs \
%endif
CONFIG*=no-g15 \
CONFIG*=no-embed-qt-translations \
CONFIG*=no-speechd \
%if !%{with ice}
CONFIG*=no-ice \
%endif
%if %{with system_celt}
CONFIG*=no-bundled-celt \
%endif
%if %{with system_speex}
CONFIG*=no-bundled-speex \
%endif
%if !%{with mumble11x}
CONFIG*=no-11x \
%endif
%if !%{with bonjour}
CONFIG*=no-bonjour \
%endif
%if !%{with pulseaudio}
CONFIG*=no-pulseaudio \
%endif
CONFIG*=no-crash-report \
-recursive
#
### XXX: hack for incomplete dependencies
make qmake
%if 0
# that translation stuff is just broken
# copy the available ones manually
%if 0%{?suse_version}
cp /usr/share/qt4/translations/qt_*.qm src/mumble
# 10.3 doesn't have that one
touch src/mumble/qt_pl.qm
%endif
make -C src/mumble mumble_en.qm
%if !0%{?mandriva_version}
make -C src/mumble qt_de.qm
%endif
#
%endif
###
#
# deps for *.pb.cc are broken and fail for high -j so generate
# them manually first
for i in mumble murmur; do
make -C src/$i -f Makefile.Release compiler_pb_make_all
done
make %{?jobs:-j%{jobs}}
%endif
%install
# client
install -d -m 0755 "%{buildroot}%{_bindir}"
install -D -m 0755 release/mumble %{buildroot}%{_bindir}/mumble
install -d -m 0755 "%{buildroot}%{_libdir}/mumble/plugins"
install -m 0755 release/plugins/*.so "%{buildroot}%{_libdir}/mumble/plugins"
%if !%{with system_celt}
cp -a release/libcelt0.so.* "%{buildroot}%{_libdir}/mumble"
%endif
install -m 755 scripts/mumble-overlay "%{buildroot}%{_bindir}/mumble-overlay"
install -d -m 0755 "%{buildroot}%{_mandir}/man1"
install -m 0644 man/*.1 "%{buildroot}%{_mandir}/man1"
#
install -D -m 0644 icons/mumble.xpm "%{buildroot}%{_datadir}/pixmaps/mumble.xpm"
#install -D -m 0644 icons/mumble.16x16.png "%{buildroot}%{_datadir}/icons/hicolor/16x16/apps/mumble.png"
#install -D -m 0644 icons/mumble.32x32.png "%{buildroot}%{_datadir}/icons/hicolor/32x32/apps/mumble.png"
#install -D -m 0644 icons/mumble.48x48.png "%{buildroot}%{_datadir}/icons/hicolor/48x48/apps/mumble.png"
#install -D -m 0644 icons/mumble.64x64.png "%{buildroot}%{_datadir}/icons/hicolor/64x64/apps/mumble.png"
install -D -m 0644 icons/mumble.svg "%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/mumble.svg"
#
install -d -m0755 "%{buildroot}%{_libdir}/mumble"
install -m0755 release/libmumble.so.*.*.* "%{buildroot}%{_libdir}/mumble"
/sbin/ldconfig -n "%{buildroot}%{_libdir}/mumble"
#
%if %{with mumble11x}
install -D -m 0755 release/mumble11x %{buildroot}%{_bindir}/mumble11x
%else
# XXX
/bin/rm "%{buildroot}%{_mandir}"/man1/mumble11x*
%endif
#
# server
install -D -m 0755 release/murmurd "%{buildroot}%{_sbindir}/murmurd"
install -D -m 0755 %{SOURCE2} %{buildroot}/etc/init.d/mumble-server
ln -s /etc/init.d/mumble-server %{buildroot}%{_sbindir}/rcmumble-server
install -D -m 0644 scripts/murmur.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/mumble-server.conf
install -D -m 0644 scripts/murmur.ini %{buildroot}%{_sysconfdir}/mumble-server.ini
# fix up config file
sed -i -e 's/^dbus=session/dbus=system/' \
-e 's/#uname=/uname=mumble-server/' \
-e 's@#pidfile=@pidfile=/var/run/mumble-server/mumble-server.pid@' \
-e 's@#logfile=@logfile=/var/log/mumble-server/@' \
%{buildroot}%{_sysconfdir}/mumble-server.ini
install -D -m 0755 scripts/murmur-user-wrapper %{buildroot}%{_bindir}/murmur-user-wrapper
sed -i -e '/^SYSDIR=/s@=.*@%{_docdir}/%{name}/scripts@' %{buildroot}%{_bindir}/murmur-user-wrapper
for i in log lib run; do
install -d -m755 %buildroot/var/$i/mumble-server
done
#
install -d %buildroot/%_datadir/applications
%if 0%{?suse_version}
sed 's/^Categories.*/Categories=X-SuSE-Core-Game;/' \
< scripts/mumble.desktop \
> %buildroot/%_datadir/applications/mumble.desktop
%suse_update_desktop_file mumble
%else
install -m 644 scripts/mumble.desktop %buildroot/%_datadir/applications/mumble.desktop
%endif
%if %{with mumble11x}
sed -e '/^Name=/s/$/ 1.1.x/;/^Exec=/s/$/11x/' \
< %buildroot/%_datadir/applications/mumble.desktop \
> %buildroot/%_datadir/applications/mumble11x.desktop
%endif
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -a scripts LICENSE README README.Linux %{buildroot}%{_docdir}/%{name}
#
%if 0%{?suse_version} >= 1130
%if 0%{?suse_version} == 1130
mkdir %buildroot/etc/tmpdirs.d/
cat >> %buildroot/etc/tmpdirs.d/50_mumble-server <<EOF
#!/bin/sh
while read t f m o g xxx; do
[ "$t" = d ] || continue
install -d -m $m -o $o -g $g $f
done < /etc/tmpfiles.d/mumble-server.conf
EOF
%endif
mkdir %buildroot/etc/tmpfiles.d
cat >> %buildroot/etc/tmpfiles.d/mumble-server.conf <<EOF
d /var/run/mumble-server 0755 mumble-server mumble-server -
EOF
%endif
%clean
rm -rf "%{buildroot}"
%pre server
getent group mumble-server >/dev/null || groupadd -r mumble-server || :
getent passwd mumble-server >/dev/null || \
/usr/sbin/useradd -r -d /var/lib/mumble-server -s /bin/false -c "Mumble VoIP Server" -g mumble-server mumble-server 2> /dev/null || :
%preun server
%if 0%{?suse_version}
%stop_on_removal mumble-server
%endif
%postun server
%if 0%{?suse_version}
%restart_on_update mumble-server
%insserv_cleanup
%endif
%files
%defattr(-, root, root)
%exclude %{_docdir}/%{name}/scripts/murmur.ini
%doc %{_docdir}/%{name}
%{_bindir}/mumble
%{_bindir}/mumble-overlay
%{_mandir}/man1/mumble-overlay.*
%{_mandir}/man1/mumble.*
%if %{with mumble11x}
%{_bindir}/mumble11x
%{_mandir}/man1/mumble11x*
%endif
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/*
%dir %{_datadir}/icons/hicolor/*/apps
%{_datadir}/icons/hicolor/*/apps/mumble.*
%{_datadir}/pixmaps/*
%{_datadir}/applications/*
%{_libdir}/mumble
%files server
%defattr(-,root,root)
%doc %{_docdir}/%{name}/scripts/murmur.ini
%config %{_sysconfdir}/dbus-1/system.d/mumble-server.conf
%config(noreplace) %{_sysconfdir}/mumble-server.ini
/etc/init.d/mumble-server
%{_sbindir}/rcmumble-server
%{_sbindir}/murmurd
%{_bindir}/murmur-user-wrapper
%{_mandir}/man1/murmurd.*
%{_mandir}/man1/murmur-user-wrapper.*
%dir %attr(-,mumble-server,mumble-server) /var/lib/mumble-server
%dir %attr(-,mumble-server,mumble-server) /var/log/mumble-server
%if 0%{?suse_version} < 1130
%dir %attr(-,mumble-server,mumble-server) /var/run/mumble-server
%else
%if 0%{?suse_version} == 1130
%config /etc/tmpdirs.d/50_mumble-server
%endif
%config /etc/tmpfiles.d/mumble-server.conf
%endif