[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] SC on FreeBSD



Am Sonntag, den 09.12.2007, 09:37 +0000 schrieb Holger Ballweg:



> 
> If I add -I/usr/local/include  -L/usr/local/lib to the line causing
> this error, it compiles... 
> So I probably have to add something to SConstruct, to get the proper
> location recognized!?


Ok, finally found some time to investigate this really big issue ^^

My patch now compiles without the symlink and sc on freebsd works as
expected using scel.


Holger 
Index: Source/lang/LangSource/PyrMathOps.cpp
===================================================================
--- Source/lang/LangSource/PyrMathOps.cpp	(revision 6828)
+++ Source/lang/LangSource/PyrMathOps.cpp	(working copy)
@@ -361,6 +361,8 @@
 						case opUnsignedShift : {
 #ifdef SC_WIN32
               unsigned long ia = a->ui;
+#elif defined(SC_FREEBSD)
+              u_long ia = a->ui;
 #else
               ulong ia = a->ui;
 #endif
Index: Source/lang/LangSource/PyrSignal.cpp
===================================================================
--- Source/lang/LangSource/PyrSignal.cpp	(revision 6828)
+++ Source/lang/LangSource/PyrSignal.cpp	(working copy)
@@ -964,6 +964,8 @@
 #ifdef SC_WIN32
 // in PyrMathSupport.cpp
 double log2(double x);
+#elif defined(SC_FREEBSD)
+ double log2(double x);
 #endif
 
 PyrObject* signal_log2(VMGlobals *g, PyrObject *inPyrSignal)
Index: Source/lang/LangSource/PyrMathSupport.cpp
===================================================================
--- Source/lang/LangSource/PyrMathSupport.cpp	(revision 6828)
+++ Source/lang/LangSource/PyrMathSupport.cpp	(working copy)
@@ -26,6 +26,11 @@
 #include <stdlib.h>
 #include <math.h>
 
+#ifdef SC_FREEBSD
+# include <complex.h>
+#endif
+
+
 float centsRatio[128];
 float semitoneFreq[128];
 
Index: Source/lang/LangPrimSource/SC_ComPort.cpp
===================================================================
--- Source/lang/LangPrimSource/SC_ComPort.cpp	(revision 6828)
+++ Source/lang/LangPrimSource/SC_ComPort.cpp	(working copy)
@@ -36,6 +36,10 @@
 # include <errno.h>
 #endif
 
+#ifdef SC_FREEBSD
+# include <errno.h>
+#endif
+
 #ifdef SC_DARWIN
 #include <errno.h>
 #endif
Index: Source/server/SC_ComPort.cpp
===================================================================
--- Source/server/SC_ComPort.cpp	(revision 6828)
+++ Source/server/SC_ComPort.cpp	(working copy)
@@ -45,6 +45,12 @@
 # include <unistd.h>
 #endif
 
+#ifdef SC_FREEBSD
+# include <errno.h>
+# include <unistd.h>
+#endif
+
+
 #ifdef USE_RENDEZVOUS
 #include "Rendezvous.h"
 #endif
Index: Source/server/SC_Carbon.cpp
===================================================================
--- Source/server/SC_Carbon.cpp	(revision 6828)
+++ Source/server/SC_Carbon.cpp	(working copy)
@@ -126,7 +126,7 @@
 void sc_SetDenormalFlags()
 {
 }
-#elif defined(SC_LINUX) && defined(__SSE__)
+#elif (SC_LINUX || SC_FREEBSD) && defined(__SSE__)
 # include <xmmintrin.h>
 
 // cpuid function that works with -fPIC from `minor' at http://red-bean.com
Index: Source/common/SC_DirUtils.cpp
===================================================================
--- Source/common/SC_DirUtils.cpp	(revision 6828)
+++ Source/common/SC_DirUtils.cpp	(working copy)
@@ -129,6 +129,8 @@
 	char a[] = "linux", b[] = "windows";
 #elif defined(SC_LINUX)
 	char a[] = "osx", b[] = "windows";
+#elif defined(SC_FREEBSD)
+	char a[] = "osx", b[] = "windows";
 #elif defined(SC_WIN32)
 	char a[] = "osx", b[] = "linux";
 #endif
@@ -180,6 +182,11 @@
 	if (!realpath(path, returnPath))
 		strcpy(returnPath, path);
 	return;
+#elif defined(SC_FREEBSD)
+	isAlias = sc_IsSymlink(path);
+	if (!realpath(path, returnPath))
+		strcpy(returnPath, path);
+	return;
 #endif
 	strcpy(returnPath, path);
 	return;
Index: SConstruct
===================================================================
--- SConstruct	(revision 6828)
+++ SConstruct	(working copy)
@@ -48,6 +48,11 @@
     PLUGIN_EXT = '.scx'
     DEFAULT_AUDIO_API = 'coreaudio'
     DEFAULT_PREFIX = '/usr/local'
+elif PLATFORM == 'freebsd':
+    PLATFORM_SYMBOL = 'SC_FREEBSD'
+    PLUGIN_EXT = '.so'
+    DEFAULT_AUDIO_API = 'jack'
+    DEFAULT_PREFIX = '/usr/local'
 elif PLATFORM == 'linux':
     PLATFORM_SYMBOL = 'SC_LINUX'
     PLUGIN_EXT = '.so'
@@ -461,9 +466,15 @@
     else:
         build_host_supports_sse = False
 	if CPU != 'ppc':
-           if PLATFORM != 'darwin':
-              flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
-              x86_flags = flag_line.split (": ")[1:][0].split ()
+	   if PLATFORM == 'freebsd':
+                machine_info = os.popen ("sysctl -a  hw.instruction_sse").read()[:-1]
+		x86_flags = 'no'
+		if "1" in [x for x in machine_info]:
+			build_host_supports_sse = True
+			x86_flags = 'sse'
+           elif PLATFORM != 'darwin':
+           	flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
+              	x86_flags = flag_line.split (": ")[1:][0].split ()
            else:
               machine_info = os.popen ("sysctl -a machdep.cpu").read()[:-1]
               x86_flags = machine_info.split()
@@ -601,7 +612,6 @@
                '#Headers/plugin_interface',
                '#Headers/server'],
     CPPDEFINES = [('SC_PLUGIN_DIR', '\\"' + pkg_lib_dir(FINAL_PREFIX, 'plugins') + '\\"'), ('SC_PLUGIN_EXT', '\\"' + PLUGIN_EXT + '\\"')],
