summaryrefslogtreecommitdiff
path: root/devel/sonarqube-community/Makefile
blob: 62697418f46c27f46d7b3d549d5300bb2b034ac4 (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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
PORTNAME=	sonarqube
DISTVERSION=	10.7.0.96327
PORTREVISION=	4
CATEGORIES=	devel security www java
MASTER_SITES=	https://binaries.sonarsource.com/Distribution/sonarqube/:m_core \
		https://binaries.sonarsource.com/Distribution/sonar-csharp-plugin/:m_csharp \
		https://binaries.sonarsource.com/Distribution/sonar-java-plugin/:m_java \
		https://binaries.sonarsource.com/Distribution/sonar-javascript-plugin/:m_javascript \
		https://binaries.sonarsource.com/Distribution/sonar-php-plugin/:m_php \
		https://binaries.sonarsource.com/Distribution/sonar-python-plugin/:m_python \
		https://binaries.sonarsource.com/Distribution/sonar-vbnet-plugin/:m_vbnet
PKGNAMESUFFIX=	-community
DISTFILES=	${DISTNAME}${EXTRACT_SUFX}:m_core \
		sonar-csharp-plugin-${SONARCSHARP_VER}.jar:m_csharp \
		sonar-java-plugin-${SONARJAVA_VER}.jar:m_java \
		sonar-javascript-plugin-${SONARJAVASCRIPT_VER}.jar:m_javascript \
		sonar-php-plugin-${SONARPHP_VER}.jar:m_php \
		sonar-python-plugin-${SONARPYTHON_VER}.jar:m_python \
		sonar-vbnet-plugin-${SONARVBNET_VER}.jar:m_vbnet
EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}

MAINTAINER=	netchild@FreeBSD.org
COMMENT=	Web-based continuous code inspection tool
WWW=		https://www.sonarqube.org/

LICENSE=	LGPL3
LICENSE_FILE=	${WRKSRC}/COPYING

#BUILD_DEPENDS=	jna>0:devel/jna
RUN_DEPENDS=	bash:shells/bash #\
#		jna>0:devel/jna

USES=		cpe shebangfix zip nodejs:lts,run
CPE_VENDOR=	sonarsource
USE_JAVA=	yes

SHEBANG_FILES=	elasticsearch/bin/elasticsearch-cli \
		elasticsearch/bin/elasticsearch-env

NO_ARCH=	yes
NO_BUILD=	yes
JAVA_VERSION=	17+
JAVA_VENDOR=	openjdk
USE_RC_SUBR=	${PORTNAME}

APP_NAME=	${PORTNAME}
APP_DIR=	libexec/${PORTNAME}
LOG_DIR=	/var/log/${PORTNAME}
PID_DIR=	/var/run/${PORTNAME}
JAR_VERSION=	${DISTVERSION}
DBBASE_DIR=	/var/db/${PORTNAME}
DATA_DIR=	${DBBASE_DIR}/data
TEMP_DIR=	${DBBASE_DIR}/temp

# If you want to update plugins, simply update the version number below,
# and run "make makesum".
SONARCSHARP_VER=	10.3.0.106239
SONARJAVA_VER=		8.5.0.37199
SONARJAVASCRIPT_VER=	10.16.0.27621
SONARPHP_VER=		3.40.0.12590
SONARPYTHON_VER=	4.24.0.18631
SONARVBNET_VER=		${SONARCSHARP_VER}

USERS=		sonarqube
GROUPS=		sonarqube

SUB_LIST=	\
		APP_NAME=${APP_NAME} \
		APP_DIR=${APP_DIR} \
		JAVA_HOME=${JAVA_HOME} \
		JAVA=${JAVA} \
		LOG_DIR=${LOG_DIR} \
		PID_DIR=${PID_DIR} \
		JAR_VERSION=${JAR_VERSION} \
		DATA_DIR=${DATA_DIR} \
		TEMP_DIR=${TEMP_DIR}

SUB_FILES=	\
		${APP_NAME} \
		pkg-message

PLIST_SUB=	APP_NAME=${APP_NAME} \
		APP_DIR=${APP_DIR} \
		LOG_DIR=${LOG_DIR} \
		PID_DIR=${PID_DIR} \
		JAR_VERSION=${JAR_VERSION} \
		DBBASE_DIR=${DBBASE_DIR} \
		DATA_DIR=${DATA_DIR} \
		TEMP_DIR=${TEMP_DIR} \
		SONARCSHARP_VER=${SONARCSHARP_VER} \
		SONARJAVA_VER=${SONARJAVA_VER} \
		SONARJAVASCRIPT_VER=${SONARJAVASCRIPT_VER} \
		SONARPHP_VER=${SONARPHP_VER} \
		SONARPYTHON_VER=${SONARPYTHON_VER} \
		SONARSCMGIT_VER=${SONARSCMGIT_VER} \
		SONARSCMSVN_VER=${SONARSCMSVN_VER} \
		SONARVBNET_VER=${SONARVBNET_VER}

post-extract:
	${RM} -r ${WRKSRC}/bin ${WRKSRC}/lib/jsw ${WRKSRC}/conf/wrapper.conf
#	${RM} ${WRKSRC}/elasticsearch/lib/jna*.jar
	${MV} ${WRKSRC}/conf/sonar.properties ${WRKSRC}/conf/sonar.properties.sample
