commit 83d70474a5452eb28d6ebbe61eb3bfb1aa5b8abb Author: Toshaan Bharvani Date: Tue Oct 18 15:08:27 2022 +0200 initial package creation Signed-off-by: Toshaan Bharvani diff --git a/SOURCES/pmdefaults.desktop b/SOURCES/pmdefaults.desktop new file mode 100644 index 0000000..2a6456d --- /dev/null +++ b/SOURCES/pmdefaults.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=PmDefaults +GenericName=PortMidi Settings +Comment=Set default input and output devices for PortMidi +Exec=pmdefaults +Icon=pmdefaults-icon +Terminal=false +Type=Application +Categories=Audio;AudioVideo;Midi; diff --git a/SOURCES/portmidi-217-format-security.patch b/SOURCES/portmidi-217-format-security.patch new file mode 100644 index 0000000..01bd2f5 --- /dev/null +++ b/SOURCES/portmidi-217-format-security.patch @@ -0,0 +1,95 @@ +--- portmidi/pm_test/latency.c_old 2014-06-09 19:58:02.503837705 +0200 ++++ portmidi/pm_test/latency.c 2014-06-09 19:59:15.645838404 +0200 +@@ -280,7 +280,7 @@ int get_number(char *prompt) + { + char line[STRING_MAX]; + int n = 0, i; +- printf(prompt); ++ printf("%s",prompt); + while (n != 1) { + n = scanf("%d", &i); + fgets(line, STRING_MAX, stdin); +diff -Nurp portmidi/pm_test/midiclock.c portmidi/pm_test.new/midiclock.c +--- portmidi/pm_test/midiclock.c 2014-06-09 20:05:10.783841793 +0200 ++++ portmidi/pm_test.new/midiclock.c 2014-06-09 20:06:05.582842316 +0200 +@@ -167,7 +167,7 @@ int get_number(char *prompt) + { + char line[STRING_MAX]; + int n = 0, i; +- printf(prompt); ++ printf("%s",prompt); + while (n != 1) { + n = scanf("%d", &i); + fgets(line, STRING_MAX, stdin); +@@ -256,7 +256,7 @@ int main(int argc, char **argv) + err = Pm_OpenOutput(&midi, outp, DRIVER_INFO, OUTPUT_BUFFER_SIZE, + TIME_PROC, TIME_INFO, LATENCY); + if (err) { +- printf(Pm_GetErrorText(err)); ++ printf("%s",Pm_GetErrorText(err)); + goto error_exit_no_device; + } + active = true; +diff -Nurp portmidi/pm_test/mm.c portmidi/pm_test.new/mm.c +--- portmidi/pm_test/mm.c 2010-10-05 20:49:09.000000000 +0200 ++++ portmidi/pm_test.new/mm.c 2014-06-09 20:09:26.222844231 +0200 +@@ -119,7 +119,7 @@ int get_number(char *prompt) + { + char line[STRING_MAX]; + int n = 0, i; +- printf(prompt); ++ printf("%s",prompt); + while (n != 1) { + n = scanf("%d", &i); + fgets(line, STRING_MAX, stdin); +@@ -136,7 +136,7 @@ void receive_poll(PtTimestamp timestamp, + if (!active) return; + while ((count = Pm_Read(midi_in, &event, 1))) { + if (count == 1) output(event.message); +- else printf(Pm_GetErrorText(count)); ++ else printf("%s",Pm_GetErrorText(count)); + } + } + +@@ -168,7 +168,7 @@ int main(int argc, char **argv) + inp = get_number("Type input device number: "); + err = Pm_OpenInput(&midi_in, inp, NULL, 512, NULL, NULL); + if (err) { +- printf(Pm_GetErrorText(err)); ++ printf("%s",Pm_GetErrorText(err)); + Pt_Stop(); + mmexit(1); + } +@@ -484,7 +484,7 @@ private int put_pitch(int p) + "gs", "a", "bf", "b" }; + /* note octave correction below */ + sprintf(result, "%s%d", ptos[p % 12], (p / 12) - 1); +- printf(result); ++ printf("%s",result); + return strlen(result); + } + +diff -Nurp portmidi/pm_test/test.c portmidi/pm_test.new/test.c +--- portmidi/pm_test/test.c 2009-09-16 18:54:04.000000000 +0200 ++++ portmidi/pm_test.new/test.c 2014-06-09 20:10:04.310844594 +0200 +@@ -37,7 +37,7 @@ int get_number(char *prompt) + { + char line[STRING_MAX]; + int n = 0, i; +- printf(prompt); ++ printf("%s",prompt); + while (n != 1) { + n = scanf("%d", &i); + fgets(line, STRING_MAX, stdin); +diff -Nurp portmidi/pm_test/sysex.c portmidi/pm_test.new/sysex.c +--- portmidi/pm_test/sysex.c 2010-09-20 21:57:48.000000000 +0200 ++++ portmidi/pm_test.new/sysex.c 2014-06-09 20:12:05.502845751 +0200 +@@ -39,7 +39,7 @@ int get_number(char *prompt) + { + char line[STRING_MAX]; + int n = 0, i; +- printf(prompt); ++ printf("%s",prompt); + while (n != 1) { + n = scanf("%d", &i); + fgets(line, STRING_MAX, stdin); diff --git a/SOURCES/portmidi-cmake.patch b/SOURCES/portmidi-cmake.patch new file mode 100644 index 0000000..f638083 --- /dev/null +++ b/SOURCES/portmidi-cmake.patch @@ -0,0 +1,106 @@ +diff -rupN portmidi.old/pm_common/CMakeLists.txt portmidi/pm_common/CMakeLists.txt +--- portmidi.old/pm_common/CMakeLists.txt 2010-09-20 15:57:48.000000000 -0400 ++++ portmidi/pm_common/CMakeLists.txt 2011-06-23 22:35:41.000000000 -0400 +@@ -120,8 +120,8 @@ set_target_properties(pmjni PROPERTIES E + # install the libraries (Linux and Mac OS X command line) + if(UNIX) + INSTALL(TARGETS portmidi-static pmjni +- LIBRARY DESTINATION /usr/local/lib +- ARCHIVE DESTINATION /usr/local/lib) ++ LIBRARY DESTINATION ${LIB_INSTALL_DIR} ++ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + # .h files installed by pm_dylib/CMakeLists.txt, so don't need them here + # INSTALL(FILES portmidi.h ../porttime/porttime.h + # DESTINATION /usr/local/include) +diff -rupN portmidi.old/pm_dylib/CMakeLists.txt portmidi/pm_dylib/CMakeLists.txt +--- portmidi.old/pm_dylib/CMakeLists.txt 2009-11-20 00:41:09.000000000 -0500 ++++ portmidi/pm_dylib/CMakeLists.txt 2011-06-23 22:35:41.000000000 -0400 +@@ -59,7 +59,7 @@ if(UNIX) + + set(JAVAVM_LIB "${FRAMEWORK_PATH}/JavaVM.framework") + set(JAVA_INCLUDE_PATHS ${JAVAVM_LIB}/Headers) +- set(INSTALL_NAME_DIR "/usr/local/lib") ++ set(INSTALL_NAME_DIR ${LIB_INSTALL_DIR}) + message(STATUS "SYSROOT: " ${CMAKE_OSX_SYSROOT}) + else(APPLE) + # LINUX settings... +@@ -75,11 +75,7 @@ if(UNIX) + # 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(JAVAVM_LIB ${JAVA_JVM_LIBRARY}) + + set(LINUXSRC pmlinuxalsa pmlinux finddefault) + prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC}) +@@ -114,14 +110,14 @@ prepend_path(SHARED_PATHS ../pm_common/ + list(APPEND LIBSRC ${SHARED_PATHS}) + + add_library(portmidi-dynamic SHARED ${LIBSRC}) +-set_target_properties(portmidi-dynamic PROPERTIES OUTPUT_NAME "portmidi") ++set_target_properties(portmidi-dynamic PROPERTIES LINK_FLAGS "-L${CMAKE_CACHEFILE_DIR}/Release" SOVERSION 0 VERSION 0.${VERSION} OUTPUT_NAME "portmidi") + target_link_libraries(portmidi-dynamic ${PM_NEEDED_LIBS}) + + # install the libraries (Linux and Mac OS X command line) + if(UNIX) + INSTALL(TARGETS portmidi-dynamic +- LIBRARY DESTINATION /usr/local/lib +- ARCHIVE DESTINATION /usr/local/lib) ++ LIBRARY DESTINATION ${LIB_INSTALL_DIR} ++ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + INSTALL(FILES ../pm_common/portmidi.h ../porttime/porttime.h +- DESTINATION /usr/local/include) ++ DESTINATION ${INCLUDE_INSTALL_DIR}) + endif(UNIX) +diff -rupN portmidi.old/pm_java/CMakeLists.txt portmidi/pm_java/CMakeLists.txt +--- portmidi.old/pm_java/CMakeLists.txt 2009-11-04 10:20:44.000000000 -0500 ++++ portmidi/pm_java/CMakeLists.txt 2011-06-23 22:35:54.000000000 -0400 +@@ -16,12 +16,12 @@ if(UNIX) + COMMAND javac -classpath . pmdefaults/PmDefaultsFrame.java + MAIN_DEPENDENCY pmdefaults/PmDefaultsFrame.java + DEPENDS pmdefaults/PmDefaults.java +- WORKING_DIRECTORY pm_java) ++ ) + add_custom_command(OUTPUT pmdefaults/PmDefaults.class + COMMAND javac -classpath . pmdefaults/PmDefaults.java + MAIN_DEPENDENCY pmdefaults/PmDefaults.java + DEPENDS pmdefaults/PmDefaultsFrame.java +- WORKING_DIRECTORY pm_java) ++ ) + add_custom_command(OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults.jar + COMMAND cp pmdefaults/portmusic_logo.png . + COMMAND jar cmf pmdefaults/manifest.txt pmdefaults.jar +@@ -32,7 +32,7 @@ if(UNIX) + COMMAND rm portmusic_logo.png + MAIN_DEPENDENCY pmdefaults/PmDefaults.class + DEPENDS ${PMDEFAULTS_ALL_CLASSES} +- WORKING_DIRECTORY pm_java) ++ ) + add_custom_target(pmdefaults_target ALL + DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults.jar) + # message(STATUS "add_custom_target: pmdefaults.jar") +@@ -41,7 +41,7 @@ if(UNIX) + INSTALL(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults.jar + DESTINATION /usr/share/java) + INSTALL(PROGRAMS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults +- DESTINATION /usr/local/bin) ++ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + endif(APPLE) + endif(UNIX) + # In windows, use pm_java/make.bat +diff -rupN portmidi.old/pm_test/CMakeLists.txt portmidi/pm_test/CMakeLists.txt +--- portmidi.old/pm_test/CMakeLists.txt 2010-09-20 15:57:48.000000000 -0400 ++++ portmidi/pm_test/CMakeLists.txt 2011-06-23 22:35:41.000000000 -0400 +@@ -12,7 +12,7 @@ endif(WIN32) + + macro(make_a_test name) + add_executable(${name} ${name}.c) +- target_link_libraries(${name} portmidi-static ${PM_NEEDED_LIBS}) ++ target_link_libraries(${name} portmidi-dynamic) + add_dependencies(${name} portmidi-static) + endmacro(make_a_test) + diff --git a/SOURCES/portmidi-cyrex-0.21.patch b/SOURCES/portmidi-cyrex-0.21.patch new file mode 100644 index 0000000..46b6bf8 --- /dev/null +++ b/SOURCES/portmidi-cyrex-0.21.patch @@ -0,0 +1,10 @@ +--- portmidi/pm_python/pyportmidi/_pyportmidi.pyx-orig 2010-09-26 21:32:44.000000000 +0200 ++++ portmidi/pm_python/pyportmidi/_pyportmidi.pyx 2019-05-20 14:23:34.617039615 +0200 +@@ -532,6 +532,6 @@ example: Read(50) returns all the events + if NumEvents < 0: raise Exception, Pm_GetErrorText(NumEvents) + x=[] + if NumEvents >= 1: +- for loop in range(NumEvents): ++ for loop in range(NumEvents): + x.append([[buffer[loop].message & 0xff, (buffer[loop].message >> 8) & 0xFF, (buffer[loop].message >> 16) & 0xFF, (buffer[loop].message >> 24) & 0xFF], buffer[loop].timestamp]) + return x diff --git a/SOURCES/portmidi-no.c++.patch b/SOURCES/portmidi-no.c++.patch new file mode 100644 index 0000000..5de7c36 --- /dev/null +++ b/SOURCES/portmidi-no.c++.patch @@ -0,0 +1,11 @@ +--- portmidi/CMakeLists.txt.no.c++ 2010-09-20 21:57:48.000000000 +0200 ++++ portmidi/CMakeLists.txt 2018-03-08 16:06:11.719028872 +0100 +@@ -38,7 +38,7 @@ set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINF + + set(CMAKE_OSX_ARCHITECTURES i386 ppc x86_64 CACHE STRING "change to needed architecture for a smaller library" FORCE) + +-PROJECT(portmidi) ++PROJECT(portmidi C) + + if(UNIX) + # Problem: if there was an old Debug build and you change diff --git a/SOURCES/portmidi-no.java.patch b/SOURCES/portmidi-no.java.patch new file mode 100644 index 0000000..6daf312 --- /dev/null +++ b/SOURCES/portmidi-no.java.patch @@ -0,0 +1,85 @@ +--- portmidi-old/CMakeLists.txt 2022-07-26 13:58:56.502175056 +0200 ++++ portmidi/CMakeLists.txt 2022-07-26 14:01:36.635235371 +0200 +@@ -72,6 +72,4 @@ + + add_subdirectory(pm_dylib) + +-# Cannot figure out how to make an xcode Java application with CMake +-add_subdirectory(pm_java) + +--- portmidi-old/pm_common/CMakeLists.txt 2022-07-26 13:58:56.494175153 +0200 ++++ portmidi/pm_common/CMakeLists.txt 2022-07-26 14:04:07.113412636 +0200 +@@ -67,15 +67,6 @@ + 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) +- + set(LINUXSRC pmlinuxalsa pmlinux finddefault) + prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC}) + list(APPEND LIBSRC ../porttime/ptlinux) +@@ -99,7 +90,6 @@ + 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,9 @@ + 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 ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + # .h files installed by pm_dylib/CMakeLists.txt, so don't need them here +--- portmidi-old/pm_dylib/CMakeLists.txt 2022-07-26 13:58:56.494175153 +0200 ++++ portmidi/pm_dylib/CMakeLists.txt 2022-07-26 14:05:24.435476039 +0200 +@@ -63,20 +63,6 @@ + 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(JAVAVM_LIB ${JAVA_JVM_LIBRARY}) +- + set(LINUXSRC pmlinuxalsa pmlinux finddefault) + prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC}) + list(APPEND LIBSRC ../porttime/ptlinux) +@@ -102,7 +88,6 @@ + # message(STATUS "JAVAVM_LIB: " ${JAVAVM_LIB}) + endif(WIN32) + endif(UNIX) +-set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVAVM_LIB}) + + # this completes the list of library sources by adding shared code + set(SHARED_FILES pmutil portmidi) diff --git a/SOURCES/portmidi-no_date_footer.patch b/SOURCES/portmidi-no_date_footer.patch new file mode 100644 index 0000000..5c30a3b --- /dev/null +++ b/SOURCES/portmidi-no_date_footer.patch @@ -0,0 +1,22 @@ +diff -rupN portmidi.old/Doxyfile portmidi/Doxyfile +--- portmidi.old/Doxyfile 2009-01-02 15:16:17.000000000 -0500 ++++ portmidi/Doxyfile 2012-06-12 22:45:25.821808644 -0400 +@@ -765,7 +765,7 @@ HTML_HEADER = + # each generated HTML page. If it is left blank doxygen will generate a + # standard footer. + +-HTML_FOOTER = ++HTML_FOOTER = no_date_footer.html + + # The HTML_STYLESHEET tag can be used to specify a user-defined cascading + # style sheet that is used by each HTML page. It can be used to +diff -rupN portmidi.old/no_date_footer.html portmidi/no_date_footer.html +--- portmidi.old/no_date_footer.html 1969-12-31 19:00:00.000000000 -0500 ++++ portmidi/no_date_footer.html 2012-06-04 20:21:32.825802299 -0400 +@@ -0,0 +1,6 @@ ++
++Generated for $projectname by doxygen ++$doxygenversion
++ ++ diff --git a/SPECS/portmidi.spec b/SPECS/portmidi.spec new file mode 100644 index 0000000..2578195 --- /dev/null +++ b/SPECS/portmidi.spec @@ -0,0 +1,402 @@ +%if 0%{?fedora} >= 36 +# Leave undefined if not 1: +%ifarch %{java_arches} +%global JAVA 1 +%endif +%else +%global JAVA 1 +%endif + +Summary: Real-time Midi I/O Library +Name: portmidi +Version: 217 +Release: 48%{?dist} +License: MIT +URL: http://portmedia.sourceforge.net/ +Source0: http://downloads.sourceforge.net/portmedia/%{name}-src-%{version}.zip +Source1: pmdefaults.desktop +# Build fixes: +Patch0: portmidi-cmake.patch +# Fix multilib conflict RHBZ#831432 +Patch1: portmidi-no_date_footer.patch +Patch2: portmidi-217-format-security.patch +Patch3: portmidi-no.c++.patch +Patch4: portmidi-cyrex-0.21.patch +Patch5: portmidi-no.java.patch +BuildRequires: make +BuildRequires: alsa-lib-devel +BuildRequires: cmake +BuildRequires: desktop-file-utils +BuildRequires: python3-devel +BuildRequires: python3-Cython +BuildRequires: doxygen +BuildRequires: tex(latex) +BuildRequires: gcc +%if 0%{?JAVA} +BuildRequires: java-devel >= 1.7 +BuildRequires: javapackages-tools +%endif + +%description +PortMedia is a set of simple clean APIs and cross-platform library +implementations for music and other media. PortMidi sub-project provides a +real-time MIDI input/output library. This package contains the PortMidi +libraries. + +%package devel +Summary: Headers for developing programs that will use %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +PortMedia is a set of simple clean APIs and cross-platform library +implementations for music and other media. PortMidi sub-project provides a +real-time MIDI input/output library. This package contains the header files +and the documentation of PortMidi libraries. + +%package -n python3-%{name} +Summary: Python 3 wrapper for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n python3-%{name} +PortMedia is a set of simple clean APIs and cross-platform library +implementations for music and other media. PortMidi sub-project provides a +real-time MIDI input/output library. This package contains the python +bindings of PortMidi libraries. It can send and receive MIDI data in +real-time from Python 3. + +%package tools +Summary: Tools to configure and use %{name} +Requires: hicolor-icon-theme +Requires: java >= 1.7 +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description tools +PortMedia is a set of simple clean APIs and cross-platform library +implementations for music and other media. PortMidi sub-project provides a +real-time MIDI input/output library. This package contains +%{?JAVA:the PortMidi configuration utility "pmdefaults" and +}some test applications. + +%prep +%setup -q -n %{name} +%patch0 -p1 -b .buildfix +%patch1 -p1 -b .no.date +%patch2 -p1 -b .fmt.security +%patch3 -p1 -b .no.c++ +%patch4 -p1 -b .pyrex021 +%if ! 0%{?JAVA} +%patch5 -p1 -b .no.java +%endif + + +# generate Cython C files during build +rm -f pm_python/pyportmidi/_pyportmidi.c + +# we do not use setup.py +rm -f pm_python/setup.py + +# ewwww... binaries +rm -f portmidi_cdt.zip */*.exe */*/*.exe + +# Fix permissons and encoding issues: +find . -name "*.c" -exec chmod -x {} \; +find . -name "*.h" -exec chmod -x {} \; +for i in *.txt */*.txt */*/*.txt ; do + chmod -x $i + sed 's|\r||' $i > $i.tmp + touch -r $i $i.tmp + mv -f $i.tmp $i +done + +%if 0%{?JAVA} +# Fedora's jni library location is different +sed -i 's|loadLibrary.*|load("%{_libdir}/%{name}/libpmjni.so");|' \ + pm_java/jportmidi/JPortMidiApi.java + +# Add shebang, lib and class path +sed -i -e 's|^java|#!/bin/sh\njava \\\ + -Djava.library.path=%{_libdir}/%{name}/|' \ + -e 's|/usr/share/java/|%{_libdir}/%{name}/|' \ + pm_java/pmdefaults/pmdefaults + +# Don't hardcode the java path as it might be different in i.e. Flatpak builds +sed -i -e 's|/usr/share/java|%{_javadir}|' \ + pm_java/CMakeLists.txt +%endif + +%build +export JAVA_HOME=%{java_home} +%cmake -DCMAKE_SKIP_BUILD_RPATH=1 -DCMAKE_CACHEFILE_DIR=%{_builddir}/%{name}/build -DVERSION=%{version} -B. +make %{?_smp_flags} + +# Build the doxygen documentation: +doxygen + +# Build python modules +pushd pm_python/pyportmidi + cython -2 _pyportmidi.pyx + gcc %{optflags} -pthread -fPIC -c -o _pyportmidi.o -I../../pm_common \ + -I../../porttime $(python3-config --includes) _pyportmidi.c + gcc -shared -o _pyportmidi.so _pyportmidi.o -lportmidi $(python3-config --libs) \ + -L../../build/Release +popd + +%install +%make_install + +# Install the test applications: +install -d %{buildroot}%{_libdir}/%{name} +for app in latency midiclock midithread midithru mm qtest sysex test; do + install -m 0755 build/Release/$app %{buildroot}%{_libdir}/%{name}/ +done + +%if 0%{?JAVA} +# Fedora's jni library location is different +mv %{buildroot}%{_libdir}/libpmjni.so \ + %{buildroot}%{_libdir}/%{name}/ +mv %{buildroot}%{_javadir}/pmdefaults.jar \ + %{buildroot}%{_libdir}/%{name}/ + +# pmdefaults icon +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/ +install -pm 644 pm_java/pmdefaults/pmdefaults-icon.png \ + %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/ + +# desktop file +mkdir -p %{buildroot}%{_datadir}/applications/ +desktop-file-install \ + --dir=%{buildroot}%{_datadir}/applications \ + %{SOURCE1} +%endif + +# Why don't they install this header file? +install -pm 644 pm_common/pmutil.h %{buildroot}%{_includedir}/ + +# Install python modules +mkdir -p %{buildroot}%{python3_sitearch}/pyportmidi +pushd pm_python/pyportmidi + install -pm 755 _pyportmidi.so %{buildroot}%{python3_sitearch}/pyportmidi/ + install -pm 644 *.py %{buildroot}%{python3_sitearch}/pyportmidi/ +popd + +# we don't want to provide private python extension libs +%{?filter_setup: +%filter_provides_in %{python3_sitearch}/.*\.so$ +%filter_setup +} + +# Remove duplicate library +rm -f %{buildroot}%{_libdir}/libportmidi_s.so + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%doc CHANGELOG.txt +%license license.txt +%{_libdir}/lib*.so.* + +%files tools +%doc pm_java/pmdefaults/README.txt pm_cl/* +%{_libdir}/%{name}/ +%if 0%{?JAVA} +%{_bindir}/pmdefaults +%{_datadir}/icons/hicolor/128x128/apps/pmdefaults-icon.png +%{_datadir}/applications/pmdefaults.desktop +%endif + +%files -n python3-%{name} +%{python3_sitearch}/pyportmidi/ + +%files devel +%doc README.txt +%doc html +%{_includedir}/* +%{_libdir}/lib*.so + +%changelog +* Tue Jul 26 2022 Michael J Gruber - 217-48 +- fix FTBFS caused by Drop_i686_JDKs + +* Tue Jul 26 2022 Michael J Gruber - 217-47 +- clarify java utils/tools dependencies + +* Fri Jul 22 2022 Fedora Release Engineering - 217-46 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 217-45 +- Rebuilt for Python 3.11 + +* Fri Apr 01 2022 Tomas Popela - 217-44 +- Don't hardcode the java path as it might be different in i.e. Flatpak builds + +* Sat Feb 05 2022 Jiri Vanek - 217-43 +- Rebuilt for java-17-openjdk as system jdk + +* Fri Jan 21 2022 Fedora Release Engineering - 217-42 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 217-41 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 217-40 +- Rebuilt for Python 3.10 + +* Wed Jan 27 2021 Fedora Release Engineering - 217-39 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sat Aug 01 2020 Michael J Gruber - 217-38 +- original PR: Thu Jul 30 2020 Michael J Gruber - 217-37 +- adjust to new cmake macros + +* Sat Aug 01 2020 Fedora Release Engineering - 217-37 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 217-36 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sat Jul 11 2020 Jiri Vanek - 217-35 +- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11 + +* Wed Jun 24 2020 Michael J Gruber - 217-34 +- Make it clear that we do not use setup.py +- Remove obsolete README. + +* Tue May 26 2020 Miro Hrončok - 217-33 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 217-32 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Oct 03 2019 Miro Hrončok - 217-31 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 217-30 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 217-29 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon May 20 2019 Michael J Gruber - 217-28 +- Generate Cython C files during build + +* Sat Feb 02 2019 Fedora Release Engineering - 217-27 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Oct 01 2018 Orcan Ogetbil - 217-26 +- Removed the Python2 binding + +* Fri Jul 13 2018 Fedora Release Engineering - 217-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 217-24 +- Rebuilt for Python 3.7 + +* Thu Mar 08 2018 Michael J Gruber - 217-23 +- Adjust to new guidelines (BR gcc) + +* Fri Feb 09 2018 Fedora Release Engineering - 217-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 217-21 +- Python 2 binary package renamed to python2-portmidi + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Aug 03 2017 Fedora Release Engineering - 217-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 217-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Jul 07 2017 Igor Gnatenko - 217-18 +- Rebuild due to bug in RPM (RHBZ #1468476) + +* Thu Jun 08 2017 Gwyn Ciesla - 217-17 +- Python 3 support. + +* Sat Feb 11 2017 Fedora Release Engineering - 217-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Jul 19 2016 Fedora Release Engineering - 217-15 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 217-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jun 18 2015 Fedora Release Engineering - 217-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sun Aug 17 2014 Fedora Release Engineering - 217-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Mon Jun 09 2014 Brendan Jones 217-11 +- -Wformat-security patch + +* Sat Jun 07 2014 Fedora Release Engineering - 217-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 11 2013 Brendan Jones 217-9 +- Correct desktop file + +* Sun Aug 04 2013 Fedora Release Engineering - 217-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 217-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Jul 21 2012 Fedora Release Engineering - 217-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Jun 12 2012 Orcan Ogetbil 217-6 +- Fix multilib conflict RHBZ#831432 +- Don't bulid PDF doc, as it causes another multilib conflict +- Specfile cleanup. Drop old GCJ-Java and Python bits + +* Sat Jan 14 2012 Fedora Release Engineering - 217-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Jun 23 2011 Orcan Ogetbil 217-4 +- Fix FTBFS due to changes in cmake. RHBZ #715668 + +* Sat May 14 2011 Daniel Drake - 217-3 +- move Requires:Java to tools subpackage, its not needed by the main package + +* Wed Feb 09 2011 Fedora Release Engineering - 217-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Oct 09 2010 Orcan Ogetbil 217-1 +- Update to 217 + +* Fri Jul 23 2010 Orcan Ogetbil 200-4 +- Fix python module build + +* Wed Jul 21 2010 David Malcolm - 200-3 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Sat Jan 30 2010 Orcan Ogetbil 200-2 +- Remove duplicate library + +* Sat Jan 30 2010 Orcan Ogetbil 200-1 +- Update to 200. +- Add python subpackage + +* Fri Nov 27 2009 Orcan Ogetbil 184-1 +- Update to 184. Build system uses cmake now. + +* Sun Jul 26 2009 Fedora Release Engineering - 131-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Feb 24 2009 Orcan Ogetbil 131-3 +- Include pmutil.h in the devel package + +* Tue Jan 27 2009 Orcan Ogetbil 131-2 +- Build and add doxygen documentation +- Preserve some timestamps + +* Sun Jan 11 2009 Orcan Ogetbil 131-1 +- New upstream release. + +* Sun Dec 07 2008 Orcan Ogetbil 82-1 +- Initial release.