-    LIBS = ['common', 'pthread', 'dl'],
     LIBPATH = 'build',
     LINKFLAGS = '-Wl,-rpath,' + FINAL_PREFIX + '/lib')
 libscsynthEnv = serverEnv.Copy(
@@ -617,6 +627,13 @@
     )
 
 # platform specific
+
+# functionality of libdl is included in libc on freebsd
+if PLATFORM == 'freebsd':
+    serverEnv.Append(LIBS = ['common', 'pthread'])
+else:
+    serverEnv.Append(LIBS = ['common', 'pthread', 'dl'])
+
 if PLATFORM == 'darwin':
     serverEnv.Append(
 	LINKFLAGS = '-framework CoreServices'
@@ -624,6 +641,9 @@
 elif PLATFORM == 'linux':
     serverEnv.Append(CPPDEFINES = [('SC_PLUGIN_LOAD_SYM', '\\"load\\"')])
 
+elif PLATFORM == 'freebsd':
+    serverEnv.Append(CPPDEFINES = [('SC_PLUGIN_LOAD_SYM', '\\"load\\"')])
+
 # required libraries
 merge_lib_info(
     serverEnv,
@@ -699,6 +719,12 @@
 if PLATFORM == 'darwin':
     pluginEnv['SHLINKFLAGS'] = '$LINKFLAGS -bundle -flat_namespace -undefined suppress'
 
+if PLATFORM == 'freebsd':
+    merge_lib_info(
+        pluginEnv,
+        libraries['sndfile'])
+
+
 plugins = []
 
 def make_plugin_target(name):
@@ -812,15 +838,25 @@
                '#Headers/server',
                '#Source/lang/LangSource/Bison'],
     CPPDEFINES = [['USE_SC_TERMINAL_CLIENT', env['TERMINAL_CLIENT']]],
-    LIBS = ['common', 'scsynth', 'pthread', 'dl', 'm'],
     LIBPATH = 'build'
     )
+
+
+# functionality of libdl is included in libc on freebsd
+if PLATFORM == 'freebsd':
+    langEnv.Append(LIBS = ['common', 'scsynth', 'pthread', 'm'])
+else:
+    langEnv.Append(LIBS = ['common', 'scsynth', 'pthread', 'dl',  'm'])
+
 if PLATFORM == 'darwin':
     langEnv.Append(
 	LINKFLAGS = '-framework CoreServices')
 elif PLATFORM == 'linux':
     langEnv.Append(
     LINKFLAGS = '-Wl,-rpath,build -Wl,-rpath,' + FINAL_PREFIX + '/lib')
+elif PLATFORM == 'freebsd':
+    langEnv.Append(
+    LINKFLAGS = '-Wl,-rpath,build -Wl,-rpath,' + FINAL_PREFIX + '/lib')
 
 
 merge_lib_info(langEnv, libraries['audioapi'])
Index: Headers/common/SC_Endian.h
===================================================================
--- Headers/common/SC_Endian.h	(revision 6828)
+++ Headers/common/SC_Endian.h	(working copy)
@@ -35,6 +35,12 @@
 
 # include <machine/endian.h>
 
+#elif defined(SC_FREEBSD)
+
+# include <machine/endian.h>
+# include <netinet/in.h>
+
+
 #elif defined(SC_WIN32)
 
 # define LITTLE_ENDIAN 1234