Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Nov 2013 14:11:22 +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: r333572 - head/Mk/Uses
Message-ID:  <201311121411.rACEBMwY064705@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Tue Nov 12 14:11:22 2013
New Revision: 333572
URL: http://svnweb.freebsd.org/changeset/ports/333572

Log:
  Convert www/firefox/Makefile.webplugins into a USES
  Simplify it a lot,
  remove all not supported anymore web browsers,
  Prepend private varible behind an underscore
  Rename the gecko18, gecko19 target into a simple gecko target
  
  If you are writing a plugin port please use this USES, and if this USES does fit your need please report it so we can improve.

Added:
  head/Mk/Uses/webplugin.mk
     - copied, changed from r332670, head/www/firefox/Makefile.webplugins

Copied and modified: head/Mk/Uses/webplugin.mk (from r332670, head/www/firefox/Makefile.webplugins)
==============================================================================
--- head/www/firefox/Makefile.webplugins	Mon Nov  4 07:31:27 2013	(r332670, copy source)
+++ head/Mk/Uses/webplugin.mk	Tue Nov 12 14:11:22 2013	(r333572)
@@ -1,68 +1,51 @@
-# Created by: Andrew Pantyukhin <infofarmer@FreeBSD.org>
 # $FreeBSD$
-
-# MAINTAINER=	gecko@FreeBSD.org
+#
+# MAINTAINER= gecko@FreeBSD.org
 #
 # Documentation and examples:
 #
-# Makefile.webplugins will create symlinks automatically for each supported
-# application that supports the webplugins framework.  Also, it will remove
-# these symlinks when the plug-in port is uninstalled.
+# Feature:	webplugin
+# Usage:	USES=webplugin or USES=webplugin:ARGS
+# Valid ARGS:	gecko: Support geko based plugings
+# 		native: Support gecko, opera, webkit-gtk*
+# 		linux: Support linux plugins
+# 		[list of indivudual engines]: specify browsers to use
+# 		all: All browser (implicit, default)
 #
-# USE_WEBPLUGINS	- Specify a list of applications that this plug-in
-# 			  port supports.  For each of these applications, a
-# 			  symlink will be created in
-# 			  lib/browser_plugins/symlinks.  See
-# 			  WEBPLUGINS_APPS_ALL_* below for the list of
-# 			  supported applications.
-#			  Default: USE_WEBPLUGINS=${WEBPLUGINS_APPS_ALL} (all
-#			  applications)
+# USES=webplugin will create symlinks automatically for each supported
+# application that supports the webplugin framework.  Also, it will remove
+# these symlinks when the plug-in port is uninstalled.
 #
-# WEBPLUGINS_NAME	- If your port installs files in ${WEBPLUGINS_DIR},
-# 			  then you can tweak WEBPLUGINS_NAME to change the
+# WEBPLUGIN_NAME	- If your port installs files in ${WEBPLUGIN_DIR},
+# 			  then you can tweak WEBPLUGIN_NAME to change the
 # 			  name of the directory
-# 			  (lib/browser_plugins/symlinks/WEBPLUGINS_NAME).
-#			  Default: WEBPLUGINS_NAME=${PKGBASE}
+# 			  (lib/browser_plugins/symlinks/WEBPLUGIN_NAME).
+#			  Default: WEBPLUGIN_NAME=${PKGBASE}
 #
-# WEBPLUGINS_FILES	- The plug-in files that are going to be linked
+# WEBPLUGIN_FILES	- The plug-in files that are going to be linked
 #			  in lib/browser_plugins/symlinks/*/. It cannot
 #			  be empty or the port will set IGNORE.
 #
-# WEBPLUGINS_DIR	- The directory where the plug-in file(s) can be
-# 			  found.  Each plug-in file in WEBPLUGINS_FILES
-# 			  must be found in WEBPLUGINS_DIR.  If your port
-# 			  does not install in WEBPLUGINS_DIR, but in its own
+# WEBPLUGIN_DIR	- The directory where the plug-in file(s) can be
+# 			  found.  Each plug-in file in WEBPLUGIN_FILES
+# 			  must be found in WEBPLUGIN_DIR.  If your port
+# 			  does not install in WEBPLUGIN_DIR, but in its own
 # 			  path, you will need to specify that here or
 # 			  symlinks will be created to non-existent files.
