aboutsummaryrefslogtreecommitdiffstats
path: root/www/redmine/bsd.redmine.mk
blob: 3468f4d74b8b1c1f570fcf25fde5a3ab192b1563 (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
# Module that simplifies installation of Redmine plugins.
#
# Date created:                      2010-09-12
# Whom:                              Eygene Ryabinkin <rea-fbsd@codelabs.ru>
#
# $FreeBSD$
#
# We're assuming standard plugin installation sequence that is described
# in the http://www.redmine.org/wiki/redmine/Plugins
#
# Basically, we need the following variables to be defined:
# - REDMINE_PLUGIN_NAME: the name of the plugin;
# - WWWDIR: the location of the Redmine installation;
#   the default value is ${PREFIX}/www/redmine;
#   the directory must lie under ${PREFIX} or such configuration
#   will be IGNORE'd;
# - WRKSRC must be set to the root directory of the plugin contents:
#   we will copy all objects in this directory to the plugin's
#   destination directory, excluding all files named *.orig.
#
# PLIST will be generated automatically, there is no need to worry
# about it.  But if you will need to use your own (even the standard
# packaging list in ${PORTDIR}/pkg-plist), set the variable PLIST
# pointing to that file.
#
# You can override the target 'do-build', but in this case, you should
# remember that the target named 'redmine-plugin-plist' does the
# automated generation of the PLIST: use it if you need.
#
#
# Here is an example of a simple Makefile for Redmine plugin:
# {{{
# PORTNAME= me-the-plugin
# PORTVERSION=  1.0
# CATEGORIES=   www
# MASTER_SITES= http://cool.org.name/some/path/
#
# MAINTAINER=   you@your.org
# COMMENT=  Another cool plugin for Redmine
#
# REDMINE_PLUGIN_NAME=  redmine_http_auth
#
# .include "${.CURDIR}/../../www/redmine/bsd.redmine.mk"
# }}}

PKGNAMEPREFIX?= redmine-

RUN_DEPENDS+=   redmine>=0.9:${PORTSDIR}/www/redmine

USE_RUBY=   yes
.if !defined(PLIST)
PLIST=      ${WRKDIR}/PLIST
_GEN_PLIST= YesPlease
.endif

WWWDIR?=    ${PREFIX}/www/redmine
WWWDIR_REL= ${WWWDIR:S|^${PREFIX}/||}

.if ${WWWDIR_REL} == ${WWWDIR}
IGNORE=     WWWDIR is not a child of PREFIX (${PREFIX})
.endif

.if !defined(do-build)
do-build: redmine-plugin-plist
    @${DO_NADA}
.endif

redmine-plugin-plist:
.if defined(_GEN_PLIST)
    cd ${WRKSRC} && ${FIND} . -type f | ${GREP} -v '\.orig$$' | ${SED} -e's|^\.|${WWWDIR_REL}/vendor/plugins/${REDMINE_PLUGIN_NAME}|' >> ${PLIST}
    cd ${WRKSRC} && ${FIND} -d . -type d | ${SED} -e's|^\.|@dirrm ${WWWDIR_REL}/vendor/plugins/${REDMINE_PLUGIN_NAME}|' >> ${PLIST}
.else
    @${DO_NADA}
.endif

do-install:
    ${MKDIR} "${WWWDIR}/vendor/plugins/${REDMINE_PLUGIN_NAME}"
    ${TAR} -C "${WRKSRC}" -cf - --exclude '*.orig' . | ${TAR} -C "${WWWDIR}/vendor/plugins/${REDMINE_PLUGIN_NAME}" -xf -

.include <bsd.port.mk>