Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jun 2014 12:16:43 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r358249 - head/Mk/Uses
Message-ID:  <201406181216.s5ICGhkD023106@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Jun 18 12:16:43 2014
New Revision: 358249
URL: http://svnweb.freebsd.org/changeset/ports/358249
QAT: https://qat.redports.org/buildarchive/r358249/

Log:
  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"

Added:
  head/Mk/Uses/drupal.mk
     - copied, changed from r358237, head/Mk/bsd.drupal.mk

Copied and modified: head/Mk/Uses/drupal.mk (from r358237, head/Mk/bsd.drupal.mk)
==============================================================================
--- head/Mk/bsd.drupal.mk	Wed Jun 18 09:43:38 2014	(r358237, copy source)
+++ head/Mk/Uses/drupal.mk	Wed Jun 18 12:16:43 2014	(r358249)
@@ -1,69 +1,57 @@
 # $FreeBSD$
 #
-# bsd.drupal.mk - Support for Drupal ports and modules.
+# Support for Drupal ports and modules.
 #
-# For FreeBSD committers:
-# Please send all suggested changes to the maintainer instead of committing
-# them to SVN yourself.
+# 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
 
-bsd_drupal_mk_MAINTAINER=	miwi@FreeBSD.org
+.if !defined(_INCLUDE_USES_DRUPAL_Mk)
+_INCLUDE_USES_DRUPAL_Mk=	yes
 
-# Make sure we cannot define any combination of DRUPAL{5,6}
-.if (defined(DRUPAL5_MODULE) && defined(DRUPAL6_MODULE))
-BROKEN=		cannot define a combination of DRUPAL5_MODULE and DRUPAL6_MODULE
-.endif
+_drupal_ARGS=	${drupal_ARGS:S/,/ /g}
 
-.if (defined(DRUPAL5_THEME) && defined(DRUPAL6_THEME))
-BROKEN=		cannot define a combination of DRUPAL5_THEME and DRUPAL6_THEME
+.if ${_drupal_ARGS:M[67]}
+_DRUPAL_VERSION=	${_drupal_ARGS:M[67]}
 .endif
 
-.if defined(DRUPAL6_MODULE) || defined(DRUPAL6_PORT)  || defined(DRUPAL6_THEME)
-DRUPAL_VERSION?=	6
-.endif
+VALID_VERSIONS=	6 7
 
-.if !defined(DRUPAL_VERSION)
-BROKEN=		must define DRUPAL_VERSION
+.if ${_drupal_ARGS:N[67]:Ntheme:Nmodule}
+IGNORE=	Unknown argument for USES=drupal: ${_drupal_ARGS:N[67]:Ntheme:Nmodule}
 .endif
 
-# Make sure DRUPAL_MODULE is defined where necessary
-.if defined(DRUPAL5_MODULE) || defined(DRUPAL6_MODULE)
-DRUPAL_MODULE?=	yes
-.endif
+_DRUPAL_COMP=	${_drupal_ARGS:N[67]}
 
-.if defined(DRUPAL_MODULE)
-DRUPAL_MODTYPE=	modules
+.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
 
-# Make sure DRUPAL_PORT is defined where necessary
-.if defined(DRUPAL5_PORT) || defined(DRUPAL6_PORT)
-DRUPAL_PORT?=	yes
+.if ${_drupal_ARGS:Mmodule} && ${_drupal_ARGS:Mtheme}
+IGNORE=	theme and module arguments are mutually exclusive for USES=drupal
 .endif
 
-# Make sure DRUPAL_THEME is defined where necessary
-.if defined(DRUPAL5_THEME) || defined(DRUPAL6_THEME)
-DRUPAL_THEME?=	yes
-DRUPAL_MODTYPE=	themes
-.endif
-
-.if ${DRUPAL_VERSION} == "7"
-DRUPAL_BASE?=	www/drupal7
-.elif ${DRUPAL_VERSION} == "6"
-DRUPAL_BASE?=	www/drupal6
-.else
-BROKEN=		Unknown DRUPAL_VERSION (${DRUPAL_VERSION})
-.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 defined(DRUPAL_PORT)
+.if ! ${_DRUPAL_COMP}
 DOCSDIR?=	${DRUPAL_DOCSDIR}
 .endif
 
-.if defined(DRUPAL_MODULE) || defined (DRUPAL_THEME)
-PKGNAMEPREFIX=  drupal${DRUPAL_VERSION}-
+.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/
@@ -73,25 +61,19 @@ LICENSE_COMB=	dual
 .endif
 
 .if defined(DRUPAL_MODSUBDIR)
-DRUPAL_MODDIR?=	${DRUPAL_BASE}/sites/all/${DRUPAL_MODTYPE}/${DRUPAL_MODSUBDIR}
+DRUPAL_MODDIR?=	${DRUPAL_BASE}/sites/all/${_DRUPAL_COMP}s/${DRUPAL_MODSUBDIR}
 .else
