You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
7.1 KiB

13 years ago
##
## arangodb.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2016 OpenPKG Foundation e.V. <http://openpkg.net/>
13 years ago
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_opkg 2.8.9
%define V_tarball 2.8.9
13 years ago
# package information
Name: arangodb
Summary: Document/Graph/Key-Value Database
URL: http://www.arangodb.org/
Vendor: triAGENS GmbH
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: Database
License: Apache
Version: %{V_opkg}
10 years ago
Release: 20160516
13 years ago
# list of sources
Source0: https://github.com/arangodb/arangodb/archive/v%{V_tarball}.tar.gz
13 years ago
Source1: rc.arangodb
Source2: arangod.conf
Source3: arangosh.conf
13 years ago
Patch0: arangodb.patch
# build information
10 years ago
BuildPreReq: OpenPKG, openpkg >= 20160101, gcc, gcc::with_cxx = yes, bison
10 years ago
PreReq: OpenPKG, openpkg >= 20160101
BuildPreReq: readline, ncurses, openssl, icu, libexecinfo
PreReq: readline, ncurses, openssl, icu, libexecinfo
13 years ago
%description
10 years ago
ArangoDB is a distributed database with four main features:
Multi-Model: documents, graphs and key-value pairs -— model your
data as you see fit for your application; Joins: conveniently join
what belongs together for flexible ad-hoc querying, less data
redundancy; Transactions: easy application development keeping your
data consistent and safe. No hassle in your client; Query Language:
use the SQL-like ArangoDB Query Language (AQL) for powerful data
retrival.
13 years ago
%track
prog arangodb = {
version = %{version}
url = https://github.com/arangodb/arangodb/releases
regex = v(\d+\.\d+\.\d+)\.tar\.gz
13 years ago
}
%prep
%setup -q -n arangodb-%{V_tarball}
13 years ago
%patch -p0
%build
# do not use -ldl on non-Linux platforms
case "%{l_platform -t}" in
*-linux* ) ;;
10 years ago
* ) %{l_shtool} subst -e 's;-ldl;;g' configure m4/external.openssl ;;
esac
# patch sources
%{l_shtool} subst \
-e 's;/bin/bash;%{l_bash};g' \
3rdParty/V8-*/build/gyp/gyp
10 years ago
%{l_shtool} subst \
-e 's;-O3;-O2;g' \
-e 's; -g ; ;g' \
Makefile.in
# provide tools as it is too hard to pass the correct flags
# to all sub-directory build processes of ArangoDB
mkdir tool
( echo "#!/bin/sh"
echo "exec %{l_prefix}/bin/cc -std=gnu11 %{l_cflags -O} %{l_cppflags} %{l_ldflags} \${1+\"\$@\"}"
) >tool/cc
( echo "#!/bin/sh"
10 years ago
echo "exec %{l_prefix}/bin/c++ -D_GLIBCXX_USE_C99 -std=gnu++14 %{l_cxxflags -O} %{l_cppflags} %{l_ldflags} \${1+\"\$@\"}"
) >tool/c++
chmod a+x tool/*
PATH=`pwd`/tool:$PATH
# configure program
CC="cc" \
CXX="c++" \
CFLAGS="" \
CXXFLAGS="" \
CPPFLAGS="" \
LDFLAGS="" \
13 years ago
LIBS="-lcrypto -lncurses -lexecinfo -lm" \
AUTOMAKE="true" \
AUTOCONF="true" \
ACLOCAL="true" \
13 years ago
./configure \
--prefix=%{l_prefix} \
--mandir=%{l_prefix}/man \
--with-readline=%{l_prefix} \
--with-openssl-inc=%{l_prefix}/include \
--with-openssl-lib=%{l_prefix}/lib \
10 years ago
--disable-all-in-one-etcd \
--enable-console \
--enable-logger
13 years ago
# build program
%{l_make} %{l_mflags -O}
%install
# install program
%{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
# post-adjust installation
10 years ago
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
13 years ago
rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/log >/dev/null 2>&1 || true
# install default configuration
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/arangodb/*
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE arangod.conf} \
%{SOURCE arangosh.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/arangodb/
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.arangodb} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# create run-time directory
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/arangodb/apps \
13 years ago
$RPM_BUILD_ROOT%{l_prefix}/var/arangodb/db \
$RPM_BUILD_ROOT%{l_prefix}/var/arangodb/log \
$RPM_BUILD_ROOT%{l_prefix}/var/arangodb/run
13 years ago
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
13 years ago
'%config %{l_prefix}/etc/arangodb/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/arangodb/*'
13 years ago
%files -f files
%clean
13 years ago
%post
if [ $1 -eq 1 ]; then
# display information about next steps
( echo "After initially starting ArangoDB with..."
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc arangodb start"
10 years ago
echo "...you should immediately set a root password:"
echo " \$ echo 'require(\"org/arangodb/users\").update(\"root\", \"<root-pw>\");' | \\%{l_nil}"
echo " $RPM_INSTALL_PREFIX/bin/arangosh --server.disable-authentication true"
echo "You can then create an user account:"
echo " \$ echo 'u = require(\"org/arangodb/users\"); \\%{l_nil}"
echo " u.save(\"<user-name>\", \"<user-pw>\"); u.reload();' | \\%{l_nil}"
echo " $RPM_INSTALL_PREFIX/bin/arangosh \\%{l_nil}"
echo " --server.username root --server.password <root-pw>"
echo "The web interface of ArangoDB you can reach under:"
echo " http://localhost:8529/"
13 years ago
) | %{l_rpmtool} msg -b -t notice
fi
if [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} arangodb status 2>/dev/null`
[ ".$arangodb_active" = .yes ] && %{l_rc} mongodb restart
fi
exit 0
%preun
# before erase, stop service and remove log files
if [ $1 -eq 0 ]; then
%{l_rc} arangodb stop 2>/dev/null
10 years ago
rm -f $RPM_INSTALL_PREFIX/var/arangodb/run/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/arangodb/log/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/arangodb/db/* >/dev/null 2>&1 || true
13 years ago
fi
exit 0