summaryrefslogtreecommitdiff
path: root/databases/couchdb/Makefile
blob: 04eefc7a781f6e2f2839add19f852afa2a5716f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# $NetBSD: Makefile,v 1.67 2020/04/23 19:59:41 rillig Exp $

DISTNAME=		apache-couchdb-2.3.1
PKGNAME=		${DISTNAME:S/apache-//}
PKGREVISION=		5
CATEGORIES=		databases
MASTER_SITES=		${MASTER_SITE_APACHE:=couchdb/source/${PKGVERSION_NOREV}/}

MAINTAINER=		pkgsrc-users@NetBSD.org
HOMEPAGE=		https://couchdb.apache.org/
COMMENT=		Document database server, accessible via a RESTful JSON API
LICENSE=		apache-2.0

HAS_CONFIGURE=		yes
USE_LANGUAGES=		c c++
USE_TOOLS+=		gmake pax pkg-config
USE_LIBTOOL=		yes
BUILD_DEFS+=		VARBASE

BUILD_DEPENDS+=		help2man-[0-9]*:../../converters/help2man
BUILD_DEPENDS+=		rebar>=2.6.0<3:../../devel/rebar

.include "../../mk/bsd.prefs.mk"

COUCH_DBDIR?=		${VARBASE}/db/couchdb
COUCH_EGDIR=		${PREFIX}/share/examples/couchdb
COUCH_LOGDIR?=		${VARBASE}/log/couchdb
COUCH_RUNDIR?=		${VARBASE}/run/couchdb
COUCH_USER?=		couchdb
COUCH_GROUP?=		${COUCH_USER}

PKG_GROUPS+=			${COUCH_GROUP}
PKG_USERS+=			${COUCH_USER}:${COUCH_GROUP}
PKG_GECOS.${COUCH_USER}=	CouchDB Server User
PKG_HOME.${COUCH_USER}=		${COUCH_DBDIR}
PKG_SHELL.${COUCH_USER}=	${COMMAND_SHELL}

FILES_SUBST+=		COUCH_USER=${COUCH_USER}
FILES_SUBST+=		COUCH_GROUP=${COUCH_GROUP}
FILES_SUBST+=		COUCH_DBDIR=${COUCH_DBDIR}
FILES_SUBST+=		COUCH_RUNDIR=${COUCH_RUNDIR}
FILES_SUBST+=		ERTS_VERSION=${VERSION.erts}

OWN_DIRS=		${COUCH_LOGDIR} ${COUCH_DBDIR} ${COUCH_RUNDIR} ${PKG_SYSCONFDIR}
OWN_DIRS_PERMS+=	${COUCH_DBDIR} ${COUCH_USER} ${COUCH_GROUP} 0770
OWN_DIRS_PERMS+=	${COUCH_LOGDIR} ${COUCH_USER} ${COUCH_GROUP} 0770
OWN_DIRS_PERMS+=	${COUCH_RUNDIR} ${COUCH_USER} ${COUCH_GROUP} 0770

PKG_SYSCONFSUBDIR=	couchdb
PKG_SYSCONFDIR_PERMS=	${COUCH_USER} ${COUCH_GROUP} 0775
CONF_FILES_PERMS+=	${COUCH_EGDIR}/default.ini ${PKG_SYSCONFDIR}/default.ini \
			${COUCH_USER} ${COUCH_GROUP} 0660
CONF_FILES_PERMS+=	${COUCH_EGDIR}/local.ini ${PKG_SYSCONFDIR}/local.ini \
			${COUCH_USER} ${COUCH_GROUP} 0660
CONF_FILES_PERMS+=	${COUCH_EGDIR}/vm.args ${PKG_SYSCONFDIR}/vm.args \
			${COUCH_USER} ${COUCH_GROUP} 0660

SUBST_CLASSES+=		paths
SUBST_MESSAGE.paths=	Setting standard paths
SUBST_STAGE.paths=	pre-configure
SUBST_FILES.paths+=	rel/files/couchdb.in
SUBST_FILES.paths+=	rel/overlay/etc/default.ini
SUBST_FILES.paths+=	src/config/src/config_app.erl
SUBST_VARS.paths=	COUCH_DBDIR COUCH_LOGDIR COUCH_RUNDIR PREFIX PKG_SYSCONFDIR

CHECK_PORTABILITY_SKIP+=	build-aux/print-committerlist.sh

CONFIGURE_ARGS+=	--rebar\ ${PREFIX}/bin/rebar
CONFIGURE_ARGS+=	--user\ ${COUCH_USER}
CONFIGURE_ARGS+=	--skip-deps
CONFIGURE_ARGS+=	--with-curl

BUILD_TARGET=		release
TEST_TARGET=		check

INSTALLATION_DIRS+=	bin couchdb/lib
INSTALLATION_DIRS+=	couchdb/share/server couchdb/share/www/docs
INSTALLATION_DIRS+=	${PKGMANDIR}/man1
INSTALLATION_DIRS+=	share/examples/couchdb

CTF_FILES_SKIP+=	couchdb/erts*/bin/*
CTF_FILES_SKIP+=	couchdb/lib/*/priv/bin/*
CTF_FILES_SKIP+=	couchdb/lib/*/priv/lib/*.so

RCD_SCRIPTS+=		couchdb

# This is silly, but the rebar release target embeds the Erlang VM
# into the tree, including existing Erlang module versions that might
# differ from those included in the tarball. We use a dynamic PLIST
# for the parts that may change.
GENERATE_PLIST=		cd ${DESTDIR}${PREFIX}; ${FIND}			\
				couchdb/erts-* couchdb/lib		\
				\( -type f -o -type l \) -print |	\
				${SORT} -u;
# Ignore dynamically generated parts when doing print-PLIST
PRINT_PLIST_AWK+=	/^couchdb\/erts-/ { next; }
PRINT_PLIST_AWK+=	/^couchdb\/lib\// { next; }

# We need to know the version of erts and subst it inside the SMF manifest
.include "../../lang/erlang/Makefile.versions"

do-install:
	cd ${WRKSRC}/rel/couchdb &&						\
		${PAX} -rw -pp erts-${VERSION.erts} lib releases		\
		${DESTDIR}${PREFIX}/couchdb
	${INSTALL_SCRIPT} ${WRKSRC}/rel/couchdb/bin/couchdb 			\
		${DESTDIR}${PREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/rel/couchdb/bin/couchjs			\
		${DESTDIR}${PREFIX}/bin
	${INSTALL_MAN} ${WRKSRC}/rel/couchdb/share/docs/couchdb.1		\
		${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
	cd ${WRKSRC}/rel/couchdb/share && ${PAX} -rw -pp server www		\
		${DESTDIR}${PREFIX}/couchdb/share
	cd ${WRKSRC}/rel/couchdb/etc && ${PAX} -rw -pp *.ini vm.args		\
		${DESTDIR}${COUCH_EGDIR}

# The erlang VM gets embedded, but it may still need the curses lib
BUILDLINK_DEPMETHOD.erlang=	build
.include "../../mk/termcap.buildlink3.mk"
.include "../../lang/erlang/buildlink3.mk"
.include "../../lang/spidermonkey185/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../textproc/icu/buildlink3.mk"
.include "../../www/curl/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"