-#			  Default: WEBPLUGINS_DIR=${WEBPLUGINS_LIBDIR:S,^${LOCALBASE}/,${PREFIX}/,}/${WEBPLUGINS_NAME}
-#
-#
-# The USE_WEBPLUGINS supports wildcards, native, and linux; so you can do any
-# of the following:
-#
-#	USE_WEBPLUGINS=gecko* (Supports gecko18 and gecko19.)
-#	USE_WEBPLUGINS=native (Supports gecko*, opera*, and webkit-gtk2)
-#	USE_WEBPLUGINS=linux (Supports linux-*)
-#	USE_WEBPLUGINS=opera webkit-gtk2
-#
-# Example to add in Makefile and pkg-plist if the plug-in files are installled
-# to WEBPLUGINS_DIR, and if your port does this manually:
+#			  Default: WEBPLUGIN_DIR=${_WEBPLUGIN_LIBDIR:S,^${LOCALBASE}/,${PREFIX}/,}/${WEBPLUGIN_NAME}
 #
 #	Makefile:
 #	------------------------------------------------------
+#	USES=	webplugin:gecko
 #	[...]
-# 	USE_WEBPLUGINS=gecko*
-#	WEBPLUGINS_FILES=fooplugin.so fooplugin.xpi
-#
-#	.include <bsd.port.pre.mk>
-#	.include "${PORTSDIR}/www/firefox/Makefile.webplugins"
+#	WEBPLUGIN_FILES=fooplugin.so fooplugin.xpi
 #
 #	post-install:
-#		${MKDIR} ${WEBPLUGINS_DIR}
-#		${INSTALL_DATA} ${WEBPLUGINS_FILES:S,^,${WRKSRC}/plugins/,} \
-#			${WEBPLUGINS_DIR}
+#		${MKDIR} ${STAGEDIR}${WEBPLUGIN_DIR}
+#		${INSTALL_DATA} ${WEBPLUGIN_FILES:S,^,${WRKSRC}/plugins/,} \
+#			${STAGEDIR}${WEBPLUGIN_DIR}
 #
-#	.include <bsd.port.post.mk>
+#	.include <bsd.port.mk>
 #	------------------------------------------------------
 #
 # You do not need to add lib/browser_plugins and lib/browser_plugins/symlinks
@@ -71,40 +54,35 @@
 #	pkg-plist:
 #	------------------------------------------------------
 #	[...]
-#	%%WEBPLUGINS_DIR%%/fooplugin.so
-#	%%WEBPLUGINS_DIR%%/fooplugin.xpi
-#	@dirrmtry %%WEBPLUGINS_DIR%%
+#	%%WEBPLUGIN_DIR%%/fooplugin.so
+#	%%WEBPLUGIN_DIR%%/fooplugin.xpi
+#	@dirrmtry %%WEBPLUGIN_DIR%%
 #	------------------------------------------------------
 #
 # Here is what it will look like when it creates the symlinks:
 #
 #	------------------------------------------------------
-#	/usr/local/lib/browser_plugins/symlinks/gecko18/fooplugin.so -> /usr/local/lib/browser_plugins/application/fooplugin.so
-#	/usr/local/lib/browser_plugins/symlinks/gecko18/fooplugin.xpi -> /usr/local/lib/browser_plugins/application/fooplugin.xpi
-#	/usr/local/lib/browser_plugins/symlinks/gecko19/fooplugin.so -> /usr/local/lib/browser_plugins/application/fooplugin.so
-#	/usr/local/lib/browser_plugins/symlinks/gecko19/fooplugin.xpi -> /usr/local/lib/browser_plugins/application/fooplugin.xpi
+#	/usr/local/lib/browser_plugins/symlinks/gecko/fooplugin.so -> /usr/local/lib/browser_plugins/application/fooplugin.so
+#	/usr/local/lib/browser_plugins/symlinks/gecko/fooplugin.xpi -> /usr/local/lib/browser_plugins/application/fooplugin.xpi
 #	------------------------------------------------------
 #
 # If your port uses libtool, and installs any *.a and *.la files, do not add
-# these files to WEBPLUGINS_FILES.  WEBPLUGINS_FILES should be *.so or/and
+# these files to WEBPLUGIN_FILES.  WEBPLUGIN_FILES should be *.so or/and
 # *.xpi ONLY.
 #
 # Example to add in Makefile and pkg-plist if your port installs plug-ins in
