summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authordsainty <dsainty>2010-12-19 11:22:59 +0000
committerdsainty <dsainty>2010-12-19 11:22:59 +0000
commit080c3162323ed3039baf950b06854f27e401a448 (patch)
tree0e42af44626bf9974329822836a6e609d6ca5735 /mk
parenta7dc2cd98389627a1ae946f85ea5441def97eb55 (diff)
downloadpkgsrc-080c3162323ed3039baf950b06854f27e401a448.tar.gz
This Makefile fragment is meant to be included by packages that
require a libjpeg implementation. jpeg.buildlink3.mk will: * set JPEGBASE to the base directory of the libjpeg files; * set JPEG_TYPE to the libjpeg implementation used. There are three variables that can be used to tweak the selection of the libjpeg implementation: JPEG_DEFAULT is a user-settable variable whose value is the default libjpeg implementation to use. JPEG_ACCEPTED is a package-settable list of libjpeg implementations that may be used by the package. This .mk is broadly based on fam.buildlink3.mk,v 1.7, and currently supports selection between the default "graphics/jpeg" and the alternative "graphics/libjpeg-turbo".
Diffstat (limited to 'mk')
-rw-r--r--mk/jpeg.buildlink3.mk58
1 files changed, 58 insertions, 0 deletions
diff --git a/mk/jpeg.buildlink3.mk b/mk/jpeg.buildlink3.mk
new file mode 100644
index 00000000000..5967f0d654b
--- /dev/null
+++ b/mk/jpeg.buildlink3.mk
@@ -0,0 +1,58 @@
+# $NetBSD: jpeg.buildlink3.mk,v 1.1 2010/12/19 11:22:59 dsainty Exp $
+#
+# This Makefile fragment is meant to be included by packages that
+# require a libjpeg implementation. jpeg.buildlink3.mk will:
+#
+# * set JPEGBASE to the base directory of the libjpeg files;
+# * set JPEG_TYPE to the libjpeg implementation used.
+#
+# There are three variables that can be used to tweak the selection of
+# the libjpeg implementation:
+#
+# JPEG_DEFAULT is a user-settable variable whose value is the default
+# libjpeg implementation to use.
+#
+# JPEG_ACCEPTED is a package-settable list of libjpeg implementations
+# that may be used by the package.
+#
+
+MK_JPEG_BUILDLINK3_MK:= ${MK_JPEG_BUILDLINK3_MK}+
+
+.include "bsd.fast.prefs.mk"
+
+.if !empty(MK_JPEG_BUILDLINK3_MK:M+)
+
+# This is an exhaustive list of all of the libjpeg implementations
+# that may be used with jpeg.buildlink3.mk, in order of precedence.
+#
+_JPEG_PKGS?= jpeg libjpeg-turbo
+
+JPEG_DEFAULT?= jpeg
+JPEG_ACCEPTED?= ${_JPEG_PKGS}
+
+_JPEG_DEFAULT= ${JPEG_DEFAULT}
+_JPEG_ACCEPTED= ${JPEG_ACCEPTED}
+
+_JPEG_TYPE?= ${_JPEG_DEFAULT}
+
+. if !empty(_JPEG_ACCEPTED:M${_JPEG_TYPE})
+JPEG_TYPE= ${_JPEG_TYPE}
+. else
+JPEG_TYPE= none
+. endif
+
+BUILD_DEFS+= JPEG_DEFAULT
+BUILD_DEFS_EFFECTS+= JPEGBASE JPEG_TYPE
+
+.if ${JPEG_TYPE} == "none"
+PKG_FAIL_REASON= \
+ "${_JPEG_TYPE} is not an acceptable libjpeg type for ${PKGNAME}."
+.elif ${JPEG_TYPE} == "jpeg"
+. include "../../graphics/jpeg/buildlink3.mk"
+.elif ${JPEG_TYPE} == "libjpeg-turbo"
+. include "../../graphics/libjpeg-turbo/buildlink3.mk"
+.endif
+
+JPEGBASE= ${BUILDLINK_PREFIX.${JPEG_TYPE}}
+
+.endif # MK_JPEG_BUILDLINK3_MK