On 2023/07/01 22:37, Raphael Graf wrote:
> The project has moved to github and the version numbering scheme has changed.
> A list of changes is here: https://github.com/PortMidi/portmidi/releases
> 
> Audacity still works and I have also compile-tested emulators/hatari and
> games/odamex.
> 
> The delayed playback of midi-mesages is still not implemented in the
> sndio-specific code (see XXX in files/pm_sndio/pmsndio.c). I doubt that it
> is even possible to do in userland because of the timing requirements.
> Does anybody have an idea how to implement this?
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/audio/portmidi/Makefile,v
> retrieving revision 1.5
> diff -u -p -u -p -r1.5 Makefile
> --- Makefile  11 Mar 2022 18:20:27 -0000      1.5
> +++ Makefile  1 Jul 2023 20:06:03 -0000
> @@ -1,33 +1,28 @@
>  COMMENT =    library for real time input and output of MIDI data
>  
> -DISTNAME =   portmidi-src-217
> -PKGNAME =    portmidi-217
> -REVISION =   0
> +GH_ACCOUNT = PortMidi
> +GH_PROJECT = portmidi
> +GH_TAGNAME = v2.0.4
> +EPOCH =              0
>  
> -SHARED_LIBS =        portmidi        0.0
> +DISTNAME =   portmidi-${GH_TAGNAME:S/v//}

You don't need this, it's set automatically from GH_PROJECT and
GH_TAGNAME.

> +
> +SHARED_LIBS =        portmidi        1.0
>  
>  CATEGORIES = audio
>  
> -HOMEPAGE =   http://portmedia.sourceforge.net/
> +HOMEPAGE =   https://github.com/PortMidi/portmidi

this is set automatically by GH_* too.

The rest reads ok but I don't have hw to test.

>  # ISC
>  PERMIT_PACKAGE =     Yes
>  
>  WANTLIB      =       pthread sndio
>  
> -MASTER_SITES =       ${MASTER_SITE_SOURCEFORGE:=portmedia/}
> -EXTRACT_SUFX =       .zip
> -
> -MODULES =       devel/cmake
> +MODULES =    devel/cmake
>  
> -CONFIGURE_ARGS+= -DPROJECT_BINARY_DIR=Release \
> -             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${WRKBUILD}/Release \
> -             -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${WRKBUILD}/Release \
> -             -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${WRKBUILD}/Release
> +CONFIGURE_ARGS+=     -DUSE_SNDIO=ON
>  
>  NO_TEST =    Yes
> -
> -WRKDIST =    ${WRKDIR}/portmidi
>  
>  FIX_CRLF_FILES = porttime/ptlinux.c
>  
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/audio/portmidi/distinfo,v
> retrieving revision 1.1.1.1
> diff -u -p -u -p -r1.1.1.1 distinfo
> --- distinfo  23 Mar 2019 13:30:08 -0000      1.1.1.1
> +++ distinfo  1 Jul 2023 20:06:03 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (portmidi-src-217.zip) = COmokr2AvbERUhP7ctwpp78v8QizeBgFhqpl88/ULg8=
> -SIZE (portmidi-src-217.zip) = 1030830
> +SHA256 (portmidi-2.0.4.tar.gz) = ZIk+gjrhRsq9Otf5qanFMydGq+eEfFV7mbJXevqKYHw=
> +SIZE (portmidi-2.0.4.tar.gz) = 263225
> Index: files/portmidi.pc.in
> ===================================================================
> RCS file: files/portmidi.pc.in
> diff -N files/portmidi.pc.in
> --- files/portmidi.pc.in      23 Mar 2019 13:30:08 -0000      1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,11 +0,0 @@
> -prefix=@DEST_DIR@
> -exec_prefix=${prefix}
> -libdir=${prefix}/lib
> -includedir=${prefix}/include
> -
> -Name: libportmidi
> -Description: Portable midi I/O
> -Version: 217
> -
> -Libs: -L${libdir} -lportmidi
> -Cflags: -I${includedir}
> Index: files/pm_sndio/pmsndio.c
> ===================================================================
> RCS file: /cvs/ports/audio/portmidi/files/pm_sndio/pmsndio.c,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 pmsndio.c
> --- files/pm_sndio/pmsndio.c  10 May 2019 12:55:19 -0000      1.2
> +++ files/pm_sndio/pmsndio.c  1 Jul 2023 20:06:03 -0000
> @@ -12,8 +12,8 @@
>  #include "pminternal.h"
>  #include "porttime.h"
>  
> -#define NDEVS 9 
> -#define SYSEX_MAXLEN 1024 
> +#define NDEVS 9
> +#define SYSEX_MAXLEN 1024
>  
>  #define SYSEX_START     0xf0
>  #define SYSEX_END       0xf7
> @@ -45,18 +45,18 @@ void pm_init()
>  
>      /* default */
>      strcpy(devs[0].name, MIO_PORTANY);
> -    pm_add_device("SNDIO", devs[k].name, TRUE, (void *) &devs[k],
> +    pm_add_device("SNDIO", devs[k].name, TRUE, FALSE, (void *) &devs[k],
>          &pm_sndio_in_dictionary);
> -    pm_add_device("SNDIO", devs[k].name, FALSE, (void *) &devs[k],
> +    pm_add_device("SNDIO", devs[k].name, FALSE, FALSE, (void *) &devs[k],
>          &pm_sndio_out_dictionary);
>      k++;
>  
>      for (i = 0; i < 4; i++) {
>          for (j = 0; j < 2; j++) {
>              sprintf(devs[k].name, "%s/%d", devices[i], j);
> -            pm_add_device("SNDIO", devs[k].name, TRUE, (void *) &devs[k],
> +            pm_add_device("SNDIO", devs[k].name, TRUE, FALSE, (void *) 
> &devs[k],
>                &pm_sndio_in_dictionary);
> -            pm_add_device("SNDIO", devs[k].name, FALSE, (void *) &devs[k],
> +            pm_add_device("SNDIO", devs[k].name, FALSE, FALSE, (void *) 
> &devs[k],
>                &pm_sndio_out_dictionary);
>              k++;
>          }
> @@ -85,7 +85,7 @@ void pm_term(void)
>  
>  PmDeviceID Pm_GetDefaultInputDeviceID() {
>      Pm_Initialize();
> -    return pm_default_input_device_id; 
> +    return pm_default_input_device_id;
>  }
>  
>  PmDeviceID Pm_GetDefaultOutputDeviceID() {
> @@ -107,14 +107,14 @@ static int midi_message_length(PmMessage
>          return common_len[st & 7];
>      else if (st >= 0x80)
>          return voice_len[(st >> 4) & 7];
> -    else 
> +    else
>          return 0;
>  }
>  
>  void* input_thread(void *param)
>  {
>      PmInternal *midi = (PmInternal*)param;
> -    struct mio_dev *dev = (struct mio_dev *) midi->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>      struct pollfd pfd[1];
>      nfds_t nfds;
>      unsigned char st = 0, c = 0;
> @@ -206,8 +206,7 @@ static void set_mode(struct mio_dev *dev
>  
>  static PmError sndio_out_open(PmInternal *midi, void *driverInfo)
>  {
> -    descriptor_type desc = &descriptors[midi->device_id];
> -    struct mio_dev *dev = (struct mio_dev *) desc->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>  
>      if (dev->mode & MIO_OUT)
>          return pmNoError;
> @@ -219,14 +218,12 @@ static PmError sndio_out_open(PmInternal
>          return pmHostError;
>      }
>  
> -    midi->descriptor = (void *)dev;
>      return pmNoError;
>  }
>  
>  static PmError sndio_in_open(PmInternal *midi, void *driverInfo)
>  {
> -    descriptor_type desc = &descriptors[midi->device_id];
> -    struct mio_dev *dev = (struct mio_dev *) desc->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>  
>      if (dev->mode & MIO_IN)
>          return pmNoError;
> @@ -237,7 +234,6 @@ static PmError sndio_in_open(PmInternal 
>            "mio_open (input) failed: %s\n", dev->name);
>          return pmHostError;
>      }
> -    midi->descriptor = (void *)dev;
>      pthread_attr_t attr;
>      pthread_attr_init(&attr);
>      pthread_create(&dev->thread, &attr, input_thread, ( void* )midi);
> @@ -246,7 +242,7 @@ static PmError sndio_in_open(PmInternal 
>  
>  static PmError sndio_out_close(PmInternal *midi)
>  {
> -    struct mio_dev *dev = (struct mio_dev *) midi->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>  
>      if (dev->mode & MIO_OUT)
>          set_mode(dev, dev->mode & ~MIO_OUT);
> @@ -255,7 +251,7 @@ static PmError sndio_out_close(PmInterna
>  
>  static PmError sndio_in_close(PmInternal *midi)
>  {
> -    struct mio_dev *dev = (struct mio_dev *) midi->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>  
>      if (dev->mode & MIO_IN) {
>          set_mode(dev, dev->mode & ~MIO_IN);
> @@ -280,7 +276,7 @@ static PmError do_write(struct mio_dev *
>      size_t w = mio_write(dev->hdl, addr, nbytes);
>  
>      if (w != nbytes) {
> -        snprintf(dev->errmsg, PM_HOST_ERROR_MSG_LEN, 
> +        snprintf(dev->errmsg, PM_HOST_ERROR_MSG_LEN,
>            "mio_write failed, bytes written:%zu\n", w);
>          return pmHostError;
>      }
> @@ -290,14 +286,19 @@ static PmError do_write(struct mio_dev *
>  static PmError sndio_write_byte(PmInternal *midi, unsigned char byte,
>                          PmTimestamp timestamp)
>  {
> -    struct mio_dev *dev = (struct mio_dev *) midi->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>  
> -    return do_write(dev, &byte, 1);
> +    if (midi->latency > 0) {
> +        /* XXX the byte should be queued for later playback */
> +        return do_write(dev, &byte, 1);
> +    } else {
> +        return do_write(dev, &byte, 1);
> +    }
>  }
>  
>  static PmError sndio_write_short(PmInternal *midi, PmEvent *event)
>  {
> -    struct mio_dev *dev = (struct mio_dev *) midi->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>      int nbytes = midi_message_length(event->message);
>  
>      if (midi->latency > 0) {
> @@ -321,14 +322,14 @@ PmError sndio_sysex(PmInternal *midi, Pm
>  
>  static unsigned int sndio_has_host_error(PmInternal *midi)
>  {
> -    struct mio_dev *dev = (struct mio_dev *) midi->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>  
>      return (dev->errmsg[0] != '\0');
>  }
>  
>  static void sndio_get_host_error(PmInternal *midi, char *msg, unsigned int 
> len)
>  {
> -    struct mio_dev *dev = (struct mio_dev *) midi->descriptor;
> +    struct mio_dev *dev = pm_descriptors[midi->device_id].descriptor;
>  
>      strlcpy(msg, dev->errmsg, len);
>      dev->errmsg[0] = '\0';
> @@ -347,7 +348,6 @@ pm_fns_node pm_sndio_in_dictionary = {
>      sndio_in_close,
>      success_poll,
>      sndio_has_host_error,
> -    sndio_get_host_error
>  };
>  
>  pm_fns_node pm_sndio_out_dictionary = {
> @@ -363,6 +363,5 @@ pm_fns_node pm_sndio_out_dictionary = {
>      sndio_out_close,
>      none_poll,
>      sndio_has_host_error,
> -    sndio_get_host_error
>  };
>  
> Index: patches/patch-CMakeLists_txt
> ===================================================================
> RCS file: /cvs/ports/audio/portmidi/patches/patch-CMakeLists_txt,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 patch-CMakeLists_txt
> --- patches/patch-CMakeLists_txt      11 Mar 2022 18:20:27 -0000      1.2
> +++ patches/patch-CMakeLists_txt      1 Jul 2023 20:06:03 -0000
> @@ -1,16 +1,24 @@
> +-Option USE_SNDIO
> +-Install static lib as well
> +
>  Index: CMakeLists.txt
>  --- CMakeLists.txt.orig
>  +++ CMakeLists.txt
> -@@ -73,5 +73,11 @@ add_subdirectory(pm_test)
> - add_subdirectory(pm_dylib)
> +@@ -26,6 +26,8 @@ option(PM_USE_STATIC_RUNTIME 
> +        "Use MSVC static runtime. Only applies when BUILD_SHARED_LIBS is OFF"
> +        ON)
>   
> - # Cannot figure out how to make an xcode Java application with CMake
> --add_subdirectory(pm_java)
> -+#add_subdirectory(pm_java)
> ++option(USE_SNDIO "Use sndio backend" OFF)
> ++
> + # MSVCRT_DLL is used to construct the MSVC_RUNTIME_LIBRARY property
> + #  (see pm_common/CMakeLists.txt and pm_test/CMakeLists.txt)
> + if(PM_USE_STATIC_RUNTIME AND NOT BUILD_SHARED_LIBS)
> +@@ -117,7 +119,7 @@ if(BUILD_JAVA_NATIVE_INTERFACE)
> + endif(BUILD_JAVA_NATIVE_INTERFACE)
>   
> -+set(DEST_DIR "${CMAKE_INSTALL_PREFIX}")
> -+CONFIGURE_FILE("portmidi.pc.in" "portmidi.pc" @ONLY)
> -+install(FILES
> -+  "${CMAKE_CURRENT_BINARY_DIR}/portmidi.pc"
> -+  DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig"
> -+)
> + # Install the libraries and headers (Linux and Mac OS X command line)
> +-INSTALL(TARGETS portmidi ${PMJNI_IF_EXISTS}
> ++INSTALL(TARGETS portmidi portmidi_s ${PMJNI_IF_EXISTS}
> +   EXPORT PortMidiTargets
> +   LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
> +   ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
> Index: patches/patch-pm_common_CMakeLists_txt
> ===================================================================
> RCS file: /cvs/ports/audio/portmidi/patches/patch-pm_common_CMakeLists_txt,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 patch-pm_common_CMakeLists_txt
> --- patches/patch-pm_common_CMakeLists_txt    11 Mar 2022 18:20:27 -0000      
> 1.2
> +++ patches/patch-pm_common_CMakeLists_txt    1 Jul 2023 20:06:03 -0000
> @@ -1,55 +1,42 @@
> +-Build static library as well
> +-Use sndio backend
> +
>  Index: pm_common/CMakeLists.txt
>  --- pm_common/CMakeLists.txt.orig
>  +++ pm_common/CMakeLists.txt
> -@@ -66,21 +66,12 @@ if(UNIX)
> -     set(JAVA_INCLUDE_PATHS ${JAVAVM_LIB}/Headers)
> -     message(STATUS "SYSROOT: " ${CMAKE_OSX_SYSROOT})
> -   else(APPLE)
> --    # LINUX settings...
> --    include(FindJNI)
> --    message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
> --    message(STATUS "JAVA_INCLUDE_PATH is " ${JAVA_INCLUDE_PATH})
> --    message(STATUS "JAVA_INCLUDE_PATH2 is " ${JAVA_INCLUDE_PATH2})
> --    message(STATUS "JAVA_JVM_LIBRARY is " ${JAVA_JVM_LIBRARY})
> --    set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
> --    # libjvm.so is found relative to JAVA_INCLUDE_PATH:
> --    set(JAVAVM_LIB ${JAVA_JVM_LIBRARY}/libjvm.so)
> +@@ -37,9 +37,10 @@ set(PM_LIB_PUBLIC_SRC ${PMDIR}/pm_common/portmidi.c
> +                       ${PMDIR}/pm_common/pmutil.c
> +                       ${PMDIR}/porttime/porttime.c)
> + add_library(portmidi ${PM_LIB_PUBLIC_SRC})
> ++add_library(portmidi_s STATIC ${PM_LIB_PUBLIC_SRC})
>   
> --    set(LINUXSRC pmlinuxalsa pmlinux finddefault)
> --    prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC})
> -+    set(LINUXSRC pmsndio)
> -+    prepend_path(LIBSRC ../pm_sndio/ ${LINUXSRC})
> -     list(APPEND LIBSRC ../porttime/ptlinux)
> + # MSVCRT_DLL is "DLL" for shared runtime library, and "" for static:
> +-set_target_properties(portmidi PROPERTIES
> ++set_target_properties(portmidi portmidi_s PROPERTIES
> +                       VERSION ${LIBRARY_VERSION}
> +                       SOVERSION ${LIBRARY_SOVERSION}
> +                       OUTPUT_NAME "${PM_ACTUAL_LIB_NAME}"
> +@@ -78,8 +79,22 @@ if(NOT WIN32)
> +   find_package(Threads REQUIRED)
> + endif()
>   
> --    set(PM_NEEDED_LIBS pthread asound)
> -+    set(PM_NEEDED_LIBS pthread sndio)
> -   endif(APPLE)
> - else(UNIX)
> -   if(WIN32)
> -@@ -99,7 +90,6 @@ else(UNIX)
> -     set(PM_NEEDED_LIBS winmm.lib)
> -   endif(WIN32)
> - endif(UNIX)
> --set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})
> - 
> - # this completes the list of library sources by adding shared code
> - list(APPEND LIBSRC pmutil portmidi)
> -@@ -109,17 +99,10 @@ add_library(portmidi-static ${LIBSRC})
> - set_target_properties(portmidi-static PROPERTIES OUTPUT_NAME "portmidi_s")
> - target_link_libraries(portmidi-static ${PM_NEEDED_LIBS})
> - 
> --# define the jni library
> --include_directories(${JAVA_INCLUDE_PATHS})
> - 
> --set(JNISRC ${LIBSRC} ../pm_java/pmjni/pmjni.c)
> --add_library(pmjni SHARED ${JNISRC})
> --target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
> --set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")
> --
> - # install the libraries (Linux and Mac OS X command line)
> - if(UNIX)
> --  INSTALL(TARGETS portmidi-static pmjni
> -+  INSTALL(TARGETS portmidi-static
> -     LIBRARY DESTINATION /usr/local/lib
> -     ARCHIVE DESTINATION /usr/local/lib)
> - # .h files installed by pm_dylib/CMakeLists.txt, so don't need them here
> ++# Check for sndio
> ++include (FindPackageHandleStandardArgs)
> ++find_path(SNDIO_INCLUDE_DIRS NAMES sndio.h)
> ++find_library(SNDIO_LIBRARY sndio)
> ++find_package_handle_standard_args(Sndio
> ++    REQUIRED_VARS SNDIO_LIBRARY SNDIO_INCLUDE_DIRS)
> ++
> + # first include the appropriate system-dependent file:
> +-if(UNIX AND APPLE)
> ++if(SNDIO_FOUND AND USE_SNDIO)
> ++  set(PM_LIB_PRIVATE_SRC
> ++      ${PMDIR}/porttime/ptlinux.c
> ++      ${PMDIR}/pm_sndio/pmsndio.c)
> ++  set(PM_NEEDED_LIBS Threads::Threads ${SNDIO_LIBRARY} PARENT_SCOPE)
> ++  target_link_libraries(portmidi PRIVATE Threads::Threads ${SNDIO_LIBRARY})
> ++  target_include_directories(portmidi PRIVATE ${SNDIO_INCLUDE_DIRS})
> ++elseif(UNIX AND APPLE)
> +   set(Threads::Threads "" PARENT_SCOPE)
> +   find_library(COREAUDIO_LIBRARY CoreAudio REQUIRED)
> +   find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
> Index: patches/patch-pm_dylib_CMakeLists_txt
> ===================================================================
> RCS file: patches/patch-pm_dylib_CMakeLists_txt
> diff -N patches/patch-pm_dylib_CMakeLists_txt
> --- patches/patch-pm_dylib_CMakeLists_txt     11 Mar 2022 18:20:27 -0000      
> 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,37 +0,0 @@
> -Index: pm_dylib/CMakeLists.txt
> ---- pm_dylib/CMakeLists.txt.orig
> -+++ pm_dylib/CMakeLists.txt
> -@@ -62,30 +62,11 @@ if(UNIX)
> -     set(INSTALL_NAME_DIR "/usr/local/lib")
> -     message(STATUS "SYSROOT: " ${CMAKE_OSX_SYSROOT})
> -   else(APPLE)
> --    # LINUX settings...
> --    include(FindJNI)
> --    # message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
> --    # message(STATUS "JAVA_INCLUDE_PATH is " ${JAVA_INCLUDE_PATH})
> --    # note: should use JAVA_JVM_LIB_PATH, but it is not set properly
> --    # note: user might need to set JAVA_INCLUDE_PATH manually
> --    #
> --    # this will probably break on BSD and other Unix systems; the fix
> --    # depends on whether FindJNI can find Java or not. If yes, then
> --    # we should try to rely on automatically set JAVA_INCLUDE_PATH and
> --    # JAVA_INCLUDE_PATH2; if no, then we need to make both JAVA_INCLUDE_PATH
> --    # and JAVA_INCLUDE_PATH2 set by user (will need clear documentation
> --    # because JAVA_INCLUDE_PATH2 is pretty obscure)
> --    set(JAVA_INCLUDE_PATH  ${JAVA_INCLUDE_PATH-UNKNOWN}
> --        CACHE STRING "where to find Java SDK include directory")
> --    set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/linux)
> --    # libjvm.so is found relative to JAVA_INCLUDE_PATH:
> --    set(JAVAVM_LIB ${JAVA_INCLUDE_PATH}/../jre/lib/i386/client/libjvm.so)
> --
> --    set(LINUXSRC pmlinuxalsa pmlinux finddefault)
> --    prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC})
> -+    set(LINUXSRC pmsndio)
> -+    prepend_path(LIBSRC ../pm_sndio/ ${LINUXSRC})
> -     list(APPEND LIBSRC ../porttime/ptlinux)
> - 
> --    set(PM_NEEDED_LIBS pthread asound)
> -+    set(PM_NEEDED_LIBS pthread sndio)
> -   endif(APPLE)
> - else(UNIX)
> -   if(WIN32)
> Index: patches/patch-pm_test_CMakeLists_txt
> ===================================================================
> RCS file: patches/patch-pm_test_CMakeLists_txt
> diff -N patches/patch-pm_test_CMakeLists_txt
> --- patches/patch-pm_test_CMakeLists_txt      11 Mar 2022 18:20:27 -0000      
> 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,9 +0,0 @@
> -Index: pm_test/CMakeLists.txt
> ---- pm_test/CMakeLists.txt.orig
> -+++ pm_test/CMakeLists.txt
> -@@ -1,4 +1,5 @@
> - # pm_test
> -+cmake_policy(SET CMP0037 OLD)
> - 
> - # set the build directory to be in portmidi, not in portmidi/pm_test
> - # this is required for Xcode:
> Index: patches/patch-porttime_ptlinux_c
> ===================================================================
> RCS file: /cvs/ports/audio/portmidi/patches/patch-porttime_ptlinux_c,v
> retrieving revision 1.3
> diff -u -p -u -p -r1.3 patch-porttime_ptlinux_c
> --- patches/patch-porttime_ptlinux_c  11 Mar 2022 18:20:27 -0000      1.3
> +++ patches/patch-porttime_ptlinux_c  1 Jul 2023 20:06:03 -0000
> @@ -1,47 +1,22 @@
> +Upstream commit 3209da8c9865efa3dbc1a2e642350c154df20d2a
> +
>  Index: porttime/ptlinux.c
>  --- porttime/ptlinux.c.orig
>  +++ porttime/ptlinux.c
> -@@ -31,14 +31,13 @@ CHANGE LOG
> +@@ -31,11 +31,15 @@ CHANGE LOG
>   #include "porttime.h"
> - #include "sys/time.h"
> + #include "time.h"
>   #include "sys/resource.h"
>  -#include "sys/timeb.h"
>   #include "pthread.h"
>   
>   #define TRUE 1
>   #define FALSE 0
> ++
> ++#ifndef CLOCK_MONOTONIC_RAW
> ++  #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
> ++#endif
> ++
>   
>   static int time_started_flag = FALSE;
> --static struct timeb time_offset = {0, 0, 0, 0};
> -+static struct timespec time_offset = {0, 0};
> - static pthread_t pt_thread_pid;
> - static int pt_thread_created = FALSE;
> - 
> -@@ -79,7 +78,7 @@ static void *Pt_CallbackProc(void *p)
> - PtError Pt_Start(int resolution, PtCallback *callback, void *userData)
> - {
> -     if (time_started_flag) return ptNoError;
> --    ftime(&time_offset); /* need this set before process runs */
> -+    clock_gettime(CLOCK_MONOTONIC, &time_offset); /* need this set before 
> process runs */
> -     if (callback) {
> -         int res;
> -         pt_callback_parameters *parms = (pt_callback_parameters *) 
> -@@ -120,12 +119,12 @@ int Pt_Started()
> - 
> - PtTimestamp Pt_Time()
> - {
> --    long seconds, milliseconds;
> --    struct timeb now;
> --    ftime(&now);
> --    seconds = now.time - time_offset.time;
> --    milliseconds = now.millitm - time_offset.millitm;
> --    return seconds * 1000 + milliseconds;
> -+    long seconds, nanoseconds;
> -+    struct timespec now;
> -+    clock_gettime(CLOCK_MONOTONIC, &now);
> -+    seconds = now.tv_sec - time_offset.tv_sec;
> -+    nanoseconds = now.tv_nsec - time_offset.tv_nsec;
> -+    return seconds * 1000 + nanoseconds / 1000000;
> - }
> - 
> - 
> + static struct timespec time_offset = {0, 0};
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/audio/portmidi/pkg/PLIST,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 PLIST
> --- pkg/PLIST 11 Mar 2022 18:20:27 -0000      1.2
> +++ pkg/PLIST 1 Jul 2023 20:06:03 -0000
> @@ -1,5 +1,12 @@
> +include/pmutil.h
>  include/portmidi.h
>  include/porttime.h
> +lib/cmake/
> +lib/cmake/PortMidi/
> +lib/cmake/PortMidi/PortMidiConfig.cmake
> +lib/cmake/PortMidi/PortMidiConfigVersion.cmake
> +lib/cmake/PortMidi/PortMidiTargets${MODCMAKE_BUILD_SUFFIX}
> +lib/cmake/PortMidi/PortMidiTargets.cmake
> +@static-lib lib/libportmidi.a
>  @lib lib/libportmidi.so.${LIBportmidi_VERSION}
> -lib/libportmidi_s.a
>  lib/pkgconfig/portmidi.pc
> 

Reply via email to