unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 4eed0949fdf8fb612b28e02dfae75cf8b505670c 13268 bytes (raw)
name: gnu/packages/patches/portmidi-modular-build.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
 
https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/portmidi/files/portmidi-217-cmake.patch?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d

--- portmidi/CMakeLists.txt
+++ portmidi/CMakeLists.txt
@@ -9,12 +9,11 @@
   set(CMAKE_BUILD_TYPE Release CACHE STRING 
       "Semicolon-separate list of supported configuration types")
   # set default directories but don't override cached values...
-  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE}
+  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
       CACHE STRING "libraries go here")
-  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE}
+  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
       CACHE STRING "libraries go here")
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY 
-      ${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE}
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
       CACHE STRING "executables go here")
 
 else(UNIX)
@@ -68,10 +67,20 @@
 include_directories(pm_common porttime)
 add_subdirectory(pm_common)
 
-add_subdirectory(pm_test)
+option(PORTMIDI_ENABLE_JAVA "Enable Java bindings support" ON)
+option(PORTMIDI_ENABLE_STATIC "Build and install static libraries" OFF)
+option(PORTMIDI_ENABLE_TEST "Build test programs" ON)
+
+if(PORTMIDI_ENABLE_TEST)
+  add_subdirectory(pm_test)
+endif(PORTMIDI_ENABLE_TEST)
 
 add_subdirectory(pm_dylib)
 
 # Cannot figure out how to make an xcode Java application with CMake
-add_subdirectory(pm_java)
+if(PORTMIDI_ENABLE_JAVA)
+  set(JAR_INSTALL_DIR share/java
+      CACHE STRING "Define directory name for jar installation")
+  add_subdirectory(pm_java)
+endif(PORTMIDI_ENABLE_JAVA)
 
--- portmidi/pm_common/CMakeLists.txt
+++ portmidi/pm_common/CMakeLists.txt
@@ -44,9 +44,6 @@
 
 # first include the appropriate system-dependent file:
 if(UNIX)
-  # add the -g switch for Linux and Mac OS X (not used in Win32)
-  set (CMAKE_C_FLAGS_DEBUG "-g ${CMAKE_C_FLAGS_DEBUG}" 
-       CACHE STRING "enable extra checks for debugging" FORCE)
   if(APPLE)
     set(MACSRC pmmacosxcm pmmac readbinaryplist finddefault)
     prepend_path(LIBSRC ../pm_mac/ ${MACSRC})
@@ -62,19 +59,23 @@
                              ${COREMIDI_LIB} ${CORESERVICES_LIB}
         CACHE INTERNAL "")
 
-    set(JAVAVM_LIB "${FRAMEWORK_PATH}/JavaVM.framework")
-    set(JAVA_INCLUDE_PATHS ${JAVAVM_LIB}/Headers)
+    if(PORTMIDI_ENABLE_JAVA)
+      set(JAVAVM_LIB "${FRAMEWORK_PATH}/JavaVM.framework")
+      set(JAVA_INCLUDE_PATHS ${JAVAVM_LIB}/Headers)
+    endif(PORTMIDI_ENABLE_JAVA)
     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)
+    if(PORTMIDI_ENABLE_JAVA)
+      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)
+    endif(PORTMIDI_ENABLE_JAVA)
 
     set(LINUXSRC pmlinuxalsa pmlinux finddefault)
     prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC})
@@ -88,10 +89,12 @@
     # /MD is multithread DLL, /MT is multithread. Change to static:
     include(../pm_win/static.cmake)
     
-    include(FindJNI)
+    if(PORTMIDI_ENABLE_JAVA)
+      include(FindJNI)
 
-    set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
-    # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
+      set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
+      # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
+    endif(PORTMIDI_ENABLE_JAVA)
 
     set(WINSRC pmwin pmwinmm)
     prepend_path(LIBSRC ../pm_win/ ${WINSRC})
@@ -99,29 +102,43 @@
     set(PM_NEEDED_LIBS winmm.lib)
   endif(WIN32)
 endif(UNIX)
-set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})
+
+if(PORTMIDI_ENABLE_JAVA)
+  set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})
+endif(PORTMIDI_ENABLE_JAVA)
 
 # this completes the list of library sources by adding shared code
 list(APPEND LIBSRC pmutil portmidi)
 
 # now add the shared files to make the complete list of library sources
