LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File couchdb.spec of Package couchdb (Project server:database)

#
# spec file for package couchdb
#
# 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/
#


#
%define couchdb_user couchdb
%define couchdb_group couchdb
%define couchdb_home %{_localstatedir}/lib/couchdb

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
Source2:        %{name}.sysconfig
Patch0:         couchdb-futon-default-view-language.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  automake
BuildRequires:  erlang
BuildRequires:  gcc-c++
BuildRequires:  help2man
BuildRequires:  libicu-devel
BuildRequires:  libtool
%if 0%{?suse_version} < 1200
BuildRequires:  mozilla-xulrunner192-devel
%else
BuildRequires:  js-devel
%endif
BuildRequires:  pkgconfig
Requires:       erlang
Requires:       logrotate
Requires(post): aaa_base
Requires(preun):aaa_base
# Users and groups
Requires(pre):  pwdutils
PreReq:         %insserv_prereq %fillup_prereq

%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

%build
autoreconf -fi

# Versions of SpiderMonkey after the js185-1.0.0 release remove the optional
# enforcement of preventing anonymous functions in a statement context. This
# will most likely break your existing JavaScript code as well as render all
# example code invalid.
# If you wish to ignore this error pass --enable-js-trunk to ./configure.
#
# We need to define the use of gnu99 standard. It seems expected in the code, but not passed.
export CFLAGS="%{optflags} -std=gnu99"
%configure --enable-js-trunk
make %{?_smp_mflags}

%install
%makeinstall
## Install couchdb initscript
install -D -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}
install -d %{buildroot}%{_sbindir}
ln -s %{_initddir}/couchdb %{buildroot}%{_sbindir}/rccouchdb
# Sysconfig template
mkdir -p %{buildroot}%{_var}/adm/fillup-templates/
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_var}/adm/fillup-templates/sysconfig.couchdb
# Create needed directories
install -d %{buildroot}%{_localstatedir}/{log,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} || :
if getent passwd %{couchdb_user} >/dev/null ; then
    # There was a bad login shell up to openSUSE 12.2 (bnc#796242), SLE11SP2 used /bin/bash. Fix it.
    usermod -s /usr/sbin/nologin %{couchdb_user} || :
else
    useradd -r -g %{couchdb_group} -d %{couchdb_home} -s /usr/sbin/nologin \
    -c "Couchdb Database Server" %{couchdb_user} || :
fi

%post
%{fillup_and_insserv couchdb}
mkdir -p %{_localstatedir}/run/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
%{_var}/adm/fillup-templates/sysconfig.couchdb
%{_sbindir}/rccouchdb
%{_bindir}/*
%{_libdir}/couchdb
%{_datadir}/couchdb
%{_mandir}/man1/*
%dir %attr(0755, %{couchdb_user}, root) %{_localstatedir}/log/couchdb
%ghost %dir %attr(0755, %{couchdb_user}, root) %{_localstatedir}/run/couchdb
%dir %attr(0755, %{couchdb_user}, root) %{_localstatedir}/lib/couchdb

%changelog