Hello,

I am trying to support codec2 to OpenBSD.
At least three files to be modified.

misc/CmakeLists.txt
        to tell the directory of libsamplerate, use ${LIBSAMPLERATE} instead
        of samplerate in target_link_libraries()
src/freedv_api.c
        <malloc.h> is at <sys/malloc.h>, other *BSDs are same.
unittest/CMakeLists.txt
        -fstack-usage option can be used with GCC only,
        avoid it when using other compiler (OpenBSD/amd64 uses clang).

Here is the diff.

Index: misc/CMakeLists.txt
===================================================================
--- misc/CMakeLists.txt (revision 3986)
+++ misc/CMakeLists.txt (working copy)
@@ -28,7 +28,7 @@
 target_link_libraries(raw2h codec2)
 
 add_executable(tsrc tsrc.c)
-target_link_libraries(tsrc samplerate)
+target_link_libraries(tsrc ${LIBSAMPLERATE})
 
 add_executable(tlininterp tlininterp.c)
 add_executable(tdec tdec.c)
Index: src/freedv_api.c
===================================================================
--- src/freedv_api.c    (revision 3986)
+++ src/freedv_api.c    (working copy)
@@ -33,8 +33,10 @@
 #include <string.h>
 #include <math.h>
 
-#ifdef __APPLE__
+#if defined(__APPLE__)
 #include <malloc/malloc.h>
+#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
+#include <sys/malloc.h>
 #else
 #include <malloc.h>
 #endif /* __APPLE__ */
Index: unittest/CMakeLists.txt
===================================================================
--- unittest/CMakeLists.txt     (revision 3986)
+++ unittest/CMakeLists.txt     (working copy)
@@ -32,7 +32,11 @@
 add_library(function_trace STATIC ../unittest/function_trace.c)
 
 add_executable(ofdm_stack ofdm_stack.c ../src/ofdm.c ../src/octave.c 
../src/kiss_fft.c ../src/modem_probe.c ../src/mpdecode_core.c ../src/phi0.c 
../src/filter.c)
-target_compile_options(ofdm_stack PUBLIC -fstack-usage -finstrument-functions 
-no-pie)
+if (CMAKE_C_COMPILER MATCHES "gcc$")
+    target_compile_options(ofdm_stack PUBLIC -fstack-usage 
-finstrument-functions -no-pie)
+else()
+    target_compile_options(ofdm_stack PUBLIC -finstrument-functions -no-pie)
+endif()
 target_link_libraries(ofdm_stack function_trace m -no-pie 
"-Wl,-Map=ofdm_stack.map")
 add_definitions(-D__UNITTEST__)

-- 
SASANO Takayoshi (JG1UAA) <[email protected]>


_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to