shithub: qk3

ref: 761946b93cf45a3b9e47868a704fb165af760333
dir: /code/unix/Conscript-client/

View raw version
# full client build script

Import qw( BASE_CFLAGS BASE_LDFLAGS INSTALL_DIR BUILD_DIR TARGETNAME CC CXX LINK );

# splines
$env_splines = new cons(
  CC => $CC,
  CXX => $CXX,
  LINK => $LINK,
	ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} }
  );

@SPLINES_FILES = qw(
  ../splines/math_angles.cpp
  ../splines/math_matrix.cpp
  ../splines/math_quaternion.cpp
  ../splines/math_vector.cpp
  ../splines/q_parse.cpp
  ../splines/q_shared.cpp
  ../splines/splines.cpp
  ../splines/util_str.cpp  
  );
$SPLINES_FILESREF = \@SPLINES_FILES;
  
Library $env_splines 'splines', @$SPLINES_FILESREF;  

# botlib
# FIXME TTimo
# we already deal with botlib on dedicated target
# the compilation options are a bit different but we could certainly rely on
#   the same Conscript and make things cleaner

$env_botlib = new cons(
  CC => $CC,
  CXX => $CXX,
  LINK => $LINK,
	ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} },
  CFLAGS => $BASE_CFLAGS . '-DBOTLIB '
);

@BOTLIB_FILES = qw(
  ../botlib/be_aas_bspq3.c
  ../botlib/be_aas_cluster.c
  ../botlib/be_aas_debug.c
  ../botlib/be_aas_entity.c
  ../botlib/be_aas_file.c
  ../botlib/be_aas_main.c
  ../botlib/be_aas_move.c
  ../botlib/be_aas_optimize.c
  ../botlib/be_aas_reach.c
  ../botlib/be_aas_route.c
  ../botlib/be_aas_routealt.c
  ../botlib/be_aas_sample.c
  ../botlib/be_ai_char.c
  ../botlib/be_ai_chat.c
  ../botlib/be_ai_gen.c
  ../botlib/be_ai_goal.c
  ../botlib/be_ai_move.c
  ../botlib/be_ai_weap.c
  ../botlib/be_ai_weight.c
  ../botlib/be_ea.c
  ../botlib/be_interface.c
  ../botlib/l_crc.c
  ../botlib/l_libvar.c
  ../botlib/l_log.c
  ../botlib/l_memory.c
  ../botlib/l_precomp.c
  ../botlib/l_script.c
  ../botlib/l_struct.c
);
$BOTLIB_REF = \@BOTLIB_FILES;

Library $env_botlib 'botlib', @$BOTLIB_REF;

# jpeg
# NOTE TTimo we might need this one on other targets
$env_jpeglib = new cons(
  CC => $CC,
  CXX => $CXX,
  LINK => $LINK,
	ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} },
  CFLAGS => $BASE_CFLAGS
  );
  
@JPEGLIB_FILES = qw(
  ../jpeg-6/jcapimin.c 
  ../jpeg-6/jchuff.c 
  ../jpeg-6/jcinit.c 
  ../jpeg-6/jccoefct.c 
  ../jpeg-6/jccolor.c 
  ../jpeg-6/jfdctflt.c 
  ../jpeg-6/jcdctmgr.c 
  ../jpeg-6/jcphuff.c 
  ../jpeg-6/jcmainct.c 
  ../jpeg-6/jcmarker.c 
  ../jpeg-6/jcmaster.c 
  ../jpeg-6/jcomapi.c
  ../jpeg-6/jcparam.c
  ../jpeg-6/jcprepct.c
  ../jpeg-6/jcsample.c 
  ../jpeg-6/jdapimin.c 
  ../jpeg-6/jdapistd.c 
  ../jpeg-6/jdatasrc.c 
  ../jpeg-6/jdcoefct.c 
  ../jpeg-6/jdcolor.c 
  ../jpeg-6/jddctmgr.c 
  ../jpeg-6/jdhuff.c 
  ../jpeg-6/jdinput.c 
  ../jpeg-6/jdmainct.c 
  ../jpeg-6/jdmarker.c 
  ../jpeg-6/jdmaster.c 
  ../jpeg-6/jdpostct.c 
  ../jpeg-6/jdsample.c 
  ../jpeg-6/jdtrans.c 
  ../jpeg-6/jerror.c  
  ../jpeg-6/jidctflt.c 
  ../jpeg-6/jmemmgr.c 
  ../jpeg-6/jmemnobs.c   
  ../jpeg-6/jutils.c 
  );
$JPEGLIB_REF = \@JPEGLIB_FILES;  
  
Library $env_jpeglib 'jpeglib', @$JPEGLIB_REF;   

# NOTE TTimo this requires patched cons version to work (see unix/cons)
%nasm_hash = new cons()->copy(
  CC => 'nasm',
  CCCOM => '%CC -f elf -o %> %<'
);
$nasm_hash{SUFMAP}{'.nasm'} = 'build::command::cc';
$nasm_env = new cons(%nasm_hash);