.for plugin in sonar-csharp-plugin \
    sonar-java-plugin \
    sonar-javascript-plugin \
    sonar-php-plugin \
    sonar-python-plugin \
    sonar-vbnet-plugin
	${RM} ${WRKSRC}/lib/extensions/${plugin}-*.jar
.endfor
.for plugin in sonar-csharp-plugin-${SONARCSHARP_VER}.jar \
    sonar-java-plugin-${SONARJAVA_VER}.jar \
    sonar-javascript-plugin-${SONARJAVASCRIPT_VER}.jar \
    sonar-php-plugin-${SONARPHP_VER}.jar \
    sonar-python-plugin-${SONARPYTHON_VER}.jar \
    sonar-vbnet-plugin-${SONARVBNET_VER}.jar
	${CP} ${DISTDIR}/${plugin} ${WRKSRC}/lib/extensions/
.endfor

post-patch:
	${REINPLACE_CMD} -e 's:%%LOG_DIR%%:${LOG_DIR}:g ; s:%%DATA_DIR%%:${DATA_DIR}:g ; s:%%TEMP_DIR%%:${TEMP_DIR}:g' ${WRKSRC}/conf/sonar.properties.sample

do-install:
	${MKDIR} ${STAGEDIR}${PREFIX}/${APP_DIR}/elasticsearch/plugins
	${MKDIR} ${STAGEDIR}${LOG_DIR} ${STAGEDIR}${PID_DIR} \
		${STAGEDIR}${DATA_DIR} ${STAGEDIR}${TEMP_DIR}
.for dir in conf elasticsearch extensions lib web
	cd ${WRKSRC}; ${COPYTREE_SHARE} ${dir} ${STAGEDIR}${PREFIX}/${APP_DIR} "! -name *\.orig"
.endfor
#	 ${LN} -s ${JAVASHAREDIR}/classes/jna.jar \
#		${STAGEDIR}${PREFIX}/${APP_DIR}/elasticsearch/lib/jna.jar

gen-plist:
	${ECHO} '@sample ${APP_DIR}/conf/sonar.properties.sample' >${PLIST}.new
	${ECHO} '@dir(sonarqube,sonarqube,755) %%DBBASE_DIR%%' >>${PLIST}.new
	${ECHO} '@dir(sonarqube,sonarqube,755) %%DATA_DIR%%' >>${PLIST}.new
	${ECHO} '@dir(sonarqube,sonarqube,755) %%TEMP_DIR%%' >>${PLIST}.new
	${ECHO} '@dir %%APP_DIR%%/elasticsearch/plugins' >>${PLIST}.new
#	${ECHO} '@dir(sonarqube,sonarqube,755) %%APP_DIR%%/extensions' >>${PLIST}.new
.for dir in conf elasticsearch lib web
	${FIND} ${STAGEDIR}${PREFIX}/${APP_DIR}/${dir} -type f -o -type l |  \
	    ${SED} -e "s:${STAGEDIR}${PREFIX}/::g ; \
		s:${JAR_VERSION}:%%JAR_VERSION%%:g ; \
		s:sonar-csharp-plugin-[0-9.]*.jar:sonar-csharp-plugin-%%SONARCSHARP_VER%%.jar:g ; \
		s:sonar-java-plugin-[0-9.]*.jar:sonar-java-plugin-%%SONARJAVA_VER%%.jar:g ; \
		s:sonar-javascript-plugin-[0-9.]*.jar:sonar-javascript-plugin-%%SONARJAVASCRIPT_VER%%.jar:g ; \
		s:sonar-php-plugin-[0-9.]*.jar:sonar-php-plugin-%%SONARPHP_VER%%.jar:g ; \
		s:sonar-python-plugin-[0-9.]*.jar:sonar-python-plugin-%%SONARPYTHON_VER%%.jar:g ; \
		s:sonar-vbnet-plugin-[0-9.]*.jar:sonar-vbnet-plugin-%%SONARVBNET_VER%%.jar:g ; \
		s:\(.*elasticsearch/bin.*\):@(,,755) \1:g" | \
	    ${GREP} -v conf/sonar.properties.sample | ${SORT} >> ${PLIST}.new
.endfor
	${ECHO} '@owner sonarqube' >>${PLIST}.new
	${ECHO} '@group sonarqube' >>${PLIST}.new
.for dir in extensions
	${FIND} ${STAGEDIR}${PREFIX}/${APP_DIR}/${dir} -type d | \
	    ${SED} -e "s:${STAGEDIR}${PREFIX}/:@dir(sonarqube,sonarqube,755) :g" | \
	    ${SORT} >> ${PLIST}.new
	${FIND} ${STAGEDIR}${PREFIX}/${APP_DIR}/${dir} -type f | \
	    ${SED} -e "s:${STAGEDIR}${PREFIX}/::g ; \
		s:${JAR_VERSION}:%%JAR_VERSION%%:g" | \
	    ${SORT} >> ${PLIST}.new
.endfor
	${ECHO} '@dir(sonarqube,sonarqube,755) %%LOG_DIR%%' >> ${PLIST}.new
	${ECHO} '@dir(sonarqube,sonarqube,755) %%PID_DIR%%' >> ${PLIST}.new

.include <bsd.port.mk>