summaryrefslogtreecommitdiff
path: root/net/keycloak/Makefile
blob: 70307ec423caafb919484bbec4bfa37805c3baa5 (plain) (blame)
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
PORTNAME=	keycloak
DISTVERSION=	26.0.6
CATEGORIES=	net java
MASTER_SITES=	https://github.com/${PORTNAME}/${PORTNAME}/releases/download/${DISTVERSION}/

MAINTAINER=	freebsd@rheinwolf.de
COMMENT=	Identity and access management solution
WWW=		https://www.keycloak.org/

LICENSE=	APACHE20
LICENSE_FILE=	${WRKSRC}/LICENSE.txt

USES=		cpe shebangfix

CPE_VENDOR=	redhat

USE_JAVA=	yes
JAVA_VERSION=	21+
JAVA_OS=	native
JAVA_VENDOR=	openjdk
JAVA_RUN=	yes

USE_RC_SUBR=	keycloak

SHEBANG_FILES=	bin/kc.sh \
		bin/kcadm.sh \
		bin/kcreg.sh

VAR_DIR?=	/var
LOG_DIR?=	${VAR_DIR}/log/${PORTNAME}
RUN_DIR?=	${VAR_DIR}/run/${PORTNAME}

NO_ARCH=	yes
NO_BUILD=	yes

SUB_FILES+=	pkg-message
SUB_LIST+=	GROUP=${KEYCLOAK_GROUP} \
		JAVA=${JAVA} \
		JAVA_HOME=${JAVA_HOME} \
		LOG_DIR=${LOG_DIR} \
		PORTNAME=${PORTNAME} \
		RUN_DIR=${RUN_DIR} \
		USER=${KEYCLOAK_USER} \
		GROUP=${KEYCLOAK_GROUP}

KEYCLOAK_USER=	${PORTNAME}
KEYCLOAK_GROUP=	${PORTNAME}
USERS=		${KEYCLOAK_USER}
GROUPS=		${USERS}

PLIST_SUB=	VERSION=${DISTVERSION} \
		USER=${KEYCLOAK_USER} \
		GROUP=${KEYCLOAK_GROUP}

OPTIONS_DEFINE=	DOCS EXAMPLES

CONFIG_FILES=	conf/cache-ispn.xml \
		conf/keycloak.conf \
		lib/quarkus/build-system.properties

post-patch:
.for f in ${CONFIG_FILES}
	${MV} ${WRKSRC}/${f} ${WRKSRC}/${f}.sample
.endfor
	${RM} ${WRKSRC}/bin/kc.bat
	${RM} ${WRKSRC}/bin/kcadm.bat
	${RM} ${WRKSRC}/bin/kcreg.bat

do-install:
	${MKDIR} ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/bin
	${MKDIR} ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/data
	${MKDIR} ${STAGEDIR}${LOG_DIR}
	${MKDIR} ${STAGEDIR}${RUN_DIR}

	# Install files in bin
	${INSTALL_SCRIPT} ${WRKSRC}/bin/*.sh ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/bin
	(cd ${WRKSRC}/bin && ${COPYTREE_SHARE} client ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/bin)

	# Install jar files, configuration and everything else
	(cd ${WRKSRC} && ${COPYTREE_SHARE} "conf lib providers themes" ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME})

	# Create links for kc* binaries
	${LN} -sf ../share/java/${PORTNAME}/bin/kcadm.sh ${STAGEDIR}${PREFIX}/bin/kcadm
	${LN} -sf ../share/java/${PORTNAME}/bin/kcreg.sh ${STAGEDIR}${PREFIX}/bin/kcreg

.include <bsd.port.mk>