aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt/portscout/Makefile
blob: 8f59121a6d823e3a8f0193b87312aae60592adc4 (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
# Created by: Shaun Amott <shaun@inerd.com>

PORTNAME=	portscout
PORTVERSION=	0.8.1.4
CATEGORIES=	ports-mgmt

MAINTAINER=	koobs@FreeBSD.org
COMMENT=	Tool to scan for new versions of FreeBSD ports

LICENSE=	BSD2CLAUSE

RUN_DEPENDS=	p5-DBI>=0:databases/p5-DBI \
		p5-CGI>=0:www/p5-CGI \
		p5-Proc-Queue>=0:devel/p5-Proc-Queue \
		p5-URI>=0:net/p5-URI \
		p5-XML-XPath>=0:textproc/p5-XML-XPath \
		p5-MIME-Lite>=0:mail/p5-MIME-Lite \
		p5-libwww>=0:www/p5-libwww \
		p5-JSON>0:converters/p5-JSON

USES=		perl5 shebangfix
USE_GITHUB=	yes
GH_ACCOUNT=	freebsd

OPTIONS_DEFINE=		DOCS HTTPS
OPTIONS_DEFAULT=	HTTPS PGSQL

OPTIONS_MULTI=		DATABASE
OPTIONS_MULTI_DATABASE=	SQLITE PGSQL

DATABASE_DESC=	Database Backends

NO_ARCH=	yes
NO_BUILD=	yes
SHEBANG_FILES=	${WRKSRC}/portscout.pl

PORTDOCS=	UPDATING portscout-portconfig.txt xml-datasrc-example.xml

HTTPS_RUN_DEPENDS=	p5-LWP-Protocol-https>=0:www/p5-LWP-Protocol-https

SQLITE_USES=		sqlite
SQLITE_RUN_DEPENDS=	p5-DBD-SQLite>=0:databases/p5-DBD-SQLite

PGSQL_USES=		pgsql
PGSQL_RUN_DEPENDS=	p5-DBD-Pg>=0:databases/p5-DBD-Pg

.include <bsd.port.options.mk>

pre-everything::
.if ${PORT_OPTIONS:MSQLITE}
	@${ECHO_MSG} "+-------------------------------------------------------------+"
	@${ECHO_MSG} "| Warning! although SQLite is supported, portscout will only  |"
	@${ECHO_MSG} "| operate in non-forking mode with this database backend. It  |"
	@${ECHO_MSG} "| is therefore recommended only for use with light workloads. |"
	@${ECHO_MSG} "+-------------------------------------------------------------+"
.endif

pre-install:
	@${REINPLACE_CMD} -e "s#^\(templates .*\)/etc#\1/share#"	\
	                  -e "s#^prefix\( *= *\).*#prefix\1${PREFIX}#"	\
	                  ${WRKSRC}/portscout.conf
	@${REINPLACE_CMD} -e "s#^\(.*PREFIX.*=> *\)'.*'#\1'${PREFIX}'#"	\
	                  ${WRKSRC}/Portscout/Const.pm
	@${MV} ${WRKSRC}/docs/*.* ${WRKSRC}

pre-install-SQLITE-on:
	@${REINPLACE_CMD} 's/^\([^#]*DBI:Pg.*\)$$/#\1/g' ${WRKSRC}/portscout.conf
	@${REINPLACE_CMD} 's/^#\(.*DBI:SQLite.*\)$$/\1/g' ${WRKSRC}/portscout.conf

do-install:
	@${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout
	@${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/DataSrc
	@${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SiteHandler
	@${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SQL
	${INSTALL_SCRIPT} ${WRKSRC}/Portscout/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/
	${INSTALL_SCRIPT} ${WRKSRC}/Portscout/DataSrc/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/DataSrc/
	${INSTALL_SCRIPT} ${WRKSRC}/Portscout/SiteHandler/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SiteHandler/
	${INSTALL_SCRIPT} ${WRKSRC}/Portscout/SQL/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SQL/
	${INSTALL_SCRIPT} ${WRKSRC}/Portscout.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout.pm
	${INSTALL_SCRIPT} ${WRKSRC}/portscout.pl ${STAGEDIR}${PREFIX}/bin/portscout

	${INSTALL_DATA} ${WRKSRC}/portscout.pod ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}

	pod2man ${WRKSRC}/portscout.pod ${WRKSRC}/portscout.1
	${INSTALL_MAN} ${WRKSRC}/portscout.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/

	@${MKDIR} ${STAGEDIR}${DATADIR}/templates
	cd ${WRKSRC}/templates \
	  && ${INSTALL_DATA} * ${STAGEDIR}${DATADIR}/templates

	@${MKDIR} ${STAGEDIR}${DATADIR}/sql
	cd ${WRKSRC}/sql && ${INSTALL_DATA} *.sql ${STAGEDIR}${DATADIR}/sql

	${INSTALL_DATA} ${WRKSRC}/portscout.conf ${STAGEDIR}${PREFIX}/etc/portscout.conf.sample

do-install-DOCS-on:
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
.	for f in ${PORTDOCS}
		${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}
.	endfor

test:
	${PERL} ${WRKSRC}/t/00-use.t
	${PERL} ${WRKSRC}/t/01-vercompare.t
.if ${PORT_OPTIONS:MSQLITE}
	${PERL} ${WRKSRC}/t/10-sqlite.t
#.else
#	${PERL} ${WRKSRC}/10-postgresql.t
.endif

.include <bsd.port.mk>