File couchdb.spec of Package couchdb
#
# spec file for package couchdb
#
# 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/
#
#
%define couchdb_user couchdb
%define couchdb_group couchdb
%define couchdb_home %{_localstatedir}/lib/couchdb
%define xul_version 192
%define xul_pathext /
%if 0%{?suse_version} == 1120
%define xul_version 191
%define xul_pathext /unstable
%endif
%if 0%{?suse_version} == 1130
%define xul_version 192
%define xul_pathext /
%endif
Name: couchdb
Version: 1.2.0
Release: 0
Summary: A document database server, accessible via a RESTful JSON API
License: Apache-2.0
Group: Productivity/File utilities
Url: http://couchdb.apache.org/
Source0: http://www.apache.org/dist/%{name}/releases/%{version}/apache-couchdb-%{version}.tar.gz
Source1: %{name}.init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: automake
BuildRequires: erlang
BuildRequires: gcc-c++
BuildRequires: help2man
BuildRequires: libcurl-devel
BuildRequires: libicu-devel
BuildRequires: libtool
%if %suse_version > 1210
BuildRequires: js-devel
BuildRequires: xulrunner-devel
%else
BuildRequires: mozilla-xulrunner%{xul_version}-devel
%endif
BuildRequires: pkgconfig
Requires: erlang
#Requires: %%{_bindir}/icu-config
#Requires: libicu-devel
# Require the proper mozilla-js (do not rely on the autoprovreq found libmozjs)
%if 0%{?suse_version} > 1210
Requires: js
%else
%if 0%{?suse_version} < 1130
Requires: mozilla-xulrunner%{xul_version}
%else
Requires: mozilla-js%{xul_version}
%endif
%endif
Requires: logrotate
Requires(post): aaa_base
Requires(preun):aaa_base
# Users and groups
Requires(pre): pwdutils
%description
Apache CouchDB is a distributed, fault-tolerant and schema-free
document-oriented database accessible via a RESTful HTTP/JSON API.
Among other features, it provides robust, incremental replication
with bi-directional conflict detection and resolution, and is
queryable and indexable using a table-oriented view engine with
JavaScript acting as the default view definition language.
%prep
%setup -q -n apache-couchdb-%{version}
#%patch0 -p1
%build
#autoreconf -fi
# We need to define the use of gnu99 standard. It seems expected in the code, but not passed.
export CFLAGS="%{optflags} -std=gnu99"
%configure \
--with-js-include=$(pkg-config --variable=includedir mozjs185) \
--with-js-lib=$(pkg-config --variable=libdir mozjs185)
make %{?_smp_mflags}
%install
%make_install
## Install couchdb initscript
install -D -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}
install -d %{buildroot}%{_sbindir}
ln -s %{_initddir}/couchdb %{buildroot}%{_sbindir}/rccouchdb
# Create needed directories
install -d %{buildroot}%{_localstatedir}/{log,run,lib}/couchdb
install -d %{buildroot}%{_sysconfdir}/couchdb/{default.d,local.d}
# Remove unecessary files
rm %{buildroot}%{_sysconfdir}/rc.d/couchdb
rm -rf %{buildroot}%{_datadir}/doc/couchdb
# clean-up .la archives
find %{buildroot} -name '*.la' -delete -print
%pre
getent group %{couchdb_group} >/dev/null || groupadd -r %{couchdb_group}
getent passwd %{couchdb_user} >/dev/null || \
useradd -r -g %{couchdb_group} -d %{couchdb_home} -s /bin/bash \
-c "Couchdb Database Server" %{couchdb_user}
exit 0
%post
%{fillup_and_insserv couchdb}
%postun
%restart_on_update couchdb
%insserv_cleanup
%preun
%stop_on_removal couchdb
%files
%defattr(-,root,root,-)
%doc AUTHORS BUGS CHANGES LICENSE NEWS NOTICE README THANKS
%dir %{_sysconfdir}/couchdb
%dir %{_sysconfdir}/couchdb/local.d
%dir %{_sysconfdir}/couchdb/default.d
%config(noreplace) %attr(0644, %{couchdb_user}, root) %{_sysconfdir}/couchdb/default.ini
%config(noreplace) %attr(0644, %{couchdb_user}, root) %{_sysconfdir}/couchdb/local.ini
%config(noreplace) %{_sysconfdir}/default/couchdb
%config(noreplace) %{_sysconfdir}/logrotate.d/couchdb
%{_initddir}/couchdb
%{_sbindir}/rccouchdb
%{_bindir}/*
%{_libdir}/couchdb
%{_datadir}/couchdb
%{_mandir}/man1/*
%dir %attr(0755, %{couchdb_user}, root) %{_localstatedir}/log/couchdb
%dir %attr(0755, %{couchdb_user}, root) %{_localstatedir}/run/couchdb
%dir %attr(0755, %{couchdb_user}, root) %{_localstatedir}/lib/couchdb
%changelog