Commits

Lars Yencken committed 2f26d92

Updated build instructions to work for FreeBSD.

Comments (0)

Files changed (7)

     """ Check whether the correct libraries exist, and thus whether building
         is possible.
     """
-    # Detect OS X python installation, and attempt to correct for it.
-    if os.uname()[0] == 'Darwin':
+    # Some platform-specific customisations.
+    platform = os.uname()[0].lower()
+    if platform.endswith('bsd') or platform == 'darwin':
+        env.Append(CXXFLAGS='-DBSD ')
+
+    if platform == 'darwin':
+        # Extra build parameters for OS X 
         env.Replace(SHLINKFLAGS='$LINKFLAGS -bundle -flat_namespace -undefined suppress')
         env.Replace(SHLIBSUFFIX='.so')
-        env.Append(CXXFLAGS='-DDARWIN ')
+
+    print 'Configuring for platform: %s' % platform
 
     # Detect the presence of necessary dependencies.
     conf = Configure(env)
         print "Can't find standard math libraries."
         Exit(1)
 
+    if not conf.CheckLib('pthread'):
+        print "Can't find pthread."
+        Exit(1)
+
     if not conf.CheckLibWithHeader('cppunit', 'cppunit/ui/text/TestRunner.h',
             'c++'):
         print "Can't find cppunit."
 # Set up the compilation environment.
 env = Environment(
         SHLIBPREFIX='',
-        LIBS=['gomp'],
+        LIBS=['gomp', 'pthread'],
     )
+env.Append(CXXFLAGS='-DBSD ')
 
 environmentVars = (
         'CPATH',
     wcout << L"Reading from " << filename << endl;
     wifstream iStream(filename);
 
-#ifndef DARWIN
+#ifndef BSD
     iStream.imbue(locale(g_locale));
 #endif
 
     wcout << L"Writing to " << filename << endl;
     wcout << L"--> " << alignments.size() << L" records" << endl;
     wofstream oStream(filename);
-#ifndef DARWIN
+#ifndef BSD
     oStream.imbue(locale("en_US.UTF-8"));
 #endif
     if (!oStream) {
 Kanjidic::Kanjidic(const char* filename)
 {
     wifstream iStream(filename);
-#ifndef DARWIN
+#ifndef BSD
     iStream.imbue(locale("en_US.UTF8"));
 #endif
     wchar_t* reading;
 
 using namespace std;
 
-#ifdef DARWIN
+#ifdef BSD
 #include <locale.h>
 #endif
 
 
 int main(int argc, char *argv[])
 {
-#ifdef DARWIN
+#ifdef BSD
     setlocale(LC_CTYPE, g_locale);
 #else
     cout.imbue(locale(g_locale));
 
 //--------------------------------------------------------------------------//
 
-#ifdef DARWIN
+#ifdef BSD
 #define PLATFORM_CONST
 #else
 #define PLATFORM_CONST const

src/tests/runTests.cpp

 int main(int argc, char *argv[])
 {
     ios::sync_with_stdio(false);
-#ifdef DARWIN
+#ifdef BSD
     setlocale(LC_CTYPE, "g_locale");
     // if (!setlocale(LC_CTYPE, "en_US.UTF8")) {
     //     wcerr << "Error: couldn't set the C locale to use utf8" << endl;

src/tfIdfAligner.cpp

     int nFailed = 0;
     wofstream errorLog;
     errorLog.open("errors.log");
-#ifndef DARWIN
+#ifndef BSD
     errorLog.imbue(locale(g_locale));
 #endif
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.