summaryrefslogtreecommitdiffstats
path: root/security/trousers/Makefile
blob: 3d8a9fd4b24fe5eacf627e0d5ab693ec6d8af3db (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
# Created by: Sebastian Schuetz <sschuetz@fhm.edu>
# $FreeBSD$

PORTNAME=	trousers
PORTVERSION=	0.3.6
PORTREVISION=	3
CATEGORIES=	security
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/${PORTVERSION}

MAINTAINER=	ports@FreeBSD.org
COMMENT=	The open-source TCG Software Stack

USE_GCC=	any
USE_GMAKE=	YES
USE_ICONV=	YES
USE_OPENSSL=	YES
USE_LDCONFIG=	YES
USES=		pkgconfig
USE_AUTOTOOLS=	autoconf automake libtool
GNU_CONFIGURE=	YES
MAKE_JOBS_SAFE=	YES

USE_RC_SUBR=	tcsd
SUB_FILES=	pkg-message
SUB_LIST=	USERS=${USERS} GROUPS=${GROUPS}

USERS=		_tss
GROUPS=		_tss

LICENSE=	CPL
LICENSE_NAME=	Common Public License
LICENSE_FILE=	${WRKSRC}/LICENSE
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

.include "Makefile.man"

CONFIGURE_ARGS=	--with-gui=none --enable-static \
		--localstatedir=${PREFIX}/var \
		--with-tssuser=${USERS} --with-tssgroup=${GROUPS}

OPTIONS_DEFINE=	EMULATOR DEBUG
EMULATOR_DESC=	Build for use with the tpm-emulator

WRKSRC=		${WRKDIR}/${DISTNAME}

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MEMULATOR}
PKGNAMESUFFIX+=	-no_tddl
LIB_DEPENDS+=	tddl.1:${PORTSDIR}/emulators/tpm-emulator

post-patch:
	@${REINPLACE_CMD} -e \
		's|$${top_builddir}/src/tddl/libtddl.a|${LOCALBASE}/lib/libtddl.a|' \
			${WRKSRC}/src/tcs/Makefile.am \
			${WRKSRC}/src/tcsd/Makefile.am
	@${REINPLACE_CMD} -e \
		's|libtddl\.a||g' \
			${WRKSRC}/src/tddl/Makefile.am

# The emulator has already a libttddl.so, so comment out trousers' libtddl in the pkg-plist
PLIST_SUB+=	TDDL="@comment "
.else
PKGNAMESUFFIX+=	-tddl
CONFLICTS+=	tpm-emulator-0*
PLIST_SUB+=	TDDL=""
.endif

.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=--enable-debug
.endif

run-autotools:	run-autotools-autoreconf

run-autotools-autoreconf:
	@cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTORECONF} -i

post-install:
	@${MKDIR} ${EXAMPLESDIR}
	@${INSTALL_DATA} -o ${USERS} -g ${GROUPS} -m 0600 \
		${WRKSRC}/dist/tcsd.conf ${EXAMPLESDIR}/tcsd.conf
	@[ -f ${PREFIX}/etc/tcsd.conf ] || \
		${CP} -p ${EXAMPLESDIR}/tcsd.conf ${PREFIX}/etc/tcsd.conf
	@${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 /var/run/tpm
	@${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 /var/run/ima
	@${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 ${PREFIX}/var/lib/tpm
	@${CAT} ${PKGMESSAGE}

add-plist-post:
	@${ECHO_CMD} "@cwd /"								>> ${TMPPLIST}
	@${ECHO_CMD} "@unexec ${RMDIR} var/run/tpm 2>/dev/null || true"			>> ${TMPPLIST}
	@${ECHO_CMD} "@exec ${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 var/run/tpm"	>> ${TMPPLIST}
	@${ECHO_CMD} "@unexec ${RMDIR} var/run/ima 2>/dev/null || true"			>> ${TMPPLIST}
	@${ECHO_CMD} "@exec ${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 var/run/ima"	>> ${TMPPLIST}

.include <bsd.port.mk>
OpenPOWER on IntegriCloud