--- wscript	2011-10-17 09:27:26.000000000 -0500
+++ wscript	2011-12-17 22:26:58.000000000 -0500
@@ -153,15 +153,21 @@
         data_dir = bld.path.find_dir('data')
         bld.install_files('wxMupen64Plus.app/Contents/Resources', data_dir.ant_glob('*'))
         bin_install_path = "wxMupen64Plus.app/Contents/MacOS"
-        
+    elif os.uname()[0] == 'FreeBSD':
+        if 'LOCALBASE' in os.environ:
+           LOCALBASE = os.environ['LOCALBASE']
+        else:
+           LOCALBASE = '/usr/local/'
+
+        build_flags += ['-I'+ LOCALBASE +'/include/X11']
+        osal_src += ['mupen64plusplus/osal_dynamiclib_unix.c', 'mupen64plusplus/osal_files_unix.c']
+        link_flags += ['-lGL','-lX11']
     else:
         # For other unices
         build_flags += ['-I/usr/include/X11']
         osal_src += ['mupen64plusplus/osal_dynamiclib_unix.c', 'mupen64plusplus/osal_files_unix.c']
         link_flags += ['-lGL', '-ldl', '-lX11']
         
-        link_flags += ['-ldl']
-        
         # install target
         data_dir = bld.path.find_dir('data')
         if len(bld.env['datadir']) > 0:
