Some improvements on installation from source.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@785 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Include build functions used here
|
||||
. build/unix/config_functions
|
||||
. build/unix/menu_functions
|
||||
. build/unix/ansi
|
||||
|
||||
|
||||
# Some requirements:
|
||||
have_program gcc || exit 1
|
||||
COMPILE="$PROG_gcc_FILE"
|
||||
|
||||
case "$OSNAME" in
|
||||
MINGW32*)
|
||||
have_program windres
|
||||
WINDRES="$PROG_windres_FILE"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Define WORDS_BIGENDIAN on bigendian machines
|
||||
check_endianness
|
||||
|
||||
|
||||
# Libraries used
|
||||
use_library SDL 1.2.3 || exit 1
|
||||
use_library SDL_image || exit 1
|
||||
#have_library vorbis || exit 1
|
||||
have_library vorbisfile || exit 1
|
||||
|
||||
|
||||
# Add defines for HAVE_STRUPR and STRICMP
|
||||
define_have_symbol strupr
|
||||
define_have_symbol stricmp
|
||||
|
||||
# Check for getopt.h
|
||||
define_have_header getopt.h
|
||||
|
||||
|
||||
# Describe the menu:
|
||||
MENU_main_ITEMS="debug graphics sound install_path"
|
||||
MENU_main_TITLE="Main menu"
|
||||
MENU_main_ITEM_debug_TYPE=CHOICE
|
||||
MENU_main_ITEM_graphics_TYPE=CHOICE
|
||||
MENU_main_ITEM_sound_TYPE=CHOICE
|
||||
MENU_main_ITEM_link_TYPE=CHOICE
|
||||
MENU_main_ITEM_install_path_TYPE=MENU
|
||||
|
||||
CHOICE_debug_OPTIONS="nodebug debug strictdebug"
|
||||
CHOICE_debug_TITLE="Include debugging information"
|
||||
CHOICE_debug_OPTION_nodebug_TITLE="No debugging information"
|
||||
CHOICE_debug_OPTION_nodebug_ACTION='nodebug_action'
|
||||
nodebug_action() {
|
||||
CFLAGS="$CFLAGS -O3"
|
||||
DEBUG=0
|
||||
}
|
||||
CHOICE_debug_OPTION_debug_TITLE="Debugging information"
|
||||
CHOICE_debug_OPTION_debug_ACTION='debug_action'
|
||||
debug_action() {
|
||||
CFLAGS="$CFLAGS -g -O0 -W -Wall"
|
||||
CFLAGS="$CFLAGS -DDEBUG_TRACK_SEM" # enable semaphore deugging
|
||||
LDFLAGS="$LDFLAGS -O0"
|
||||
DEBUG=1
|
||||
}
|
||||
CHOICE_debug_OPTION_strictdebug_TITLE="Debug info + strict compile checks"
|
||||
CHOICE_debug_OPTION_strictdebug_ACTION='strictdebug_action'
|
||||
strictdebug_action() {
|
||||
CFLAGS="$CFLAGS -O1" # This is needed for -Wunitialized
|
||||
CFLAGS="$CFLAGS -DDEBUG_TRACK_SEM" # enable semaphore deugging
|
||||
CFLAGS="$CFLAGS -W -Wall \
|
||||
-Wbad-function-cast -Wcast-qual -Wmissing-prototypes \
|
||||
-Wstrict-prototypes -Wmissing-declarations \
|
||||
-Wwrite-strings -Wimplicit -Wreturn-type -Wformat \
|
||||
-Wswitch -Wcomment -Wchar-subscripts \
|
||||
-Wparentheses -Wcast-align -Waggregate-return \
|
||||
-Winline -Wuninitialized"
|
||||
# CFLAGS="$CFLAGS "-Wpointer-arith"
|
||||
# Some standard header won't even compile with this on
|
||||
CFLAGS="$CFLAGS -Wshadow"
|
||||
# This gives absurd conflicts with standard files,
|
||||
# like from 'y2'
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
# CFLAGS="$CFLAGS -pedantic-errors -ansi -trigraphs" # ANSI
|
||||
# CFLAGS="$CFLAGS -Wnested-externs"
|
||||
# We know they're in the code, and though we'd like to get
|
||||
# rid of them, they're not bugs.
|
||||
CFLAGS=`echo $CFLAGS`
|
||||
# Remove all the unnecessary spaces from $CFLAGS,
|
||||
# for more readable messages.
|
||||
DEBUG=0
|
||||
}
|
||||
CHOICE_debug_DEFAULT=debug
|
||||
|
||||
CHOICE_graphics_OPTIONS="pure opengl"
|
||||
CHOICE_graphics_TITLE="OpenGL graphics support"
|
||||
CHOICE_graphics_OPTION_pure_TITLE="Don't include OpenGL graphics support"
|
||||
CHOICE_graphics_OPTION_pure_ACTION='graphics_pure_action'
|
||||
graphics_pure_action() {
|
||||
CFLAGS="$CFLAGS -DGFXMODULE_SDL"
|
||||
HAVE_OPENGL=0
|
||||
}
|
||||
CHOICE_graphics_OPTION_opengl_TITLE="Include OpenGL graphics support"
|
||||
CHOICE_graphics_OPTION_opengl_ACTION='graphics_opengl_action'
|
||||
CHOICE_graphics_OPTION_opengl_PRECOND="have_library opengl"
|
||||
graphics_opengl_action() {
|
||||
CFLAGS="$CFLAGS -DGFXMODULE_SDL -DHAVE_OPENGL"
|
||||
HAVE_OPENGL=1
|
||||
use_library opengl
|
||||
}
|
||||
CHOICE_graphics_DEFAULT=opengl
|
||||
|
||||
CHOICE_sound_OPTIONS="mixsdl openal"
|
||||
CHOICE_sound_TITLE="Sound backend"
|
||||
CHOICE_sound_OPTION_mixsdl_TITLE="Use MixSDL for sound"
|
||||
CHOICE_sound_OPTION_mixsdl_ACTION=sound_mixsdl_action
|
||||
sound_mixsdl_action() {
|
||||
CFLAGS="$CFLAGS -DSOUNDMODULE_SDL"
|
||||
SOUNDMODULE=mixsdl
|
||||
use_library vorbisfile
|
||||
# use_library vorbis
|
||||
}
|
||||
CHOICE_sound_OPTION_openal_TITLE="Include OpenAL support (experimental)"
|
||||
CHOICE_sound_OPTION_openal_PRECOND="have_library openal"
|
||||
CHOICE_sound_OPTION_openal_ACTION=sound_openal_action
|
||||
sound_openal_action() {
|
||||
CFLAGS="$CFLAGS -DHAVE_OPENAL -DSOUNDMODULE_SDL"
|
||||
SOUNDMODULE=openal
|
||||
use_library openal
|
||||
use_library vorbisfile
|
||||
# use_library vorbis
|
||||
}
|
||||
CHOICE_sound_DEFAULT=mixsdl
|
||||
|
||||
# Making static binaries is more complicated than this.
|
||||
# For now, it will have to be done by hand.
|
||||
#CHOICE_link_OPTIONS="static dynamic"
|
||||
#CHOICE_link_TITLE="Linking"
|
||||
#CHOICE_link_OPTION_static_TITLE="Statically linked libraries"
|
||||
#CHOICE_link_OPTION_static_ACTION='eval LDFLAGS="$LDFLAGS -static"'
|
||||
#CHOICE_link_OPTION_dynamic_TITLE="Dynamically linked libraries"
|
||||
#CHOICE_link_DEFAULT=dynamic
|
||||
|
||||
MENU_install_path_ITEMS="install_prefix install_bindir install_libdir"
|
||||
MENU_install_path_TITLE="Installation paths"
|
||||
MENU_install_path_ITEM_install_prefix_TYPE=INPUT
|
||||
MENU_install_path_ITEM_install_libdir_TYPE=INPUT
|
||||
MENU_install_path_ITEM_install_bindir_TYPE=INPUT
|
||||
|
||||
INPUT_install_prefix_DEFAULT="/usr/local/games"
|
||||
INPUT_install_prefix_TITLE="Installation prefix"
|
||||
INPUT_install_prefix_VALIDATOR=validate_path
|
||||
INPUT_install_prefix_ACTION='eval INSTALL_PREFIX=$MENU_install_prefix_VALUE'
|
||||
|
||||
INPUT_install_bindir_DEFAULT='$prefix/bin'
|
||||
INPUT_install_bindir_TITLE="Location for binaries"
|
||||
INPUT_install_bindir_VALIDATOR=validate_path
|
||||
|
||||
INPUT_install_libdir_DEFAULT='$prefix/lib'
|
||||
INPUT_install_libdir_TITLE="Location for libraries"
|
||||
INPUT_install_libdir_VALIDATOR=validate_path
|
||||
|
||||
|
||||
# Show the menu and let people set things
|
||||
do_menu main
|
||||
|
||||
# Set INSTALL_LIBDIR and INSTALL_BINDIR by to their set values, replacing
|
||||
# '$prefix' to the prefix set.
|
||||
prefix="$INPUT_install_prefix_VALUE" \
|
||||
eval INSTALL_LIBDIR="${INPUT_install_libdir_VALUE%/}/"
|
||||
prefix="$INPUT_install_prefix_VALUE" \
|
||||
eval INSTALL_BINDIR="${INPUT_install_bindir_VALUE%/}/"
|
||||
|
||||
# Set the content dir
|
||||
CONTENTDIR="${INSTALL_LIBDIR}uqm/content"
|
||||
|
||||
|
||||
# Export the HAVE_ symbols to config.h, using config.h.in as template
|
||||
SUBSTITUTE_VARS="$HAVE_SYMBOLS CONTENTDIR"
|
||||
SUBSTITUTE_FILES="src/config.h"
|
||||
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES
|
||||
|
||||
# Make build.vars from build.vars.in, substituting variables.
|
||||
SUBSTITUTE_VARS="CFLAGS LDFLAGS MAKE DEBUG SOUNDMODULE HAVE_OPENGL \
|
||||
INSTALL_LIBDIR INSTALL_BINDIR WINDRES"
|
||||
SUBSTITUTE_FILES="build.vars"
|
||||
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES
|
||||
|
||||
# Make 'uqm' shell script from build.vars.in, substituting variables.
|
||||
SUBSTITUTE_VARS="INSTALL_LIBDIR INSTALL_BINDIR uqm_NAME"
|
||||
SUBSTITUTE_FILES="build/unix/uqm"
|
||||
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES
|
||||
|
||||
Reference in New Issue
Block a user