mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-13 21:51:09 +00:00
* Removed cons based build system
* Removed some id specific shell/perl scripts * Removed some unused asm files * Removed prehistoric RPM build rules
This commit is contained in:
parent
2897abe618
commit
e66a28dfeb
16 changed files with 0 additions and 8863 deletions
431
code/Construct
431
code/Construct
|
@ -1,431 +0,0 @@
|
|||
# -*- mode: perl -*-
|
||||
# cons script for cgame game q3_ui ui .so and .qvm builds
|
||||
#
|
||||
# Oct. 2001 TTimo <ttimo@idsoftware.com>
|
||||
#
|
||||
|
||||
# the top directory is
|
||||
# <config>-<cpu>-<OS>-<libc version>
|
||||
# where:
|
||||
# <config> is "debug" or "release"
|
||||
# <cpu> is "x86" or "ppc"
|
||||
# <OS> is "Linux" "BSD" "IRIX" etc.
|
||||
# <libc version> is major.minor of libc config
|
||||
|
||||
# source the compiler version utility
|
||||
BEGIN {
|
||||
push @INC, './unix';
|
||||
}
|
||||
use Cons_gcc;
|
||||
|
||||
# defaults
|
||||
$config = 'debug';
|
||||
$do_smp = 1;
|
||||
$do_masterserver = 0;
|
||||
$do_authserver = 0;
|
||||
$do_authport = 0;
|
||||
$do_setup = 0;
|
||||
$do_bspc = 0;
|
||||
$do_sdk = 0;
|
||||
$do_pk3 = 0;
|
||||
# those are exported
|
||||
$DO_WIN32 = 0;
|
||||
$NO_VM = 0;
|
||||
$NO_SO = 0;
|
||||
$CC='gcc';
|
||||
$CXX='g++';
|
||||
|
||||
# detect an sdk build (don't attempt client build and other things)
|
||||
if ( -r 'unix/Conscript-client' )
|
||||
{
|
||||
$no_core = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$no_core = 1;
|
||||
}
|
||||
|
||||
# detection of CPU type
|
||||
$cpu = `uname -m`;
|
||||
chop ($cpu);
|
||||
if ($cpu =~ /i.86/)
|
||||
{
|
||||
$cpu = 'i386';
|
||||
}
|
||||
# OS
|
||||
$OS = `uname`;
|
||||
chop ($OS);
|
||||
# hacky win32 detection and win32 specifics code
|
||||
if ($OS =~ CYGWIN)
|
||||
{
|
||||
$DO_WIN32 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
# libc .. do the little magic!
|
||||
$libc_cmd = '/lib/libc.so.6 |grep "GNU C "|grep version|awk -F "version " \'{ print $2 }\'|cut -b -3';
|
||||
$libc = `$libc_cmd`;
|
||||
chop ($libc);
|
||||
}
|
||||
|
||||
if ($DO_WIN32 eq 1)
|
||||
{
|
||||
print("Win32 build\n");
|
||||
|
||||
$config = $ARGV[0];
|
||||
|
||||
# TODO: option to override $Q3BASE from command line
|
||||
$Q3BASE = $ENV{Q3BASE}; # FIXME: this doesn't play nice with cygwin path syntax
|
||||
print("\$Q3BASE: $Q3BASE\n");
|
||||
|
||||
if($config eq 'debug')
|
||||
{
|
||||
$DIR = 'Debug';
|
||||
system("cp -v $DIR/quake3.exe \$Q3BASE");
|
||||
system("cp -v $DIR/cgamex86.dll $DIR/qagamex86.dll $DIR/uix86.dll \$Q3BASE/baseq3");
|
||||
}
|
||||
elsif ($config eq 'debug-TA')
|
||||
{
|
||||
$DIR = 'Debug_TA';
|
||||
system("cp -v $DIR/quake3.exe \$Q3BASE");
|
||||
system("cp -v $DIR/cgamex86.dll $DIR/qagamex86.dll $DIR/uix86.dll \$Q3BASE/missionpack");
|
||||
}
|
||||
elsif($config eq 'release-TA')
|
||||
{
|
||||
$DIR = 'Release_TA';
|
||||
# spank!
|
||||
system("./spank.sh");
|
||||
system("cp -v $DIR/quake3.exe \$Q3BASE");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("ERROR: no config option (debug debug-TA release-TA)");
|
||||
exit;
|
||||
}
|
||||
|
||||
# copy selected stuff to shared media
|
||||
$DESTDIR='/cygdrive/e/incoming/Id/q3-1.32';
|
||||
system("cp -v $DIR/quake3.exe $DESTDIR");
|
||||
system("cp -v /cygdrive/e/Q3SetupMedia/quake3/CHANGES-1.32.txt $DESTDIR");
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if(@ARGV gt 0)
|
||||
{
|
||||
foreach $cmdopt (@ARGV)
|
||||
{
|
||||
if(lc($cmdopt) eq 'release')
|
||||
{
|
||||
$config = 'release';
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) eq 'debug')
|
||||
{
|
||||
$config = 'debug';
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) eq 'novm')
|
||||
{
|
||||
$NO_VM = 1;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) eq 'noso')
|
||||
{
|
||||
$NO_SO = 1;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) eq 'nosmp')
|
||||
{
|
||||
$do_smp = 0;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'master_server=.*')
|
||||
{
|
||||
$do_masterserver = 1;
|
||||
$master_server = lc($cmdopt);
|
||||
$master_server =~ s/master_server=(.*)/\1/;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'auth_server=.*')
|
||||
{
|
||||
$do_authserver = 1;
|
||||
$auth_server = lc($cmdopt);
|
||||
$auth_server =~ s/auth_server=(.*)/\1/;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'auth_port=.*')
|
||||
{
|
||||
$do_authport = 1;
|
||||
$auth_port = lc($cmdopt);
|
||||
$auth_port =~ s/auth_port=(.*)/\1/;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'setup')
|
||||
{
|
||||
$do_setup = 1;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'bspc')
|
||||
{
|
||||
$do_bspc = 1;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'sdk')
|
||||
{
|
||||
$do_sdk = 1;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'pk3')
|
||||
{
|
||||
$do_pk3 = 1;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'gcc=.*')
|
||||
{
|
||||
$CC=lc($cmdopt);
|
||||
$CC =~ s/gcc=(.*)/\1/;
|
||||
next;
|
||||
}
|
||||
elsif(lc($cmdopt) =~ 'g\+\+=.*')
|
||||
{
|
||||
$CXX=lc($cmdopt);
|
||||
$CXX=~s/g\+\+=(.*)/\1/;
|
||||
next;
|
||||
}
|
||||
else
|
||||
{
|
||||
# output an error & exit
|
||||
print("Error\n $0: Unknown command line option: [ $cmdopt ]\n");
|
||||
system("cons -h");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($do_setup eq 1) && ($config ne 'release'))
|
||||
{
|
||||
print("Error\n $0: 'setup' requires 'release'\n");
|
||||
exit;
|
||||
}
|
||||
|
||||
# sdk
|
||||
if ($do_sdk eq 1)
|
||||
{
|
||||
# extract the Q3 version from q_shared.h
|
||||
$line = `cat game/q_shared.h | grep Q3_VERSION`;
|
||||
chomp $line;
|
||||
$line =~ s/.*Q3\ (.*)\"/$1/;
|
||||
$Q3_VER = $line;
|
||||
$SDK_NAME = "linuxq3a-sdk-$Q3_VER.x86.run";
|
||||
Default "unix/$SDK_NAME";
|
||||
Export qw( SDK_NAME Q3_VER );
|
||||
Build 'unix/Conscript-sdk';
|
||||
return;
|
||||
}
|
||||
|
||||
# build the config directory
|
||||
$CONFIG_DIR = $config . '-' . $cpu . '-' . $OS . '-' . $libc;
|
||||
|
||||
$COMMON_CFLAGS = '-pipe ';
|
||||
|
||||
if ($config eq 'debug')
|
||||
{
|
||||
# use -Werror for better QA
|
||||
$BASE_CFLAGS = $COMMON_CFLAGS . '-g -Wall -O0 ';
|
||||
$BSPC_BASE_CFLAGS = $COMMON_CFLAGS . '-g -O0 -DLINUX -DBSPC -Dstricmp=strcasecmp ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$BASE_CFLAGS = $COMMON_CFLAGS . '-DNDEBUG -O3 -march=i686 -fomit-frame-pointer -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce ';
|
||||
$BSPC_BASE_CFLAGS = $BASE_CFLAGS . '-DLINUX -DBSPC -Dstricmp=strcasecmp ';
|
||||
}
|
||||
|
||||
if ($do_masterserver eq 1)
|
||||
{
|
||||
$BASE_CFLAGS .= "-DMASTER_SERVER_NAME=\\\"$master_server\\\" ";
|
||||
}
|
||||
|
||||
if ($do_authserver eq 1)
|
||||
{
|
||||
$BASE_CFLAGS .= "-DAUTHORIZE_SERVER_NAME=\\\"$auth_server\\\" ";
|
||||
}
|
||||
|
||||
if ($do_authport eq 1)
|
||||
{
|
||||
$BASE_CFLAGS .= "-DPORT_AUTHORIZE=$auth_port ";
|
||||
}
|
||||
|
||||
my @gcc_version = Cons_gcc::get_gcc_version($CC);
|
||||
print("GCC version: $gcc_version[1] - $gcc_version[2]\n");
|
||||
# with 2.95 you can link with gcc, this avoids nasty useless libstdc++ dependency
|
||||
if ($gcc_version[0] eq '2')
|
||||
{
|
||||
$LINK = $CC;
|
||||
} else {
|
||||
$LINK = $CXX;
|
||||
}
|
||||
|
||||
my @ccache = Cons_gcc::get_ccache();
|
||||
if ($ccache[0] eq '1')
|
||||
{
|
||||
$CC = $ccache[1] . " " . $CC;
|
||||
$CXX = $ccache[1] . " " . $CXX;
|
||||
}
|
||||
|
||||
print 'cpu : ' . $cpu . "\nOS : " . $OS . "\n";
|
||||
print "libc: " . $libc . "\n";
|
||||
print "configured for " . $config . " build\n";
|
||||
print 'CFLAGS: ' . $BASE_CFLAGS . "\n";
|
||||
|
||||
# install config
|
||||
$INSTALL_BASEDIR='#install';
|
||||
|
||||
Default $INSTALL_BASEDIR;
|
||||
|
||||
sub build_tools {
|
||||
system("mkdir qvmtools 2>/dev/null");
|
||||
if (@_[0] eq 'q3lcc')
|
||||
{
|
||||
system("cd ../lcc && mkdir -p .obj && make all && cp .obj/q3lcc ../code/qvmtools/q3lcc && cp .obj/q3rcc ../code/qvmtools/q3rcc && cp .obj/q3cpp ../code/qvmtools/q3cpp");
|
||||
}
|
||||
elsif (@_[0] eq 'q3asm')
|
||||
{
|
||||
system("cd ../q3asm && make && cp q3asm ../code/qvmtools");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("build_tools: @_[0] unrecognized command\n");
|
||||
die;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
# build tools
|
||||
$env_tools = new cons();
|
||||
Command $env_tools 'qvmtools/q3lcc', '[perl] &build_tools(\'q3lcc\')';
|
||||
Command $env_tools 'qvmtools/q3asm', '[perl] &build_tools(\'q3asm\')';
|
||||
|
||||
if ($do_bspc eq 1)
|
||||
{
|
||||
# build bspc
|
||||
$BUILD_DIR = $CONFIG_DIR . '/bspc';
|
||||
Link $BUILD_DIR => '.';
|
||||
$INSTALL_DIR = $INSTALL_BASEDIR . '/utils';
|
||||
Export qw( BSPC_BASE_CFLAGS BUILD_DIR INSTALL_DIR CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/bspc/Conscript';
|
||||
}
|
||||
|
||||
# build vanilla Q3
|
||||
$TARGET_DIR='Q3';
|
||||
|
||||
$INSTALL_DIR = $INSTALL_BASEDIR . '/baseq3';
|
||||
|
||||
$BUILD_DIR = $CONFIG_DIR . '/' . $TARGET_DIR . '/cgame';
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/cgame/Conscript';
|
||||
|
||||
$BUILD_DIR = $CONFIG_DIR . '/' . $TARGET_DIR . '/game';
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/game/Conscript';
|
||||
|
||||
$BUILD_DIR = $CONFIG_DIR . '/' . $TARGET_DIR . '/q3_ui';
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/q3_ui/Conscript';
|
||||
|
||||
# build TA
|
||||
$TARGET_DIR='TA';
|
||||
|
||||
$INSTALL_DIR = $INSTALL_BASEDIR . '/missionpack';
|
||||
|
||||
$BUILD_DIR = $CONFIG_DIR . "/" . $TARGET_DIR . '/cgame';
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/cgame/Conscript';
|
||||
|
||||
$BUILD_DIR = $CONFIG_DIR . "/" . $TARGET_DIR . '/game';
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/game/Conscript';
|
||||
|
||||
$BUILD_DIR = $CONFIG_DIR . '/' . $TARGET_DIR . '/ui';
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/ui/Conscript';
|
||||
|
||||
# core
|
||||
if ($no_core eq 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$INSTALL_DIR = $INSTALL_BASEDIR;
|
||||
$BUILD_DIR = $CONFIG_DIR . '/core/dedicated';
|
||||
Link $BUILD_DIR => '.';
|
||||
$hack = $BASE_CFLAGS; # hit me!
|
||||
$BASE_CFLAGS .= '-DDEDICATED ';
|
||||
Export qw( BASE_CFLAGS BUILD_DIR INSTALL_DIR CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/unix/Conscript-dedicated';
|
||||
$BASE_CFLAGS = $hack;
|
||||
|
||||
|
||||
|
||||
$TARGETNAME = 'linuxquake3';
|
||||
$BUILD_DIR = $CONFIG_DIR . '/core/client';
|
||||
$BASE_LDFLAGS = '';
|
||||
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS BASE_LDFLAGS BUILD_DIR INSTALL_DIR TARGETNAME CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/unix/Conscript-client';
|
||||
|
||||
if ($do_smp eq 1)
|
||||
{
|
||||
$TARGETNAME = 'linuxquake3-smp';
|
||||
$BUILD_DIR = $CONFIG_DIR . '/core/client-smp';
|
||||
$BASE_CFLAGS .= '-DSMP ';
|
||||
$BASE_LDFLAGS = '-lpthread ';
|
||||
|
||||
Link $BUILD_DIR => '.';
|
||||
Export qw( BASE_CFLAGS BASE_LDFLAGS BUILD_DIR INSTALL_DIR TARGETNAME CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/unix/Conscript-client';
|
||||
}
|
||||
|
||||
if ($NO_VM eq 0 && $do_pk3 eq 1)
|
||||
{
|
||||
# build the PK3s
|
||||
$INSTALL_DIR = $INSTALL_BASEDIR;
|
||||
$BUILD_DIR = $CONFIG_DIR . '/pk3-builder';
|
||||
Link $BUILD_DIR => 'unix';
|
||||
Export qw( INSTALL_DIR BUILD_DIR CONFIG_DIR CC CXX LINK cpu );
|
||||
Build $BUILD_DIR . '/Conscript-pk3';
|
||||
}
|
||||
|
||||
if ($do_setup eq 1)
|
||||
{
|
||||
Link $CONFIG_DIR => '.';
|
||||
Export qw( INSTALL_BASEDIR );
|
||||
Build $CONFIG_DIR . '/unix/Conscript-setup';
|
||||
}
|
||||
|
||||
Help
|
||||
"
|
||||
Usage: cons [-h] [ -- [release|debug] [novm] [noso] [nosmp] [master_server=<adr>] [auth_server=<adr>] [auth_port=<port>] [pk3] [bspc] [setup] [sdk]]
|
||||
Default build type is Debug, specifying '-- release' on the
|
||||
command line builds a Release version (NOTE that this option
|
||||
only affects the native libraries).
|
||||
|
||||
novm: will not build the VMs
|
||||
noso: will not build the so
|
||||
|
||||
below are for core builds only:
|
||||
|
||||
nosmp : do not build the SMP-enabled version of the renderer
|
||||
pk3 : generate the pk3s on the fly (defined in unix/Conscript-pk3)
|
||||
bspc : build bspc
|
||||
setup : build setup
|
||||
sdk : build the mod sdk
|
||||
"
|
||||
;
|
|
@ -1,47 +0,0 @@
|
|||
#
|
||||
# Some utilities to handle gcc compiler setup
|
||||
#
|
||||
|
||||
package Cons_gcc;
|
||||
|
||||
# pass the compiler name
|
||||
# returns an array, first element is 2 for 2.x 3 for 3.x, then full version, then machine info
|
||||
sub get_gcc_version
|
||||
{
|
||||
my @ret;
|
||||
my ($CC) = @_;
|
||||
my $version=`$CC --version | head -n 1`;
|
||||
chop($version);
|
||||
my $machine=`$CC -dumpmachine`;
|
||||
chop($machine);
|
||||
if($version =~ '2\.[0-9]*\.[0-9]*')
|
||||
{
|
||||
push @ret, '2';
|
||||
} else {
|
||||
push @ret, '3';
|
||||
}
|
||||
push @ret, $version;
|
||||
push @ret, $machine;
|
||||
return @ret;
|
||||
}
|
||||
|
||||
# http://ccache.samba.org/
|
||||
# check ccache existence and path
|
||||
# returns an array, first element 0 / 1, then path
|
||||
sub get_ccache
|
||||
{
|
||||
my @ret;
|
||||
$ccache_path=`which ccache`;
|
||||
chop($ccache_path);
|
||||
if(-x $ccache_path)
|
||||
{
|
||||
push @ret, '1';
|
||||
push @ret, $ccache_path;
|
||||
return @ret;
|
||||
}
|
||||
push @ret, '0';
|
||||
return @ret;
|
||||
}
|
||||
|
||||
# close package
|
||||
1;
|
|
@ -1,283 +0,0 @@
|
|||
# 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/lib64 -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_interpreted.c
|
||||
);
|
||||
|
||||
if ($cpu eq 'i386')
|
||||
{
|
||||
push @VM_FILES, qw(
|
||||
../qcommon/vm_x86.c
|
||||
);
|
||||
}
|
||||
elsif ($cpu eq 'ppc')
|
||||
{
|
||||
push @VM_FILES, qw(
|
||||
../qcommon/vm_ppc.c
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
push @VM_FILES, qw(
|
||||
../qcommon/vm_none.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;
|
|
@ -1,134 +0,0 @@
|
|||
# dedicated server build script
|
||||
|
||||
Import qw( BASE_CFLAGS BUILD_DIR INSTALL_DIR CC CXX LINK );
|
||||
|
||||
$DEDICATED_NAME = 'linuxq3ded';
|
||||
|
||||
$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;
|
||||
|
||||
# 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';
|
||||
|
||||
$env = new cons(
|
||||
CC => $CC,
|
||||
CXX => $CXX,
|
||||
LINK => $LINK,
|
||||
ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} },
|
||||
# FIXME TTimo I'm not sure about what C_ONLY is for
|
||||
CFLAGS => $BASE_CFLAGS . '-DC_ONLY',
|
||||
LDFLAGS => '-ldl -lm',
|
||||
LIBS => ' '
|
||||
. $BUILD_DIR . '/unix/botlib.a '
|
||||
. $BUILD_DIR . '/unix/asmlib.a '
|
||||
);
|
||||
|
||||
# list the files for the dedicated server
|
||||
@FILES = qw(
|
||||
../null/null_client.c
|
||||
../null/null_input.c
|
||||
../null/null_snddma.c
|
||||
../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
|
||||
../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/huffman.c
|
||||
../qcommon/md4.c
|
||||
../qcommon/msg.c
|
||||
../qcommon/net_chan.c
|
||||
../qcommon/unzip.c
|
||||
../qcommon/vm.c
|
||||
../qcommon/vm_interpreted.c
|
||||
../game/q_math.c
|
||||
../game/q_shared.c
|
||||
../unix/linux_common.c
|
||||
../unix/unix_main.c
|
||||
../unix/unix_net.c
|
||||
../unix/unix_shared.c
|
||||
../unix/linux_signals.c
|
||||
);
|
||||
$FILESREF = \@FILES;
|
||||
|
||||
if ($cpu eq 'i386')
|
||||
{
|
||||
push @FILES, qw(
|
||||
../qcommon/vm_x86.c
|
||||
);
|
||||
}
|
||||
elsif ($cpu eq 'ppc')
|
||||
{
|
||||
push @FILES, qw(
|
||||
../qcommon/vm_ppc.c
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
push @FILES, qw(
|
||||
../qcommon/vm_none.c
|
||||
);
|
||||
}
|
||||
|
||||
# DEDICATED_NAME is imported, holds the name of the target
|
||||
# wolfded.x86 usually
|
||||
Program $env $DEDICATED_NAME, @$FILESREF;
|
||||
Install $env $INSTALL_DIR, $DEDICATED_NAME;
|
|
@ -1,135 +0,0 @@
|
|||
# build pk3 on the fly
|
||||
|
||||
Import qw( INSTALL_DIR BUILD_DIR CONFIG_DIR CC CXX LINK );
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
$env = new cons(); # the env on which we will be working for all pk3s (NOTE: maybe we need several ctually)
|
||||
|
||||
$hcf_do_exec = 1;
|
||||
sub do_command($)
|
||||
{
|
||||
printf("@_[0]\n");
|
||||
if ($hcf_do_exec)
|
||||
{
|
||||
system("@_[0]");
|
||||
}
|
||||
}
|
||||
|
||||
sub build_pk3 {
|
||||
|
||||
sub launch {
|
||||
#print "In launch\n";
|
||||
$Data::Dumper::Indent = 2;
|
||||
#print Dumper(@_);
|
||||
$tmpdir = "/tmp/pk3-builder$$";
|
||||
do_command("rm -rf $tmpdir");
|
||||
|
||||
($target, $sets) = @_;
|
||||
$base=`basename $target`; chomp($base);
|
||||
$dirname=`dirname $target`; chomp($dirname);
|
||||
|
||||
foreach (@{$sets})
|
||||
{
|
||||
($sourcepath, $destpath, $file) = @{$_};
|
||||
#print "source: $sourcepath dest: $destpath file: $file\n";
|
||||
do_command("mkdir -p $tmpdir/$destpath");
|
||||
if ($sourcepath =~ /#.*/)
|
||||
{
|
||||
#print "$sourcepath is absolute\n";
|
||||
$sourcepath =~ s/#//;
|
||||
if (ref($file))
|
||||
{
|
||||
foreach(@{$file})
|
||||
{
|
||||
do_command("cp $sourcepath/$_ $tmpdir/$destpath/$_");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do_command("cp $sourcepath/$file $tmpdir/$destpath/$file");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#print "$sourcepath in linked dir\n";
|
||||
if (ref($file))
|
||||
{
|
||||
foreach(@{$file})
|
||||
{
|
||||
do_command("cp $BUILD_DIR/$sourcepath/$_ $tmpdir/$destpath/$_");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do_command("cp $BUILD_DIR/$sourcepath/$file $tmpdir/$destpath/$file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do_command("cd $tmpdir ; zip -r $base *");
|
||||
do_command("mkdir -p $BUILD_DIR/$dirname");
|
||||
do_command("cp $tmpdir/$base $BUILD_DIR/$target");
|
||||
do_command("rm -rf $tmpdir");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# extract the parameters
|
||||
($target, $sets) = @_;
|
||||
|
||||
$base=`basename $target`; chomp($base);
|
||||
$dirname=`dirname $target`; chomp($dirname);
|
||||
|
||||
# the build command is stored and called later on by cons
|
||||
# this makes it impossible to have several build_pk3 working together
|
||||
# there is probably a cleaner solution than this hack, but this works
|
||||
$target_uniquename="target_$base";
|
||||
$target_uniquename=~s/\.//g;
|
||||
eval("\$$target_uniquename=\$target");
|
||||
$sets_uniquename="sets_$base";
|
||||
$sets_uniquename=~s/\.//g;
|
||||
eval("\$$sets_uniquename=\$sets");
|
||||
#print "name: $target_uniquename after the hack: $target_pak8pk3";
|
||||
|
||||
# don't pass @{@_} .. since this will be called during the process
|
||||
$command = "[perl] &launch( \$$target_uniquename, [ \@{\$$sets_uniquename} ] )";
|
||||
#print "$command\n";
|
||||
|
||||
foreach(@{$sets})
|
||||
{
|
||||
($sourcepath, $destpath, $file) = @{$_};
|
||||
if (ref($file))
|
||||
{
|
||||
foreach(@{$file})
|
||||
{
|
||||
Depends $env $target, $sourcepath . '/' . $_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Depends $env $target, $sourcepath . '/' . $file;
|
||||
}
|
||||
}
|
||||
Command $env $target, $command;
|
||||
Install $env $INSTALL_DIR . "/$dirname", $target;
|
||||
}
|
||||
|
||||
# quick rundown on the syntax:
|
||||
# <target file>, [ <fileset1>, <fileset2>, ... ]
|
||||
# where <fileset>: [ <source directory>, <directory in zip>, <file1>, <file2>, .. ]
|
||||
|
||||
build_pk3('baseq3/pak8.pk3',
|
||||
[ [ '#../../../media/Q3Media-1.32/baseq3/menu/art', 'menu/art', 'pblogo.tga' ],
|
||||
[ '../Q3/q3_ui/q3_ui', 'vm', 'ui.qvm' ],
|
||||
[ '../Q3/cgame/cgame', 'vm', 'cgame.qvm' ],
|
||||
[ '../Q3/game/game', 'vm', 'qagame.qvm' ] ]
|
||||
);
|
||||
|
||||
build_pk3('missionpack/pak3.pk3',
|
||||
[ [ '#../ui', 'ui', [ 'createserver.menu', 'joinserver.menu', 'filter.menu', 'punkbuster.menu', 'menus.txt' ] ],
|
||||
[ '../TA/ui/ui', 'vm', 'ui.qvm' ],
|
||||
[ '../TA/cgame/cgame', 'vm', 'cgame.qvm' ],
|
||||
[ '../TA/game/game', 'vm', 'qagame.qvm' ],
|
||||
[ '#../../../media/Q3Media-1.32/missionpack/scripts', 'scripts', 'models2.shader' ] ]
|
||||
);
|
|
@ -1,122 +0,0 @@
|
|||
# sdk
|
||||
|
||||
Import qw( SDK_NAME Q3_VER CC CXX LINK );
|
||||
|
||||
# http://www.devdaily.com/perl/edu/articles/pl010005/pl010005.shtml
|
||||
#----------------------------( promptUser )-----------------------------#
|
||||
# #
|
||||
# FUNCTION: promptUser #
|
||||
# #
|
||||
# PURPOSE: Prompt the user for some type of input, and return the #
|
||||
# input back to the calling program. #
|
||||
# #
|
||||
# ARGS: $promptString - what you want to prompt the user with #
|
||||
# $defaultValue - (optional) a default value for the prompt #
|
||||
# #
|
||||
#-------------------------------------------------------------------------#
|
||||
|
||||
sub promptUser {
|
||||
|
||||
#-------------------------------------------------------------------#
|
||||
# two possible input arguments - $promptString, and $defaultValue #
|
||||
# make the input arguments local variables. #
|
||||
#-------------------------------------------------------------------#
|
||||
|
||||
local($promptString,$defaultValue) = @_;
|
||||
|
||||
#-------------------------------------------------------------------#
|
||||
# if there is a default value, use the first print statement; if #
|
||||
# no default is provided, print the second string. #
|
||||
#-------------------------------------------------------------------#
|
||||
|
||||
if ($defaultValue) {
|
||||
print $promptString, "[", $defaultValue, "]: ";
|
||||
} else {
|
||||
print $promptString, ": ";
|
||||
}
|
||||
|
||||
$| = 1; # force a flush after our print
|
||||
$_ = <STDIN>; # get the input from STDIN (presumably the keyboard)
|
||||
|
||||
|
||||
#------------------------------------------------------------------#
|
||||
# remove the newline character from the end of the input the user #
|
||||
# gave us. #
|
||||
#------------------------------------------------------------------#
|
||||
|
||||
chomp;
|
||||
|
||||
#-----------------------------------------------------------------#
|
||||
# if we had a $default value, and the user gave us input, then #
|
||||
# return the input; if we had a default, and they gave us no #
|
||||
# no input, return the $defaultValue. #
|
||||
# #
|
||||
# if we did not have a default value, then just return whatever #
|
||||
# the user gave us. if they just hit the <enter> key, #
|
||||
# the calling routine will have to deal with that. #
|
||||
#-----------------------------------------------------------------#
|
||||
|
||||
if ("$defaultValue") {
|
||||
return $_ ? $_ : $defaultValue; # return $_ if it has a value
|
||||
} else {
|
||||
return $_;
|
||||
}
|
||||
}
|
||||
|
||||
sub launch {
|
||||
|
||||
print("Building MOD SDK (version $Q3_VER)\n");
|
||||
print("Before building the mod sdk, your CVS tree must be completely clean!\nIf there are some temporary files and binaries in the tree, they can get included in the distribution and cause problems.\n");
|
||||
$ok = &promptUser("Ready to build mod sdk [y/n]? ");
|
||||
if ($ok ne 'y')
|
||||
{
|
||||
print("aborting\n");
|
||||
return 0;
|
||||
}
|
||||
# create the dirs:
|
||||
$RAW_DATA = "mod-sdk-$Q3_VER";
|
||||
system("rm -rf $RAW_DATA ; mkdir -p $RAW_DATA/code");
|
||||
# actual code
|
||||
system("cp -R cgame game q3_ui ui $RAW_DATA/code");
|
||||
# UI stuff
|
||||
system("cp -R ../ui $RAW_DATA");
|
||||
# tools
|
||||
system("cp -R ../lcc ../q3asm $RAW_DATA");
|
||||
# build scripts
|
||||
system("cp Construct $RAW_DATA/code");
|
||||
system("mkdir $RAW_DATA/code/unix ; cp unix/cons unix/pcons-2.3.1 unix/Conscript-pk3 $RAW_DATA/code/unix");
|
||||
system("cp unix/mod-sdk-data/Makefile $RAW_DATA/code/");
|
||||
# cleanup some stuff
|
||||
system("find $RAW_DATA -name CVS -exec rm -rf {} \\; 2>/dev/null");
|
||||
# test that the build works just fine
|
||||
$host=`hostname`; chomp($host);
|
||||
if ($host ne 'antares')
|
||||
{
|
||||
system("rm -rf /tmp/$RAW_DATA ; cp -R $RAW_DATA /tmp");
|
||||
system("cd /tmp/$RAW_DATA/code ; make");
|
||||
if ($? ne 0)
|
||||
{
|
||||
printf("ERROR: test build failed\n");
|
||||
return 0;
|
||||
}
|
||||
printf("build test successful\n");
|
||||
}
|
||||
# make a setup out of this
|
||||
system("cp -R unix/setup/setup.sh unix/setup/setup.data $RAW_DATA");
|
||||
# TODO: splash!
|
||||
system("cp unix/mod-sdk-data/setup.xml unix/mod-sdk-data/config.sh unix/mod-sdk-data/postinstall.sh $RAW_DATA/setup.data");
|
||||
# mod-sdk-data/Q3A_EULA.txt is a copy of stuff that is usually in $Q3SETUPMEDIA .. can't be arsed
|
||||
system("cp unix/mod-sdk-data/Q3A_EULA.txt $RAW_DATA");
|
||||
# I love those dirty hacks
|
||||
system("cd $RAW_DATA/setup.data/bin ; ln -s Linux FreeBSD ; ln -s Linux OpenBSD ; ln -s Linux NetBSD");
|
||||
# cleanup some stuff
|
||||
system("find $RAW_DATA -name CVS -exec rm -rf {} \\; 2>/dev/null");
|
||||
# weeee
|
||||
system("unix/mod-sdk-data/makeself/makeself.sh $RAW_DATA $SDK_NAME \"Quake III Arena mod SDK\" ./setup.sh $Q3_VER");
|
||||
return 1;
|
||||
}
|
||||
|
||||
print("in Conscript-sdk\n");
|
||||
|
||||
$env = new cons();
|
||||
Command $env "$SDK_NAME", "[perl] &launch()";
|
|
@ -1,33 +0,0 @@
|
|||
# setup
|
||||
|
||||
Import qw( INSTALL_BASEDIR );
|
||||
|
||||
$env = new cons(
|
||||
# add this path so setup script finds brandelf
|
||||
ENV => { PATH => $ENV{PATH} . ":" . $ENV{HOME} . "./usr/bin", },
|
||||
);
|
||||
|
||||
sub launch {
|
||||
# need to get the correct version (i.e. from SP source)
|
||||
$version = `cat game/q_shared.h | grep Q3_VERSION`;
|
||||
chomp $version;
|
||||
$version =~ s/.*Q3\ (.*)\"/$1/;
|
||||
print("version: $version\n");
|
||||
system("cd unix ; ./build_setup.sh $version");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# no dependency to PB, we get it directly from the tree and not in install/
|
||||
Depends $env "$INSTALL_BASEDIR/foo",
|
||||
"$INSTALL_BASEDIR/linuxq3ded",
|
||||
"$INSTALL_BASEDIR/linuxquake3-smp",
|
||||
"$INSTALL_BASEDIR/linuxquake3";
|
||||
# during developement phase, we generate and copy the pk3 on the fly
|
||||
# then those should move to the media tree
|
||||
# those have been finalized and moved to the media tree
|
||||
# "$INSTALL_BASEDIR/baseq3/pak8.pk3",
|
||||
# "$INSTALL_BASEDIR/missionpack/pak3.pk3";
|
||||
|
||||
|
||||
Command $env "$INSTALL_BASEDIR/foo", "[perl] &launch()";
|
|
@ -1528,64 +1528,6 @@ $(B)/missionpack/ui/bg_lib.o : $(GDIR)/bg_lib.c; $(DO_SHLIB_CC) -DMISSIONPACK
|
|||
$(B)/missionpack/ui/q_math.o : $(GDIR)/q_math.c; $(DO_SHLIB_CC) -DMISSIONPACK
|
||||
$(B)/missionpack/ui/q_shared.o : $(GDIR)/q_shared.c; $(DO_SHLIB_CC) -DMISSIONPACK
|
||||
|
||||
|
||||
#############################################################################
|
||||
# RPM
|
||||
#############################################################################
|
||||
|
||||
TMPDIR=/var/tmp
|
||||
TARDIR=$(TMPDIR)/$(BUILD_NAME)
|
||||
TARFILE = $(BUILD_NAME)-$(VERSION)-$(RPM_RELEASE).$(ARCH).tar
|
||||
|
||||
tar:
|
||||
if [ ! -d archives ];then mkdir archives;chmod 755 archives;fi
|
||||
$(MAKE) copyfiles COPYDIR=$(TARDIR)
|
||||
cd $(TARDIR); tar cvf $(TARFILE) * && gzip -9 $(TARFILE)
|
||||
mv $(TARDIR)/$(TARFILE).gz archives/.
|
||||
rm -rf $(TARDIR)
|
||||
|
||||
# Make RPMs. You need to be root to make this work
|
||||
RPMROOT=/usr/src/redhat
|
||||
RPM = rpm
|
||||
RPMFLAGS = -bb
|
||||
INSTALLDIR = /usr/local/games/$(BUILD_NAME)
|
||||
RPMDIR = $(TMPDIR)/$(BUILD_NAME)-$(VERSION)
|
||||
DESTDIR= $(RPMDIR)/$(INSTALLDIR)
|
||||
|
||||
rpm: $(BUILD_NAME).spec
|
||||
touch $(RPMROOT)/SOURCES/$(BUILD_NAME)-$(VERSION).tar.gz
|
||||
if [ ! -d archives ];then mkdir archives;fi
|
||||
$(MAKE) copyfiles COPYDIR=$(DESTDIR)
|
||||
cp $(UDIR)/quake3.gif $(RPMROOT)/SOURCES/.
|
||||
cp $(BUILD_NAME).spec $(RPMROOT)/SPECS/.
|
||||
cd $(RPMROOT)/SPECS; $(RPM) $(RPMFLAGS) $(BUILD_NAME).spec
|
||||
rm -rf $(RPMDIR)
|
||||
mv $(RPMROOT)/RPMS/$(RPMARCH)/$(BUILD_NAME)-$(VERSION)-$(RPM_RELEASE).$(RPMARCH).rpm archives/$(BUILD_NAME)-$(VERSION)-$(RPM_RELEASE).$(RPMARCH).rpm
|
||||
|
||||
copyfiles:
|
||||
@if [ ! -d $(COPYDIR) ]; then echo "You need to set COPYDIR to where you installed Quake III!"; false; fi
|
||||
-mkdir -p -m 0755 $(COPYDIR)
|
||||
install -s -m 0755 $(BR)/linuxquake3 $(COPYDIR)/quake3
|
||||
# install -s -m 0755 $(BR)/linuxquake3-smp $(COPYDIR)/quake3-smp
|
||||
install -s -m 0755 $(BR)/linuxq3ded $(COPYDIR)/q3ded
|
||||
-mkdir -p -m 0755 $(COPYDIR)/baseq3
|
||||
install -s -m 0755 $(BR)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
|
||||
$(COPYDIR)/baseq3/.
|
||||
install -s -m 0755 $(BR)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
|
||||
$(COPYDIR)/baseq3/.
|
||||
install -s -m 0755 $(BR)/baseq3/ui$(ARCH).$(SHLIBEXT) \
|
||||
$(COPYDIR)/baseq3/.
|
||||
-mkdir -p -m 0755 $(COPYDIR)/missionpack
|
||||
install -s -m 0755 $(BR)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
|
||||
$(COPYDIR)/missionpack/.
|
||||
install -s -m 0755 $(BR)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
|
||||
$(COPYDIR)/missionpack/.
|
||||
install -s -m 0755 $(BR)/missionpack/ui$(ARCH).$(SHLIBEXT) \
|
||||
$(COPYDIR)/missionpack/.
|
||||
|
||||
$(BUILD_NAME).spec : $(UDIR)/$(BUILD_NAME).spec.sh Makefile
|
||||
sh $< $(VERSION) $(RPM_RELEASE) $(ARCH) $(INSTALLDIR) > $@
|
||||
|
||||
#############################################################################
|
||||
# MISC
|
||||
#############################################################################
|
||||
|
@ -1621,8 +1563,3 @@ clean-debug:
|
|||
clean-release:
|
||||
$(MAKE) clean2 B=$(BR) CFLAGS="$(DEBUG_CFLAGS)"
|
||||
|
||||
# TTimo: for the setups it's easier to shell out to a script
|
||||
|
||||
setup: release
|
||||
./build_setup.sh $(VERSION)
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# KDE Config File
|
||||
[KDE Desktop Entry]
|
||||
Name=Quake3
|
||||
Name[C]=Quake3
|
||||
MimeType=
|
||||
Exec=/usr/local/games/quake3/linuxquake3
|
||||
Comment=Quake3: Arena by id Software
|
||||
Icon=quake3.xpm
|
||||
TerminalOptions=
|
||||
Path=
|
||||
Type=Application
|
||||
Terminal=0
|
|
@ -1,125 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Build various setups..
|
||||
|
||||
# inputs:
|
||||
# directory with the common media
|
||||
Q3SETUPMEDIA=/home/timo/Id/Q3SetupMedia/quake3
|
||||
# directory with binaries tree
|
||||
Q3BINARIES=../install
|
||||
# version: $1
|
||||
VERSION=$1
|
||||
# temporary directory used to prepare the files
|
||||
# NOTE: this dir is erased before a new setup is built
|
||||
TMPDIR=setup.tmp
|
||||
|
||||
# location of the setup dir (for graphical installer and makeself)
|
||||
SETUPDIR=setup
|
||||
|
||||
# cp setup phase
|
||||
# we need to copy the symlinked files, and not the symlinks themselves
|
||||
# on antares this is forced with a cp -L
|
||||
# on spoutnik, -L is not recognized, and dereference is the default behaviour
|
||||
# we need a robust way of checking
|
||||
TESTFILE=/tmp/foo$$
|
||||
touch $TESTFILE
|
||||
# see if option is supported
|
||||
cp -L $TESTFILE $TESTFILE.cp 2>/dev/null
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
# option not supported, should be on by default
|
||||
echo "cp doesn't have -L option"
|
||||
unset CPOPT
|
||||
else
|
||||
# option supported, use it
|
||||
echo "cp supports -L option"
|
||||
CPOPT="-L"
|
||||
fi
|
||||
rm $TESTFILE
|
||||
|
||||
|
||||
# graphical installer (based on Loki Software's Setup tool)
|
||||
build_installer ()
|
||||
{
|
||||
TMPDIR=setup.tmp
|
||||
|
||||
rm -rf $TMPDIR
|
||||
mkdir $TMPDIR
|
||||
|
||||
# copy base setup files
|
||||
cp $CPOPT -R $SETUPDIR/setup.sh $SETUPDIR/setup.data $TMPDIR
|
||||
|
||||
# copy media files
|
||||
cp $CPOPT -R $Q3SETUPMEDIA/* $TMPDIR
|
||||
|
||||
# remove CVS entries
|
||||
find $TMPDIR -name CVS | xargs rm -rf
|
||||
|
||||
# copy binaries
|
||||
mkdir -p $TMPDIR/bin/x86
|
||||
# smp
|
||||
cp $CPOPT $Q3BINARIES/linuxquake3-smp $TMPDIR/bin/x86/quake3-smp.x86
|
||||
strip $TMPDIR/bin/x86/quake3-smp.x86
|
||||
brandelf -t Linux $TMPDIR/bin/x86/quake3-smp.x86
|
||||
# old school
|
||||
cp $CPOPT $Q3BINARIES/linuxquake3 $TMPDIR/bin/x86/quake3.x86
|
||||
strip $TMPDIR/bin/x86/quake3.x86
|
||||
brandelf -t Linux $TMPDIR/bin/x86/quake3.x86
|
||||
# ded
|
||||
cp $CPOPT $Q3BINARIES/linuxq3ded $TMPDIR/bin/x86/q3ded
|
||||
strip $TMPDIR/bin/x86/q3ded
|
||||
brandelf -t Linux $TMPDIR/bin/x86/q3ded
|
||||
|
||||
# PB files
|
||||
mkdir -p $TMPDIR/pb/htm
|
||||
cp $CPOPT ../pb/linux/*.so $TMPDIR/pb
|
||||
cp $CPOPT ../pb/htm/*.htm $TMPDIR/pb/htm
|
||||
|
||||
# Linux FAQ
|
||||
mkdir -p $TMPDIR/Docs/LinuxFAQ
|
||||
cp $CPOPT LinuxSupport/* $TMPDIR/Docs/LinuxFAQ
|
||||
|
||||
# generated .qvm pk3 files
|
||||
mkdir -p $TMPDIR/baseq3
|
||||
mkdir -p $TMPDIR/missionpack
|
||||
# not needed now
|
||||
#cp $CPOPT $Q3BINARIES/baseq3/pak8.pk3 $TMPDIR/baseq3/
|
||||
#cp $CPOPT $Q3BINARIES/missionpack/pak3.pk3 $TMPDIR/missionpack/
|
||||
|
||||
# menu shortcut to the game
|
||||
# FIXME current setup doesn't have a way to set symlinks on arbitrary things
|
||||
# so we use a dummy quake3 script (which will be overwritten by postinstall.sh)
|
||||
echo -e "#!/bin/sh\necho \"If you read this, then the setup script failed miserably.\nPlease report to ttimo@idsoftware.com\n\"" > $TMPDIR/bin/x86/quake3
|
||||
echo -e "#!/bin/sh\necho \"If you read this, then the setup script failed miserably.\nPlease report to ttimo@idsoftware.com\n\"" > $TMPDIR/bin/x86/quake3-smp
|
||||
# create the auto-extractible archive
|
||||
# first step: on FreeBSD we would default to Linux binaries .. use a symlink
|
||||
(
|
||||
cd $TMPDIR/setup.data/bin
|
||||
ln -s Linux FreeBSD
|
||||
ln -s Linux NetBSD
|
||||
ln -s Linux OpenBSD
|
||||
)
|
||||
# NOTE: we used to pass the $VERSION, but it doesn't seem very usefull
|
||||
./$SETUPDIR/makeself/makeself.sh $TMPDIR linuxq3apoint-$VERSION.x86.run "Quake III Arena Point Release $VERSION " ./setup.sh
|
||||
|
||||
chmod a+rx linuxq3apoint-$VERSION.x86.run
|
||||
|
||||
#rm -rf $TMPDIR
|
||||
}
|
||||
|
||||
check_brandelf()
|
||||
{
|
||||
# make sure brandelf is installed to avoid any problem when building the setups
|
||||
BRAND=`which brandelf`;
|
||||
if [ -n "$BRAND" ] && [ -x "$BRAND" ]
|
||||
then
|
||||
echo "brandelf is present: $BRAND"
|
||||
else
|
||||
echo "brandelf not found"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# safe checks
|
||||
check_brandelf
|
||||
|
||||
build_installer
|
6828
code/unix/cons
6828
code/unix/cons
File diff suppressed because it is too large
Load diff
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# extracting version string from game/q_shared.h
|
||||
# hacked from Wolf build process
|
||||
|
||||
# extract the wolf version from q_shared.h
|
||||
$line = `cat ../game/q_shared.h | grep Q3_VERSION`;
|
||||
chomp $line;
|
||||
$line =~ s/.*Q3\ (.*)\"/$1/;
|
||||
print "$line\n";
|
|
@ -1,52 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Generate Quake3 test
|
||||
# $1 is version
|
||||
# $2 is release
|
||||
# $3 is arch
|
||||
# $4 is install dir (assumed to be in /var/tmp)
|
||||
cat <<EOF
|
||||
%define name q3test
|
||||
%define version ${1}
|
||||
%define release ${2}
|
||||
%define arch ${3}
|
||||
%define builddir \$RPM_BUILD_DIR/%{name}-%{version}
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Vendor: id Software
|
||||
Packager: Dave "Zoid" Kirsch <zoid@idsoftware.com>
|
||||
URL: http://www.idsoftware.com/
|
||||
Source: q3test-%{version}.tar.gz
|
||||
Group: Games
|
||||
Copyright: Restricted
|
||||
Icon: quake3.gif
|
||||
BuildRoot: /var/tmp/%{name}-%{version}
|
||||
Summary: Q3Test for Linux
|
||||
|
||||
%description
|
||||
|
||||
%install
|
||||
|
||||
%files
|
||||
|
||||
%attr(644,root,root) $4/README.EULA
|
||||
%attr(644,root,root) $4/README.Q3Test
|
||||
%attr(644,root,root) $4/README.Linux
|
||||
%attr(644,root,root) $4/Quake3.kdelnk
|
||||
%attr(644,root,root) $4/quake3.xpm
|
||||
%attr(755,root,root) $4/linuxquake3
|
||||
%attr(755,root,root) $4/cgamei386.so
|
||||
%attr(755,root,root) $4/qagamei386.so
|
||||
%attr(755,root,root) $4/uii386.so
|
||||
%attr(755,root,root) $4/libMesaVoodooGL.so.3.1
|
||||
%attr(644,root,root) $4/demoq3/pak0.pk3
|
||||
|
||||
%post
|
||||
|
||||
if [ -n "\$KDEDIR" ]; then
|
||||
ln -sf $4/Quake3.kdelnk \$KDEDIR/share/applnk/Games/Quake3.kdelnk
|
||||
ln -sf $4/quake3.xpm \$KDEDIR/share/icons/quake3.xpm
|
||||
fi
|
||||
|
||||
EOF
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
# for easy use with Anjuta
|
||||
cd `dirname $0`/debugi386-glibc
|
||||
echo "in $PWD"
|
||||
|
||||
# now execute whatever you want
|
||||
#./linuxquake3-smp +set fs_basepath /usr/local/games/quake3 +set developer 1 +set r_smp 1 +set r_showsmp 1 +devmap mythology
|
||||
|
||||
#gvd ./linuxquake3-smp --pargs +set logfile 2 +set fs_basepath /usr/local/games/quake3 +set developer 1 +set r_smp 0 +set r_showsmp 1 +devmap mythology
|
||||
|
||||
./linuxquake3-smp +set logfile 2 +set fs_basepath /usr/local/games/quake3 +set developer 1 +set r_smp 1 +set r_fullscreen 0 +set r_showsmp 1 +devmap mythology &
|
||||
gvd ./linuxquake3-smp
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena 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 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//
|
||||
// sys_dosa.s
|
||||
// x86 assembly-language DOS-dependent routines.
|
||||
|
||||
#include "qasm.h"
|
||||
|
||||
|
||||
.data
|
||||
|
||||
.align 4
|
||||
fpenv:
|
||||
.long 0, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
.text
|
||||
|
||||
.globl C(MaskExceptions)
|
||||
C(MaskExceptions):
|
||||
fnstenv fpenv
|
||||
orl $0x3F,fpenv
|
||||
fldenv fpenv
|
||||
|
||||
ret
|
||||
|
||||
#if 0
|
||||
.globl C(unmaskexceptions)
|
||||
C(unmaskexceptions):
|
||||
fnstenv fpenv
|
||||
andl $0xFFFFFFE0,fpenv
|
||||
fldenv fpenv
|
||||
|
||||
ret
|
||||
#endif
|
||||
|
||||
.data
|
||||
|
||||
.align 4
|
||||
.globl ceil_cw, single_cw, full_cw, cw, pushed_cw
|
||||
ceil_cw: .long 0
|
||||
single_cw: .long 0
|
||||
full_cw: .long 0
|
||||
cw: .long 0
|
||||
pushed_cw: .long 0
|
||||
|
||||
.text
|
||||
|
||||
.globl C(Sys_LowFPPrecision)
|
||||
C(Sys_LowFPPrecision):
|
||||
fldcw single_cw
|
||||
|
||||
ret
|
||||
|
||||
.globl C(Sys_HighFPPrecision)
|
||||
C(Sys_HighFPPrecision):
|
||||
fldcw full_cw
|
||||
|
||||
ret
|
||||
|
||||
.globl C(Sys_PushFPCW_SetHigh)
|
||||
C(Sys_PushFPCW_SetHigh):
|
||||
fnstcw pushed_cw
|
||||
fldcw full_cw
|
||||
|
||||
ret
|
||||
|
||||
.globl C(Sys_PopFPCW)
|
||||
C(Sys_PopFPCW):
|
||||
fldcw pushed_cw
|
||||
|
||||
ret
|
||||
|
||||
.globl C(Sys_SetFPCW)
|
||||
C(Sys_SetFPCW):
|
||||
fnstcw cw
|
||||
movl cw,%eax
|
||||
#if id386
|
||||
andb $0xF0,%ah
|
||||
orb $0x03,%ah // round mode, 64-bit precision
|
||||
#endif
|
||||
movl %eax,full_cw
|
||||
|
||||
#if id386
|
||||
andb $0xF0,%ah
|
||||
orb $0x0C,%ah // chop mode, single precision
|
||||
#endif
|
||||
movl %eax,single_cw
|
||||
|
||||
#if id386
|
||||
andb $0xF0,%ah
|
||||
orb $0x08,%ah // ceil mode, single precision
|
||||
#endif
|
||||
movl %eax,ceil_cw
|
||||
|
||||
ret
|
||||
|
|
@ -1,462 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena 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 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//
|
||||
// vm_x86a.s
|
||||
// linux x86 vm support
|
||||
|
||||
#include "qasm.h"
|
||||
|
||||
.extern C(instructionPointers)
|
||||
|
||||
.data
|
||||
|
||||
.align 4
|
||||
|
||||
programStack .long 0
|
||||
opStack .long 0
|
||||
syscallNum .long 0
|
||||
|
||||
.text
|
||||
|
||||
.globl C(AsmCAll)
|
||||
C(AsmCall):
|
||||
movl (%edi),%eax
|
||||
subl 4,%edi
|
||||
orl %eax,%eax
|
||||
jl systemCall
|
||||
// calling another vm function
|
||||
shll 2,%eax
|
||||
addl C(instructionPointers),%eax
|
||||
call (%eax)
|
||||
ret
|
||||
systemCall:
|
||||
|
||||
// convert negative num to system call number
|
||||
// and store right before the first arg
|
||||
negl %eax
|
||||
decl %eax
|
||||
|
||||
movl %eax,syscallNum
|
||||
///---- UNFINISHED FROM HERE
|
||||
mov dword ptr syscallNum, eax // so C code can get at it
|
||||
mov dword ptr programStack, esi // so C code can get at it
|
||||
mov dword ptr opStack, edi
|
||||
|
||||
push ecx
|
||||
push esi // we may call recursively, so the
|
||||
push edi // statics aren't guaranteed to be around
|
||||
}
|
||||
// save the stack to allow recursive VM entry
|
||||
currentVM->programStack = programStack - 4;
|
||||
*(int *)((byte *)currentVM->dataBase + programStack + 4) = syscallNum;
|
||||
//VM_LogSyscalls( (int *)((byte *)currentVM->dataBase + programStack + 4) );
|
||||
*(opStack+1) = currentVM->systemCall( (int *)((byte *)currentVM->dataBase + programStack + 4) );
|
||||
|
||||
_asm {
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
add edi, 4 // we added the return value
|
||||
|
||||
ret
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
movl val(%esp),%ecx
|
||||
movl $0x100,%edx // 0x10000000000 as dividend
|
||||
cmpl %edx,%ecx
|
||||
jle LOutOfRange
|
||||
|
||||
subl %eax,%eax
|
||||
divl %ecx
|
||||
|
||||
ret
|
||||
|
||||
LOutOfRange:
|
||||
movl $0xFFFFFFFF,%eax
|
||||
ret
|
||||
|
||||
#if 0
|
||||
|
||||
#define in 4
|
||||
#define out 8
|
||||
|
||||
.align 2
|
||||
.globl C(TransformVector)
|
||||
C(TransformVector):
|
||||
movl in(%esp),%eax
|
||||
movl out(%esp),%edx
|
||||
|
||||
flds (%eax) // in[0]
|
||||
fmuls C(vright) // in[0]*vright[0]
|
||||
flds (%eax) // in[0] | in[0]*vright[0]
|
||||
fmuls C(vup) // in[0]*vup[0] | in[0]*vright[0]
|
||||
flds (%eax) // in[0] | in[0]*vup[0] | in[0]*vright[0]
|
||||
fmuls C(vpn) // in[0]*vpn[0] | in[0]*vup[0] | in[0]*vright[0]
|
||||
|
||||
flds 4(%eax) // in[1] | ...
|
||||
fmuls C(vright)+4 // in[1]*vright[1] | ...
|
||||
flds 4(%eax) // in[1] | in[1]*vright[1] | ...
|
||||
fmuls C(vup)+4 // in[1]*vup[1] | in[1]*vright[1] | ...
|
||||
flds 4(%eax) // in[1] | in[1]*vup[1] | in[1]*vright[1] | ...
|
||||
fmuls C(vpn)+4 // in[1]*vpn[1] | in[1]*vup[1] | in[1]*vright[1] | ...
|
||||
fxch %st(2) // in[1]*vright[1] | in[1]*vup[1] | in[1]*vpn[1] | ...
|
||||
|
||||
faddp %st(0),%st(5) // in[1]*vup[1] | in[1]*vpn[1] | ...
|
||||
faddp %st(0),%st(3) // in[1]*vpn[1] | ...
|
||||
faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum
|
||||
|
||||
flds 8(%eax) // in[2] | ...
|
||||
fmuls C(vright)+8 // in[2]*vright[2] | ...
|
||||
flds 8(%eax) // in[2] | in[2]*vright[2] | ...
|
||||
fmuls C(vup)+8 // in[2]*vup[2] | in[2]*vright[2] | ...
|
||||
flds 8(%eax) // in[2] | in[2]*vup[2] | in[2]*vright[2] | ...
|
||||
fmuls C(vpn)+8 // in[2]*vpn[2] | in[2]*vup[2] | in[2]*vright[2] | ...
|
||||
fxch %st(2) // in[2]*vright[2] | in[2]*vup[2] | in[2]*vpn[2] | ...
|
||||
|
||||
faddp %st(0),%st(5) // in[2]*vup[2] | in[2]*vpn[2] | ...
|
||||
faddp %st(0),%st(3) // in[2]*vpn[2] | ...
|
||||
faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum
|
||||
|
||||
fstps 8(%edx) // out[2]
|
||||
fstps 4(%edx) // out[1]
|
||||
fstps (%edx) // out[0]
|
||||
|
||||
ret
|
||||
|
||||
#endif
|
||||
|
||||
#define EMINS 4+4
|
||||
#define EMAXS 4+8
|
||||
#define P 4+12
|
||||
|
||||
.align 2
|
||||
.globl C(BoxOnPlaneSide)
|
||||
C(BoxOnPlaneSide):
|
||||
pushl %ebx
|
||||
|
||||
movl P(%esp),%edx
|
||||
movl EMINS(%esp),%ecx
|
||||
xorl %eax,%eax
|
||||
movl EMAXS(%esp),%ebx
|
||||
movb pl_signbits(%edx),%al
|
||||
cmpb $8,%al
|
||||
jge Lerror
|
||||
flds pl_normal(%edx) // p->normal[0]
|
||||
fld %st(0) // p->normal[0] | p->normal[0]
|
||||
jmp Ljmptab(,%eax,4)
|
||||
|
||||
|
||||
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||
//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||
Lcase0:
|
||||
fmuls (%ebx) // p->normal[0]*emaxs[0] | p->normal[0]
|
||||
flds pl_normal+4(%edx) // p->normal[1] | p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]
|
||||
fxch %st(2) // p->normal[0] | p->normal[0]*emaxs[0] |
|
||||
// p->normal[1]
|
||||
fmuls (%ecx) // p->normal[0]*emins[0] |
|
||||
// p->normal[0]*emaxs[0] | p->normal[1]
|
||||
fxch %st(2) // p->normal[1] | p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fld %st(0) // p->normal[1] | p->normal[1] |
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fmuls 4(%ebx) // p->normal[1]*emaxs[1] | p->normal[1] |
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
flds pl_normal+8(%edx) // p->normal[2] | p->normal[1]*emaxs[1] |
|
||||
// p->normal[1] | p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fxch %st(2) // p->normal[1] | p->normal[1]*emaxs[1] |
|
||||
// p->normal[2] | p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fmuls 4(%ecx) // p->normal[1]*emins[1] |
|
||||
// p->normal[1]*emaxs[1] |
|
||||
// p->normal[2] | p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fxch %st(2) // p->normal[2] | p->normal[1]*emaxs[1] |
|
||||
// p->normal[1]*emins[1] |
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fld %st(0) // p->normal[2] | p->normal[2] |
|
||||
// p->normal[1]*emaxs[1] |
|
||||
// p->normal[1]*emins[1] |
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fmuls 8(%ebx) // p->normal[2]*emaxs[2] |
|
||||
// p->normal[2] |
|
||||
// p->normal[1]*emaxs[1] |
|
||||
// p->normal[1]*emins[1] |
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[0]*emins[0]
|
||||
fxch %st(5) // p->normal[0]*emins[0] |
|
||||
// p->normal[2] |
|
||||
// p->normal[1]*emaxs[1] |
|
||||
// p->normal[1]*emins[1] |
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[2]*emaxs[2]
|
||||
faddp %st(0),%st(3) //p->normal[2] |
|
||||
// p->normal[1]*emaxs[1] |
|
||||
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[2]*emaxs[2]
|
||||
fmuls 8(%ecx) //p->normal[2]*emins[2] |
|
||||
// p->normal[1]*emaxs[1] |
|
||||
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[2]*emaxs[2]
|
||||
fxch %st(1) //p->normal[1]*emaxs[1] |
|
||||
// p->normal[2]*emins[2] |
|
||||
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
|
||||
// p->normal[0]*emaxs[0] |
|
||||
// p->normal[2]*emaxs[2]
|
||||
faddp %st(0),%st(3) //p->normal[2]*emins[2] |
|
||||
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
|
||||
// p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]|
|
||||
// p->normal[2]*emaxs[2]
|
||||
fxch %st(3) //p->normal[2]*emaxs[2] +
|
||||
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
|
||||
// p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]|
|
||||
// p->normal[2]*emins[2]
|
||||
faddp %st(0),%st(2) //p->normal[1]*emins[1]+p->normal[0]*emins[0]|
|
||||
// dist1 | p->normal[2]*emins[2]
|
||||
|
||||
jmp LSetSides
|
||||
|
||||
//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||
Lcase1:
|
||||
fmuls (%ecx) // emins[0]
|
||||
flds pl_normal+4(%edx)
|
||||
fxch %st(2)
|
||||
fmuls (%ebx) // emaxs[0]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 4(%ebx) // emaxs[1]
|
||||
flds pl_normal+8(%edx)
|
||||
fxch %st(2)
|
||||
fmuls 4(%ecx) // emins[1]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 8(%ebx) // emaxs[2]
|
||||
fxch %st(5)
|
||||
faddp %st(0),%st(3)
|
||||
fmuls 8(%ecx) // emins[2]
|
||||
fxch %st(1)
|
||||
faddp %st(0),%st(3)
|
||||
fxch %st(3)
|
||||
faddp %st(0),%st(2)
|
||||
|
||||
jmp LSetSides
|
||||
|
||||
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||
//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||
Lcase2:
|
||||
fmuls (%ebx) // emaxs[0]
|
||||
flds pl_normal+4(%edx)
|
||||
fxch %st(2)
|
||||
fmuls (%ecx) // emins[0]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 4(%ecx) // emins[1]
|
||||
flds pl_normal+8(%edx)
|
||||
fxch %st(2)
|
||||
fmuls 4(%ebx) // emaxs[1]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 8(%ebx) // emaxs[2]
|
||||
fxch %st(5)
|
||||
faddp %st(0),%st(3)
|
||||
fmuls 8(%ecx) // emins[2]
|
||||
fxch %st(1)
|
||||
faddp %st(0),%st(3)
|
||||
fxch %st(3)
|
||||
faddp %st(0),%st(2)
|
||||
|
||||
jmp LSetSides
|
||||
|
||||
//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||
Lcase3:
|
||||
fmuls (%ecx) // emins[0]
|
||||
flds pl_normal+4(%edx)
|
||||
fxch %st(2)
|
||||
fmuls (%ebx) // emaxs[0]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 4(%ecx) // emins[1]
|
||||
flds pl_normal+8(%edx)
|
||||
fxch %st(2)
|
||||
fmuls 4(%ebx) // emaxs[1]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 8(%ebx) // emaxs[2]
|
||||
fxch %st(5)
|
||||
faddp %st(0),%st(3)
|
||||
fmuls 8(%ecx) // emins[2]
|
||||
fxch %st(1)
|
||||
faddp %st(0),%st(3)
|
||||
fxch %st(3)
|
||||
faddp %st(0),%st(2)
|
||||
|
||||
jmp LSetSides
|
||||
|
||||
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||
//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||
Lcase4:
|
||||
fmuls (%ebx) // emaxs[0]
|
||||
flds pl_normal+4(%edx)
|
||||
fxch %st(2)
|
||||
fmuls (%ecx) // emins[0]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 4(%ebx) // emaxs[1]
|
||||
flds pl_normal+8(%edx)
|
||||
fxch %st(2)
|
||||
fmuls 4(%ecx) // emins[1]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 8(%ecx) // emins[2]
|
||||
fxch %st(5)
|
||||
faddp %st(0),%st(3)
|
||||
fmuls 8(%ebx) // emaxs[2]
|
||||
fxch %st(1)
|
||||
faddp %st(0),%st(3)
|
||||
fxch %st(3)
|
||||
faddp %st(0),%st(2)
|
||||
|
||||
jmp LSetSides
|
||||
|
||||
//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||
Lcase5:
|
||||
fmuls (%ecx) // emins[0]
|
||||
flds pl_normal+4(%edx)
|
||||
fxch %st(2)
|
||||
fmuls (%ebx) // emaxs[0]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 4(%ebx) // emaxs[1]
|
||||
flds pl_normal+8(%edx)
|
||||
fxch %st(2)
|
||||
fmuls 4(%ecx) // emins[1]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 8(%ecx) // emins[2]
|
||||
fxch %st(5)
|
||||
faddp %st(0),%st(3)
|
||||
fmuls 8(%ebx) // emaxs[2]
|
||||
fxch %st(1)
|
||||
faddp %st(0),%st(3)
|
||||
fxch %st(3)
|
||||
faddp %st(0),%st(2)
|
||||
|
||||
jmp LSetSides
|
||||
|
||||
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||
//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||
Lcase6:
|
||||
fmuls (%ebx) // emaxs[0]
|
||||
flds pl_normal+4(%edx)
|
||||
fxch %st(2)
|
||||
fmuls (%ecx) // emins[0]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 4(%ecx) // emins[1]
|
||||
flds pl_normal+8(%edx)
|
||||
fxch %st(2)
|
||||
fmuls 4(%ebx) // emaxs[1]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 8(%ecx) // emins[2]
|
||||
fxch %st(5)
|
||||
faddp %st(0),%st(3)
|
||||
fmuls 8(%ebx) // emaxs[2]
|
||||
fxch %st(1)
|
||||
faddp %st(0),%st(3)
|
||||
fxch %st(3)
|
||||
faddp %st(0),%st(2)
|
||||
|
||||
jmp LSetSides
|
||||
|
||||
//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||
Lcase7:
|
||||
fmuls (%ecx) // emins[0]
|
||||
flds pl_normal+4(%edx)
|
||||
fxch %st(2)
|
||||
fmuls (%ebx) // emaxs[0]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 4(%ecx) // emins[1]
|
||||
flds pl_normal+8(%edx)
|
||||
fxch %st(2)
|
||||
fmuls 4(%ebx) // emaxs[1]
|
||||
fxch %st(2)
|
||||
fld %st(0)
|
||||
fmuls 8(%ecx) // emins[2]
|
||||
fxch %st(5)
|
||||
faddp %st(0),%st(3)
|
||||
fmuls 8(%ebx) // emaxs[2]
|
||||
fxch %st(1)
|
||||
faddp %st(0),%st(3)
|
||||
fxch %st(3)
|
||||
faddp %st(0),%st(2)
|
||||
|
||||
LSetSides:
|
||||
|
||||
// sides = 0;
|
||||
// if (dist1 >= p->dist)
|
||||
// sides = 1;
|
||||
// if (dist2 < p->dist)
|
||||
// sides |= 2;
|
||||
|
||||
faddp %st(0),%st(2) // dist1 | dist2
|
||||
fcomps pl_dist(%edx)
|
||||
xorl %ecx,%ecx
|
||||
fnstsw %ax
|
||||
fcomps pl_dist(%edx)
|
||||
andb $1,%ah
|
||||
xorb $1,%ah
|
||||
addb %ah,%cl
|
||||
|
||||
fnstsw %ax
|
||||
andb $1,%ah
|
||||
addb %ah,%ah
|
||||
addb %ah,%cl
|
||||
|
||||
// return sides;
|
||||
|
||||
popl %ebx
|
||||
movl %ecx,%eax // return status
|
||||
|
||||
ret
|
||||
|
||||
|
||||
Lerror:
|
||||
movl 1, %eax
|
||||
ret
|
||||
|
||||
#endif // id386
|
Loading…
Reference in a new issue