From 6108fbe6a24bf217b82d4476055635cfe4b3e39a Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Tue, 15 Feb 2022 23:41:35 +1100 Subject: [PATCH] portmidi: 234 -> 2.0.2 --- .../libraries/portmidi/default.nix | 61 ++++--------------- .../libraries/portmidi/missing-header.diff | 12 ++++ .../portmidi/remove-darwin-variables.diff | 52 ---------------- 3 files changed, 23 insertions(+), 102 deletions(-) create mode 100644 pkgs/development/libraries/portmidi/missing-header.diff delete mode 100644 pkgs/development/libraries/portmidi/remove-darwin-variables.diff diff --git a/pkgs/development/libraries/portmidi/default.nix b/pkgs/development/libraries/portmidi/default.nix index 2d6951301a11..43699291d362 100644 --- a/pkgs/development/libraries/portmidi/default.nix +++ b/pkgs/development/libraries/portmidi/default.nix @@ -1,66 +1,27 @@ -{ lib, stdenv, fetchurl, unzip, cmake, /*jdk,*/ alsa-lib, Carbon, CoreAudio, CoreFoundation, CoreMIDI, CoreServices }: +{ lib, stdenv, fetchFromGitHub, unzip, cmake, alsa-lib, Carbon, CoreAudio, CoreFoundation, CoreMIDI, CoreServices }: stdenv.mkDerivation rec { pname = "portmidi"; - version = "234"; + version = "2.0.2"; - src = fetchurl { - url = "mirror://sourceforge/portmedia/portmedia-code-r${version}.zip"; - sha256 = "1g7i8hgarihycadbgy2f7lifiy5cbc0mcrcazmwnmbbh1bqx6dyp"; + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = "v${version}"; + sha256 = "zOmzJ2MLGhGXiN0XjcmnnUrk/uqxP9IaZbqCG5XchC4="; }; - prePatch = '' - cd portmidi/trunk - ''; - - cmakeFlags = let - #base = "${jdk}/jre/lib/${jdk.architecture}"; - in [ - "-DPORTMIDI_ENABLE_JAVA=0" - /* TODO: Fix Java support. - "-DJAVA_AWT_LIBRARY=${base}/libawt.so" - "-DJAVA_JVM_LIBRARY=${base}/server/libjvm.so" - */ + cmakeFlags = [ "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=Release" "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=Release" "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=Release" - ] ++ lib.optionals stdenv.isDarwin [ - "-DCMAKE_OSX_ARCHITECTURES=${if stdenv.isAarch64 then "arm64" else "x86_64"}" - "-DCOREAUDIO_LIB=${CoreAudio}" - "-DCOREFOUNDATION_LIB=${CoreFoundation}" - "-DCOREMIDI_LIB=${CoreMIDI}" - "-DCORESERVICES_LIB=${CoreServices}" - ]; - - NIX_LDFLAGS = lib.optionalString stdenv.isDarwin [ - "-framework CoreAudio" - "-framework CoreFoundation" - "-framework CoreMIDI" - "-framework CoreServices" ]; patches = [ - # XXX: This is to deactivate Java support. - (fetchurl { - url = "https://raw.github.com/Rogentos/argent-gentoo/master/media-libs/portmidi/files/portmidi-217-cmake-libdir-java-opts.patch"; - sha256 = "1jbjwan61iqq9fqfpq2a4fd30k3clg7a6j0gfgsw87r8c76kqf6h"; - }) - ] ++ lib.optionals stdenv.isDarwin [ - # Remove hardcoded variables so we can set them properly - ./remove-darwin-variables.diff + # Add missing header include + ./missing-header.diff ]; - postPatch = '' - sed -i -e 's|/usr/local/|'"$out"'|' -e 's|/usr/share/|'"$out"'/share/|' \ - pm_common/CMakeLists.txt pm_dylib/CMakeLists.txt pm_java/CMakeLists.txt - sed -i \ - -e 's|-classpath .|-classpath '"$(pwd)"'/pm_java|' \ - -e 's|pmdefaults/|'"$(pwd)"'/pm_java/&|g' \ - -e 's|jportmidi/|'"$(pwd)"'/pm_java/&|g' \ - -e 's/WORKING_DIRECTORY pm_java//' \ - pm_java/CMakeLists.txt - ''; - postInstall = let ext = stdenv.hostPlatform.extensions.sharedLibrary; in '' ln -s libportmidi${ext} "$out/lib/libporttime${ext}" ''; @@ -75,7 +36,7 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" ]; meta = with lib; { - homepage = "http://portmedia.sourceforge.net/portmidi/"; + homepage = "https://github.com/PortMidi/portmidi"; description = "Platform independent library for MIDI I/O"; license = licenses.mit; maintainers = with maintainers; [ emilytrau ]; diff --git a/pkgs/development/libraries/portmidi/missing-header.diff b/pkgs/development/libraries/portmidi/missing-header.diff new file mode 100644 index 000000000000..1fa1f147014e --- /dev/null +++ b/pkgs/development/libraries/portmidi/missing-header.diff @@ -0,0 +1,12 @@ +diff --git a/porttime/ptmacosx_mach.c b/porttime/ptmacosx_mach.c +index 10c3554..712a974 100755 +--- a/porttime/ptmacosx_mach.c ++++ b/porttime/ptmacosx_mach.c +@@ -12,6 +12,7 @@ + + #include "porttime.h" + #include "sys/time.h" ++#include "sys/qos.h" + #include "pthread.h" + + #ifndef NSEC_PER_MSEC diff --git a/pkgs/development/libraries/portmidi/remove-darwin-variables.diff b/pkgs/development/libraries/portmidi/remove-darwin-variables.diff deleted file mode 100644 index 15ed874f172f..000000000000 --- a/pkgs/development/libraries/portmidi/remove-darwin-variables.diff +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4919b78..758eccb 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -36,8 +36,6 @@ set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused") - set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused") - set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused") - --set(CMAKE_OSX_ARCHITECTURES i386 ppc x86_64 CACHE STRING "change to needed architecture for a smaller library" FORCE) -- - PROJECT(portmidi) - - if(UNIX) -diff --git a/pm_common/CMakeLists.txt b/pm_common/CMakeLists.txt -index cbeeade..f765430 100644 ---- a/pm_common/CMakeLists.txt -+++ b/pm_common/CMakeLists.txt -@@ -22,7 +22,7 @@ else(APPLE OR WIN32) - endif(APPLE OR WIN32) - - if(APPLE) -- set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk CACHE -+ set(CMAKE_OSX_SYSROOT / CACHE - PATH "-isysroot parameter for compiler") - set(CMAKE_C_FLAGS "-mmacosx-version-min=10.6" CACHE - STRING "needed in conjunction with CMAKE_OSX_SYSROOT" FORCE) -@@ -54,10 +54,6 @@ if(UNIX) - - include_directories(${CMAKE_OSX_SYSROOT}/Developer/Headers/FlatCarbon) - set(FRAMEWORK_PATH ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks) -- set(COREAUDIO_LIB "${FRAMEWORK_PATH}/CoreAudio.framework") -- set(COREFOUNDATION_LIB "${FRAMEWORK_PATH}/CoreFoundation.framework") -- set(COREMIDI_LIB "${FRAMEWORK_PATH}/CoreMIDI.framework") -- set(CORESERVICES_LIB "${FRAMEWORK_PATH}/CoreServices.framework") - set(PM_NEEDED_LIBS ${COREAUDIO_LIB} ${COREFOUNDATION_LIB} - ${COREMIDI_LIB} ${CORESERVICES_LIB} - CACHE INTERNAL "") -diff --git a/pm_dylib/CMakeLists.txt b/pm_dylib/CMakeLists.txt -index f693dd6..1dc5cd6 100644 ---- a/pm_dylib/CMakeLists.txt -+++ b/pm_dylib/CMakeLists.txt -@@ -49,10 +49,6 @@ if(UNIX) - - include_directories(${CMAKE_OSX_SYSROOT}/Developer/Headers/FlatCarbon) - set(FRAMEWORK_PATH ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks) -- set(COREAUDIO_LIB "${FRAMEWORK_PATH}/CoreAudio.framework") -- set(COREFOUNDATION_LIB "${FRAMEWORK_PATH}/CoreFoundation.framework") -- set(COREMIDI_LIB "${FRAMEWORK_PATH}/CoreMIDI.framework") -- set(CORESERVICES_LIB "${FRAMEWORK_PATH}/CoreServices.framework") - set(PM_NEEDED_LIBS ${COREAUDIO_LIB} ${COREFOUNDATION_LIB} - ${COREMIDI_LIB} ${CORESERVICES_LIB} - CACHE INTERNAL "")