tech-pkg archive

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

Re: CVS commit: pkgsrc/devel/libusb-compat



			Hi tech-pkg@,

On 26/01/2018 14:26, Pierre Pronchery wrote:
> 
> On 24/01/2018 02:16, Greg Troxel wrote:
>>
>> Pierre Pronchery <khorben%defora.org@localhost> writes:
>>
>>>> Import buildlink3.mk file for devel/libusb-compat
>>>>
>>>> libusb-compat is an API wrapper, emulating devel/libusb through the newer
>>>> code from devel/libusb1. On NetBSD, this has multiple advantages, such as
>>>> not requiring root privileges when accessing ugen(4) USB devices. We should
>>>> therefore consider to default to devel/libusb-compat instead of
>>>> devel/libusb on NetBSD at the very least.
>>>>
>>>> Tested with devel/libftdi on NetBSD/amd64.
>>>
>>> Can we do this, and if yes what would be the best way?
>>>
>>> I thought I could use prior art from eg devel/pkg-config vs
>>> devel/pkgconf, but it does not involve buildlink3.mk files like here. Is
>>> there another place I could get inspiration from?
>>
>> I have not really thought about this case, but we often have an
>> mk/foo.mk file that uses a pkgsrc-settable variable to switch between
>> implementations (including native as a choice, when that makes sense).
>> You might look at the krb5 one.
> 
> Yes, I have been discussing this with leot too, and we came to the same
> conclusion. I will suggest a patch using this approach in a moment.

This is a first patch, still work-in-progress, only tested with
devel/libftdi so far. It would be greatly helpful if someone could tell
me if this looks like the right direction.

It is still missing updates to everything using
devel/libusb/buildlink3.mk (except for devel/libftdi for my tests) and I
will test this next.

Cheers,
-- 
khorben
Index: mk/defaults/mk.conf
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defaults/mk.conf,v
retrieving revision 1.290
diff -p -u -r1.290 mk.conf
--- mk/defaults/mk.conf	2 Jan 2018 05:49:44 -0000	1.290
+++ mk/defaults/mk.conf	28 Jan 2018 02:28:12 -0000
@@ -1246,6 +1246,11 @@ JAKARTA_HOME?= ${JAVA_HOME}/jakarta
 # Possible: any libdvdcss site
 # Default: not defined
 
+LIBUSB_TYPE?=native
+# Used in packages using libusb to specify which implementation is used.
+# Possible: compat, native
+# Default: native
+
 #LATEX2HTML_ICONPATH=
 # Used in the latex2html package to set URL prefix for where to
 # find latex2html's icons.
Index: mk/libusb.mk
===================================================================
RCS file: mk/libusb.mk
diff -N mk/libusb.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mk/libusb.mk	28 Jan 2018 02:28:12 -0000
@@ -0,0 +1,17 @@
+# $NetBSD$
+#
+
+.include "../mk/bsd.fast.prefs.mk"
+
+.if defined(LIBUSB_TYPE)
+.  if !empty(LIBUSB_TYPE:Mcompat)
+.    include "../../devel/libusb-compat/buildlink3.mk"
+.  elif !empty(LIBUSB_TYPE:Mnative)
+.    include "../../devel/libusb/buildlink3.mk"
+.  else
+PKG_FAIL_REASON+="Unknown LIBUSB_TYPE: ${LIBUSB_TYPE:Q}"
+.  endif
+.else
+WARNINGS+="[libusb.mk] LIBUSB_TYPE is not set"
+.  include "../../devel/libusb/buildlink3.mk"
+.endif
Index: devel/libftdi/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libftdi/Makefile,v
retrieving revision 1.6
diff -p -u -r1.6 Makefile
--- devel/libftdi/Makefile	16 Aug 2017 20:21:07 -0000	1.6
+++ devel/libftdi/Makefile	28 Jan 2018 02:28:12 -0000
@@ -20,5 +20,5 @@ CONFIGURE_ARGS+=	--without-docs
 PKGCONFIG_OVERRIDE+=	libftdi.pc.in
 PKGCONFIG_OVERRIDE+=	libftdipp.pc.in
 
-.include "../../devel/libusb/buildlink3.mk"
+.include "../../mk/libusb.mk"
 .include "../../mk/bsd.pkg.mk"
Index: devel/libftdi/buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libftdi/buildlink3.mk,v
retrieving revision 1.1
diff -p -u -r1.1 buildlink3.mk
--- devel/libftdi/buildlink3.mk	23 Oct 2010 15:34:34 -0000	1.1
+++ devel/libftdi/buildlink3.mk	28 Jan 2018 02:28:12 -0000
@@ -8,7 +8,7 @@ LIBFTDI_BUILDLINK3_MK:=
 BUILDLINK_API_DEPENDS.libftdi+=	libftdi>=0.18
 BUILDLINK_PKGSRCDIR.libftdi?=	../../devel/libftdi
 
-.include "../../devel/libusb/buildlink3.mk"
+.include "../../mk/libusb.mk"
 .endif	# LIBFTDI_BUILDLINK3_MK
 
 BUILDLINK_TREE+=	-libftdi


Home | Main Index | Thread Index | Old Index