Index: head/databases/Makefile =================================================================== --- head/databases/Makefile +++ head/databases/Makefile @@ -41,6 +41,7 @@ SUBDIR += clickhouse SUBDIR += cockroach SUBDIR += couchdb2 + SUBDIR += couchdb3 SUBDIR += courier-authlib-mysql SUBDIR += courier-authlib-pgsql SUBDIR += courier-authlib-userdb Index: head/databases/couchdb3/Makefile =================================================================== --- head/databases/couchdb3/Makefile +++ head/databases/couchdb3/Makefile @@ -0,0 +1,103 @@ +# $FreeBSD$ + +PORTNAME= couchdb3 +DISTVERSION= 3.1.0 +CATEGORIES= databases +MASTER_SITES= APACHE/couchdb/source/${DISTVERSION} +DISTNAME= apache-couchdb-${DISTVERSION} + +MAINTAINER= dch@FreeBSD.org +COMMENT= JSON document database with HTTP API and scalable multi-master sync + +LICENSE= APACHE20 BSD3CLAUSE ISCL WTFPL OFL11 +LICENSE_COMB= multi + +BUILD_DEPENDS= rebar:devel/rebar \ + erlang-runtime22>=22.0:lang/erlang-runtime22 +LIB_DEPENDS= libicudata.so:devel/icu \ + libmozjs-60.so:lang/spidermonkey60 +RUN_DEPENDS= erlang-runtime22>=22.0:lang/erlang-runtime22 + +USES= cpe gmake libtool ncurses +USE_RC_SUBR= ${PORTNAME} + +CONFLICTS= couchdb[24]* + +CPE_VENDOR= apache + +USERS= couchdb +GROUPS= couchdb + +SUB_FILES= pkg-message +SUB_LIST= APPDIR=${APPDIR} \ + ERL_PATH=${LOCALBASE}/lib/erlang22/bin/erl \ + PORTNAME=${PORTNAME} \ + RELDIR=${RELDIR} \ + WWWDIR=${WWWDIR} +PLIST_SUB= VERSION=${DISTVERSION} + +HAS_CONFIGURE= yes +CONFIGURE_ARGS= --skip-deps --user ${USERS} --rebar ${LOCALBASE}/bin/rebar \ + --spidermonkey-version 60 + +ALL_TARGET= release + +MAKE_ENV= PATH=${LOCALBASE}/lib/erlang22/bin:${PATH} + +OPTIONS_DEFINE= DOCS +OPTIONS_SUB= yes + +DBDIR?= /var/db/${PORTNAME} +LOGDIR?= /var/log/${PORTNAME} +LOGFILE?= ${LOGDIR}/couch.log +APPDIR= ${LOCALBASE}/libexec/${PORTNAME} +RELDIR= ${APPDIR}/releases/${DISTVERSION} + +post-patch: + @${REINPLACE_CMD} \ + -e 's,%%APPDIR%%,${APPDIR},g' \ + -e 's,%%DATADIR%%,${DATADIR},g' \ + -e 's,%%DBDIR%%,${DBDIR},g' \ + -e 's,%%LOCALBASE%%,${LOCALBASE},g' \ + -e 's,%%PORTNAME%%,${PORTNAME},g' \ + -e 's,%%WWWDIR%%,${WWWDIR},g' \ + -e 's,\$COUCHDB_USER,${USERS},g' \ + -e 's,\$LOG_FILE,${LOGFILE},g' \ + ${WRKSRC}/configure + +pre-install: + # relocate user-modifiable runtime configs to match hier(7) + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${WRKSRC}/rel/couchdb/etc/local.ini \ + ${STAGEDIR}${ETCDIR}/local.ini.sample + ${INSTALL_DATA} ${WRKSRC}/rel/couchdb/etc/vm.args \ + ${STAGEDIR}${ETCDIR}/vm.args.sample + ${INSTALL_MAN} ${WRKSRC}/share/docs/man/apachecouchdb.1 \ + ${STAGEDIR}${MANPREFIX}/man/man1 + # prune build artefacts and surplus headers + ${FIND} -E ${WRKSRC} -type f \ + -regex '.*\.(a|buildinfo|c|cc|cmd|d|o|orig|h|cpp)' -print -delete + # remove runtime dirs and files that were moved to match hier(7) + ${RM} -rv ${WRKSRC}/rel/couchdb/var \ + ${WRKSRC}/rel/couchdb/etc/*.d \ + ${WRKSRC}/rel/couchdb/etc/local.ini \ + ${WRKSRC}/rel/couchdb/etc/vm.args \ + ${WRKSRC}/rel/couchdb/releases/*/vm.args \ + ${WRKSRC}/rel/couchdb/lib/couch-*/priv/couch*js + @${CP} ${WRKSRC}/src/docs/images/favicon.ico ${WRKSRC}/share/www/ + (cd ${WRKSRC}/rel/couchdb && ${COPYTREE_SHARE} . ${STAGEDIR}${APPDIR}) + +post-install: + @${FIND} -E ${STAGEDIR} -type f \ + \( -name couchjs -o -name *.so \) \ + -exec ${STRIP_CMD} {} + + @${MKDIR} \ + ${STAGEDIR}${DBDIR} \ + ${STAGEDIR}${LOGDIR} + # fauxton UI is a required component + (cd ${WRKSRC}/share/www && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}) + +post-install-DOCS-on: + (cd ${WRKSRC}/share/docs/html && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}/docs) + +.include Index: head/databases/couchdb3/distinfo =================================================================== --- head/databases/couchdb3/distinfo +++ head/databases/couchdb3/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1588800925 +SHA256 (apache-couchdb-3.1.0.tar.gz) = 4867c796a1ff6f0794b7bd3863089ea6397bd5c47544f9b97db8cdacff90f8ed +SIZE (apache-couchdb-3.1.0.tar.gz) = 19719024 Index: head/databases/couchdb3/files/couchdb3.in =================================================================== --- head/databases/couchdb3/files/couchdb3.in +++ head/databases/couchdb3/files/couchdb3.in @@ -0,0 +1,96 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: couchdb3 +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# couchdb3_enable (bool): Set to NO by default. +# Set it to YES to enable couchdb. + +. /etc/rc.subr + +name=%%PORTNAME%% +rcvar=%%PORTNAME%%_enable + +start_cmd="${name}_start" +stop_cmd="${name}_stop" +status_cmd="${name}_status" + +load_rc_config $name + +: ${%%PORTNAME%%_enable:="NO"} +: ${%%PORTNAME%%_user="couchdb"} +: ${%%PORTNAME%%_erl_flags="-couch_ini %%APPDIR%%/etc/default.ini %%ETCDIR%%/local.ini"} +: ${%%PORTNAME%%_chdir="/var/db/%%PORTNAME%%"} + +command="%%ERL_PATH%%" +pidfile="/var/run/${name}.pid" +daemonpidfile="/var/run/${name}-daemon.pid" + +erl_sasl='-sasl releases_dir \"%%PORTNAME%%/releases\"' +erl_boot='-boot %%RELDIR%%/couchdb -boot_var RELTOOL_EXT_LIB %%APPDIR%%/lib' +erl_args='-args_file %%ETCDIR%%/vm.args' +erl_flags="${erl_sasl} ${erl_boot} ${erl_args} ${%%PORTNAME%%_erl_flags}" + +%%PORTNAME%%_start() +{ + # chdir manually as overriding _start() blocks rc.subr defaults + cd "${%%PORTNAME%%_chdir}" + /usr/sbin/daemon -p ${pidfile} \ + -P ${daemonpidfile} \ + -t ${name} \ + -u ${%%PORTNAME%%_user} \ + env ERL_FLAGS="${erl_flags}" \ + HOME=/var/run/couchdb \ + ERL_CRASH_DUMP=/var/run/couchdb/erl_crash.dump \ + %%PORTNAME%%_FAUXTON_DOCROOT=%%WWWDIR%% \ + %%PORTNAME%%_QUERY_SERVER_JAVASCRIPT="%%APPDIR%%/bin/couchjs %%APPDIR%%/share/server/main.js" \ + %%PORTNAME%%_QUERY_SERVER_COFFEESCRIPT="%%APPDIR%%/bin/couchjs %%APPDIR%%/share/server/main-coffee.js" \ + ${command} +} + +%%PORTNAME%%_stop() +{ + echo -n "Stopping ${name}: " + retval=0 + if ! status_quiet + then + echo "already stopped" + return 1 + else + %%PORTNAME%%_pids=$(/bin/pgrep -ifU ${%%PORTNAME%%_user} ${name}) + kill ${%%PORTNAME%%_pids} + wait_for_pids ${%%PORTNAME%%_pids} + retval=$? + echo "stopped" + fi + return $retval +} + +%%PORTNAME%%_status() +{ + /bin/pgrep -ifU ${%%PORTNAME%%_user} ${name} > /dev/null && status="$?" || status="$?" + if [ "${status}" = 0 ]; then + echo "${name} is running" + return 0 + elif [ "${status}" = 4 ]; then + echo "could not access PID file for ${name}" + return ${status} + else + echo "${name} is not running" + return ${status} + fi +} + +status_quiet() +{ + %%PORTNAME%%_status >/dev/null 2>&1 +} + +run_rc_command $1 + Index: head/databases/couchdb3/files/patch-Makefile =================================================================== --- head/databases/couchdb3/files/patch-Makefile +++ head/databases/couchdb3/files/patch-Makefile @@ -0,0 +1,20 @@ +--- Makefile.orig 2020-02-23 16:17:39 UTC ++++ Makefile +@@ -122,7 +122,7 @@ help: + .PHONY: couch + # target: couch - Build CouchDB core, use ERL_OPTS to provide custom compiler's options + couch: config.erl +- @COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) compile $(COMPILE_OPTS) ++ @COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) -v compile $(COMPILE_OPTS) + @cp src/couch/priv/couchjs bin/ + + +@@ -397,7 +397,7 @@ dist: all derived + release: all + @echo "Installing CouchDB into rel/couchdb/ ..." + @rm -rf rel/couchdb +- @$(REBAR) generate # make full erlang release ++ @$(REBAR) -v generate # make full erlang release + + ifeq ($(with_fauxton), 1) + @mkdir -p rel/couchdb/share/ Index: head/databases/couchdb3/files/patch-configure =================================================================== --- head/databases/couchdb3/files/patch-configure +++ head/databases/couchdb3/files/patch-configure @@ -0,0 +1,26 @@ +--- configure.orig 2018-08-18 17:55:47 UTC ++++ configure +@@ -19,7 +19,7 @@ + rootdir="$(cd "${0%/*}" 2>/dev/null; echo "$PWD")" + basename=`basename $0` + +-PACKAGE_AUTHOR_NAME="The Apache Software Foundation" ++PACKAGE_AUTHOR_NAME="FreeBSD" + + # TEST=0 + WITH_CURL="false" +@@ -168,10 +168,10 @@ cat > rel/couchdb.config << EOF + % + {package_author_name, "$PACKAGE_AUTHOR_NAME"}. +-{prefix, "."}. ++{prefix, "%%APPDIR%%"}. +-{data_dir, "./data"}. +-{view_index_dir, "./data"}. ++{data_dir, "%%DBDIR%%"}. ++{view_index_dir, "%%DBDIR%%"}. + {log_file, "$LOG_FILE"}. +-{fauxton_root, "./share/www"}. ++{fauxton_root, "%%WWWDIR%%"}. + {user, "$COUCHDB_USER"}. + {node_name, "-name couchdb@127.0.0.1"}. + {cluster_port, 5984}. Index: head/databases/couchdb3/files/patch-rel_overlay_etc_vm.args =================================================================== --- head/databases/couchdb3/files/patch-rel_overlay_etc_vm.args +++ head/databases/couchdb3/files/patch-rel_overlay_etc_vm.args @@ -0,0 +1,14 @@ +--- rel/overlay/etc/vm.args.orig 2018-12-19 09:30:35 UTC ++++ rel/overlay/etc/vm.args +@@ -43,9 +43,9 @@ + # Start a pool of asynchronous IO threads + +A 16 + +-# Comment this line out to enable the interactive Erlang shell on startup ++# Comment these lines out to enable the interactive Erlang shell on startup + +Bd -noinput +- ++-detached + # Force use of the smp scheduler, fixes #1296 + -smp enable + Index: head/databases/couchdb3/files/patch-rel_reltool.config =================================================================== --- head/databases/couchdb3/files/patch-rel_reltool.config +++ head/databases/couchdb3/files/patch-rel_reltool.config @@ -0,0 +1,10 @@ +--- rel/reltool.config.orig 2018-08-20 14:11:32 UTC ++++ rel/reltool.config +@@ -11,6 +11,7 @@ + % the License. + + {sys, [ ++ {excl_lib, otp_root}, %% require erts runtime from FreeBSD ports + {lib_dirs, ["../src"]}, + {rel, "couchdb", "3.1.0", [ + %% stdlib Index: head/databases/couchdb3/files/patch-src_ibrowse_src_ibrowse__http__client.erl =================================================================== --- head/databases/couchdb3/files/patch-src_ibrowse_src_ibrowse__http__client.erl +++ head/databases/couchdb3/files/patch-src_ibrowse_src_ibrowse__http__client.erl @@ -0,0 +1,11 @@ +--- src/ibrowse/src/ibrowse_http_client.erl.orig 2018-09-19 11:50:56 UTC ++++ src/ibrowse/src/ibrowse_http_client.erl +@@ -532,7 +532,7 @@ is_ipv6_host(Host) -> + {ok, {_, _, _, _}} -> + false; + _ -> +- case inet:gethostbyname(Host) of ++ case inet:gethostbyname(Host, inet6) of + {ok, #hostent{h_addrtype = inet6}} -> + true; + _ -> Index: head/databases/couchdb3/files/pkg-message.in =================================================================== --- head/databases/couchdb3/files/pkg-message.in +++ head/databases/couchdb3/files/pkg-message.in @@ -0,0 +1,54 @@ +[ +{ type: install + message: <