[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Sc-devel] SC on FreeBSD
Hi folks,
I added some ifdefs etc. to get the svn-version working on FreeBSD
6.3-PRERELEASE. Unfortunately I'm not some experienced programmer, so,
here is my patch, would be nice if someone could review and eventually
commit it.
As I'm probably the sole user of this "port"/platform for now, I'll also
volunteer to maintain it.
What you need to compile SC on FreeBSD:
- everything you need for the linux version :-)
- probably a link from /usr/local/include/sndfile.h to /usr/include/
(Why is sndfile.h not found in /usr/local/include??)
Holger
Index: Source/lang/LangSource/PyrMathOps.cpp
===================================================================
--- Source/lang/LangSource/PyrMathOps.cpp (Revision 6772)
+++ Source/lang/LangSource/PyrMathOps.cpp (Arbeitskopie)
@@ -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 6772)
+++ Source/lang/LangSource/PyrSignal.cpp (Arbeitskopie)
@@ -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 6772)
+++ Source/lang/LangSource/PyrMathSupport.cpp (Arbeitskopie)
@@ -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 6772)
+++ Source/lang/LangPrimSource/SC_ComPort.cpp (Arbeitskopie)
@@ -34,6 +34,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 6772)
+++ Source/server/SC_ComPort.cpp (Arbeitskopie)
@@ -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 6772)
+++ Source/server/SC_Carbon.cpp (Arbeitskopie)
@@ -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 6772)
+++ Source/common/SC_DirUtils.cpp (Arbeitskopie)
@@ -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 6772)
+++ SConstruct (Arbeitskopie)
@@ -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,
@@ -812,15 +832,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 6772)
+++ Headers/common/SC_Endian.h (Arbeitskopie)
@@ -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