void-packages/srcpkgs/yoshimi/patches/cmake.patch

58 lines
1.5 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- src/CMakeLists.txt.orig 2017-10-15 22:35:17.000000000 +0200
+++ src/CMakeLists.txt 2017-10-22 18:09:47.997475553 +0200
@@ -105,7 +105,7 @@
set (BuildOptionsBasic
"-O3 -msse -msse2 -mfpmath=sse -ffast-math -fomit-frame-pointer"
- CACHE STRING "basic X86 complier options"
+ CACHE STRING "basic X86 compiler options"
)
set (BuildOptionsDebug
@@ -118,6 +118,34 @@
message(FATAL_ERROR "pkg-config required but not found")
endif (PKG_CONFIG_FOUND)
+include (CheckFunctionExists)
+# musl systems dont have random_r() and also need argp-standalone
+check_function_exists(random_r randomR)
+
+if (randomR)
+ add_definitions(-DHAVE_RANDOM_R)
+endif(randomR)
+
+check_c_source_compiles (
+ "#include <argp.h>
+ int main () {
+ int argc=1;
+ char *argv[]={\"test\"};
+ argp_parse(0,argc,argv,0,0,0);
+ return 0;
+ }" LIBC_HAS_ARGP
+)
+
+if (NOT LIBC_HAS_ARGP)
+ message(STATUS "libc does not have argp")
+ find_library (ARGP_LIB argp REQUIRED)
+ if (ARGP_LIB)
+ message(STATUS "Found libargp")
+ else(ARGP_LIB)
+ message(FATAL_ERROR "libargp required but not found")
+ endif(ARGP_LIB)
+endif(NOT LIBC_HAS_ARGP)
+
# libz
set (CMAKE_REQUIRED_LIBRARIES z)
check_c_source_compiles (
@@ -497,6 +525,10 @@
target_link_libraries (yoshimi ${ExternLibraries})
+if (ARGP_LIB)
+ target_link_libraries (yoshimi ${ARGP_LIB})
+endif(ARGP_LIB)
+
install (TARGETS yoshimi RUNTIME DESTINATION bin)
install (DIRECTORY ../banks DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/yoshimi