diff -Naur ET-GPL/src/SConscript.core ET-GPL-FBSD/src/SConscript.core
--- ET-GPL/src/SConscript.core	2010-08-11 01:16:48.000000000 +0200
+++ ET-GPL-FBSD/src/SConscript.core	2016-09-08 14:05:07.190728842 +0200
@@ -163,6 +163,13 @@
 #        'unix/snd_mixa.S'
 ]
 
+freebsd_full_sources = [
+        'unix/linux_glimp.c',
+        'unix/linux_qgl.c',
+        'unix/linux_snd.c',
+#        'unix/snd_mixa.S'
+]
+
 mac_sources = [
 	'game/q_shared.c',
 	'game/q_math.c',
@@ -246,6 +253,8 @@
 staticx11_libs = [ 'libXxf86dga.a', 'libXxf86vm.a' ]
 if ( os.path.exists( os.path.join( '/usr/lib', staticx11_libs[0] ) ) ):
 	staticx11_libs = [ os.path.join( '/usr/lib', i ) for i in staticx11_libs ]
+elif ( os.path.exists( os.path.join( '/usr/local/lib', staticx11_libs[0] ) ) ):
+	staticx11_libs = [ os.path.join( '/usr/local/lib', i ) for i in staticx11_libs ]
 else:
 	staticx11_libs = [ os.path.join( '/usr/X11R6/lib', i ) for i in staticx11_libs ]
 
@@ -261,6 +270,18 @@
 	matha = gas_env.StaticObject( 'unix/matha.spp' )
         snd_mixa = gas_env.StaticObject( 'unix/snd_mixa.spp' )
 
+if ( g_os == 'FreeBSD' ):
+	nasm_env = Environment( tools = [ 'nasm' ] )
+	nasm_env['ASFLAGS'] = '-f elf'
+	snapvector = nasm_env.StaticObject( 'unix/snapvector.asm' )
+
+	# gas assembly, with preprocessing
+	gas_env = Environment( tools = [ 'gcc', 'gas' ] )
+	gas_env.Append( CPPDEFINES = [ 'ELF' ] )
+	gas_env.Append( ASFLAGS = [ '-m32', '-x', 'assembler-with-cpp' ] )
+	matha = gas_env.StaticObject( 'unix/matha.spp' )
+        snd_mixa = gas_env.StaticObject( 'unix/snd_mixa.spp' )
+
 splines_env = g_env.Clone()
 splines_lib = splines_env.StaticLibrary( splines_list )
 
@@ -281,6 +302,20 @@
 	else:
 		local_env['ENV']['CC'] = g_env['CC']
 		local_env['LINK'] = 'unix/staticlinkcpp.sh'
+elif ( g_os == 'FreeBSD' ):
+	if ( local_dedicated == 0 ):
+		local_env.Append( LIBS = [ 'X11', 'Xext', 'm' ] )
+		local_env.Append( LIBPATH = [ '/usr/X11R6/lib' ] )
+		local_env.Append( CPPPATH = [ 'curl-7.12.2/include' ] )
+	else:
+		local_env.Append( CPPDEFINES = [ 'DEDICATED' ] )
+		local_env.Append( LIBS = [ 'm' ] )
+
+	if gcc3 == 0:
+		g_env.Append(LINKFLAGS=[ os.popen( g_env['CXX'] + ' -print-file-name=libstdc++.a' ).read().rstrip() ])
+	else:
+		local_env['ENV']['CC'] = g_env['CC']
+		local_env['LINK'] = 'unix/staticlinkcpp.sh'
 elif ( g_os == 'win32' ):
 	local_env.Append( LIBS = [ 'm', 'winmm', 'wsock32', 'gdi32', 'ole32', 'iphlpapi' ] )
 	if ( local_dedicated == 0 ):
@@ -298,6 +333,8 @@
 source_list = server_list + qcommon_list
 if ( g_os == 'Linux' ):
 	source_list += linux_sources + snapvector + matha
+elif ( g_os == 'FreeBSD' ):
+	source_list += linux_sources + snapvector + matha
 elif ( g_os == 'win32' ):
 	source_list += win32_sources
 elif ( g_os == 'Darwin' ):
@@ -322,6 +359,10 @@
 		source_list += snd_mixa
 		source_list += linux_full_sources
 		source_list += staticx11_libs
+	if ( g_os == 'FreeBSD' ):
+		source_list += snd_mixa
+		source_list += freebsd_full_sources
+		source_list += staticx11_libs
 	if ( g_os == 'win32' ):
 		source_list += win32_full_sources
 else:
diff -Naur ET-GPL/src/SConstruct ET-GPL-FBSD/src/SConstruct
--- ET-GPL/src/SConstruct	2012-05-22 13:39:00.000000000 +0200
+++ ET-GPL-FBSD/src/SConstruct	2016-09-08 13:02:34.797418902 +0200
@@ -149,10 +149,16 @@
 	mingw = os.popen( CC + ' -dumpmachine' ).read()
 	return re.search('mingw', mingw) != None
 
+def gcc_is_freebsd():
+	freebsd = os.popen( CC + ' -dumpmachine' ).read()
+	return re.search('freebsd', freebsd) != None
+
 if gcc_is_mingw():
 	g_os = 'win32'
 elif OS == 'Darwin':
 	g_os = 'Darwin'
+elif gcc_is_freebsd():
+	g_os = 'FreeBSD'
 else:
 	g_os = 'Linux'
 print 'OS: %s' % g_os
@@ -238,6 +244,7 @@
 BASECPPFLAGS.append( '-Wall' )
 # don't wrap gcc messages
 BASECPPFLAGS.append( '-fmessage-length=0' )
+BASECPPFLAGS.append( '-I/usr/local/include' )
 
 if ( BUILD == 'debug-all' ):
 	BASECPPFLAGS.append( '-g' )
@@ -257,6 +264,15 @@
 		# -funroll-loops ?
 		# -mfpmath=sse -msse ?
 		OPTCPPFLAGS = [ '-O3', '-march=i686', '-Winline', '-ffast-math', '-fomit-frame-pointer', '-finline-functions', '-fschedule-insns2' ]
+	elif ( OS == 'FreeBSD' ):
+		# -fomit-frame-pointer: gcc manual indicates -O sets this implicitely,
+		# only if that doesn't affect debugging
+		# on Linux, this affects backtrace capability, so I'm assuming this is needed
+		# -finline-functions: implicit at -O3
+		# -fschedule-insns2: implicit at -O3
+		# -funroll-loops ?
+		# -mfpmath=sse -msse ?
+		OPTCPPFLAGS = [ '-O3', '-march=i586', '-Winline', '-ffast-math', '-fomit-frame-pointer', '-finline-functions' ]
 	elif ( OS == 'Darwin' ):
 		OPTCPPFLAGS = []
 else:
diff -Naur ET-GPL/src/game/q_shared.h ET-GPL-FBSD/src/game/q_shared.h
--- ET-GPL/src/game/q_shared.h	2010-08-11 01:16:54.000000000 +0200
+++ ET-GPL-FBSD/src/game/q_shared.h	2016-09-08 13:29:02.912537427 +0200
@@ -262,6 +262,20 @@
 
 #endif
 
+#ifdef __FreeBSD__
+
+#define MAC_STATIC
+
+#ifdef __i386__
+#define CPUSTRING   "freebsd-i386"
+#else
+#define CPUSTRING   "linux-other"
+#endif
+
+#define PATH_SEP '/'
+
+#endif
+
 //=============================================================
 
 
diff -Naur ET-GPL/src/qcommon/common.c ET-GPL-FBSD/src/qcommon/common.c
--- ET-GPL/src/qcommon/common.c	2010-08-11 01:16:56.000000000 +0200
+++ ET-GPL-FBSD/src/qcommon/common.c	2016-09-08 12:38:18.835164127 +0200
@@ -40,6 +40,10 @@
 #elif __MACOS__
 // getpid
 #include <unistd.h>
+#elif __FreeBSD__
+#include <netinet/in.h>
+// getpid
+#include <unistd.h>
 #else
 #include <winsock.h>
 #endif
diff -Naur ET-GPL/src/qcommon/qcommon.h ET-GPL-FBSD/src/qcommon/qcommon.h
--- ET-GPL/src/qcommon/qcommon.h	2010-08-11 01:16:56.000000000 +0200
+++ ET-GPL-FBSD/src/qcommon/qcommon.h	2016-09-08 12:36:04.384296055 +0200
@@ -1308,6 +1308,20 @@
 	#define SYS_DLLNAME_UI "zndrfh"
 #endif
 
+#elif __FreeBSD__
+
+// qagame.mp.i386.so
+#define SYS_DLLNAME_QAGAME_SHIFT 6
+#define SYS_DLLNAME_QAGAME "wgmgsk4sv4o9><4yu"
+
+// cgame.mp.i386.so
+#define SYS_DLLNAME_CGAME_SHIFT 2
+#define SYS_DLLNAME_CGAME "eicog0or0k5:80uq"
+
+// ui.mp.i386.so
+#define SYS_DLLNAME_UI_SHIFT 5
+#define SYS_DLLNAME_UI "zn3ru3n8=;3xt"
+
 #else
 
 #error unknown OS
diff -Naur ET-GPL/src/splines/util_str.cpp ET-GPL-FBSD/src/splines/util_str.cpp
--- ET-GPL/src/splines/util_str.cpp	2010-08-11 01:16:54.000000000 +0200
+++ ET-GPL-FBSD/src/splines/util_str.cpp	2016-09-08 12:51:02.182405827 +0200
@@ -40,6 +40,11 @@
 #undef toupper
 #endif
 
+#if __FreeBSD__
+#undef tolower
+#undef toupper
+#endif
+
 #ifdef _WIN32
 #ifndef __GNUC__
 #pragma warning(disable : 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data
diff -Naur ET-GPL/src/unix/linux_snd.c ET-GPL-FBSD/src/unix/linux_snd.c
--- ET-GPL/src/unix/linux_snd.c	2010-08-11 01:16:56.000000000 +0200
+++ ET-GPL-FBSD/src/unix/linux_snd.c	2016-09-08 13:30:08.418773780 +0200
@@ -60,6 +60,7 @@
 
 static qboolean use_custom_memset = qfalse;
 // show_bug.cgi?id=371
+#ifndef __FreeBSD__
 void Snd_Memset( void* dest, const int val, const size_t count ) {
 	int *pDest;
 	int i, iterate;
@@ -68,6 +69,7 @@
 		Com_Memset( dest,val,count );
 		return;
 	}
+
 	iterate = count / sizeof( int );
 	pDest = (int*)dest;
 	for ( i = 0; i < iterate; i++ )
@@ -75,6 +77,7 @@
 		pDest[i] = val;
 	}
 }
+#endif
 
 qboolean SNDDMA_Init( void ) {
 	int rc;
diff -Naur ET-GPL/src/unix/staticlinkcpp.sh ET-GPL-FBSD/src/unix/staticlinkcpp.sh
--- ET-GPL/src/unix/staticlinkcpp.sh	2010-08-11 01:16:56.000000000 +0200
+++ ET-GPL-FBSD/src/unix/staticlinkcpp.sh	2016-09-08 13:46:44.178391485 +0200
@@ -1,2 +1,2 @@
 #!/bin/sh
-$CC "$@" -static-libgcc "$($CC --print-file-name='libstdc++.a')" -lm
+$CC "$@" -static-libgcc -L/usr/local/lib "$($CC --print-file-name='libstdc++.a')" -lm
