From 1f055ddab5e517557a42a53979fd57435bcdde51 Mon Sep 17 00:00:00 2001 From: mkrull Date: Wed, 7 Aug 2013 17:26:05 +0000 Subject: added riak ebuild - bug #425132 --- dev-db/riak/ChangeLog | 12 ++ dev-db/riak/Manifest | 9 ++ dev-db/riak/files/1.4.1-fix-directories.patch | 39 +++++++ dev-db/riak/files/1.4.1-honor-cflags.patch | 155 ++++++++++++++++++++++++++ dev-db/riak/files/riak.confd | 6 + dev-db/riak/files/riak.initd | 114 +++++++++++++++++++ dev-db/riak/metadata.xml | 7 ++ dev-db/riak/riak-1.4.1.ebuild | 148 ++++++++++++++++++++++++ 8 files changed, 490 insertions(+) create mode 100644 dev-db/riak/ChangeLog create mode 100644 dev-db/riak/Manifest create mode 100644 dev-db/riak/files/1.4.1-fix-directories.patch create mode 100644 dev-db/riak/files/1.4.1-honor-cflags.patch create mode 100644 dev-db/riak/files/riak.confd create mode 100644 dev-db/riak/files/riak.initd create mode 100644 dev-db/riak/metadata.xml create mode 100644 dev-db/riak/riak-1.4.1.ebuild (limited to 'dev-db') diff --git a/dev-db/riak/ChangeLog b/dev-db/riak/ChangeLog new file mode 100644 index 000000000..4cc219837 --- /dev/null +++ b/dev-db/riak/ChangeLog @@ -0,0 +1,12 @@ +# ChangeLog for dev-db/riak +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +*riak-1.4.1 (19 Aug 2013) + + 19 Aug 2013; mkrull +files/1.4.1-fix-directories.patch, +riak-1.4.1.ebuild, + +files/riak.confd, +files/riak.initd, +files/1.4.1-honor-cflags.patch, + +metadata.xml: + New ebuild for bug #425132 + + diff --git a/dev-db/riak/Manifest b/dev-db/riak/Manifest new file mode 100644 index 000000000..7e36f12d0 --- /dev/null +++ b/dev-db/riak/Manifest @@ -0,0 +1,9 @@ +AUX 1.4.1-fix-directories.patch 1366 SHA256 4230c9c96a349f35dd46e8c06fc8448e5b33173c372710c660bcff84a47ebff3 SHA512 aebaa5ce28a4547f80dd083f503855acaade0aacee710fecca7e0043f1dc761365c6d9506dda5612e2bc972d22f4d1f34ac488572e3fd098325a47a2f18554d2 WHIRLPOOL 1040c4d7d40dc07a498c099d44e5c028e2e5b7a6ff847343724e321b04b72ccf08c9ccf24cb361a7dca3ccc05fd99a89eb1839e5a16ea55aa47128276d0f4edc +AUX 1.4.1-honor-cflags.patch 5054 SHA256 155cd51c4724dbedd6cf9612e5e3c3f5333bb3cd695bda435ddadc819de35163 SHA512 212897135232130a6bb099155fdf9ff01bc55a44f458b22214e9b6575d6188f670533217cc29df5de06e68439899815c340e600f439070fad81b02a36ee9ac55 WHIRLPOOL 76efc38ce6d5a3723379939bac4d1e05f925a9881eba1c864f2880ea3f2dd3e898cead574c72eee7638983dd61b68c7b8884b6485a276f48c3c2c790b3dcb014 +AUX riak.confd 221 SHA256 bb0cfc525cd2b9658c94aceaadeab4bbadc705ae33e5001a5de6c2b2b6376894 SHA512 0d02f6d5cfdaa663a9ee1ace01fa1b65531bf5fbc6dabc436607e258c5aa1a64f916003077418243cbd25907de98c5a05b41a22f3294ba4bd449e7876f54c3f4 WHIRLPOOL 2e983282405567f15abc5cc90095abbb20e93d95dc752888397bc44e454c256c286e55d3334247fc38da323412fb74fc5dcad93f2e445493f88543038defd4a5 +AUX riak.initd 2663 SHA256 aa64c6fc2ccb76fef6ffb71c633ed6697a8055e54df4857b1fb3cd9d36783e1d SHA512 021b776f2a468f046d87ec8920d0a50cf537b9e6b43a0f3822ecaa26e8af0e9951e9a62fdcaf7d8115952116b72729e0fb4eb3f18955d0964b793735dbf58dc1 WHIRLPOOL 12d355e218c94a52c6e9c1c32a84ebdc98cd5c1a3884edff7601436bb9e2e58726bf0731ec137ef842f6501ea253b018449af0ae13ffc90d5163bcc71af21e66 +DIST leveldb-1.4.1.tar.gz 260837 SHA256 f768af7306843e6db8481bbc56be2b68d1172e8d8e7612c6cb3b0e510906acd0 SHA512 e6600e8fd1e33584e2b772d47e9509394273b8983697fceb91c30a3373f0a65d7062b0856af862168cdb050a8ce90835e47107934c32749092a2b2ac8c9cd6a9 WHIRLPOOL 4130845af942d3751b83ddd60847ece71af2435ccd0f14d5233dd701ec430d5e033b4cb678da804e5ad4bbb18df4971bc199993c5fcbdd1858a6f07359b2abe3 +DIST riak-1.4.1.tar.gz 13423355 SHA256 7a5f3d79996c56b4bb3ffa6264580581f3230427920265aea7eb71dc3a83e6ed SHA512 ce5fc66fcf9bcbb7db4f0e4221cca18635b5c163132b265c02a6561ad6bba896cee47563aa9cd0ba8171af1bea03156955bfbd7fe3a02b13470ed632e58ffb68 WHIRLPOOL a1c0467900a7c846087a7dbc545fb56154bd2f0edfebbcf431573948273b6151bf486ab83c63d636ef979ccd14c961d423cbeced4e48cf2fe8d0753dc5e5a57d +EBUILD riak-1.4.1.ebuild 4116 SHA256 7bbb80174c7fe1fd4217fe8fe52d865f8f115162305d0baf2a3ccaa15216ad98 SHA512 2c2a61e74d5a05ba0e2137eec0c743734a9d2764acccf8ac1663262f138ff635d627bd336d3101ffba0da51e54e41c7d15d09051344f9b2a4c3cd7891202ee97 WHIRLPOOL 6781517f64d13d147eb34dc5514cec760edc845a1f4e587f5c0f30baa4542b7a5f6eef22c5c2a6b7633c988aabfc146214e4e69f63c2a08dc279b2fd7cca6b66 +MISC ChangeLog 338 SHA256 c39dfc019e47bc7fafe49d23a3f4a016d5881951af02b1539a86c296b797572b SHA512 a804067f210412880783245be33855430bc08c397fc152563fe06ab5a572d716f5cba4e09dce53e9421eb1a0f9b5b1861acfbf22ad09efd0869cb306fb1a0c8b WHIRLPOOL 7119faa58cd96f54f729a0d7b14f0ce6e704eb0adc232203c2cfef4251ee2189147b63ae8c17cb40f42ce521c08b59f7f11aaa002d55c11d63c54f3c93ecdaba +MISC metadata.xml 214 SHA256 c1f09dc7d5313cd2da7b82259c7846ed23144d62b15e59680ada90e2b6b4d154 SHA512 aeb2fb354a9ddf41c45a071091a58b91eaf8b25d6d2c49e3e3daa547b591a54530144de4533573160b48dc356289c909612c4e3c80e387f081f88cb39263e130 WHIRLPOOL 54d8861daedd18ca38e4ada0fb71026c612b63946d47a9b34de90d1d6d85c8ce05c0a4b97730f554ea637d73ccce8ed207d33e707c2b8c1dd28af24cf44dd186 diff --git a/dev-db/riak/files/1.4.1-fix-directories.patch b/dev-db/riak/files/1.4.1-fix-directories.patch new file mode 100644 index 000000000..ec75801ca --- /dev/null +++ b/dev-db/riak/files/1.4.1-fix-directories.patch @@ -0,0 +1,39 @@ +--- a/rel/vars.config 2013-08-04 06:44:05.000000000 +0000 ++++ b/rel/vars.config 2013-08-19 14:22:26.463290231 +0000 +@@ -2,11 +2,11 @@ + %% ex: ft=erlang ts=4 sw=4 et + + %% Platform-specific installation paths +-{platform_bin_dir, "./bin"}. +-{platform_data_dir, "./data"}. +-{platform_etc_dir, "./etc"}. +-{platform_lib_dir, "./lib"}. +-{platform_log_dir, "./log"}. ++{platform_bin_dir, "/usr/bin"}. ++{platform_data_dir, "/var/lib/riak"}. ++{platform_etc_dir, "/etc/riak"}. ++{platform_lib_dir, "/usr/lib/riak"}. ++{platform_log_dir, "/var/log/riak"}. + + %% + %% etc/app.config +@@ -47,12 +47,12 @@ + %% + %% bin/riak + %% +-{runner_script_dir, "$(cd ${0%/*} && pwd)"}. +-{runner_base_dir, "{{runner_script_dir}}/.."}. +-{runner_etc_dir, "$RUNNER_BASE_DIR/etc"}. +-{runner_log_dir, "$RUNNER_BASE_DIR/log"}. +-{runner_lib_dir, "$RUNNER_BASE_DIR/lib"}. +-{runner_patch_dir, "$RUNNER_BASE_DIR/lib/basho-patches"}. +-{pipe_dir, "/tmp/$RUNNER_BASE_DIR/"}. ++{runner_script_dir, "/usr/bin"}. ++{runner_base_dir, "{{platform_lib_dir}}"}. ++{runner_etc_dir, "{{platform_etc_dir}}"}. ++{runner_log_dir, "{{platform_log_dir}}"}. ++{runner_lib_dir, "{{platform_lib_dir}}"}. ++{runner_patch_dir, "{{platform_lib_dir}}/lib/basho-patches"}. ++{pipe_dir, "/tmp/riak"}. + {runner_user, ""}. + {runner_wait_process, "riak_core_node_watcher"}. diff --git a/dev-db/riak/files/1.4.1-honor-cflags.patch b/dev-db/riak/files/1.4.1-honor-cflags.patch new file mode 100644 index 000000000..2b819cfaf --- /dev/null +++ b/dev-db/riak/files/1.4.1-honor-cflags.patch @@ -0,0 +1,155 @@ +--- a/deps/eleveldb/rebar.config 2013-01-30 01:06:04.000000000 +0100 ++++ b/deps/eleveldb/rebar.config 2013-08-02 12:40:30.188055240 +0200 +@@ -5,9 +5,9 @@ + + {port_env, [ + %% Make sure to set -fPIC when compiling leveldb +- {"CFLAGS", "$CFLAGS -Wall -O3 -fPIC"}, +- {"CXXFLAGS", "$CXXFLAGS -Wall -O3 -fPIC"}, +- {"DRV_CFLAGS", "$DRV_CFLAGS -O3 -Wall -I c_src/leveldb/include"}, ++ {"CFLAGS", "$CFLAGS -fPIC"}, ++ {"CXXFLAGS", "$CXXFLAGS -fPIC"}, ++ {"DRV_CFLAGS", "$DRV_CFLAGS -I c_src/leveldb/include"}, + {"DRV_LDFLAGS", "$DRV_LDFLAGS c_src/leveldb/libleveldb.a c_src/system/lib/libsnappy.a -lstdc++"} + ]}. + +--- a/deps/eleveldb/c_src/leveldb/Makefile 2013-08-14 22:24:55.000000000 +0000 ++++ b/deps/eleveldb/c_src/leveldb/Makefile 2013-08-19 14:35:42.850310464 +0000 +@@ -9,9 +9,10 @@ + # Uncomment exactly one of the lines labelled (A), (B), and (C) below + # to switch between compilation modes. + +-OPT ?= -O2 -g -DNDEBUG # (A) Production use (optimized mode) ++# OPT ?= -O2 -g -DNDEBUG # (A) Production use (optimized mode) + # OPT ?= -g2 # (B) Debug mode, w/ full line-level debugging symbols + # OPT ?= -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols ++OPT ?= # (D) Honor system flags mode + #----------------------------------------------- + + # detect what platform we're building on + +--- a/deps/eleveldb/c_src/snappy-1.0.4/configure 2011-09-15 21:29:20.000000000 +0200 ++++ b/deps/eleveldb/c_src/snappy-1.0.4/configure 2013-08-08 12:10:58.335772573 +0200 +@@ -3930,13 +3930,13 @@ + CFLAGS=$ac_save_CFLAGS + elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then +- CFLAGS="-g -O2" ++ CFLAGS= + else + CFLAGS="-g" + fi + else + if test "$GCC" = yes; then +- CFLAGS="-O2" ++ CFLAGS= + else + CFLAGS= + fi +@@ -10934,13 +10934,13 @@ + CXXFLAGS=$ac_save_CXXFLAGS + elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then +- CXXFLAGS="-g -O2" ++ CXXFLAGS= + else + CXXFLAGS="-g" + fi + else + if test "$GXX" = yes; then +- CXXFLAGS="-O2" ++ CXXFLAGS= + else + CXXFLAGS= + fi +@@ -11319,13 +11319,13 @@ + CXXFLAGS=$ac_save_CXXFLAGS + elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then +- CXXFLAGS="-g -O2" ++ CXXFLAGS= + else + CXXFLAGS="-g" + fi + else + if test "$GXX" = yes; then +- CXXFLAGS="-O2" ++ CXXFLAGS= + else + CXXFLAGS= + fi + +--- a/deps/eleveldb/c_src/build_deps.sh 2013-01-30 01:06:04.000000000 +0100 ++++ b/deps/eleveldb/c_src/build_deps.sh 2013-08-08 12:26:50.878780564 +0200 +@@ -56,10 +56,9 @@ + *) + if [ ! -d snappy-$SNAPPY_VSN ]; then + tar -xzf snappy-$SNAPPY_VSN.tar.gz +- (cd snappy-$SNAPPY_VSN && ./configure --prefix=$BASEDIR/system --with-pic) + fi + +- (cd snappy-$SNAPPY_VSN && $MAKE && $MAKE install) ++ (cd snappy-$SNAPPY_VSN && ./configure --prefix=$BASEDIR/system --with-pic && $MAKE && $MAKE install) + + export CFLAGS="$CFLAGS -I $BASEDIR/system/include" + export CXXFLAGS="$CXXFLAGS -I $BASEDIR/system/include" + +--- a/deps/erlang_js/c_src/Makefile 2013-01-29 21:13:01.000000000 +0100 ++++ b/deps/erlang_js/c_src/Makefile 2013-08-08 11:38:12.687204467 +0200 +@@ -25,20 +25,18 @@ + js: $(LIB_DIR)/libjs.a + + $(LIB_DIR)/libjs.a: $(LIB_DIR)/libnspr4.a +- $(GUNZIP) -c js-$(SMONKEY_VER).tar.gz | $(TAR) xf - + @for I in patches/js-*.patch; do \ + ($(PATCH) -p1 < $${I} || echo "Skipping patch"); \ + done +- @$(MAKE) -C $(JS_DIR)/src BUILD_OPT=1 JS_DIST=$(SYSTEM_DIR) \ ++ @$(MAKE) -C $(JS_DIR)/src JS_DIST=$(SYSTEM_DIR) \ + JS_THREADSAFE=1 \ + XCFLAGS="-DHAVE_VA_COPY -DVA_COPY=va_copy $(CFLAGS)" \ +- XLDFLAGS="$(LDFLAGS)" \ + -f Makefile.ref + @mkdir $(INC_DIR)/js + @cp $(JS_DIR)/src/*.h $(INC_DIR)/js + @cp $(JS_DIR)/src/*.tbl $(INC_DIR)/js +- @cp $(JS_DIR)/src/*_OPT.OBJ/*.h $(INC_DIR)/js +- @cp $(JS_DIR)/src/*_OPT.OBJ/libjs.a $(LIB_DIR) ++ @cp $(JS_DIR)/src/*_DBG.OBJ/*.h $(INC_DIR)/js ++ @cp $(JS_DIR)/src/*_DBG.OBJ/libjs.a $(LIB_DIR) + + $(LIB_DIR)/libnspr4.a: + $(GUNZIP) -c nsprpub-$(NSPR_VER).tar.gz | $(TAR) xf - +@@ -46,7 +44,7 @@ + ($(PATCH) -p1 < $${I} || echo "Skipping patch"); \ + done + (cd $(NSPR_DIR) && \ +- ./configure --disable-debug --enable-optimize \ ++ ./configure --disable-debug \ + --prefix=$(SYSTEM_DIR) $(NSPR_SIXTYFOUR) && \ + $(MAKE) all install) + +--- a/deps/erlang_js/c_src/js/src/config.mk 2008-03-12 15:36:06.000000000 +0100 ++++ b/deps/erlang_js/c_src/js/src/config.mk 2013-08-08 11:27:26.308232045 +0200 +@@ -122,8 +122,8 @@ + INTERP_OPTIMIZER = -O2 -GL + LDFLAGS += -LTCG + else +-OPTIMIZER = -Os +-INTERP_OPTIMIZER = -Os ++OPTIMIZER = ++INTERP_OPTIMIZER = + endif + DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(USER) + OBJDIR_TAG = _OPT +@@ -132,8 +132,8 @@ + OPTIMIZER = -Zi + INTERP_OPTIMIZER = -Zi + else +-OPTIMIZER = -g3 +-INTERP_OPTIMIZER = -g3 ++OPTIMIZER = ++INTERP_OPTIMIZER = + endif + DEFINES += -DDEBUG -DDEBUG_$(USER) + OBJDIR_TAG = _DB diff --git a/dev-db/riak/files/riak.confd b/dev-db/riak/files/riak.confd new file mode 100644 index 000000000..eeb7773b3 --- /dev/null +++ b/dev-db/riak/files/riak.confd @@ -0,0 +1,6 @@ +RIAK_USER="riak" +RIAK_ERTS_PATH="/usr/lib/riak/erts-5.9.3.1" +RIAK_EXEC="/usr/bin/riak" +RIAK_PIDFILE="/run/riak/riak.pid" +# timeout to wait for the beam to start and riak to answer to ping requests +RIAK_STARTUP_TIMEOUT=10 diff --git a/dev-db/riak/files/riak.initd b/dev-db/riak/files/riak.initd new file mode 100644 index 000000000..380dc6da0 --- /dev/null +++ b/dev-db/riak/files/riak.initd @@ -0,0 +1,114 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +extra_started_commands="reload" + +depend() { + need net +} + +start() { + ebegin "Start ${SVCNAME}" + + # create pid dir + local pid_dir=$(dirname "${RIAK_PIDFILE}") + if [ ! -d $pid_dir ]; then + einfo "Creating $pid_dir." + mkdir -p $pid_dir && chown ${RIAK_USER} $pid_dir + fi + + # warn on low ulimit + local ulimit=$(grep 'Max open files' /proc/self/limits |tr -s ' '|cut -d' ' -f4) + if [ "$ulimit" -lt "4096" ]; then + ewarn "Current ulimit -n is $ulimit. 4096 is the recommended minimum." + fi + + start-stop-daemon --background --start --user "${RIAK_USER}" \ + --pidfile "${RIAK_PIDFILE}" \ + --exec "${RIAK_EXEC}" -- start + + # wait for riak to start before creating pidfile + while [ "${RIAK_STARTUP_TIMEOUT}" -ge "0" ]; do + # ping riak + local res=$("${RIAK_EXEC}" ping 2>/dev/null) + + # on pong it has fully started + case $res in + *pong*) + while [ "${RIAK_STARTUP_TIMEOUT}" -ge "0" ]; do + # get the beam's pid + local beam=$(pidof "${RIAK_ERTS_PATH}/bin/beam.smp") + # retry if multiple pids are returned + if [ $(echo "$beam" | wc -w) -ne 1 ]; then + # let pidfile creation time out + RIAK_STARTUP_TIMEOUT=$(expr "${RIAK_STARTUP_TIMEOUT}" - 1) + sleep 1 + else + # create pidfile and be done + [ "$beam" ] && echo -n $beam > "${RIAK_PIDFILE}" + break + fi + done + # break the outer while loop + break + ;; + *) + # let pidfile creation time out + RIAK_STARTUP_TIMEOUT=$(expr "${RIAK_STARTUP_TIMEOUT}" - 1) + sleep 1 + ;; + esac + done + + [ -f "${RIAK_PIDFILE}" ] || ewarn "Slow startup. No pidfile created." + + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + local beam="${RIAK_ERTS_PATH}/bin/beam.smp" + + # if riak stop fails use more force + if [ $("${RIAK_EXEC}" stop 2>&1 > /dev/null) ]; then + start-stop-daemon \ + --stop --quiet --retry=TERM/30/KILL/5 \ + --user ${RIAK_USER} --exec $beam + [ -f "${RIAK_PIDFILE}" ] && unlink "${RIAK_PIDFILE}" + else + [ -f "${RIAK_PIDFILE}" ] && unlink "${RIAK_PIDFILE}" + fi + + einfo "Stopping epmd" + local epmd=$(pidof "${RIAK_ERTS_PATH}"/bin/epmd) + [ $epmd ] && kill $epmd + + eend $? +} + +reload() { + ebegin "Reloading ${SVCNAME}" + "${RIAK_EXEC}" restart 2>&1 > /dev/null + eend $? +} + +status() { + local res=$("${RIAK_EXEC}" ping 2>/dev/null) + local epmd=$(pidof ${RIAK_ERTS_PATH}/bin/epmd) + case $res in + *pong*) + einfo "status: started" + ;; + *) + if [ -f "${RIAK_PIDFILE}" ]; then + eerror "status: crashed" + else + # cleanup + [ "$epmd" ] && kill "$epmd" + einfo "status: stopped" + fi + ;; + esac +} diff --git a/dev-db/riak/metadata.xml b/dev-db/riak/metadata.xml new file mode 100644 index 000000000..cc3fe2494 --- /dev/null +++ b/dev-db/riak/metadata.xml @@ -0,0 +1,7 @@ + + + + + maintainer-wanted@gentoo.org + + diff --git a/dev-db/riak/riak-1.4.1.ebuild b/dev-db/riak/riak-1.4.1.ebuild new file mode 100644 index 000000000..a6ab7fbf9 --- /dev/null +++ b/dev-db/riak/riak-1.4.1.ebuild @@ -0,0 +1,148 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 + +inherit versionator eutils user multilib toolchain-funcs + +# build time dependency +# fork of the google project with riak specific changes +# is used to build the eleveldb lib and gets removed before install +LEVELDB_PV="${PV}" +LEVELDB_URI="https://github.com/basho/leveldb/archive/${LEVELDB_PV}.tar.gz" +LEVELDB_P="leveldb-${LEVELDB_PV}.tar.gz" +LEVELDB_WD="${WORKDIR}/leveldb-${LEVELDB_PV}" +LEVELDB_TARGET_LOCATION="${S}/deps/eleveldb/c_src/leveldb" + +DESCRIPTION="An open source, distributed database" +HOMEPAGE="http://www.basho.com/" +SRC_URI="http://s3.amazonaws.com/downloads.basho.com/${PN}/$(get_version_component_range 1-2)/${PV}/${P}.tar.gz + ${LEVELDB_URI} -> ${LEVELDB_P} +" + +# prestripped files +# bootstrapped from existing dev-lang/erlang install +QA_PRESTRIPPED=" + /usr/lib.*/riak/lib/asn1-.*/priv/lib/asn1_erl_nif.so + /usr/lib.*/riak/lib/crypto-.*/priv/lib/crypto.so + /usr/lib.*/riak/lib/os_mon-.*/priv/bin/memsup + /usr/lib.*/riak/lib/os_mon-.*/priv/bin/cpu_sup + /usr/lib.*/riak/lib/runtime_tools-.*/priv/lib/dyntrace.so + /usr/lib.*/riak/lib/runtime_tools-.*/priv/lib/trace_ip_drv.so + /usr/lib.*/riak/lib/runtime_tools-.*/priv/lib/trace_file_drv.so + /usr/lib.*/riak/erts-.*/bin/beam + /usr/lib.*/riak/erts-.*/bin/beam.smp + /usr/lib.*/riak/erts-.*/bin/child_setup + /usr/lib.*/riak/erts-.*/bin/inet_gethost + /usr/lib.*/riak/erts-.*/bin/heart + /usr/lib.*/riak/erts-.*/bin/erlexec + /usr/lib.*/riak/erts-.*/bin/erlc + /usr/lib.*/riak/erts-.*/bin/escript + /usr/lib.*/riak/erts-.*/bin/ct_run + /usr/lib.*/riak/erts-.*/bin/run_erl + /usr/lib.*/riak/erts-.*/bin/to_erl + /usr/lib.*/riak/erts-.*/bin/epmd +" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="doc" + +RDEPEND=" + dev-libs/openssl + sys-libs/ncurses + sys-libs/zlib +" +# TODO test non smp install +DEPEND=" + =dev-lang/erlang-15.2.3.1[smp] + ${RDEPEND} +" + +pkg_setup() { + ebegin "Creating riak user and group" + local riak_home="/var/$(get_libdir)/riak" + enewgroup riak + enewuser riak -1 -1 $riak_home riak + eend $? +} + +src_prepare() { + # unpack source archives to patch with honor-cflags-patch + tar xfp "${S}"/deps/erlang_js/c_src/js-*.tar.gz -C "${S}"/deps/erlang_js/c_src/ || die + tar xfp "${S}"/deps/eleveldb/c_src/snappy-*.tar.gz -C "${S}"/deps/eleveldb/c_src/ || die + + # avoid fetching deps via git that are already available + ln -s ${LEVELDB_WD} ${LEVELDB_TARGET_LOCATION} || die + mkdir -p "${S}"/deps/riaknostic/deps || die + ln -s "${S}"/deps/lager "${S}"/deps/riaknostic/deps || die + ln -s "${S}"/deps/meck "${S}"/deps/riaknostic/deps || die + ln -s "${S}"/deps/getopt "${S}"/deps/riaknostic/deps || die + + epatch "${FILESDIR}/${PV}-fix-directories.patch" \ + "${FILESDIR}/${PV}-honor-cflags.patch" +} + +src_compile() { + # build fails with MAKEOPTS > -j1 + emake -j1 \ + CC=$(tc-getCC) \ + CXX=$(tc-getCXX) \ + AR=$(tc-getAR) \ + LD=$(tc-getLD) \ + RANLIB=$(tc-getRANLIB) \ + STRIP="" rel +} + +src_install() { + local lib_dir=$(get_libdir) + local erts_version=$(find /usr/${lib_dir}/erlang/lib/ -maxdepth 1 -type d -name erts-* | cut -d'-' -f2) + + # install /usr/lib + # TODO test on x86 + insinto /usr/${lib_dir}/riak + doins -r rel/riak/lib \ + rel/riak/releases \ + rel/riak/erts-${erts_version} + fperms -R 0755 /usr/${lib_dir}/riak/erts-${erts_version}/bin + + cd "${D}" + find "usr/${lib_dir}/riak/lib/" -type f -path */priv/bin/* | xargs fperms 0755 + cd "${S}" + + # install /usr/bin + dobin rel/riak/bin/* + + # install /etc/riak + insinto /etc/riak + doins rel/riak/etc/* + + # restrict access to cert and key + fperms 0600 /etc/riak/cert.pem \ + /etc/riak/key.pem + + # create neccessary directories + keepdir /var/lib/riak/{bitcask,ring,leveldb} \ + /var/log/riak/sasl + + # change owner to riak + fowners -R riak:riak /var/lib/riak \ + /var/log/riak + + # create docs + doman doc/man/man1/* + use doc && dodoc doc/*.txt + + # init.d file + newinitd "${FILESDIR}/${PN}.initd" riak + newconfd "${FILESDIR}/${PN}.confd" riak + + # TODO logrotate +} + +pkg_postinst() { + ewarn "To use kernel polling build erlang with the 'kpoll' useflag" +} -- cgit v1.2.3-65-gdbad