aboutsummaryrefslogtreecommitdiff
path: root/net/keycloak/Makefile
blob: e4554441cdea71d59d8c38021d9e8aaa09c1927f (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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
PORTNAME=	keycloak
PORTVERSION=	15.1.1
CATEGORIES=	net java
MASTER_SITES=	https://github.com/${PORTNAME}/${PORTNAME}/releases/download/${PORTVERSION}/

MAINTAINER=	freebsd@rheinwolf.de
COMMENT=	Identity and access management solution

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

FLAVORS=	default mysql postgres
FLAVOR?=	${FLAVORS:[1]}
mysql_PKGNAMESUFFIX=	-mysql
postgres_PKGNAMESUFFIX=	-postgres

.if ${FLAVOR:U} == mysql
RUN_DEPENDS+=	${JAVAJARDIR}/mysql-connector-java.jar:databases/mysql-connector-java
PLIST_SUB+=	MYSQL=""
.else
PLIST_SUB+=	MYSQL="@comment "
.endif

.if ${FLAVOR:U} == postgres
RUN_DEPENDS+=	${JAVAJARDIR}/postgresql.jar:databases/postgresql-jdbc
PLIST_SUB+=	POSTGRES=""
.else
PLIST_SUB+=	POSTGRES="@comment "
.endif

USES=		cpe
CPE_VENDOR=	redhat

USE_JAVA=	yes
JAVA_VERSION=	1.8+
JAVA_OS=	native
JAVA_VENDOR=	openjdk oracle
JAVA_RUN=	yes

USE_RC_SUBR=	keycloak

USER=		www
GROUP=		www

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

NO_ARCH=	yes
NO_BUILD=	yes

SUB_LIST+=	GROUP=${GROUP} \
		LOG_DIR=${LOG_DIR} \
		JAVA=${JAVA} \
		PORTNAME=${PORTNAME} \
		RUN_DIR=${RUN_DIR} \
		USER=${USER}

OPTIONS_DEFINE=	DOCS EXAMPLES

CONFIG_FILES=	bin/.jbossclirc \
		bin/add-user.properties \
		bin/domain.conf \
		bin/jboss-cli-logging.properties \
		bin/jboss-cli.xml bin/product.conf \
		bin/standalone.conf \
		domain/configuration/application-roles.properties \
		domain/configuration/application-users.properties \
		domain/configuration/default-server-logging.properties \
		domain/configuration/domain.xml \
		domain/configuration/host-master.xml \
		domain/configuration/host-slave.xml \
		domain/configuration/host.xml \
		domain/configuration/logging.properties \
		domain/configuration/mgmt-groups.properties \
		domain/configuration/mgmt-users.properties \
		modules/layers.conf \
		standalone/configuration/application-roles.properties \
		standalone/configuration/application-users.properties \
		standalone/configuration/logging.properties \
		standalone/configuration/mgmt-groups.properties \
		standalone/configuration/mgmt-users.properties \
		standalone/configuration/standalone-ha.xml \
		standalone/configuration/standalone.xml

post-patch:
.for f in ${CONFIG_FILES}
	${MV} ${WRKSRC}/${f} ${WRKSRC}/${f}.sample
.endfor
	${RM} -r ${WRKSRC}/modules/system/layers/base/org/apache/activemq/artemis/journal/main/lib/linux-i686
	${RM} -r ${WRKSRC}/modules/system/layers/base/org/apache/activemq/artemis/journal/main/lib/linux-x86_64
	${RM} -r ${WRKSRC}/modules/system/layers/base/org/wildfly/openssl/main/lib

do-install:
	${MKDIR} ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/bin
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	${MKDIR} ${STAGEDIR}${LOG_DIR}/domain
	${MKDIR} ${STAGEDIR}${LOG_DIR}/standalone
	${MKDIR} ${STAGEDIR}${RUN_DIR}

	# Install files in bin
	${INSTALL_SCRIPT} ${WRKSRC}/bin/*.sh ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/bin
.for f in .jbossclirc.sample add-user.properties.sample domain.conf.sample jboss-cli-logging.properties.sample jboss-cli.xml.sample \
	launcher.jar migrate-domain-clustered.cli migrate-domain-standalone.cli migrate-standalone-ha.cli migrate-standalone.cli \
	product.conf.sample standalone.conf.sample wildfly-elytron-tool.jar
	${INSTALL_DATA} ${WRKSRC}/bin/${f} ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/bin
.endfor
	${INSTALL_DATA} ${WRKSRC}/jboss-modules.jar ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}
	(cd ${WRKSRC}/bin && ${COPYTREE_SHARE} client ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/bin)

	# Install jar files, configuration and everything else
	(cd ${WRKSRC} && ${COPYTREE_SHARE} "domain modules standalone themes welcome-content" ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME})
	(cd ${WRKSRC}/docs/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
.for d in licenses-keycloak schema
	(cd ${WRKSRC}/docs/${d} && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/${d})
.endfor

	# 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

	# Create links for log directories
	${LN} -sf ../../../../../..${LOG_DIR}/domain ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/domain/log
	${LN} -sf ../../../../../..${LOG_DIR}/standalone ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/standalone/log

.if ${FLAVOR:U} == mysql
	@${MKDIR} ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/modules/system/layers/keycloak/com/mysql/main
	${CP} ${FILESDIR}/mysql-module.xml ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/modules/system/layers/keycloak/com/mysql/main/module.xml
	${LN} -sf ${JAVAJARDIR}/mysql-connector-java.jar ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/modules/system/layers/keycloak/com/mysql/main/mysql-connector-java.jar
.endif

.if ${FLAVOR:U} == postgres
	@${MKDIR} ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/modules/system/layers/keycloak/org/postgresql/main
	${CP} ${FILESDIR}/postgresql-module.xml ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/modules/system/layers/keycloak/org/postgresql/main/module.xml
	${LN} -sf ${JAVAJARDIR}/postgresql.jar ${STAGEDIR}${JAVASHAREDIR}/${PORTNAME}/modules/system/layers/keycloak/org/postgresql/main/postgresql.jar
.endif

.include <bsd.port.mk>