-# its own directory, and you need to set WEBPLUGINS_DIR.
+# its own directory, and you need to set WEBPLUGIN_DIR.
 #
 #	Makefile:
 #	------------------------------------------------------
 #	[...]
-# 	USE_WEBPLUGINS=gecko*
-#	WEBPLUGINS_DIR=${PREFIX}/lib/application
-#	WEBPLUGINS_FILES=fooplugin.so fooplugin.xpi
-#
-#	.include <bsd.port.pre.mk>
-#	.include "${PORTSDIR}/www/firefox/Makefile.webplugins"
+# 	USES=	webplugin:gecko
+#	WEBPLUGIN_DIR=${PREFIX}/lib/application
+#	WEBPLUGIN_FILES=fooplugin.so fooplugin.xpi
 #
 #	[...]
 #
-#	.include <bsd.port.post.mk>
+#	.include <bsd.port.mk>
 #	------------------------------------------------------
 #
 # As for the pkg-plist, it should only include the actual files your
@@ -123,37 +101,43 @@
 # Here is what it will look like when it creates symlinks:
 #
 #	------------------------------------------------------
-#	/usr/local/lib/browser_plugins/symlinks/gecko18/fooplugin.so -> /usr/local/lib/application/fooplugin.so
-#	/usr/local/lib/browser_plugins/symlinks/gecko18/fooplugin.xpi -> /usr/local/lib/application/fooplugin.xpi
-#	/usr/local/lib/browser_plugins/symlinks/gecko19/fooplugin.so -> /usr/local/lib/application/fooplugin.so
-#	/usr/local/lib/browser_plugins/symlinks/gecko19/fooplugin.xpi -> /usr/local/lib/application/fooplugin.xpi
-#	------------------------------------------------------
-
-WEBPLUGINS_NAME?=			${PKGBASE}
-WEBPLUGINS_FILES?=			empty
-WEBPLUGINS_APPS_ALL_LINUX=	linux-firefox linux-firefox-devel linux-flock \
-							linux-flock-devel linux-mozilla \
-							linux-nvu linux-opera linux-opera-devel \
-							linux-seamonkey linux-seamonkey-devel \
-							linux-sunbird linux-sunbird-devel
-WEBPLUGINS_APPS_ALL_NATIVE=	gecko18 gecko19 opera opera-devel webkit-gtk2
-WEBPLUGINS_APPS_ALL=		${WEBPLUGINS_APPS_ALL_LINUX} \
-							${WEBPLUGINS_APPS_ALL_NATIVE}
-
-.if !defined(USE_WEBPLUGINS) || ${USE_WEBPLUGINS} == "yes" || \
-	${USE_WEBPLUGINS} == "*"
-USE_WEBPLUGINS=	${WEBPLUGINS_APPS_ALL}
+#	/usr/local/lib/browser_plugins/symlinks/gecko/fooplugin.so -> /usr/local/lib/application/fooplugin.so
+#	/usr/local/lib/browser_plugins/symlinks/gecko/fooplugin.xpi -> /usr/local/lib/application/fooplugin.xpi
+#	------------------------------------------------------
+
+.if !defined(_INCLUDE_USES_WEBPLUGIN_MK)
+_INCLUDE_USES_WEBPLUGIN_MK=	yes
+
+WEBPLUGIN_NAME?=		${PKGBASE}
+_WEBPLUGIN_APPS_ALL_LINUX=	linux-firefox linux-opera linux-opera-devel \
+				linux-seamonkey
+_WEBPLUGIN_APPS_ALL_NATIVE=	gecko opera opera-devel webkit-gtk2
+_WEBPLUGIN_APPS_ALL=		${_WEBPLUGIN_APPS_ALL_LINUX} \
+				${_WEBPLUGIN_APPS_ALL_NATIVE}
+
+webplugin_ARGS?=	all
+_WEBPLUGIN_ARGS=	${webplugin_ARGS:C/,/ /}
+_WEBPLUGIN_TEST=	${_WEBPLUGIN_APPS_ALL}
+.if ${_WEBPLUGIN_ARGS} == all
+_WEBPLUGIN_PATTERN=	*
+.elif ${_WEBPLUGIN_ARGS} == native
+_WEBPLUGIN_PATTERN=	*
+_WEBPLUGIN_TEST=	${_WEBPLUGIN_APPS_ALL_NATIVE}
+.elif ${_WEBPLUGIN_ARGS} == linux
+_WEBPLUGIN_PATTERN=	*
+_WEBPLUGIN_TEST=	${_WEBPLUGIN_APPS_ALL_LINUX}
+.else
+_WEBPLUGIN_PATTERN=	${_WEBPLUGIN_ARGS:C/,/ /}
 .endif
 
