#*****************************************************************************
#                    The Dark Mod GPL Source Code
# 
# This file is part of the The Dark Mod Source Code, originally based 
# on the Doom 3 GPL Source Code as published in 2011.
# 
# The Dark Mod Source Code is free software: you can redistribute it 
# and/or modify it under the terms of the GNU General Public License as 
# published by the Free Software Foundation, either version 3 of the License, 
# or (at your option) any later version. For details, see LICENSE.TXT.
# 
# Project: The Dark Mod (http://www.thedarkmod.com/)
# 
#*****************************************************************************

import scons_utils

Import( 'GLOBALS' )
Import( GLOBALS )

extlibs_string = ' \
	devil.cpp \
	ffmpeg.cpp \
	jpeg.cpp \
	vorbis.cpp \
	zlib.cpp'
extlibs_list = scons_utils.BuildList( '../../ExtLibs', extlibs_string )


local_env = g_env_base.Clone()

# Build ExtLibs sources to object files
obj_list = []
for f in extlibs_list:
	obj_list += local_env.StaticObject( source = f )
# Add ogg library
obj_list += SConscript( '../../sys/scons/SConscript.ogg' )
# Add curl library (built separately)
obj_list += curl_lib
# greebo: Use custom compiled devIL and libjpeg (since the engine requires 4 bytes per pixel format) in Linux
obj_list += SConscript( '../../sys/scons/SConscript.devil' )
obj_list += SConscript( '../../sys/scons/SConscript.libjpeg' )
obj_list += SConscript( '../../sys/scons/SConscript.libpng' )
# stgatilov: we need only zlib code, because internal minizip uses it
obj_list += SConscript( '../../sys/scons/SConscript.zlib' )

# Note: Unlike windows version, we built ExtLibs as static library,
# because Linux forbids wrapping prebuilt static libraries into a shared library.
# I think it is simply not worth the effort.
ret = local_env.StaticLibrary( target = 'extlibs', source = obj_list )
Return( 'ret' )
