pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Import global switch for libusb's implementation [1/2]



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b60f49e5f3ae
branches:  trunk
changeset: 375375:b60f49e5f3ae
user:      khorben <khorben%pkgsrc.org@localhost>
date:      Sat Feb 10 13:45:45 2018 +0000

description:
Import global switch for libusb's implementation [1/2]

This switch is meant to be used by packages requiring an implementation of the
former libusb (as in devel/libusb). The original implementation can be
chosen by setting LIBUSB_TYPE to "native".

The alternative implementation libusb-compat (as in devel/libusb-compat) wraps
libusb1 (in devel/libusb1). This implementation can be chosen by setting
LIBUSB_TYPE to "compat". On NetBSD, it has the advantage of not requiring root
privileges to locate and use USB devices without a kernel driver.

This first part only imports the switch framework itself.

diffstat:

 mk/defaults/mk.conf     |   9 ++++++++-
 mk/libusb.buildlink3.mk |  36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diffs (63 lines):

diff -r 875e3c56ec7a -r b60f49e5f3ae mk/defaults/mk.conf
--- a/mk/defaults/mk.conf       Sat Feb 10 13:36:48 2018 +0000
+++ b/mk/defaults/mk.conf       Sat Feb 10 13:45:45 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.290 2018/01/02 05:49:44 maya Exp $
+# $NetBSD: mk.conf,v 1.291 2018/02/10 13:45:45 khorben Exp $
 #
 
 # This file provides default values for variables that may be overridden
@@ -1246,6 +1246,13 @@
 # Possible: any libdvdcss site
 # Default: not defined
 
+LIBUSB_TYPE?= native
+# Used in packages using libusb (version 0.x) to choose a specific
+# implementation. On NetBSD, compat has the advantage of not requiring root
+# privileges to locate and use USB devices without a kernel driver.
+# Possible: compat, native
+# Default: native
+
 #LATEX2HTML_ICONPATH=
 # Used in the latex2html package to set URL prefix for where to
 # find latex2html's icons.
diff -r 875e3c56ec7a -r b60f49e5f3ae mk/libusb.buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/libusb.buildlink3.mk   Sat Feb 10 13:45:45 2018 +0000
@@ -0,0 +1,36 @@
+# $NetBSD: libusb.buildlink3.mk,v 1.1 2018/02/10 13:45:45 khorben Exp $
+#
+# This Makefile is meant to be included by packages that require an
+# implementation of the former libusb (still found in devel/libusb). The
+# original implementation can be chosen by setting LIBUSB_TYPE to "native".
+#
+# The alternative implementation libusb-compat (found in devel/libusb-compat)
+# wraps libusb1 (in devel/libusb1). This implementation can be chosen by setting
+# LIBUSB_TYPE to "compat". On NetBSD, it has the advantage of not requiring root
+# privileges to locate and use USB devices without a kernel driver.
+#
+# === User-settable variables ===
+#
+# LIBUSB_TYPE
+#      The name of the libusb implementation to default to, native or compat.
+#
+
+MK_LIBUSB_BUILDLINK3_MK:=    ${MK_LIBUSB_BUILDLINK3_MK}+
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+.if !empty(MK_LIBUSB_BUILDLINK3_MK:M+)
+
+LIBUSB_TYPE?=  none
+
+BUILD_DEFS+=   LIBUSB_TYPE
+
+.  if ${LIBUSB_TYPE} == "native"
+.    include "../../devel/libusb/buildlink3.mk"
+.  elif ${LIBUSB_TYPE} == "compat"
+.    include "../../devel/libusb-compat/buildlink3.mk"
+.  else
+PKG_FAIL_REASON+=      "[libusb.buildlink3.mk] Invalid value ${LIBUSB_TYPE} for LIBUSB_TYPE."
+.  endif
+
+.endif # MK_LIBUSB_BUILDLINK3_MK



Home | Main Index | Thread Index | Old Index