summaryrefslogtreecommitdiff
path: root/sysutils/cfengine3/Makefile
blob: 877ccec74acdbf925dc4c225a3882fa75fff1b0f (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
# $NetBSD: Makefile,v 1.25 2020/06/02 08:24:44 adam Exp $

DISTNAME=	cfengine-3.15.1
PKGREVISION=	3
CATEGORIES=	sysutils
MASTER_SITES=	https://cfengine-package-repos.s3.amazonaws.com/tarballs/

MAINTAINER=	pettai@NetBSD.org
HOMEPAGE=	https://cfengine.com/product/community/
COMMENT=	Tool for automating system administration
LICENSE=	gnu-gpl-v3

USE_LANGUAGES=		c c++ c99
USE_LIBTOOL=		yes
USE_TOOLS+=		gmake pax

.include "options.mk"

DISTFILES=		${DEFAULT_DISTFILES}
DISTFILES+=		cfengine-masterfiles-${PKGVERSION_NOREV}.tar.gz

GNU_CONFIGURE=		yes
CONFIGURE_ARGS+=	--enable-fhs
CONFIGURE_ARGS+=	--docdir=${DOCDIR}
CONFIGURE_ARGS+=	--datadir=${CFENGINE_DIR:Q}
CONFIGURE_ARGS+=	--with-masterdir=${PKG_SYSCONFDIR:Q}
CONFIGURE_ARGS+=	--with-sysconfdir=${PKG_SYSCONFDIR:Q}
CONFIGURE_ARGS+=	--with-workdir=${CFENGINE_DIR:Q}
CONFIGURE_ARGS+=	--with-libcurl=${BUILDLINK_PREFIX.curl:Q}
CONFIGURE_ARGS+=	--with-libxml2=${BUILDLINK_PREFIX.libxml2:Q}
CONFIGURE_ARGS+=	--with-libyaml=${BUILDLINK_PREFIX.libyaml:Q}
CONFIGURE_ARGS+=	--with-openssl=${BUILDLINK_PREFIX.openssl:Q}
CONFIGURE_ARGS+=	--with-pcre=${BUILDLINK_PREFIX.pcre:Q}

CONFIGURE_DIRS+=	. ${WRKDIR}/cfengine-masterfiles-${PKGVERSION_NOREV}

BUILD_DEFS+=		VARBASE CFENGINE_DIR
FILES_SUBST+=		CFENGINE_DIR=${CFENGINE_DIR}

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

CFENGINE_DIR?=		${VARBASE}/cfengine
DOCDIR=			${PREFIX}/share/doc/${PKGBASE}
EGDIR=			${PREFIX}/share/examples/${PKGBASE}
PKG_SYSCONFSUBDIR=	cfengine

# Regenerate masterfiles list with 'make update-masterfiles'
.include "Makefile.cf"

.for file in ${CFILES}
CONF_FILES+=		${EGDIR}/CoreBase/${file} ${PKG_SYSCONFDIR}/${file}
.endfor

RCD_SCRIPTS=		cfserverd cfexecd cfmonitord
SMF_INSTANCES=		${RCD_SCRIPTS}

INSTALLATION_DIRS+=	${PKGMANDIR}/man8
INSTALL_MAKE_FLAGS+=	examplesdir=${EGDIR} projlibdir=${PREFIX}/lib
INSTALL_MAKE_FLAGS+=	masterfilesdir=${EGDIR}/CoreBase
INSTALL_MAKE_FLAGS+=	package_modulesdir=${EGDIR}/CoreBase/modules/packages
INSTALL_MAKE_FLAGS+=	dist_package_modules_SCRIPTS="apt_get pkgsrc yum"

MAKE_DIRS=		${CFENGINE_DIR}
MAKE_DIRS+=		${PKG_SYSCONFDIR}/cfe_internal/core/deprecated
MAKE_DIRS+=		${PKG_SYSCONFDIR}/cfe_internal/update
MAKE_DIRS+=		${PKG_SYSCONFDIR}/cfe_internal/enterprise/ha
MAKE_DIRS+=		${PKG_SYSCONFDIR}/controls
MAKE_DIRS+=		${PKG_SYSCONFDIR}/inventory
MAKE_DIRS+=		${PKG_SYSCONFDIR}/lib
MAKE_DIRS+=		${PKG_SYSCONFDIR}/modules/packages
MAKE_DIRS+=		${PKG_SYSCONFDIR}/services/autorun
MAKE_DIRS+=		${PKG_SYSCONFDIR}/templates

SUBST_CLASSES+=		path
SUBST_MESSAGE.path=	Fixing default paths
SUBST_STAGE.path=	pre-configure
SUBST_FILES.path=	${WRKDIR}/cfengine-masterfiles-${PKGVERSION_NOREV}/modules/packages/pkgsrc
SUBST_VARS.path=	MACHINE_ARCH PKG_SYSCONFBASE PREFIX

# This can be removed once this module is released in 3.8.
post-extract:
	${INSTALL_SCRIPT} files/pkgsrc \
		${WRKDIR}/cfengine-masterfiles-${PKGVERSION_NOREV}/modules/packages/pkgsrc

update-masterfiles: configure
	(${ECHO} '# $$''NetBSD''$$'; \
	 ${ECHO} '# Generated by "make update-masterfiles", post-configure'; \
	 ${ECHO}; \
	 cd ${WRKDIR}/cfengine-masterfiles-${PKGVERSION_NOREV} && (\
		${FIND} cfe_internal controls inventory lib services -name '*.cf'; \
		${FIND} templates -name '*.mustache'; \
		${FIND} modules -type f | grep -v Makefile \
	 ) | ${SORT} | ${SED} -e 's|^|CFILES+=	|') \
	 > ${.CURDIR}/../../sysutils/cfengine3/Makefile.cf

post-install:
	for cf in cf-agent cf-execd cf-key cf-monitord cf-promises cf-runagent cf-serverd ; \
	do LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib ${DESTDIR}${PREFIX}/bin/$$cf -M \
		> ${DESTDIR}/${PREFIX}/${PKGMANDIR}/man8/$$cf.8 ; \
	done

.include "../../devel/pcre/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../textproc/libxml2/buildlink3.mk"
.include "../../textproc/libyaml/buildlink3.mk"
.include "../../www/curl/buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"