Thursday, April 06, 2023

Re: [Update] comms/hidapi 0.13.1

On 4/4/23 13:01, Stuart Henderson wrote:
> - I don't think it's a problem to lose static libraries.
> The way to change this would be in the cmakefiles
[...]
> - please use ${INSTALL_xx} vars instead of cp/mkdir
[...]
> and some of the patches lost their comments, so I'd go with this:

Points taken, thanks!

Given that you already sent a fixed port, I can't test dependent
ports beyond building them, and dabbling with solo2-cli, I won't follow
up on that one.

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/comms/libhidapi/Makefile,v
> retrieving revision 1.8
> diff -u -p -r1.8 Makefile
> --- Makefile 30 Mar 2023 03:04:05 -0000 1.8
> +++ Makefile 4 Apr 2023 10:56:56 -0000
> @@ -3,17 +3,16 @@ COMMENT = library for communicating with
> # XXX Any consumer should be patched to use hidapi_hid_init() instead of
> # hid_init(3) to avoid conflict with base usbhid(3).
>
> -V = 0.8.0pre20160128
> +V = 0.13.1
> DISTNAME = libhidapi-${V}
> -REVISION = 1
>
> -GH_ACCOUNT = signal11
> +GH_ACCOUNT = libusb
> GH_PROJECT = hidapi
> -GH_COMMIT = a6a622ffb680c55da0de787ff93b80280498330f
> +GH_TAGNAME = hidapi-${V}
>
> #libhidapi is symlink to hidapi-libusb. Same version numbers should be kept.
> -SHARED_LIBS += hidapi-libusb 0.0 # 0.0
> -SHARED_LIBS += hidapi 0.0 # 0.0
> +SHARED_LIBS += hidapi-libusb 1.0 # 0.0
> +SHARED_LIBS += hidapi 1.0 # 0.0
>
> CATEGORIES = comms
>
> @@ -26,20 +25,16 @@ WANTLIB += iconv pthread usb-1.0
> LIB_DEPENDS = converters/libiconv \
> devel/libusb1
>
> -SEPARATE_BUILD = Yes
> -CONFIGURE_STYLE = autoreconf
> -CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include/libusb-1.0 \
> - -I${LOCALBASE}/include" \
> - LDFLAGS="-L${LOCALBASE}/lib -lusb-1.0 -liconv"
> +MODULES = devel/cmake
>
> -AUTOCONF_VERSION = 2.69
> -AUTOMAKE_VERSION = 1.15
> +DOCDIR = ${PREFIX}/share/doc/hidapi
>
> -NO_TEST = Yes
> +NO_TEST = Yes
>
> post-install:
> - cd ${PREFIX}/lib && \
> - ln -sf libhidapi-libusb.so.${LIBhidapi-libusb_VERSION} \
> - libhidapi.so.${LIBhidapi-libusb_VERSION}
> + ${INSTALL_DATA_DIR} ${DOCDIR}
> + cd ${WRKSRC}; ${INSTALL_DATA} LICENSE* README.md AUTHORS.txt ${DOCDIR}/
> + ln -sf libhidapi-libusb.so.${LIBhidapi-libusb_VERSION} \
> + ${PREFIX}/lib/libhidapi.so.${LIBhidapi-libusb_VERSION}
>
> .include <bsd.port.mk>
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/comms/libhidapi/distinfo,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 distinfo
> --- distinfo 18 Jun 2018 23:37:01 -0000 1.1.1.1
> +++ distinfo 4 Apr 2023 10:56:56 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (libhidapi-0.8.0pre20160128-a6a622ff.tar.gz) = ZvagI/auGUBb5QEGFmRuEiRsA7IAqucuLAU6IkUD5IE=
> -SIZE (libhidapi-0.8.0pre20160128-a6a622ff.tar.gz) = 103980
> +SHA256 (libhidapi-0.13.1.tar.gz) = R2osmk3H0fyX3SI7hDONvqOAmoTK6i3NiH2XeHJUkOM=
> +SIZE (libhidapi-0.13.1.tar.gz) = 244666
> Index: patches/patch-README_md
> ===================================================================
> RCS file: patches/patch-README_md
> diff -N patches/patch-README_md
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-README_md 4 Apr 2023 10:56:56 -0000
> @@ -0,0 +1,14 @@
> +rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
> +
> +Index: README.md
> +--- README.md.orig
> ++++ README.md
> +@@ -112,7 +112,7 @@ int main(int argc, char* argv[])
> + int i;
> +
> + // Initialize the hidapi library
> +- res = hid_init();
> ++ res = hidapi_hid_init();
> +
> + // Open the device using the VID, PID,
> + // and optionally the Serial number.
> Index: patches/patch-README_txt
> ===================================================================
> RCS file: patches/patch-README_txt
> diff -N patches/patch-README_txt
> --- patches/patch-README_txt 11 Mar 2022 18:26:28 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,14 +0,0 @@
> -rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
> -
> -Index: README.txt
> ---- README.txt.orig
> -+++ README.txt
> -@@ -64,7 +64,7 @@ int main(int argc, char* argv[])
> - int i;
> -
> - // Initialize the hidapi library
> -- res = hid_init();
> -+ res = hidapi_hid_init();
> -
> - // Open the device using the VID, PID,
> - // and optionally the Serial number.
> Index: patches/patch-configure_ac
> ===================================================================
> RCS file: patches/patch-configure_ac
> diff -N patches/patch-configure_ac
> --- patches/patch-configure_ac 11 Mar 2022 18:26:28 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,31 +0,0 @@
> -add openbsd as recognized platform
> -use linux backend
> -disable hidraw component which checks for udev
> -remove librt check
> -
> -Index: configure.ac
> ---- configure.ac.orig
> -+++ configure.ac
> -@@ -53,7 +53,7 @@ hidapi_prog_error() {
> - AC_MSG_CHECKING([operating system])
> - AC_MSG_RESULT($host)
> - case $host in
> --*-linux*)
> -+*-linux* | *-openbsd*)
> - AC_MSG_RESULT([ (Linux back-end)])
> - AC_DEFINE(OS_LINUX, 1, [Linux implementations])
> - AC_SUBST(OS_LINUX)
> -@@ -61,13 +61,7 @@ case $host in
> - os="linux"
> - threads="pthreads"
> -
> -- # HIDAPI/hidraw libs
> -- PKG_CHECK_MODULES([libudev], [libudev], true, [hidapi_lib_error libudev])
> -- LIBS_HIDRAW_PR+=" $libudev_LIBS"
> -- CFLAGS_HIDRAW+=" $libudev_CFLAGS"
> --
> - # HIDAPI/libusb libs
> -- AC_CHECK_LIB([rt], [clock_gettime], [LIBS_LIBUSB_PRIVATE+=" -lrt"], [hidapi_lib_error librt])
> - PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0])
> - LIBS_LIBUSB_PRIVATE+=" $libusb_LIBS"
> - CFLAGS_LIBUSB+=" $libusb_CFLAGS"
> Index: patches/patch-hidapi_hidapi_h
> ===================================================================
> RCS file: /cvs/ports/comms/libhidapi/patches/patch-hidapi_hidapi_h,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-hidapi_hidapi_h
> --- patches/patch-hidapi_hidapi_h 11 Mar 2022 18:26:28 -0000 1.2
> +++ patches/patch-hidapi_hidapi_h 4 Apr 2023 10:56:56 -0000
> @@ -3,9 +3,9 @@ rename hid_init() to hidapi_hid_init() t
> Index: hidapi/hidapi.h
> --- hidapi/hidapi.h.orig
> +++ hidapi/hidapi.h
> -@@ -93,7 +93,7 @@ extern "C" {
> - @returns
> +@@ -197,7 +197,7 @@ extern "C" {
> This function returns 0 on success and -1 on error.
> + Call hid_error(NULL) to get the failure reason.
> */
> - int HID_API_EXPORT HID_API_CALL hid_init(void);
> + int HID_API_EXPORT HID_API_CALL hidapi_hid_init(void);
> Index: patches/patch-hidtest_Makefile_am
> ===================================================================
> RCS file: patches/patch-hidtest_Makefile_am
> diff -N patches/patch-hidtest_Makefile_am
> --- patches/patch-hidtest_Makefile_am 11 Mar 2022 18:26:28 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,17 +0,0 @@
> -pry hidraw out of hidapi's cold, dead hands
> -
> -Index: hidtest/Makefile.am
> ---- hidtest/Makefile.am.orig
> -+++ hidtest/Makefile.am
> -@@ -2,10 +2,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/hidapi/
> -
> - ## Linux
> - if OS_LINUX
> --noinst_PROGRAMS = hidtest-libusb hidtest-hidraw
> --
> --hidtest_hidraw_SOURCES = hidtest.cpp
> --hidtest_hidraw_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la
> -+noinst_PROGRAMS = hidtest-libusb
> -
> - hidtest_libusb_SOURCES = hidtest.cpp
> - hidtest_libusb_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la
> Index: patches/patch-hidtest_hidtest_cpp
> ===================================================================
> RCS file: patches/patch-hidtest_hidtest_cpp
> diff -N patches/patch-hidtest_hidtest_cpp
> --- patches/patch-hidtest_hidtest_cpp 11 Mar 2022 18:26:28 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,14 +0,0 @@
> -rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
> -
> -Index: hidtest/hidtest.cpp
> ---- hidtest/hidtest.cpp.orig
> -+++ hidtest/hidtest.cpp
> -@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
> -
> - struct hid_device_info *devs, *cur_dev;
> -
> -- if (hid_init())
> -+ if (hidapi_hid_init())
> - return -1;
> -
> - devs = hid_enumerate(0x0, 0x0);
> Index: patches/patch-hidtest_test_c
> ===================================================================
> RCS file: patches/patch-hidtest_test_c
> diff -N patches/patch-hidtest_test_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-hidtest_test_c 4 Apr 2023 10:56:56 -0000
> @@ -0,0 +1,21 @@
> +rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
> +
> +Index: hidtest/test.c
> +--- hidtest/test.c.orig
> ++++ hidtest/test.c
> +@@ -93,12 +93,12 @@ int main(int argc, char* argv[])
> + printf("Compile-time version is different than runtime version of hidapi.\n]n");
> + }
> +
> +- if (hid_init())
> ++ if (hidapi_hid_init())
> + return -1;
> +
> + #if defined(__APPLE__) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
> +- // To work properly needs to be called before hid_open/hid_open_path after hid_init.
> +- // Best/recommended option - call it right after hid_init.
> ++ // To work properly needs to be called before hid_open/hid_open_path after hidapi_hid_init.
> ++ // Best/recommended option - call it right after hidapi_hid_init.
> + hid_darwin_set_open_exclusive(0);
> +

No comments:

Post a Comment