LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File mumble.spec of Package mumble (Project games:tools)

#
# spec file for package mumble
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%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
# mumble must be able to talk to other clients which may use
# differnt versions of celt. Since each celt release is
# incompatible to each other mumble bundles some specific
# versions.
%bcond_with     system_celt
%bcond_without  system_speex

Name:           mumble
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
%if 0%{?suse_version} > 1220
BuildRequires:  gpg-offline
%endif
%endif
%if %{with system_celt}
BuildRequires:  libcelt-devel
Requires:       libcelt0 > 0.7.0
%endif
BuildRequires:  libcap-devel
BuildRequires:  libogg-devel
BuildRequires:  libsndfile-devel
%if %{with system_speex}
BuildRequires:  speex-devel
%endif
BuildRequires:  boost-devel
BuildRequires:  gcc-c++
%if 0%{?suse_version}
BuildRequires:  alsa-devel
BuildRequires:  libqt4-devel
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
%if 0%{?suse_version} > 1020
BuildRequires:  libopenssl-devel
%else
BuildRequires:  openssl-devel
%endif
%endif
%if 0%{?fedora_version}
BuildRequires:  alsa-lib-devel
BuildRequires:  libXevie-devel
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRequires:  qt4-devel
%endif
%if %{with ice}
BuildRequires:  ice-devel
%endif
%if 0%{?mandriva_version}
BuildRequires:  -alsa-plugins
BuildRequires:  alsa-lib-devel
BuildRequires:  libxevie-devel
BuildRequires:  libxi-devel
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRequires:  qt4-devel
BuildRequires:  qt4-linguist
%endif
%if %{with pulseaudio}
BuildRequires:  pulseaudio-devel
%endif
Version:        1.2.3%{?snapshot:_%snapshot}
Release:        0
%if 0%{!?snapshot:1}
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
Source3:        murmur.apparmor
Source4:        %{name}.keyring
Patch0:         0001-fix-build-error-with-capability.h.diff
Patch1:         0001-fix-user-switching.diff
Patch2:         0001-open-log-file-early-so-log-dir-can-be-root-owned.diff
Patch3:         0001-if-service-name-is-empty-don-t-pass-an-empty-string.diff
Patch4:         0001-remove-CAP_NET_ADMIN.diff
Patch5:         0001-fix-bonjour-support-using-avahi-compat-lib.diff
Patch6:         mumble-1.2.3-nohardcodedcas.diff
Patch7:         0001-Explicitly-remove-file-permissions-for-settings-and-D.diff
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
License:        BSD-3-Clause
Group:          Productivity/Multimedia/Sound/Utilities
Requires:       lsb-release
%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
#
%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:       lsb-release
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
%if 0%{?gpg_verify:1}
%gpg_verify %{S:1}
%endif
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
#
%patch50 -p1
%if 0%{?suse_version} && 0%{?suse_version} < 1020
%patch99 -p1
%endif
%if !%{with system_celt}
%if 0%{?snapshot:1}
tar -xzf %SOURCE50
tar -xzf %SOURCE51
for v in 0.7.0 0.11.0; do
	rmdir celt-$v-src
	mv celt-$v celt-$v-src
done
%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 -fno-strict-aliasing" \
	QMAKE_CXXFLAGS_RELEASE="%{optflags} -Wall -fno-strict-aliasing" \
	DEFINES*=NO_UPDATE_CHECK \
	DEFINES*=MUMBLE_VERSION=%version \
	DEFINES*=PLUGIN_PATH=%{_libdir}/mumble/plugins \
	CONFIG*=packaged \
%if 0%{?suse_version}
	DEFINES*=NO_SYSTEM_CA_OVERRIDE \
%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}"
# hack to make loading libs from applicationDirPath work
install -D -m 0755 release/mumble %{buildroot}%{_libdir}/mumble/mumble
ln -s "%{_libdir}/mumble/mumble" "%{buildroot}%{_bindir}/mumble"
#
install -d -m 0755 "%{buildroot}%{_libdir}/mumble/plugins"
install -m 0755 release/plugins/*.so "%{buildroot}%{_libdir}/mumble/plugins"
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"
# do this after ldconfig as we don't need the links
%if !%{with system_celt}
install -m 644 release/libcelt0.so.0.*.* "%{buildroot}%{_libdir}/mumble"
%endif

#
%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
install -D -m 0644 %{SOURCE3} %{buildroot}/etc/apparmor.d/usr.sbin.murmurd
%if 0%{?suse_version} < 1220
sed -i -e 's,/usr/bin/grep,/bin/grep,;s,/usr/bin/sed,/bin/sed,' %{buildroot}/etc/apparmor.d/usr.sbin.murmurd
%endif
install -d -m 0755 %{buildroot}%{_bindir}
# can be launched as user too but apparmor profile doesn't make
# sense in that case. So use link to avoid the profile.
ln -s %{_sbindir}/murmurd %{buildroot}%{_bindir}/murmurd
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 < /usr/lib/tmpfiles.d/mumble-server.conf
EOF
%endif
mkdir -p %buildroot/usr/lib/tmpfiles.d
cat >> %buildroot/usr/lib/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
%dir /etc/apparmor.d
/etc/apparmor.d/usr.sbin.murmurd
%{_sbindir}/rcmumble-server
%{_sbindir}/murmurd
%{_bindir}/murmurd
%{_bindir}/murmur-user-wrapper
%{_mandir}/man1/murmurd.*
%{_mandir}/man1/murmur-user-wrapper.*
%dir %attr(-,mumble-server,mumble-server) /var/lib/mumble-server
%dir /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
%dir /usr/lib/tmpfiles.d
%config /usr/lib/tmpfiles.d/mumble-server.conf
%endif

%changelog