Library $nasm_env 'asmlib', 'ftol.nasm', 'snapvector.nasm';

# compiling files with inlined assembly
$env_inlined = new cons(
  CFLAGS => '-DELF -x assembler-with-cpp'
  );

Library $env_inlined 'inlinelib', '../unix/matha.s', '../unix/snd_mixa.s';

# putting it all together

$env = new cons(
  CC => $CC,
  CXX => $CXX,
  LINK => $LINK,
	ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} },
  CFLAGS => $BASE_CFLAGS,
  LIBS => ' ' . $BUILD_DIR . '/unix/splines.a ' 
  . $BUILD_DIR . '/unix/botlib.a ' 
  . $BUILD_DIR . '/unix/jpeglib.a '
  . $BUILD_DIR . '/unix/asmlib.a '
  . $BUILD_DIR . '/unix/inlinelib.a '
	. $BASE_LDFLAGS
  . '-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm -ldl -lm'
);

@RENDERER_FILES = qw(
  ../renderer/tr_animation.c   
  ../renderer/tr_backend.c   
  ../renderer/tr_bsp.c   
  ../renderer/tr_cmds.c   
  ../renderer/tr_curve.c   
  ../renderer/tr_flares.c   
  ../renderer/tr_font.c    
  ../renderer/tr_image.c    
  ../renderer/tr_init.c     
  ../renderer/tr_light.c   
  ../renderer/tr_main.c    
  ../renderer/tr_marks.c    
  ../renderer/tr_mesh.c    
  ../renderer/tr_model.c    
  ../renderer/tr_noise.c    
  ../renderer/tr_scene.c    
  ../renderer/tr_shade.c    
  ../renderer/tr_shade_calc.c   
  ../renderer/tr_shader.c    
  ../renderer/tr_shadows.c    
  ../renderer/tr_sky.c    
  ../renderer/tr_surface.c   
  ../renderer/tr_world.c    
  );
$RENDERER_REF = \@RENDERER_FILES;  

@CLIENT_FILES = qw(
  ../client/cl_cgame.c   
  ../client/cl_cin.c       
  ../client/cl_console.c  
  ../client/cl_input.c   
  ../client/cl_keys.c     
  ../client/cl_main.c     
  ../client/cl_net_chan.c  
  ../client/cl_parse.c   
  ../client/cl_scrn.c    
  ../client/cl_ui.c         
  );
$CLIENT_REF = \@CLIENT_FILES;

@COMMON_FILES = qw(
  ../qcommon/cm_load.c        
  ../qcommon/cm_patch.c       
  ../qcommon/cm_polylib.c     
  ../qcommon/cm_test.c        
  ../qcommon/cm_trace.c       
  ../qcommon/cmd.c                   
  ../qcommon/common.c               
  ../qcommon/cvar.c                
  ../qcommon/files.c              
  ../qcommon/md4.c                   
  ../qcommon/msg.c                    
  ../qcommon/net_chan.c
  ../qcommon/huffman.c
  ../qcommon/unzip.c
  );
$COMMON_REF = \@COMMON_FILES;  

@SOUND_FILES = qw(
  ../client/snd_adpcm.c
  ../client/snd_dma.c
  ../client/snd_mem.c
  ../client/snd_mix.c
  ../client/snd_wavelet.c
  );
$SOUND_REF = \@SOUND_FILES;

@UNIX_FILES = qw(
  ../unix/unix_main.c 
  ../unix/unix_net.c 
  ../unix/unix_shared.c 
  ../unix/linux_common.c
  ../unix/linux_qgl.c   
  ../unix/linux_glimp.c   
  ../unix/linux_joystick.c  
  ../unix/linux_snd.c 
	../unix/linux_signals.c
  );
$UNIX_REF = \@UNIX_FILES;

@SERVER_FILES = qw(
  ../server/sv_bot.c
  ../server/sv_ccmds.c
  ../server/sv_client.c
  ../server/sv_game.c
  ../server/sv_init.c
  ../server/sv_main.c
  ../server/sv_net_chan.c
  ../server/sv_snapshot.c
  ../server/sv_world.c
  );
$SERVER_REF = \@SERVER_FILES;

# FIXME TTimo vm_<cpu>.c
@VM_FILES = qw(
  ../qcommon/vm.c
  ../qcommon/vm_x86.c
  ../qcommon/vm_interpreted.c
  );
$VM_REF = \@VM_FILES;

# FIXME: import the CPU string to build the name of the target
Program $env $TARGETNAME, '../game/q_shared.c', '../game/q_math.c',
  @$RENDERER_REF, @$CLIENT_REF, @$COMMON_REF, @$SOUND_REF,
  @$UNIX_REF, @$SERVER_REF, @$VM_REF;
Install $env $INSTALL_DIR, $TARGETNAME;