File libinfinity.spec of Package libinfinity

#
# spec file for package libinfinity (Version 0.4.2)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           libinfinity
BuildRequires:  fdupes
BuildRequires:  gettext-devel
BuildRequires:  glib2-devel
BuildRequires:  gnutls-devel
BuildRequires:  gtk-doc
BuildRequires:  gtk2-devel
BuildRequires:  libavahi-devel
BuildRequires:  libdaemon-devel
BuildRequires:  libgsasl-devel
BuildRequires:  libxml2-devel
License:        LGPLv2.1+
Group:          Development/Libraries/GNOME
Version:        0.4.2
Release:        1
%define _version 0.4
Summary:        Implementation of the Infinote collaborative editing protocol
Source0:        %{name}-%{version}.tar.bz2
Source1:        infinoted.init
Source2:        infinoted.sysconfig
Source3:        infinoted.conf
Patch0:         infinoted-add-conf-subdir.patch
Url:            http://gobby.0x539.de/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
libinfinity is an implementation of the Infinote protocol written in
GObject-based C. Infinote is a protocol for collaborative editing
multiple documents and is portable to both Windows and Unix-like
platforms.

%package -n libinfinity-1_0-0
License:        LGPLv2.1+
Summary:        Implementation of the Infinote collaborative editing protocol
Group:          Development/Libraries/GNOME
Recommends:     %{name}-lang
# Needed to make lang package installable
Provides:       %{name} = %{version}

%description -n libinfinity-1_0-0
libinfinity is an implementation of the Infinote protocol written in
GObject-based C. Infinote is a protocol for collaborative editing
multiple documents and is portable to both Windows and Unix-like
platforms.

%package devel
License:        LGPLv2.1+
Summary:        Implementation of the Infinote collaborative editing protocol
Group:          Development/Libraries/GNOME
Requires:       libinfinity-1_0-0 = %{version}
Requires:       glib2-devel
Requires:       gtk2-devel
Requires:       libgnutls-devel
Requires:       libgsasl-devel
Requires:       libxml2-devel

%description devel
libinfinity is an implementation of the Infinote protocol written in
GObject-based C. Infinote is a protocol for collaborative editing
multiple documents and is portable to both Windows and Unix-like
platforms.

%package -n infinoted
License:        LGPLv2.1+
Summary:        Server for Collaborative Document Edition
Group:          Development/Libraries/GNOME
Requires:       libinfinity-1_0-0 = %{version}

%description -n infinoted
Infinoted is a server for collaborative edition of documents via the
Infinote protocol. It is typically used with Gobby as a client.

%lang_package
%prep
%setup -q
%patch0 -p1

%build
# -fno-strict-aliasing added 2009-05-07. Need for 0.3.0 -- vuntz
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure --disable-static --with-pic
make %{?jobs:-j%jobs}

%install
%makeinstall
%find_lang %{name}-%{_version}
find %{buildroot} -type f -name "*.la" -exec %{__rm} -fv {} +
# Create init.d files
install -D -m 0755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/infinoted
install -d -m 0755 %{buildroot}%{_sbindir}
ln -s %{_sysconfdir}/init.d/infinoted %{buildroot}%{_sbindir}/rcinfinoted
# Create sysconfig data
install -D -m 0644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.infinoted  
install -d -m 0755 %{buildroot}/srv/infinoted
# Create infinoted default configuration
install -d -m 0755 %{buildroot}%{_sysconfdir}/xdg/infinoted
install -D -m 0644 %{S:3} %{buildroot}%{_sysconfdir}/xdg/infinoted/infinoted.conf
# Note: the infinoted binary is versioned, and we could use update-alternatives
# to provide it also non-versioned. However, the init.d, sysconfig and xdg
# config files are not versioned, and it will actually be bad for the user to
# have them versioned (potential loss of configuration, for example). So let's
# just unversion the binary.
mv %{buildroot}%{_bindir}/infinoted-%{_version} %{buildroot}%{_bindir}/infinoted
%fdupes $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%post -n libinfinity-1_0-0 -p /sbin/ldconfig

%post -n infinoted
%{fillup_only -n infinoted}

%preun -n infinoted
%stop_on_removal infinoted

%postun -n libinfinity-1_0-0 -p /sbin/ldconfig

%postun -n infinoted
%restart_on_update infinoted
%insserv_cleanup

%files -n libinfinity-1_0-0
%defattr (-, root, root)
%doc AUTHORS COPYING ChangeLog NEWS README TODO
%{_libdir}/libinf*.so.*
# Only needed for the test applications, it seems
%exclude %{_datadir}/icons/hicolor/*/apps/infinote.*

%files devel
%defattr (-, root, root)
%{_includedir}/libinf*
%{_libdir}/libinf*.so
%{_libdir}/pkgconfig/libinf*.pc
%{_datadir}/gtk-doc/html/*

%files -n infinoted
%defattr (-, root, root)
%{_bindir}/infinoted
%{_libdir}/infinoted-%{_version}
# default configuration
%dir %{_sysconfdir}/xdg/infinoted
%config(noreplace) %{_sysconfdir}/xdg/infinoted/infinoted.conf
# init.d files
%{_sysconfdir}/init.d/infinoted
%{_sbindir}/rcinfinoted
# sysconfig data
%{_localstatedir}/adm/fillup-templates/sysconfig.infinoted
%dir /srv/infinoted

%files lang -f %{name}-%{_version}.lang

%changelog