aboutsummaryrefslogtreecommitdiff
path: root/audio/moony-lv2
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2018-05-19 07:32:26 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2018-05-19 07:32:26 +0000
commit47d7ed77e55fa9736156afcfa3f3d7b55ebc4219 (patch)
tree53e82c4263066e09fd215a458d266538b7415788 /audio/moony-lv2
parentbc2c8d807a85ad202cdeaf59a7cb613c0e0485cd (diff)
downloadports-47d7ed77e55fa9736156afcfa3f3d7b55ebc4219.tar.gz
ports-47d7ed77e55fa9736156afcfa3f3d7b55ebc4219.zip
audio/moony-lv2: Unbreak on 12
Due to bug#221341 cpow/clog functions are missing, and were implemented ad-hoc in the patch. Recently clog has been added to 12 in r333577, which conflited with the ad-hoc implementation of clog in the patch. To correct this, cmake-level cpow/clog detection were added, and ad-hoc implementations are now added only when cpow/clog aren't present in the system.
Notes
Notes: svn path=/head/; revision=470362
Diffstat (limited to 'audio/moony-lv2')
-rw-r--r--audio/moony-lv2/files/patch-CMakeLists.txt20
-rw-r--r--audio/moony-lv2/files/patch-lcomplex_lcomplex.c6
2 files changed, 24 insertions, 2 deletions
diff --git a/audio/moony-lv2/files/patch-CMakeLists.txt b/audio/moony-lv2/files/patch-CMakeLists.txt
index ba8a88a7a866..7b5599112432 100644
--- a/audio/moony-lv2/files/patch-CMakeLists.txt
+++ b/audio/moony-lv2/files/patch-CMakeLists.txt
@@ -1,6 +1,24 @@
--- CMakeLists.txt.orig 2017-05-16 21:46:21 UTC
+++ CMakeLists.txt
-@@ -350,21 +350,21 @@ if(BUILD_TESTING)
+@@ -33,6 +33,17 @@ set(CMAKE_C_FLAGS "-Wshadow -Wimplicit-f
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-z,defs ${CMAKE_MODULE_LINKER_FLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-z,nodelete ${CMAKE_MODULE_LINKER_FLAGS}")
++elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
++ # see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221341
++ include(CheckFunctionExists)
++ check_function_exists(clog FreeBSD_CLOG_EXISTS)
++ check_function_exists(cpow FreeBSD_CPOW_EXISTS)
++ if (FreeBSD_CLOG_EXISTS)
++ set(CMAKE_C_FLAGS "-DFreeBSD_CLOG_EXISTS ${CMAKE_C_FLAGS}")
++ endif()
++ if (FreeBSD_CPOW_EXISTS)
++ set(CMAKE_C_FLAGS "-DFreeBSD_CPOW_EXISTS ${CMAKE_C_FLAGS}")
++ endif()
+ elseif(WIN32)
+ set(CMAKE_C_FLAGS "-mstackrealign ${CMAKE_C_FLAGS}")
+ endif()
+@@ -350,21 +361,21 @@ if(BUILD_TESTING)
endif()
set_target_properties(moony_test PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto
target_link_libraries(moony_test ${LIBS})
diff --git a/audio/moony-lv2/files/patch-lcomplex_lcomplex.c b/audio/moony-lv2/files/patch-lcomplex_lcomplex.c
index 364ad360f1ac..e38703204b23 100644
--- a/audio/moony-lv2/files/patch-lcomplex_lcomplex.c
+++ b/audio/moony-lv2/files/patch-lcomplex_lcomplex.c
@@ -8,12 +8,15 @@
#include "lua.h"
#include "lauxlib.h"
-@@ -78,6 +79,32 @@ static int Ltostring(lua_State *L) /**
+@@ -78,6 +79,36 @@ static int Ltostring(lua_State *L) /**
return 1;
}
++#if !defined(FreeBSD_CLOG_EXISTS)
+// Missing C99 functions clog and cpow: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221341
+static Complex clog(Complex z) {return log(cabs(z)) + I * carg(z);}
++#endif
++#if !defined(FreeBSD_CPOW_EXISTS)
+// from https://github.com/eblot/newlib/blob/master/newlib/libm/complex/cpow.c
+static Complex
+cpow(Complex a, Complex z)
@@ -37,6 +40,7 @@
+ w = r * cos(theta) + (r * sin(theta)) * I;
+ return w;
+}
++#endif
+
#define A(f,e) static int L##f(lua_State *L) { return pushcomplex(L,e); }
#define B(f) A(f,l_mathop(c##f)(Z(1),Z(2)))