-.if !defined(WEBPLUGINS_FILES) || ${WEBPLUGINS_FILES} == "empty" || \
-	${WEBPLUGINS_FILES} == ""
-IGNORE=	can't be installed: WEBPLUGINS_FILES is empty. Please, add plug-in files to it and check www/firefox/Makefile.webplugins for documentation
+.if !defined(WEBPLUGIN_FILES)
+IGNORE=	Cannot be installed: WEBPLUGIN_FILES is empty. Please, add plug-in files to it
 .endif
 
-.for _TEMP_APP__ in ${WEBPLUGINS_APPS_ALL}
+.for _TEMP_APP__ in ${_WEBPLUGIN_APPS_ALL}
 _TEMP_APP_=${_TEMP_APP__}
 _TEMP_FLAG_=0
-.	for _TEMP_USE__ in ${USE_WEBPLUGINS}
+.	for _TEMP_USE__ in ${USE_webplugin}
 _TEMP_USE_=${_TEMP_USE__}
 .		if !${_TEMP_APP_:C!${_TEMP_USE_:S/*/.*/:S/?/./}!!} || \
 		( ${_TEMP_APP_:Mlinux-*} && ${_TEMP_USE_:Mlinux} ) || \
@@ -162,61 +146,42 @@ _TEMP_FLAG_=1
 .		endif
 .	endfor
 .	if	${_TEMP_FLAG_}
-USE_WEBPLUGINS_EXP+=	${_TEMP_APP__}
+USE_WEBPLUGIN_EXP+=	${_TEMP_APP__}
 .	endif
 .endfor
 
