File icecast.spec of Package icecast
#
# spec file for package icecast
#
# Copyright (c) 2013 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/
#
Name: icecast
Version: 2.3.3
Release: 0
Summary: Audio Streaming Server
License: GPL-2.0+
Group: Productivity/Networking/Web/Servers
Url: http://www.icecast.org/
Source: http://downloads.xiph.org/releases/icecast/icecast-%{version}.tar.gz
Source1: icecast.init
Source2: icecast.service
Source3: icecast.logrotate
Source99: icecast.rpmlintrc
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0: icecast-2.3.1_runas_icecast_user.patch
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch1: icecast-fix-no-add-needed.patch
Patch2: icecast-2.3.2-CVE-2011-4612.diff
Patch3: icecast-add_pidfile_directive.patch
Patch4: http://data.gpo.zugaina.org/gentoo/net-misc/icecast/files/icecast-2.3.3-libkate.patch
Patch5: http://data.gpo.zugaina.org/gentoo/net-misc/icecast/files/icecast-2.3.3-fix-xiph_openssl.patch
BuildRequires: curl-devel
BuildRequires: libtheora-devel
BuildRequires: libtool
BuildRequires: libvorbis-devel
BuildRequires: libxslt-devel
BuildRequires: openssl-devel
BuildRequires: speex-devel
%if 0%{?suse_version} >= 1140
%if 0%{?suse_version} > 1220
%define _unitdir /usr/lib/systemd
%else
%define _unitdir /lib/systemd
%endif
BuildRequires: systemd
%{?systemd_requires}
%endif
PreReq: %fillup_prereq
PreReq: %insserv_prereq
PreReq: /usr/sbin/groupadd
PreReq: /usr/sbin/useradd
Recommends: logrotate
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Icecast is a MP3 and OGG streaming server able to serve many clients
with MP3 and OGG audio.
%package doc
Summary: Documentation for Icecast
Group: Documentation/Other
%description doc
Icecast is a MP3 and OGG streaming server able to serve many clients
with MP3 and OGG audio.
This package contains the upstream HTML documentation and the sample
configuration files from upstream.
%prep
%setup -q
%patch0
%patch1
%patch2
%patch3
%patch4 -p1
%patch5 -p1
%build
autoreconf -fiv
%configure
make
%install
make install DESTDIR=%{buildroot}
rm -rf %{buildroot}%{_datadir}/doc/%{name}
# init script
install -d -m 0755 %{buildroot}%{_sbindir}
install -D -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{name}
ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
%if 0%{?suse_version} >= 1140
# service file
install -d "%{buildroot}%{_unitdir}/system"
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/system/icecast.service
%endif
# create missing dirs
install -d -m 0755 %{buildroot}%{_localstatedir}/{lib,log}/%{name}
# logrotate
install -D -m 0644 %{SOURCE3} %{buildroot}/etc/logrotate.d/%{name}
D=%{buildroot}%{_docdir}/%{name}
install -d "$D"
cp -a README AUTHORS COPYING NEWS TODO ChangeLog "$D/"
cp -a doc/*.{html,jpg,css} "$D/"
cp -a conf/*.dist "$D/"
%clean
%{?buildroot:%__rm -rf %{buildroot}}
%pre
/usr/sbin/groupadd -r %{name} &>/dev/null || :
/usr/sbin/useradd -g %{name} -s /bin/false -r -c "Icecast streaming server" -d %{_localstatedir}/lib/%{name} %{name} &>/dev/null || :
%if 0%{?suse_version} > 1140
%service_add_pre %{name}.service
%endif
%preun
%stop_on_removal %{name}
%if 0%{?suse_version} > 1140
%service_del_preun %{name}.service
%endif
%post
%fillup_and_insserv %{name}
%if 0%{?suse_version} > 1140
%service_add_post %{name}.service
%endif
%postun
%restart_on_update %{name}
%insserv_cleanup
%if 0%{?suse_version} > 1140
%service_del_postun %{name}.service
%endif
%files
%defattr(-,root,root)
%dir %doc %{_docdir}/%{name}
%doc %{_docdir}/%{name}/README
%doc %{_docdir}/%{name}/AUTHORS
%doc %{_docdir}/%{name}/COPYING
%doc %{_docdir}/%{name}/NEWS
%doc %{_docdir}/%{name}/TODO
%doc %{_docdir}/%{name}/ChangeLog
%config(noreplace) %attr(640,root,%{name}) %{_sysconfdir}/%{name}.xml
%config(noreplace) /etc/logrotate.d/%{name}
%{_bindir}/icecast
%{_datadir}/icecast
%{_sbindir}/rc%{name}
%{_sysconfdir}/init.d/%{name}
%if 0%{?suse_version} >= 1140
%config %{_unitdir}/system/%{name}.service
%endif
# TODO: enable chroot support in this dir
%{_localstatedir}/lib/%{name}
%attr(750,%{name},%{name}) %{_localstatedir}/log/%{name}
%files doc
%defattr(-,root,root)
%dir %doc %{_docdir}/%{name}
%doc %{_docdir}/%{name}/*.html
%doc %{_docdir}/%{name}/*.jpg
%doc %{_docdir}/%{name}/*.css
%doc %{_docdir}/%{name}/*.dist
%changelog