aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses/drupal.mk
blob: ce47f4551de5dff56d6442bc989fee63aedcbbde (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
# $FreeBSD$
#
# Support for Drupal ports and modules.
#
# Feature:  drupal
# Usage:    USES=drupal or USES=drupal:ARGS
# Valid ARGS:   module <version> theme
#
# module    The port is a drupal module
#
# MAINTAINER: miwi@FreeBSD.org

.if !defined(_INCLUDE_USES_DRUPAL_Mk)
_INCLUDE_USES_DRUPAL_Mk=    yes

.if ${drupal_ARGS:M[67]}
_DRUPAL_VERSION=    ${drupal_ARGS:M[67]}
.endif

VALID_VERSIONS= 6 7

.if ${drupal_ARGS:N[67]:Ntheme:Nmodule}
IGNORE= Unknown argument for USES=drupal: ${drupal_ARGS:N[67]:Ntheme:Nmodule}
.endif

_DRUPAL_COMP=   ${drupal_ARGS:N[67]}

.if !defined(_DRUPAL_VERSION) || ! ${VALID_VERSIONS:M${_DRUPAL_VERSION}}
IGNORE= Missing or invalid argument for USES=drupal, a version must be provided: ${VALID_VERSIONS}
.endif

.if ${drupal_ARGS:Mmodule} && ${drupal_ARGS:Mtheme}
IGNORE= theme and module arguments are mutually exclusive for USES=drupal
.endif

DRUPAL_BASE?=   www/drupal${_DRUPAL_VERSION}

DRUPAL_DIR=     ${PREFIX}/${DRUPAL_BASE}
DRUPAL_DOCSDIR?=    ${PREFIX}/${DRUPAL_BASE}/doc
PLIST_SUB+=     DRUPAL_BASE=${DRUPAL_BASE}
SUB_LIST+=      DRUPAL_BASE=${DRUPAL_BASE} DRUPAL_DIR=${DRUPAL_DIR}

.if ! ${_DRUPAL_COMP}
DOCSDIR?=   ${DRUPAL_DOCSDIR}
.endif

.if ${_DRUPAL_COMP}
_USES_POST+=    drupal
PKGNAMEPREFIX=  drupal${_DRUPAL_VERSION}-
.if defined(DOC_FILES)
OPTIONS_DEFINE= DOCS
.endif

# drupal contributions must be licensed under the GPLv2 or GPLv3.  This is
# documented at: http://drupal.org/licensing/faq/
.if !defined(LICENSE)
LICENSE=    GPLv2 GPLv3
LICENSE_COMB=   dual
.endif

.if defined(DRUPAL_MODSUBDIR)
DRUPAL_MODDIR?= ${DRUPAL_BASE}/sites/all/${_DRUPAL_COMP}s/${DRUPAL_MODSUBDIR}
.else
DRUPAL_MODDIR?= ${DRUPAL_BASE}/sites/all/${_DRUPAL_COMP}s
.endif

DRUPAL_MODLIB?= ${DRUPAL_BASE}/sites/all/libraries

DOCSDIR?=   ${DRUPAL_DOCSDIR}/${PORTNAME}

MASTER_SITE_DRUPAL+= \
    http://ftp.drupal.org/files/projects/ \
    http://ftp.osuosl.org/pub/drupal/files/projects/
MASTER_SITE_DRUPAL_SUBDIR=

MASTER_SITES?=      ${MASTER_SITE_DRUPAL}
MASTER_SITE_SUBDIR?=    ${MASTER_SITE_DRUPAL_SUBDIR}

DIST_SUBDIR=    drupal

NO_BUILD?=  yes

WRKSRC?=    ${WRKDIR}/${PORTNAME}
RUN_DEPENDS+=   ${LOCALBASE}/${DRUPAL_BASE}/index.php:${PORTSDIR}/${DRUPAL_BASE}

PLIST_SUB+= DRUPAL_MODDIR=${DRUPAL_MODDIR}
PLIST_FILES+=   "@owner www" \
        "@group www" \
        ${MODULE_FILES:C|^|%%DRUPAL_MODDIR%%/|} \
        "@owner root" \
        "@group wheel"
PLIST_DIRS+=    ${MODULE_DIRS:C|^|%%DRUPAL_MODDIR%%/|}
.endif
.endif

.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_DRUPAL_POST_MK)
_INCLUDE_USES_DRUPAL_POST_MK=   yes

.if ${_DRUPAL_COMP}
.if ${PORT_OPTIONS:MDOCS}
PLIST_FILES+=   ${DOC_FILES:C|^|%%DOCSDIR%%/|}
PLIST_DIRS+=    ${DOC_DIRS:C|^|%%DOCSDIR%%/|}
PLIST_DIRS+=    %%DOCSDIR%%
.endif

do-install:
    @${MKDIR} ${DRUPAL_MODDIR:C|^|${STAGEDIR}${PREFIX}/|}
.if defined(MODULE_DIRS)
    @${MKDIR} ${MODULE_DIRS:C|^|${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/|}
.endif
.for f in ${MODULE_FILES}
    @${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/${f}
.endfor
    @${MKDIR} ${STAGEDIR}${DOCSDIR} ${DOC_DIRS:C|^|${STAGEDIR}${DOCSDIR}/|}
.for f in ${DOC_FILES}
    @${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}/${f}
.endfor

.endif
.endif