aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2014-06-18 20:16:43 +0800
committerbapt <bapt@FreeBSD.org>2014-06-18 20:16:43 +0800
commitf669476710fff20369069b61b893463a36266042 (patch)
treee298b7da1829d1ce04016c51079b2902a86035b6 /Mk/Uses
parentfd10116913e035e794ef171fa75602bafc83e698 (diff)
downloadfreebsd-ports-gnome-f669476710fff20369069b61b893463a36266042.tar.gz
freebsd-ports-gnome-f669476710fff20369069b61b893463a36266042.tar.zst
freebsd-ports-gnome-f669476710fff20369069b61b893463a36266042.zip
New USES=drupal
It accepts 6 or 7 as a mandatory argument (version of drupal) It accept nothing (aka drupal main port) or a mutually exclusive "theme"/"module"
Diffstat (limited to 'Mk/Uses')
-rw-r--r--Mk/Uses/drupal.mk123
1 files changed, 123 insertions, 0 deletions
diff --git a/Mk/Uses/drupal.mk b/Mk/Uses/drupal.mk
new file mode 100644
index 000000000000..dcda4742b346
--- /dev/null
+++ b/Mk/Uses/drupal.mk
@@ -0,0 +1,123 @@
+# $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
+
+_drupal_ARGS= ${drupal_ARGS:S/,/ /g}
+
+.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" \
+ "@owner wheel"
+PLIST_DIRS+= ${MODULE_DIRS:C|^|%%DRUPAL_MODDIR%%/|}
+PLIST_DIRS+= ${DRUPAL_MODDIR} ${DRUPAL_BASE}
+.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