-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")
+if(PORTMIDI_ENABLE_STATIC)
+  add_library(portmidi-static ${LIBSRC})
+  set_target_properties(portmidi-static PROPERTIES OUTPUT_NAME "portmidi")
+  target_link_libraries(portmidi-static ${PM_NEEDED_LIBS})
+endif(PORTMIDI_ENABLE_STATIC)
+
+if(PORTMIDI_ENABLE_JAVA)
+  # 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")
+endif(PORTMIDI_ENABLE_JAVA)
 
 # 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)
+  if(PORTMIDI_ENABLE_STATIC)
+    INSTALL(TARGETS portmidi-static
+      LIBRARY DESTINATION lib${LIB_SUFFIX}
+      ARCHIVE DESTINATION lib${LIB_SUFFIX})
+  endif(PORTMIDI_ENABLE_STATIC)
+  if(PORTMIDI_ENABLE_JAVA)
+    INSTALL(TARGETS pmjni
+      LIBRARY DESTINATION lib${LIB_SUFFIX}
+      ARCHIVE DESTINATION lib${LIB_SUFFIX})
+  endif(PORTMIDI_ENABLE_JAVA)
 # .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)
--- portmidi/pm_dylib/CMakeLists.txt
+++ portmidi/pm_dylib/CMakeLists.txt
@@ -39,9 +39,6 @@
 
 # first include the appropriate system-dependent file:
 if(UNIX)
-  # add the -g switch for Linux and Mac OS X (not used in Win32)
-  set (CMAKE_C_FLAGS_DEBUG "-g ${CMAKE_C_FLAGS_DEBUG}" 
-       CACHE STRING "enable extra checks for debugging" FORCE)
   if(APPLE)
     set(MACSRC pmmacosxcm pmmac readbinaryplist finddefault)
     prepend_path(LIBSRC ../pm_mac/ ${MACSRC})
@@ -63,7 +60,8 @@
     message(STATUS "SYSROOT: " ${CMAKE_OSX_SYSROOT})
   else(APPLE)
     # LINUX settings...
-    include(FindJNI)
+    if(PORTMIDI_ENABLE_JAVA)
+      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
@@ -75,11 +73,8 @@
     # 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})
+    endif(PORTMIDI_ENABLE_JAVA)
 
     set(LINUXSRC pmlinuxalsa pmlinux finddefault)
     prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC})
@@ -91,13 +86,15 @@
   if(WIN32)
     # /MDd is multithread debug DLL, /MTd is multithread debug
     # /MD is multithread DLL, /MT is multithread 
-    
-    include(FindJNI)
-    # note: should use JAVA_JVM_LIB_PATH, but it is not set properly
-    set(JAVAVM_LIB ${JAVA_INCLUDE_PATH}/../lib/jvm.lib)
 
-    set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
-    # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
+    if(PORTMIDI_ENABLE_JAVA)
+      include(FindJNI)
+      # note: should use JAVA_JVM_LIB_PATH, but it is not set properly
+      set(JAVAVM_LIB ${JAVA_INCLUDE_PATH}/../lib/jvm.lib)
+
+      set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
+      # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
+    endif(PORTMIDI_ENABLE_JAVA)
 
     set(WINSRC pmwin pmwinmm)
     prepend_path(LIBSRC ../pm_win/ ${WINSRC})
@@ -106,7 +103,10 @@
     # message(STATUS "JAVAVM_LIB: " ${JAVAVM_LIB})
   endif(WIN32)
 endif(UNIX)
+
+if(PORTMIDI_ENABLE_JAVA)
 set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVAVM_LIB})
+endif(PORTMIDI_ENABLE_JAVA)
 
 # this completes the list of library sources by adding shared code
 set(SHARED_FILES pmutil portmidi)
@@ -120,8 +120,8 @@
 # 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${LIB_SUFFIX}
+    ARCHIVE DESTINATION lib${LIB_SUFFIX})
   INSTALL(FILES ../pm_common/portmidi.h ../porttime/porttime.h
-    DESTINATION /usr/local/include)
+    DESTINATION include)
 endif(UNIX)