-WEBPLUGINS_APPS=		${USE_WEBPLUGINS_EXP:S.^.${LOCALBASE}/lib/.:S.$./plugins.:N*opera*:N*gecko*:N*webkit*}
-WEBPLUGINS_SLDIRS=		${USE_WEBPLUGINS_EXP:S.^.${WEBPLUGINS_SLDIR}/.}
-WEBPLUGINS_LINKFARMS=	${WEBPLUGINS_APPS} ${WEBPLUGINS_SLDIRS}
-
-WEBPLUGINS_LIBDIR=		${LOCALBASE}/lib/browser_plugins
-WEBPLUGINS_SLDIR=		${WEBPLUGINS_LIBDIR}/symlinks
-WEBPLUGINS_DIR?=		${WEBPLUGINS_LIBDIR:S,^${LOCALBASE}/,${PREFIX}/,}/${WEBPLUGINS_NAME}
-
-PLIST_SUB+=		WEBPLUGINS_DIR="${WEBPLUGINS_DIR:S,^${PREFIX}/,,}"
-
-_LNWF=		${WEBPLUGINS_FILES:S,^,${WEBPLUGINS_DIR}/,}
-_Q=	2>/dev/null || true
-_WLD=		${WEBPLUGINS_LIBDIR:S,^${LOCALBASE},%D,}
-_WLF=		${WEBPLUGINS_LINKFARMS:S,${LOCALBASE},%D,}
-_WSD=		${WEBPLUGINS_SLDIR:S,^${LOCALBASE},%D,}
-
-webplugins-post-install:
-	@if [ ! -d ${WEBPLUGINS_DIR} ]; then \
-		${ECHO_CMD}; \
-		${ECHO_CMD} "ERROR: \"${WEBPLUGINS_DIR}\" in WEBPLUGINS_DIR is either a typo or no longer exists. Please, file a bug report to ${MAINTAINER} (maintainer)."; \
-		${ECHO_CMD}; \
-	else \
-		for _f in ${WEBPLUGINS_FILES}; do \
-			if [ ! -f ${WEBPLUGINS_DIR}/$${_f} ]; then \
-				${ECHO_CMD}; \
-				${ECHO_CMD} "ERROR: \"$${_f}\" in WEBPLUGINS_FILES is either a typo or no longer exists. Please, file a bug report to ${MAINTAINER} (maintainer)."; \
-				${ECHO_CMD}; \
-			fi; \
-		done; \
-	fi; \
-	for _d in ${WEBPLUGINS_LINKFARMS}; do \
-		${INSTALL} -d $${_d}; \
-		for _l in ${_LNWF}; do \
-			${LN} -sf $${_l} $${_d}/ ${_Q}; \
-		done; \
-	done; \
-	if [ "${PREFIX}" != "${LOCALBASE}" ]; then \
-		${ECHO_CMD} "@unexec rmdir ${_WLD} ${_Q}" >> ${TMPPLIST}; \
-	fi; \
-	${ECHO_CMD} "@cwd ${LOCALBASE}" >> ${TMPPLIST}; \
-	for _d in ${_WLF}; do \
-		${ECHO_CMD} "@exec ${INSTALL} -d $$_d" >> ${TMPPLIST}; \
-		for _l in ${_LNWF}; do \
-			${ECHO_CMD} "@exec ${LN} -sf $$_l $$_d/ ${_Q}" >> ${TMPPLIST}; \
-		done; \
-		for _f in ${WEBPLUGINS_FILES:S,^,\${_d}/,}; do \
-			${ECHO_CMD} "@unexec ${RM} -f $$_f" >> ${TMPPLIST}; \
-		done; \
-		${ECHO_CMD} "@unexec rmdir $$_d ${_Q}" >> ${TMPPLIST}; \
-	done
-	@${ECHO_CMD} "@unexec rmdir ${_WSD} ${_Q}" >> ${TMPPLIST}
-	@${ECHO_CMD} "@unexec rmdir ${_WLD} ${_Q}" >> ${TMPPLIST}
+.for p in ${_WEBPLUGIN_PATTERN}
+_WEBPLUGIN_MATCHED+=	${_WEBPLUGIN_TEST:M${p}}
+.endfor
+
+_WEBPLUGIN_LIBDIR=		${LOCALBASE}/lib/browser_plugins
+_WEBPLUGIN_SLDIR=		${_WEBPLUGIN_LIBDIR}/symlinks
+
+_WEBPLUGIN_SLDIRS=	${_WEBPLUGIN_MATCHED:S.^.${_WEBPLUGIN_SLDIR}/.}
+
+_WEBPLUGIN_APPS=		${USE_WEBPLUGIN_EXP:S.^.${LOCALBASE}/lib/.:S.$./plugins.:N*opera*:N*gecko*:N*webkit*}
+_WEBPLUGIN_LINKFARMS=	${_WEBPLUGIN_APPS} ${_WEBPLUGIN_SLDIRS}
+
+WEBPLUGIN_DIR?=		${_WEBPLUGIN_LIBDIR:S,^${LOCALBASE}/,${PREFIX}/,}/${WEBPLUGIN_NAME}
+
+PLIST_SUB+=		WEBPLUGIN_DIR="${WEBPLUGIN_DIR:S,^${PREFIX}/,,}"
 
-post-install: webplugins-post-install
+_LNWF=		${WEBPLUGIN_FILES:S,^,${WEBPLUGIN_DIR}/,}
+.for f in ${WEBPLUGIN_FILES}
+PLIST_FILES+=	${_WEBPLUGIN_LINKFARMS:S,${LOCALBASE}/,,:C,(.*),\1/${f},}
+.endfor
+PLIST_DIRSTRY+=	${_WEBPLUGIN_SLDIRS:S,^${LOCALBASE}/,,} \
+		${_WEBPLUGIN_SLDIR:S,^${LOCALBASE}/,,} \
+		${_WEBPLUGIN_LIBDIR:S,^${LOCALBASE}/,,}
+
+webplugin-post-install:
+.for d in ${_WEBPLUGIN_LINKFARMS}
+	${INSTALL} -d ${STAGEDIR}${d}
+.for l in ${_LNWF}
+	${LN} -sf ${l} ${STAGEDIR}${d}/
+.endfor
+.endfor
+
+post-install: webplugin-post-install
+
+.endif



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