aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorkwm <kwm@FreeBSD.org>2015-07-17 04:53:28 +0800
committerkwm <kwm@FreeBSD.org>2015-07-17 04:53:28 +0800
commit4490d4bc75707dbdea79b297aac91b4ce174c25f (patch)
tree3fa9947d2b38c86d548ab0b4face968420a2825b /Mk
parent929b8a6a2120516c63b8fecd8eba713ab5aafae2 (diff)
downloadfreebsd-ports-gnome-4490d4bc75707dbdea79b297aac91b4ce174c25f.tar.gz
freebsd-ports-gnome-4490d4bc75707dbdea79b297aac91b4ce174c25f.tar.zst
freebsd-ports-gnome-4490d4bc75707dbdea79b297aac91b4ce174c25f.zip
Convert code in bsd.port.mk for USE_GHOSTSCRIPT* to USES=ghostscript.
Add GHOSTSCRIPT_DEFAULT to bsd.default-versions.mk for easy version selection. Arguments supported: <empty>, build, run, nox11 and agpl PR: 201201 (exp-run) Approved by: portmgr (mat@) Exp run by: antione@ (previous patch) Differential Revision: https://reviews.freebsd.org/D2938
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/ghostscript.mk104
-rw-r--r--Mk/bsd.default-versions.mk1
-rw-r--r--Mk/bsd.port.mk73
-rw-r--r--Mk/bsd.sanity.mk4
4 files changed, 109 insertions, 73 deletions
diff --git a/Mk/Uses/ghostscript.mk b/Mk/Uses/ghostscript.mk
new file mode 100644
index 000000000000..9271eb0d0134
--- /dev/null
+++ b/Mk/Uses/ghostscript.mk
@@ -0,0 +1,104 @@
+# $FreeBSD$
+#
+# Provide support for ghostscript ports.
+#
+# Feature: ghostscript
+# Usage: USES=ghostscript or USES=ghostscript:args
+# Valid ARGS: <version>, build, run, nox11, agpl
+#
+# version The chooseable versions are 7, 8 and 9. If no version is
+# specified version 9 is selected.
+#
+# USES=ghostscript:7 # Use Ghostscript 7
+# USES=ghostscript:run # Use the set default Ghostscript as a run dependancy
+# USES=ghostscript:8,build # Use ghostscript 8 as a build dependancy.
+#
+# nox11 Indicate that the Ghostscript nox11 port is required.
+# agpl Indicate that the Ghostscript apgl port is required.
+# build Indicates that Ghostscript is needed at build time and adds
+# it as BUILD_DEPENDS.
+# run Indicates that Ghostscript is needed at run time and adds
+# it as RUN_DEPENDS.
+#
+# If build and run are omitted, Ghostscript will be added as BUILD_DEPENDS and
+# RUN_DEPENDS.
+#
+# MAINTAINER: ports@FreeBSD.org
+
+.if !defined(_INCLUDE_USES_GHOSTSCRIPT_MK)
+_INCLUDE_USES_GHOSTSCRIPT_MK= yes
+
+# allowed versions
+_GS_VERSION= 7 8 9
+
+_GS_ARGS= ${ghostscript_ARGS}
+
+.if ${_GS_ARGS:N[789]:Nnox11:Nagpl:Nbuild:Nrun}
+IGNORE= Unknown ghostscript argument ${_GS_ARGS}
+.endif
+
+# Determine version number of Ghostscript to use
+.include "${PORTSDIR}/Mk/bsd.default-versions.mk"
+
+.if ${_GS_VERSION:M${GHOSTSCRIPT_DEFAULT}} == ""
+IGNORE= Invalid GHOSTSCRIPT_DEFAULT value: ${GHOSTSCRIPT_DEFAULT}, please select one of ${_GS_VERSION}
+.endif
+
+# Make sure that no dependency or some other environment variable
+# pollutes the build/run dependency detection
+.undef _GS_BUILD_DEP
+.undef _GS_RUN_DEP
+.if ${_GS_ARGS:Mbuild}
+_GS_BUILD_DEP= yes
+.endif
+.if ${_GS_ARGS:Mrun}
+_GS_RUN_DEP= yes
+.endif
+
+# The port does not specify a build or run dependency, assume both are
+# required.
+.if !defined(_GS_BUILD_DEP) && !defined(_GS_RUN_DEP)
+_GS_BUILD_DEP= yes
+_GS_RUN_DEP= yes
+.endif
+
+_GS_SELECTED= ${GHOSTSCRIPT_DEFAULT}
+.if ${_GS_ARGS:M9}
+_GS_SELECTED:= 9
+.elif ${_GS_ARGS:M8}
+_GS_SELECTED:= 8
+.elif ${_GS_ARGS:M7}
+_GS_SELECTED:= 7
+.endif
+
+.undef _GS_AGPL_SUFFIX
+.if ${_GS_ARGS:Magpl}
+. if ${_GS_SELECTED} == "9"
+_GS_AGPL_SUFFIX= -agpl
+. else
+IGNORE= Ghostscript-agpl is only available in version 9
+. endif
+.endif
+
+.undef _GS_NOX11_SUFFIX
+.if ${_GS_ARGS:Mnox11} || defined(WITHOUT_X11)
+_GS_NOX11_SUFFIX= -nox11
+.endif
+
+.endif # _INCLUDE_USES_GHOSTSCRIPT_MK
+
+.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_GHOSTSCRIPT_POST_MK)
+_INCLUDE_USES_GHOSTSCRIPT_POST_MK= yes
+
+# dependencies
+_GS_PORT= ghostscript${_GS_SELECTED}${_GS_AGPL_SUFFIX}${_GS_NOX11_SUFFIX}
+
+.if defined(_GS_BUILD_DEP)
+BUILD_DEPENDS+= ${_GS_PORT}>=0:${PORTSDIR}/print/${_GS_PORT}
+.endif
+.if defined(_GS_RUN_DEP)
+RUN_DEPENDS+= ${_GS_PORT}>=0:${PORTSDIR}/print/${_GS_PORT}
+.endif
+
+
+.endif
diff --git a/Mk/bsd.default-versions.mk b/Mk/bsd.default-versions.mk
index f1733d4556a4..3e6c85cbc280 100644
--- a/Mk/bsd.default-versions.mk
+++ b/Mk/bsd.default-versions.mk
@@ -32,6 +32,7 @@ PYTHON3_DEFAULT?= 3.4
RUBY_DEFAULT?= 2.1
TCLTK_DEFAULT?= 8.6
FIREBIRD_DEFAULT?= 2.5
+GHOSTSCRIPT_DEFAULT?= 9
# Version of lang/gcc. Do not override!
LANG_GCC_IS= 4.8
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index b855919d91a7..a3d3981df158 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -342,27 +342,6 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org
# CXXFLAGS_${ARCH}
# Append the cxxflags to CXXFLAGS only on the specified architecture
##
-# USE_GHOSTSCRIPT
-# - If set, this port needs ghostscript to both
-# build and run. If a number is specified,
-# the specified version will be used.
-# The valid value is '7', '8', or '9' in that case.
-# USE_GHOSTSCRIPT_BUILD
-# - If set, this port needs ghostscript to build.
-# USE_GHOSTSCRIPT_RUN
-# - If set, this port needs ghostscript to run.
-# GHOSTSCRIPT_PORT
-# - The port that provides postscript functionality.
-# Some installations may wish to override the default
-# to specify a version without X11 and/or localized
-# versions for their nationality.
-# Default: print/ghostscript9
-# WITH_GHOSTSCRIPT_VER
-# - If set, the specified version of ghostscript will be
-# used. The valid value is "7", "8", or "9". Note that
-# this is for users, not for port maintainers. This
-# should not be used in Makefile.
-##
# USE_GL - A list of Mesa or GL related dependencies needed by the port.
# Supported components are: egl, glesv2, glut, glu, glw, and gl.
# If set to "yes", this is equivalent to "glu". Note that
@@ -1927,58 +1906,6 @@ CONFIGURE_ARGS+=--x-libraries=${LOCALBASE}/lib --x-includes=${LOCALBASE}/include
.endif
.endif
-# Set the default for the installation of Postscript(TM)-
-# compatible functionality.
-.if !defined(USE_GHOSTSCRIPT)
-. if defined(USE_GHOSTSCRIPT_BUILD)
-_USE_GHOSTSCRIPT= ${USE_GHOSTSCRIPT_BUILD}
-. elif defined(USE_GHOSTSCRIPT_RUN)
-_USE_GHOSTSCRIPT= ${USE_GHOSTSCRIPT_RUN}
-. endif
-.else
-_USE_GHOSTSCRIPT= ${USE_GHOSTSCRIPT}
-.endif
-
-.if defined(WITH_GHOSTSCRIPT_VER) && !empty(WITH_GHOSTSCRIPT_VER:M[789])
-_USE_GHOSTSCRIPT_DEFAULT_VER= ${WITH_GHOSTSCRIPT_VER}
-.else
-_USE_GHOSTSCRIPT_DEFAULT_VER= 9
-.endif
-
-.if defined(_USE_GHOSTSCRIPT)
-. if !defined(WITHOUT_X11)
-_USE_GHOSTSCRIPT_PKGNAME_SUFFIX=
-. else
-_USE_GHOSTSCRIPT_PKGNAME_SUFFIX=-nox11
-. endif
-. if !empty(_USE_GHOSTSCRIPT:M[789])
-_USE_GHOSTSCRIPT_VER=${_USE_GHOSTSCRIPT:M[789]}
-. else
-_USE_GHOSTSCRIPT_VER=${_USE_GHOSTSCRIPT_DEFAULT_VER}
-. endif
-.else
-_USE_GHOSTSCRIPT_VER=${_USE_GHOSTSCRIPT_DEFAULT_VER}
-.endif
-
-# Sanity check
-.if defined(_USE_GHOSTSCRIPT) && defined(WITH_GHOSTSCRIPT_VER)
-. if empty(WITH_GHOSTSCRIPT_VER:M[789])
-. error You set an invalid value "${WITH_GHOSTSCRIPT_VER}" in WITH_GHOSTSCRIPT_VER. Abort.
-. elif ${_USE_GHOSTSCRIPT_VER} != ${WITH_GHOSTSCRIPT_VER}
-. error You set WITH_GHOSTSCRIPT_VER as ${WITH_GHOSTSCRIPT_VER} but ${PKGNAME} requires print/ghostscript${_USE_GHOSTSCRIPT_VER}. Abort.
-. endif
-.endif
-
-GHOSTSCRIPT_PORT?= print/ghostscript${_USE_GHOSTSCRIPT_VER}${_USE_GHOSTSCRIPT_PKGNAME_SUFFIX}
-
-# Set up the ghostscript dependencies.
-.if defined(USE_GHOSTSCRIPT) || defined(USE_GHOSTSCRIPT_BUILD)
-BUILD_DEPENDS+= gs:${PORTSDIR}/${GHOSTSCRIPT_PORT}
-.endif
-.if defined(USE_GHOSTSCRIPT) || defined(USE_GHOSTSCRIPT_RUN)
-RUN_DEPENDS+= gs:${PORTSDIR}/${GHOSTSCRIPT_PORT}
-.endif
-
# Macro for doing in-place file editing using regexps
REINPLACE_ARGS?= -i.bak
REINPLACE_CMD?= ${SED} ${REINPLACE_ARGS}
diff --git a/Mk/bsd.sanity.mk b/Mk/bsd.sanity.mk
index a540bf93a4d8..3040665aa62e 100644
--- a/Mk/bsd.sanity.mk
+++ b/Mk/bsd.sanity.mk
@@ -47,6 +47,10 @@ DEV_ERROR+= "USE_KDELIBS_VER is unsupported"
DEV_ERROR+= "USE_QT_VER is unsupported"
.endif
+.if defined(USE_GHOSTSCRIPT) || defined(USE_GHOSTSCRIPT_BUILD) || defined(USE_GHOSTSCRIPT_RUN)
+DEV_ERROR+= "USE_GHOSTSCRIPT is unsupported, please use USES=ghostscript instead"
+.endif
+
.if !empty(LIB_DEPENDS:M*/../*)
DEV_ERROR+= "LIB_DEPENDS contains unsupported relative path to dependency"
.endif