File cfengine.spec of Package cfengine

#
# spec file for package cfengine
#
# Copyright (c) 2011 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:           cfengine
%define         libname   libpromises
%define         libsoname %{libname}1

Summary:        A Tool to Maintain Complicated Networks
Version:        3.2.1
Release:        1
License:        GPLv2+
Group:          Productivity/Networking/System
Url:            http://www.cfengine.org/
Source:         %{name}-%{version}.tar.gz
Source1:        http://www.cfengine.org/manuals/cf3-Reference.pdf
Source2:        cf-monitord
Source3:        cf-execd
Source4:        cf-serverd
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bison
BuildRequires:  db-devel
BuildRequires:  flex
BuildRequires:  libtool
BuildRequires:  mysql-devel
BuildRequires:  openssl-devel
BuildRequires:  pcre-devel
BuildRequires:  postgresql-devel

%if 0%{?suse_version}
PreReq:         %install_info_prereq
BuildRequires:  texlive
%endif

%description
GNU cfengine is an abstract programming language for system
administrators of huge heterogeneous networks. With cfengine, system
administrators have an easy and elegant way to maintain complicated
networks.

%package -n %{libsoname}
Summary:        Shared library of cfengine
Group:          System/Libraries

%description -n %{libsoname}
This package contains the shared libpromises (cfengine) library.

%package devel
Summary:        Development package for cfengine
Group:          Development/Libraries/C and C++
Requires:       %{libsoname} = %{version}
Requires:       glibc-devel

%description devel
A high-speed character set detection library
 
This package contains the files needed to compile programs that use the
libguess library.

%package doc
Summary:        A Tool to Maintain Complicated Networks (docs)
Group:          Productivity/Networking/System
%if 0%{?rhel_version} || 0%{?centos_version}
BuildRequires:  texinfo
BuildRequires:  tetex tetex-dvips tetex-latex
%endif

%description doc
Full documentation for cfengine


%prep
%setup -q
##### rpmlint
#### wrong-file-end-of-line-encoding
#### incorrect-fsf-address
### http://www.fsf.org/about/contact/
find ./examples -type f -name "*.cf" -exec perl -p -i -e 's|\r\n|\n|,s|^# Foundation.*|# Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA|' {} \;

%build
%if 0%{?suse_version}
%{suse_update_config -f}
%endif
#autoreconf -fi
CC=gcc CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
%configure \
 --disable-static \
 --docdir=%{_docdir}/%{name} \
 --with-workdir=/var/lib/%{name}
%{__make} %{?_smp_mflags}

# --datadir=/var/lib/%{name}/inputs \

%install
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
[ -d %{buildroot} ] && [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%endif
%{__make} "DESTDIR=%{buildroot}" install
%{__install} -d %{buildroot}/{usr/sbin,etc/init.d,/var/lib/%{name}/bin}

# install missing AUTHORS LICENSE {S:1}
%{__install} -m0644 AUTHORS LICENSE %{S:1} %{buildroot}/%{_docdir}/%{name}/

# install init scripts
%{__install} -m 0755 %{S:2} %{S:3} %{S:4} %{buildroot}/etc/init.d/
%{__ln_s} -f ../../etc/init.d/cf-monitord %{buildroot}/%{_sbindir}/rccf-monitord
%{__ln_s} -f ../../etc/init.d/cf-execd %{buildroot}/%{_sbindir}/rccf-execd
%{__ln_s} -f ../../etc/init.d/cf-serverd %{buildroot}/%{_sbindir}/rccf-serverd
%{__ln_s} -f ../../../..%{_sbindir}/cf-promises %{buildroot}/var/lib/%{name}/bin/cf-promises

## FIXME: what is the purpose of theses libs ?
## are they really needed ?
#rm -rf %{buildroot}/%{_libdir}/libpromises.la
#{__rm} -rf %{buildroot}/%{_libdir}/libpromises.a

%preun
%stop_on_removal cf-monitord
%stop_on_removal cf-serverd
%stop_on_removal cf-execd

%post
%if 0%{?suse_version}
%if 0%{?suse_version} > 1010
%install_info --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%else
:
%endif
%else
%install_info --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%endif
/sbin/ldconfig

%postun
%if 0%{?suse_version}
%if 0%{?suse_version} > 1010
%install_info_delete --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%else
:
%endif
%else
%install_info_delete --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%endif
%insserv_cleanup
/sbin/ldconfig
for i in execd monitord serverd; do
  %restart_on_update cf-${i}
done

%post   -n %{libsoname} -p /sbin/ldconfig

%postun -n %{libsoname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%{_docdir}/%{name}/LICENSE
%exclude %{_docdir}/%{name}/AUTHORS
%exclude %{_docdir}/%{name}/ChangeLog
%exclude %{_docdir}/%{name}/README
%exclude %{_docdir}/%{name}/example_config
%exclude %{_docdir}/%{name}/examples
/usr/sbin/*
%{_datadir}/%{name}
%{_mandir}/man?/*
%dir /var/lib/%{name}
/var/lib/%{name}/*
%config %attr(0755,root,root) /etc/init.d/*

%files -n %{libsoname}
%defattr(-,root,root)
%{_libdir}/%{libname}.la
%{_libdir}/%{libname}.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/%{libname}.so

%files doc
%defattr(-,root,root)
%{_docdir}/%{name}
%exclude %{_docdir}/%{name}/LICENSE

%changelog
openSUSE Build Service is sponsored by