From 182fa63ea86b4afe115c1515cb1f225a57e37e9c Mon Sep 17 00:00:00 2001 From: zicodxx Date: Mon, 3 Jan 2011 11:42:50 +0100 Subject: [PATCH] More consistency in SConstruct command-line variables; Added automatic Endianess-checker; Set target to 'd1x-rebirth' no matter if OpenGL or not --- CHANGELOG.txt | 1 + INSTALL.txt | 38 +++++++++++----------- SConstruct | 87 +++++++++++++++++++++++++++++---------------------- 3 files changed, 69 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c29dcba23..95580cf81 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D1X-Rebirth Changelog -------- arch/sdl/joy.c, arch/sdl/key.c, arch/sdl/mouse.c, include/args.h, main/kconfig.c, main/kconfig.h, main/playsave.c, misc/args.c: Added Cycle Primary/Secondary to the config panels for keyboard and joystick like in D2X-Rebirth and store them in the designated key/button arrays; Added Cycle Primary/Secondary for Mouse which makes wheel axis cycling unnecessary and also let Weapon Keys be assigned to a Mouse button; If GameArg.NoStickyKeys do flush these keys so they can be used as normal game keys - otherwise ban them; Fixed crash when reassigning mouse button greater than 3; Joystick/Mouse function taking button as argument now check for sanity of this value so they can safely be used in kconfig code and deal with unassigned key values d1x.ini, include/args.h, main/gauges.c, main/hud.c, main/inferno.c, main/menu.c, main/playsave.c, main/playsave.h, misc/args.c: Added feature to disable D2-style Prox. Bomb Gauge; Moved NoRedundancy and MultiMessages toggles from GameArg to PlayerCfg to be set via Misc Options +SConstruct, INSTALL.txt: More consistency in SConstruct command-line variables; Added automatic Endianess-checker; Set target to 'd1x-rebirth' no matter if OpenGL or not 20110102 -------- diff --git a/INSTALL.txt b/INSTALL.txt index 42ce07a83..7236ad185 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -21,32 +21,32 @@ Compiling: *NIX: ----- Type 'scons' to compile the source. - You can also give additional options like 'scons sdl_only=1 asm=1'. See 'scons -h' for available options. + You can also give additional options like 'scons use_ipx=0'. See 'scons -h' for available options. To install, use 'scons install' but remember to use all your options as well or SCons will re-compile and install without any options given to prior compiling. However it's STRONGLY recommended NOT to use the 'install' argument but to create a package for your Linux distribution or operating system. 'install' will - compile the resulting binary (d1x-rebirth-gl/sdl) to /usr/local/bin/ by default so to uninstall, just + compile the resulting binary (d1x-rebirth) to /usr/local/bin/ by default so to uninstall, just delete the binary. MacOS: ------ For Mac OS X, an Xcode project is available (requires Xcode 2.1 or later). Xcode includes the compiler - and OpenGL. The standard SDL and SDL_mixer libraries from the SDL website may be used, these go in - /Library/Frameworks or ~/Library/Frameworks. However, to fix MP3 support for the 'Release' build I used - SDL 1.2.8 with Diedel's modified SMPEG library from his D2X-XL website. To debug these libraries compile - the frameworks from source as 'Debug' builds, then use these instead. PhysicsFS must be compiled from - source. Put its enclosing folder 'physfs', renaming if necessary, next to D1X's (typically d1x-rebirth). - In CMake ensure the build path points to 'build' inside 'physfs'. Specify 'i386;ppc' as the architecture - for a universal binary. In Xcode, build 'Debug' and 'Release' from the dynamic library target. + and OpenGL. The standard SDL and SDL_mixer libraries from the SDL website may be used, these go in + /Library/Frameworks or ~/Library/Frameworks. However, to fix MP3 support for the 'Release' build I used + SDL 1.2.8 with Diedel's modified SMPEG library from his D2X-XL website. To debug these libraries compile + the frameworks from source as 'Debug' builds, then use these instead. PhysicsFS must be compiled from + source. Put its enclosing folder 'physfs', renaming if necessary, next to D1X's (typically d1x-rebirth). + In CMake ensure the build path points to 'build' inside 'physfs'. Specify 'i386;ppc' as the architecture + for a universal binary. In Xcode, build 'Debug' and 'Release' from the dynamic library target. SCons also works on MacOS X, but it's recommended to use XCode instead. - - For Mac OS 9, an MPW Makefile is available. MPW includes the compiler. As for the shared libraries, - compile PhysicsFS version 1.0 and the latest SDL and SDL_mixer (as of writing) from source. For SDL_mixer - 1.2.11 you will need to disable MikMod support, from SDL_mixer.make, otherwise use SDL_mixer 1.2.8. - For any sources to compile, they will need to be made into text files using a typecode changing program, - if they were downloaded outside of Mac OS 9 (including Mac OS X). This will also need to be done after any + + For Mac OS 9, an MPW Makefile is available. MPW includes the compiler. As for the shared libraries, + compile PhysicsFS version 1.0 and the latest SDL and SDL_mixer (as of writing) from source. For SDL_mixer + 1.2.11 you will need to disable MikMod support, from SDL_mixer.make, otherwise use SDL_mixer 1.2.8. + For any sources to compile, they will need to be made into text files using a typecode changing program, + if they were downloaded outside of Mac OS 9 (including Mac OS X). This will also need to be done after any Terminal command (diff, svn update etc) edits the source files. - + Note that there are ready-to-go packages on http://www.dxx-rebirth.com Win32: @@ -69,9 +69,9 @@ Needed files: descent.hog descent.pig - For the PC CD-ROM, these files should be located on the Descent1 CD-Rom. The PC version data files need - to be patched to version 1.4a. - + For the PC CD-ROM, these files should be located on the Descent1 CD-Rom. The PC version data files need + to be patched to version 1.4a. + There is a patch available at: http://www.dxx-rebirth.com/download/dxx/res/d1datapt.zip diff --git a/SConstruct b/SConstruct index 9f03668fd..0eb011cb5 100644 --- a/SConstruct +++ b/SConstruct @@ -6,6 +6,7 @@ import os import SCons.Util PROGRAM_NAME = 'D1X-Rebirth' +target = 'd1x-rebirth' # version number D1XMAJOR = 0 @@ -24,16 +25,27 @@ DATA_DIR = PREFIX + DATA_SUBDIR sharepath = str(ARGUMENTS.get('sharepath', DATA_DIR)) debug = int(ARGUMENTS.get('debug', 0)) profiler = int(ARGUMENTS.get('profiler', 0)) -sdl_only = int(ARGUMENTS.get('sdl_only', 0)) +opengl = int(ARGUMENTS.get('opengl', 1)) asm = int(ARGUMENTS.get('asm', 0)) editor = int(ARGUMENTS.get('editor', 0)) -sdlmixer = int(ARGUMENTS.get('sdlmixer', 0)) -arm = int(ARGUMENTS.get('arm', 0)) +sdlmixer = int(ARGUMENTS.get('sdlmixer', 1)) ipv6 = int(ARGUMENTS.get('ipv6', 0)) use_udp = int(ARGUMENTS.get('use_udp', 1)) use_ipx = int(ARGUMENTS.get('use_ipx', 1)) verbosebuild = int(ARGUMENTS.get('verbosebuild', 0)) +# endianess-checker +def checkEndian(): + import struct + array = struct.pack('cccc', '\x01', '\x02', '\x03', '\x04') + i = struct.unpack('i', array) + if i == struct.unpack('i', array): + return "big" + return "unknown" + + print '\n===== ' + PROGRAM_NAME + VERSION_STRING + ' =====\n' # general source files @@ -223,7 +235,7 @@ arch_ogl_sources = [ 'arch/ogl/ogl.c', ] -# for sdl +# for non-ogl arch_sdl_sources = [ 'arch/sdl/gr.c', 'texmap/tmapflat.c' @@ -344,23 +356,34 @@ else: ogllibs = ['GL', 'GLU'] lflags = '-L/usr/X11R6/lib' -# arm architecture? -if (arm == 1): +# set endianess +if (checkEndian() == "big"): + print "BigEndian machine detected" asm = 0 - env.Append(CPPDEFINES = ['WORDS_NEED_ALIGNMENT']) - env.Append(CPPFLAGS = ['-mstructure-size-boundary=8']) + env.Append(CPPDEFINES = ['WORDS_BIGENDIAN']) +elif (checkEndian() == "little"): + print "LittleEndian machine detected" -# sdl or opengl? -if (sdl_only == 1): - print "building with SDL" - target = 'd1x-rebirth-sdl' - common_sources += arch_sdl_sources -else: +# opengl or software renderer? +if (opengl == 1): print "building with OpenGL" - target = 'd1x-rebirth-gl' env.Append(CPPDEFINES = ogldefines) common_sources += arch_ogl_sources libs += ogllibs +else: + print "building with Software Renderer" + common_sources += arch_sdl_sources + +# assembler code? +if (asm == 1) and (opengl == 0): + print "including: ASSEMBLER" + Object(['texmap/tmappent.S', 'texmap/tmapppro.S'], AS='gcc', ASFLAGS='-D' + str(osdef) + ' -c ') + env.Replace(AS = 'nasm') + env.Append(ASCOM = ' -f ' + str(osasmdef) + ' -d' + str(osdef) + ' -Itexmap/ ') + common_sources += asm_sources + ['texmap/tmappent.o', 'texmap/tmapppro.o'] +else: + env.Append(CPPDEFINES = ['NO_ASM']) + common_sources += noasm_sources # SDL_mixer support? if (sdlmixer == 1): @@ -383,17 +406,6 @@ if (profiler == 1): env.Append(CPPFLAGS = ['-pg']) lflags += ' -pg' -# assembler code? -if (asm == 1) and (sdl_only == 1): - print "including: ASSEMBLER" - Object(['texmap/tmappent.S', 'texmap/tmapppro.S'], AS='gcc', ASFLAGS='-D' + str(osdef) + ' -c ') - env.Replace(AS = 'nasm') - env.Append(ASCOM = ' -f ' + str(osasmdef) + ' -d' + str(osdef) + ' -Itexmap/ ') - common_sources += asm_sources + ['texmap/tmappent.o', 'texmap/tmapppro.o'] -else: - env.Append(CPPDEFINES = ['NO_ASM']) - common_sources += noasm_sources - #editor build? if (editor == 1): env.Append(CPPDEFINES = ['EDITOR']) @@ -441,18 +453,17 @@ Help(PROGRAM_NAME + ', SConstruct file help:' + Extra options (add them to command line, like 'scons extraoption=value'): - 'sharepath=DIR' (non-Mac OS *NIX only) use DIR for shared game data. (default: /usr/local/share/games/d1x-rebirth) - 'sdl_only=1' don't include OpenGL, use SDL-only instead - 'sdlmixer=1' use SDL_Mixer for sound (includes external music support) - 'asm=1' use ASSEMBLER code (only with sdl_only=1, requires NASM and x86) - 'debug=1' build DEBUG binary which includes asserts, debugging output, cheats and more output - 'profiler=1' do profiler build - 'editor=1' build editor !EXPERIMENTAL! - 'arm=1' compile for ARM architecture - 'ipv6=1' enables IPv6 copability - 'use_udp=0' disable UDP support - 'use_ipx=0' disable IPX support (IPX available on Linux and Windows, only) - 'verbosebuild=1' print out all compiler/linker messages during building + 'sharepath=[DIR]' (non-Mac OS *NIX only) use [DIR] for shared game data. [default: /usr/local/share/games/d1x-rebirth] + 'opengl=[0/1]' build with OpenGL support [default: 1] + 'sdlmixer=[0/1]' build with SDL_Mixer support for sound and music (includes external music support) [default: 1] + 'asm=[0/1]' build with ASSEMBLER code (only with opengl=0, requires NASM and x86) [default: 0] + 'debug=[0/1]' build DEBUG binary which includes asserts, debugging output, cheats and more output [default: 0] + 'profiler=[0/1]' profiler build [default: 0] + 'editor=[0/1]' include editor into build (!EXPERIMENTAL!) [default: 0] + 'ipv6=[0/1]' enable IPv6 compability [default: 0] + 'use_udp=[0/1]' enable UDP support [default: 1] + 'use_ipx=[0/1]' enable IPX support (IPX available on Linux and Windows, only) [default: 1] + 'verbosebuild=[0/1]' print out all compiler/linker messages during building [default: 0] Default values: """ + ' sharepath = ' + DATA_DIR + """