--- portmidi/pm_java/CMakeLists.txt
+++ portmidi/pm_java/CMakeLists.txt
@@ -5,43 +5,24 @@
     # java not dealt with in CMake -- see pm_mac/pm_mac.xcodeproj
   else(APPLE)
     # linux
-    set(JPORTMIDICLASS JPortMidi.class JPortMidiException.class
-    		       JPortMidiApi.class)
-    set(PMDEFAULTSCLASS PmDefaultsFrame.class PmDefaults.class)
-    prepend_path(JPORTMIDICLASS2 jportmidi/ ${JPORTMIDICLASS})
-    prepend_path(PMDEFAULTSCLASS2 pmdefaults/ ${PMDEFAULTSCLASS})
-    set(PMDEFAULTS_ALL_CLASSES ${JPORTMIDICLASS2} ${PMDEFAULTSCLASS2})
-    # message(STATUS "PMDEFAULTS_ALL_CLASSES is " ${PMDEFAULTS_ALL_CLASSES})
-    add_custom_command(OUTPUT pmdefaults/PmDefaultsFrame.class
-        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
-		pmdefaults/*.class portmusic_logo.png jportmidi/*.class
-  	COMMAND chmod +x pmdefaults/pmdefaults
-	COMMAND cp pmdefaults/pmdefaults ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-	COMMAND mv pmdefaults.jar ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-	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")
+	set(JAVA_CLASSES jportmidi pmdefaults)
+	add_custom_command(OUTPUT ${JAVA_CLASSES}
+		COMMAND javac -d ${CMAKE_CURRENT_BINARY_DIR} jportmidi/*.java pmdefaults/*.java
+		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+	add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pmdefaults.jar
+		DEPENDS ${JAVA_CLASSES}
+		COMMAND jar cmf pmdefaults/manifest.txt ${CMAKE_CURRENT_BINARY_DIR}/pmdefaults.jar
+		-C pmdefaults portmusic_logo.png -C ${CMAKE_CURRENT_BINARY_DIR} jportmidi
+		-C ${CMAKE_CURRENT_BINARY_DIR} pmdefaults
+		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+	add_custom_target(pmdefaults.jar ALL
+		DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pmdefaults.jar)
 
     # install the libraries (Linux only)
-    INSTALL(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults.jar
-      DESTINATION /usr/share/java)
-    INSTALL(PROGRAMS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults
-      DESTINATION /usr/local/bin)
+    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pmdefaults.jar
+      DESTINATION ${JAR_INSTALL_DIR})
+    INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/pmdefaults/pmdefaults
+      DESTINATION bin)
   endif(APPLE)
 endif(UNIX)
 # In windows, use pm_java/make.bat
--- portmidi/pm_test/CMakeLists.txt
+++ portmidi/pm_test/CMakeLists.txt
@@ -12,8 +12,8 @@
 
 macro(make_a_test name)
   add_executable(${name} ${name}.c)
-  target_link_libraries(${name} portmidi-static ${PM_NEEDED_LIBS})
-  add_dependencies(${name} portmidi-static)
+  target_link_libraries(${name} portmidi ${PM_NEEDED_LIBS})
+  add_dependencies(${name} portmidi)
 endmacro(make_a_test)
 
 make_a_test(test)

debug log:

solving 4eed094 ...
found 4eed094 in https://yhetil.org/guix-devel/87oa8uyhkn.fsf@elephly.net/

applying [1/1] https://yhetil.org/guix-devel/87oa8uyhkn.fsf@elephly.net/
diff --git a/gnu/packages/patches/portmidi-modular-build.patch b/gnu/packages/patches/portmidi-modular-build.patch
new file mode 100644
index 0000000..4eed094

1:12: trailing whitespace.
   set(CMAKE_BUILD_TYPE Release CACHE STRING 
1:21: trailing whitespace.
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY 
1:25: trailing whitespace.
 
1:30: trailing whitespace.
 
1:39: trailing whitespace.
 
Checking patch gnu/packages/patches/portmidi-modular-build.patch...
Applied patch gnu/packages/patches/portmidi-modular-build.patch cleanly.
warning: squelched 24 whitespace errors
warning: 29 lines add whitespace errors.

index at:
100644 4eed0949fdf8fb612b28e02dfae75cf8b505670c	gnu/packages/patches/portmidi-modular-build.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).