-DRUPAL_MODDIR?=	${DRUPAL_BASE}/sites/all/${DRUPAL_MODTYPE}/${PORTNAME}
+DRUPAL_MODDIR?=	${DRUPAL_BASE}/sites/all/${_DRUPAL_COMP}s
 .endif
 
 DRUPAL_MODLIB?=	${DRUPAL_BASE}/sites/all/libraries
 
 DOCSDIR?=	${DRUPAL_DOCSDIR}/${PORTNAME}
 
-.if defined(DRUPAL_MOD_SNAPSHOT)
-MASTER_SITE_DRUPAL+= \
-	${MASTER_SITE_LOCAL}
-MASTER_SITE_DRUPAL_SUBDIR=	pav/drupal
-.else
 MASTER_SITE_DRUPAL+= \
 	http://ftp.drupal.org/files/projects/ \
 	http://ftp.osuosl.org/pub/drupal/files/projects/
 MASTER_SITE_DRUPAL_SUBDIR=
-.endif
 
 MASTER_SITES?=		${MASTER_SITE_DRUPAL}
 MASTER_SITE_SUBDIR?=	${MASTER_SITE_DRUPAL_SUBDIR}
@@ -103,59 +85,39 @@ NO_BUILD?=	yes
 WRKSRC?=	${WRKDIR}/${PORTNAME}
 RUN_DEPENDS+=	${LOCALBASE}/${DRUPAL_BASE}/index.php:${PORTSDIR}/${DRUPAL_BASE}
 
-.if defined(MODULE_CONF_FILES)
-SUB_FILES=	pkg-install
-SUB_LIST+=	CONF_FILES="${MODULE_CONF_FILES:C|^|${DRUPAL_MODDIR}/|}" \
-		CONF_DIRS="${MODULE_CONF_DIRS:C|^|${DRUPAL_MODDIR}/|}"
-# XXX: where?
-PKGINSTALL=	${WRKDIR}/pkg-install
-PKGDEINSTALL=	${PKGINSTALL}
-.endif
-
 PLIST_SUB+=	DRUPAL_MODDIR=${DRUPAL_MODDIR}
-PLIST_FILES+=	${MODULE_FILES:C|^|%%DRUPAL_MODDIR%%/|}
-PLIST_FILES+=	${MODULE_CONF_FILES:C|^|%%DRUPAL_MODDIR%%/|:C|$|-dist|}
+PLIST_FILES+=	"@owner www" \
+		"@group www" \
+		${MODULE_FILES:C|^|%%DRUPAL_MODDIR%%/|} \
+		"@owner root" \
+		"@owner wheel"
 PLIST_DIRS+=	${MODULE_DIRS:C|^|%%DRUPAL_MODDIR%%/|}
-.if defined(DRUPAL_MODULE) || defined(DRUPAL_THEME)
-PLIST_DIRS+=	${DRUPAL_MODDIR}
+PLIST_DIRS+=	${DRUPAL_MODDIR} ${DRUPAL_BASE}
 .endif
-.if defined(DRUPAL_MODSUBDIR)
-PLIST_DIRS+=	${DRUPAL_MODDIR}
 .endif
-.if !defined(NOPORTDOCS)
+
+.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:
-.if defined(DRUPAL_MODULE) || defined(DRUPAL_THEME)
 	@${MKDIR} ${DRUPAL_MODDIR:C|^|${STAGEDIR}${PREFIX}/|}
-	@${CHOWN} ${WWWOWN}:${WWWGRP} ${DRUPAL_MODDIR:C|^|${STAGEDIR}${PREFIX}/|}
-.endif
-.if defined(MODULE_CONF_DIRS)
-	@${MKDIR} ${MODULE_CONF_DIRS:C|^|${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/|}
-	@${CHOWN} ${WWWOWN}:${WWWGRP} ${MODULE_CONF_DIRS:C|^|${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/|}
-.endif
 .if defined(MODULE_DIRS)
 	@${MKDIR} ${MODULE_DIRS:C|^|${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/|}
-	@${CHOWN} ${WWWOWN}:${WWWGRP} ${MODULE_DIRS:C|^|${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/|}
 .endif
 .for f in ${MODULE_FILES}
 	@${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/${f}
-	@${CHOWN} ${WWWOWN}:${WWWGRP} ${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/${f}
-.endfor
-.for f in ${MODULE_CONF_FILES}
-	@${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/${f}-dist
-	@${CHOWN} ${WWWOWN}:${WWWGRP} ${STAGEDIR}${PREFIX}/${DRUPAL_MODDIR}/${f}-dist
 .endfor
 	@${MKDIR} ${STAGEDIR}${DOCSDIR} ${DOC_DIRS:C|^|${STAGEDIR}${DOCSDIR}/|}
 .for f in ${DOC_FILES}
 	@${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}/${f}
 .endfor
 
-.if defined(MODULE_CONF_FILES)
-post-install:
-	@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 .endif
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406181216.s5ICGhkD023106>