Restructuring of the unix build scripts.

Also, interrupted dependency builds are now detected.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1338 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2004-02-29 00:04:18 +00:00
parent 7a21deb2cd
commit ec6fc4867e
7 changed files with 347 additions and 219 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.4: Changes towards version 0.4:
- Restructuring of the unix build scripts.
Also, interrupted dependency builds are now detected. - SvdB
- Unix build: Make it possible to use another directory than the current - Unix build: Make it possible to use another directory than the current
one for putting the build data in (such as build.vars, config.state, one for putting the build data in (such as build.vars, config.state,
the obj/ dir, and the final binary). - SvdB the obj/ dir, and the final binary). - SvdB
+31
View File
@@ -0,0 +1,31 @@
This file describes the easiest way to use this build system from
a packaging system such as rpm.
If you want an interactive configuration, you can start the build process
like you would do manually:
./build.sh uqm
to build the game, and
./build.sh uqm install
to install it.
If you want the configuration to be non-interactive, you'll want to do
the following: execute
./build.sh uqm config
once. This will generate a 'config.vars' file, which you can then
include in your package. Then when you want to build the game, put this
file the directory pointed to by $BUILD_WORK (default is the current
directory), and do
./build.sh uqm reprocess_config
to generate all the configuration information for the build, and then
./build.sh uqm
to build the game, and
./build.sh uqm install
to install it.
You may wish to set the environment variable BUILD_WORK to a directory
where the files created in the configuration and build process should be
stored. That way, the source tree will remain clean and no write access
to it is required.
+226 -192
View File
@@ -1,223 +1,257 @@
#!/bin/sh #!/bin/sh
if [ -z "$BUILD_WORK" ]; then
BUILD_WORK=.
fi
# Include build functions used here # Include build functions used here
. build/unix/config_functions . build/unix/config_functions
. build/unix/menu_functions . build/unix/menu_functions
. build/unix/ansi . build/unix/ansi
# Some requirements: uqm_requirements()
have_program gcc || exit 1 {
COMPILE="$PROG_gcc_FILE" # Some requirements:
have_program gcc || exit 1
COMPILE="$PROG_gcc_FILE"
case "$OSNAME" in case "$OSNAME" in
MINGW32*) MINGW32*)
have_program windres have_program windres
WINDRES="$PROG_windres_FILE" WINDRES="$PROG_windres_FILE"
;; ;;
esac esac
# Define WORDS_BIGENDIAN on bigendian machines # Define WORDS_BIGENDIAN on bigendian machines
check_endianness check_endianness
# Libraries used # Libraries used
use_library SDL 1.2.3 || exit 1 use_library SDL 1.2.3 || exit 1
use_library SDL_image || exit 1 use_library SDL_image || exit 1
#have_library vorbis || exit 1 #have_library vorbis || exit 1
have_library vorbisfile || exit 1 have_library vorbisfile || exit 1
# Add defines for HAVE_STRUPR and STRICMP # Add defines for HAVE_STRUPR and STRICMP
define_have_symbol strupr define_have_symbol strupr
define_have_symbol stricmp define_have_symbol stricmp
# Check for getopt.h # Check for getopt.h
define_have_header getopt.h define_have_header getopt.h
# Describe the menu:
MENU_main_ITEMS="debug graphics sound ioformat 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_ioformat_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' uqm_prepare_config()
debug_action() { {
CFLAGS="$CFLAGS -g -O0 -W -Wall" # Describe the menu:
LDFLAGS="$LDFLAGS -O0" MENU_main_ITEMS="debug graphics sound ioformat install_path"
DEBUG=1 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_ioformat_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"
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 -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"
# We shouldn't do this until we actually nail them
# all in the original code. Then we can enforce them
# on ourselves.
# 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 (internal)"
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
CHOICE_ioformat_OPTIONS="stdio stdio_zip"
CHOICE_ioformat_TITLE="Supported file i/o methods"
CHOICE_ioformat_OPTION_stdio_TITLE="Only direct file i/o"
CHOICE_ioformat_OPTION_stdio_zip_TITLE="Direct & .zip file i/o"
CHOICE_ioformat_OPTION_stdio_zip_PRECOND="have_library zlib"
CHOICE_ioformat_OPTION_stdio_zip_ACTION="ioformat_stdio_zip_action"
ioformat_stdio_zip_action() {
CFLAGS="$CFLAGS -DHAVE_ZIP=1"
USE_ZIP_IO=1
use_library zlib
}
CHOICE_ioformat_DEFAULT=stdio_zip
# 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 \
install_sharedir"
MENU_install_path_TITLE="Installation paths"
MENU_install_path_ITEM_install_prefix_TYPE=INPUT
MENU_install_path_ITEM_install_bindir_TYPE=INPUT
MENU_install_path_ITEM_install_libdir_TYPE=INPUT
MENU_install_path_ITEM_install_sharedir_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 non-sharable data"
INPUT_install_libdir_VALIDATOR=validate_path
INPUT_install_sharedir_DEFAULT='$prefix/share'
INPUT_install_sharedir_TITLE="Location for sharable data"
INPUT_install_sharedir_VALIDATOR=validate_path
} }
CHOICE_debug_OPTION_strictdebug_TITLE="Debug info + strict compile checks"
CHOICE_debug_OPTION_strictdebug_ACTION='strictdebug_action' uqm_do_config()
strictdebug_action() { {
CFLAGS="$CFLAGS -O1" # This is needed for -Wunitialized # Show the menu and let people set things
CFLAGS="$CFLAGS -W -Wall \ do_menu MENU main "$BUILD_WORK/config.state"
-Wbad-function-cast -Wcast-qual -Wmissing-prototypes \ echo "Configuration complete."
-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"
# We shouldn't do this until we actually nail them
# all in the original code. Then we can enforce them
# on ourselves.
# 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" uqm_process_config() {
CHOICE_graphics_TITLE="OpenGL graphics support" menu_process MENU main
CHOICE_graphics_OPTION_pure_TITLE="Don't include OpenGL graphics support"
CHOICE_graphics_OPTION_pure_ACTION='graphics_pure_action' # Set INSTALL_LIBDIR, INSTALL_BINDIR, and INSTALL_SHAREDIR to the specified
graphics_pure_action() { # values, replacing '$prefix' to the prefix set.
CFLAGS="$CFLAGS -DGFXMODULE_SDL" prefix="$INPUT_install_prefix_VALUE" \
HAVE_OPENGL=0 eval INSTALL_BINDIR="${INPUT_install_bindir_VALUE%/}/"
prefix="$INPUT_install_prefix_VALUE" \
eval INSTALL_LIBDIR="${INPUT_install_libdir_VALUE%/}/"
prefix="$INPUT_install_prefix_VALUE" \
eval INSTALL_SHAREDIR="${INPUT_install_sharedir_VALUE%/}/"
# Set the content dir
CONTENTDIR="${INSTALL_SHAREDIR}uqm/content"
CFLAGS="$CFLAGS -I \"$BUILD_WORK\""
# Export the HAVE_ symbols to config_unix.h, using config_unix.h.ini
# as template.
SUBSTITUTE_VARS="$HAVE_SYMBOLS CONTENTDIR"
SUBSTITUTE_FILES="config_unix.h"
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES src "$BUILD_WORK"
# Make build.vars from build.vars.in, substituting variables.
SUBSTITUTE_VARS="CFLAGS LDFLAGS MAKE DEBUG SOUNDMODULE HAVE_OPENGL \
USE_ZIP_IO \
INSTALL_LIBDIR INSTALL_BINDIR INSTALL_SHAREDIR WINDRES"
SUBSTITUTE_FILES="build.vars"
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES . "$BUILD_WORK"
# Make 'uqm' shell script from build.vars.in, substituting variables.
SUBSTITUTE_VARS="INSTALL_LIBDIR INSTALL_BINDIR INSTALL_SHAREDIR uqm_NAME"
SUBSTITUTE_FILES="uqm-wrapper"
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES build/unix "$BUILD_WORK"
} }
CHOICE_graphics_OPTION_opengl_TITLE="Include OpenGL graphics support"
CHOICE_graphics_OPTION_opengl_ACTION='graphics_opengl_action' uqm_load_config()
CHOICE_graphics_OPTION_opengl_PRECOND="have_library opengl" {
graphics_opengl_action() { menu_load MENU main "$BUILD_WORK/config.state"
CFLAGS="$CFLAGS -DGFXMODULE_SDL -DHAVE_OPENGL"
HAVE_OPENGL=1
use_library opengl
} }
CHOICE_graphics_DEFAULT=opengl
CHOICE_sound_OPTIONS="mixsdl openal" uqm_save_config()
CHOICE_sound_TITLE="Sound backend" {
CHOICE_sound_OPTION_mixsdl_TITLE="Use MixSDL for sound (internal)" menu_save MENU main "$BUILD_WORK/config.state"
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" uqm_pre_build() {
CHOICE_sound_OPTION_openal_ACTION=sound_openal_action : # Nothing to do
sound_openal_action() {
CFLAGS="$CFLAGS -DHAVE_OPENAL -DSOUNDMODULE_SDL"
SOUNDMODULE=openal
use_library openal
use_library vorbisfile
# use_library vorbis
} }
CHOICE_sound_DEFAULT=mixsdl
CHOICE_ioformat_OPTIONS="stdio stdio_zip" uqm_post_build() {
CHOICE_ioformat_TITLE="Supported file i/o methods" : # Nothing to do
CHOICE_ioformat_OPTION_stdio_TITLE="Only direct file i/o"
CHOICE_ioformat_OPTION_stdio_zip_TITLE="Direct & .zip file i/o"
CHOICE_ioformat_OPTION_stdio_zip_PRECOND="have_library zlib"
CHOICE_ioformat_OPTION_stdio_zip_ACTION="ioformat_stdio_zip_action"
ioformat_stdio_zip_action() {
CFLAGS="$CFLAGS -DHAVE_ZIP=1"
USE_ZIP_IO=1
use_library zlib
} }
CHOICE_ioformat_DEFAULT=stdio_zip
# Making static binaries is more complicated than this. uqm_pre_install() {
# For now, it will have to be done by hand. : # Nothing to do
#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 \ uqm_post_install() {
install_sharedir" : # Nothing to do
MENU_install_path_TITLE="Installation paths" }
MENU_install_path_ITEM_install_prefix_TYPE=INPUT
MENU_install_path_ITEM_install_bindir_TYPE=INPUT
MENU_install_path_ITEM_install_libdir_TYPE=INPUT
MENU_install_path_ITEM_install_sharedir_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 non-sharable data"
INPUT_install_libdir_VALIDATOR=validate_path
INPUT_install_sharedir_DEFAULT='$prefix/share'
INPUT_install_sharedir_TITLE="Location for sharable data"
INPUT_install_sharedir_VALIDATOR=validate_path
# Show the menu and let people set things
do_menu MENU main "$BUILD_WORK/config.state"
echo "Configuration complete."
# Set INSTALL_LIBDIR, INSTALL_BINDIR, and INSTALL_SHAREDIR to the specified
# values, replacing '$prefix' to the prefix set.
prefix="$INPUT_install_prefix_VALUE" \
eval INSTALL_BINDIR="${INPUT_install_bindir_VALUE%/}/"
prefix="$INPUT_install_prefix_VALUE" \
eval INSTALL_LIBDIR="${INPUT_install_libdir_VALUE%/}/"
prefix="$INPUT_install_prefix_VALUE" \
eval INSTALL_SHAREDIR="${INPUT_install_sharedir_VALUE%/}/"
# Set the content dir
CONTENTDIR="${INSTALL_SHAREDIR}uqm/content"
CFLAGS="$CFLAGS -I \"$BUILD_WORK\""
# Export the HAVE_ symbols to config_unix.h, using config_unix.h.in as template
SUBSTITUTE_VARS="$HAVE_SYMBOLS CONTENTDIR"
SUBSTITUTE_FILES="config_unix.h"
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES src "$BUILD_WORK"
# Make build.vars from build.vars.in, substituting variables.
SUBSTITUTE_VARS="CFLAGS LDFLAGS MAKE DEBUG SOUNDMODULE HAVE_OPENGL \
USE_ZIP_IO \
INSTALL_LIBDIR INSTALL_BINDIR INSTALL_SHAREDIR WINDRES"
SUBSTITUTE_FILES="build.vars"
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES . "$BUILD_WORK"
# Make 'uqm' shell script from build.vars.in, substituting variables.
SUBSTITUTE_VARS="INSTALL_LIBDIR INSTALL_BINDIR INSTALL_SHAREDIR uqm_NAME"
SUBSTITUTE_FILES="uqm-wrapper"
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES build/unix "$BUILD_WORK"
+8
View File
@@ -95,6 +95,9 @@ export "${BUILD_PROJECT}_CFLAGS" "${BUILD_PROJECT}_LDFLAGS"
eval ${BUILD_PROJECT}_OBJS=\${${BUILD_PROJECT}_OBJS%/}/ eval ${BUILD_PROJECT}_OBJS=\${${BUILD_PROJECT}_OBJS%/}/
export "${BUILD_PROJECT}_OBJS" export "${BUILD_PROJECT}_OBJS"
# Load the configuration functions
. build/unix/build.config
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
build_check_config build_check_config
build_check_dependencies build_check_dependencies
@@ -108,6 +111,10 @@ case "$2" in
;; ;;
config) config)
build_config build_config
build_process_config
;;
reprocess_config)
build_reconfig
;; ;;
depend) depend)
build_check_config build_check_config
@@ -125,3 +132,4 @@ case "$2" in
;; ;;
esac esac
+34 -4
View File
@@ -73,6 +73,10 @@ build_rec_dependancies() {
echo "Building dependancy information..." 1>&2 echo "Building dependancy information..." 1>&2
# Remove the old dependency file, if it exists.
# The .tmp file is used to detect interrupted dependency builds.
rm -f -- "$DEPEND_FILE".tmp "$DEPEND_FILE"
BUILD_FILES_VAR=${BUILD_PROJECT}_EXTRA_OFILES BUILD_FILES_VAR=${BUILD_PROJECT}_EXTRA_OFILES
export BUILD_FILES_VAR export BUILD_FILES_VAR
EXTRA_OFILES=`build_do_recursive build_collect_extra_o_files :` EXTRA_OFILES=`build_do_recursive build_collect_extra_o_files :`
@@ -88,7 +92,8 @@ build_rec_dependancies() {
done done
echo echo
build_do_recursive build_dependancies : build_do_recursive build_dependancies :
} > "$DEPEND_FILE" } > "$DEPEND_FILE".tmp
mv -f -- "$DEPEND_FILE".tmp "$DEPEND_FILE"
} }
# Output the .o file for a .c file. # Output the .o file for a .c file.
@@ -114,17 +119,38 @@ build_rec_collect_o_files() {
} }
# Start the configure program. # Start the configure program.
# $1 = target
build_config() { build_config() {
$SH build/unix/build.config config_requirements
eval "${TARGET}_requirements"
eval "${TARGET}_prepare_config"
eval "${TARGET}_do_config"
}
build_reconfig() {
if [ ! -e "$BUILD_WORK/config.state" ]; then
echo "*** Warning: file 'config.state' not found - using defaults."
fi
config_requirements
eval "${TARGET}_requirements"
build_process_config
echo "Reconfiguring complete..." 1>&2
}
# Process the configuration information
build_process_config() {
eval "${TARGET}_process_config"
} }
# Compile the lot. # Compile the lot.
# With the depend info set up, we can leave everything to make. # With the depend info set up, we can leave everything to make.
build_compile() { build_compile() {
eval "${TARGET}_pre_build"
eval CFLAGS="\${${BUILD_PROJECT}_CFLAGS}" \ eval CFLAGS="\${${BUILD_PROJECT}_CFLAGS}" \
LDFLAGS="\${${BUILD_PROJECT}_LDFLAGS}" \ LDFLAGS="\${${BUILD_PROJECT}_LDFLAGS}" \
DEPEND_FILE="\$BUILD_WORK/.depend.\${${BUILD_PROJECT}_NAME%/}" \ DEPEND_FILE="\$BUILD_WORK/.depend.\${${BUILD_PROJECT}_NAME%/}" \
\$MAKE -f Makefile.build "\$BUILD_WORK/target-\${${BUILD_PROJECT}_NAME}" \$MAKE -f Makefile.build "\$BUILD_WORK/target-\${${BUILD_PROJECT}_NAME}"
eval "${TARGET}_post_build"
} }
# Description: Remove the .o file for one .c file # Description: Remove the .o file for one .c file
@@ -165,12 +191,12 @@ build_distclean() {
# Description: check if the config files are present and load them. # Description: check if the config files are present and load them.
# If they're not present, remake them. # If they're not present, remake them.
build_check_config() { build_check_config() {
[ ! -e "$BUILD_WORK/build.vars" -o -n "$BUILD_RUN_CONFIG" ] || return [ ! -e "$BUILD_WORK/build.vars" ] || return
build_config || exit $? build_config || exit $?
build_process_config
. "$BUILD_WORK/build.vars" . "$BUILD_WORK/build.vars"
. "${BUILD_REC_PATH:=./}Makeinfo" . "${BUILD_REC_PATH:=./}Makeinfo"
unset BUILD_RUN_CONFIG
} }
# Description: check if the necessary .depend file is present, # Description: check if the necessary .depend file is present,
@@ -265,6 +291,8 @@ installsome() {
# Install the program # Install the program
build_install() { build_install() {
local SRC DEST MODE OWNER local SRC DEST MODE OWNER
eval "${TARGET}_pre_install"
local LIB LIBS LIBDIR local LIB LIBS LIBDIR
echo "Installing system-dependant data..." 1>&2 echo "Installing system-dependant data..." 1>&2
@@ -304,6 +332,8 @@ build_install() {
eval OWNER="\${${BUILD_PROJECT}_INSTALL_BIN_${BIN}_OWNER}" eval OWNER="\${${BUILD_PROJECT}_INSTALL_BIN_${BIN}_OWNER}"
installsome "$SRC" "$DEST" "$MODE" "$OWNER" installsome "$SRC" "$DEST" "$MODE" "$OWNER"
done done
eval "${TARGET}_post_install"
} }
+9 -7
View File
@@ -386,12 +386,14 @@ EOF
# Some initialisations # Some initialisations
HAVE_SYMBOLS="" HAVE_SYMBOLS=""
# Requirements for the config program itself config_requirements() {
have_program sed || exit 1 # Requirements for the config program itself
SED="$PROG_sed_FILE" have_program sed || exit 1
have_program tr || exit 1 SED="$PROG_sed_FILE"
TR="$PROG_tr_FILE" have_program tr || exit 1
have_program make || exit 1 TR="$PROG_tr_FILE"
MAKE="$PROG_make_FILE" have_program make || exit 1
MAKE="$PROG_make_FILE"
}
+37 -16
View File
@@ -603,28 +603,49 @@ menu_process_check() {
# Description: Start processing a menu # Description: Start processing a menu
# Arguments: $1 - the type of the main menu # Arguments: $1 - the type of the main menu
# $2 - the name of the main menu # $2 - the name of the main menu
# $3 - the path to the file to load and save the settings from/to
# (the file does not have to exist; in this case nothing is
# loaded)
# if the argument is empty, nothing is saved nor loaded
do_menu() { do_menu() {
local MENU_TYPE START_MENU SAVE_FILE local MENU_TYPE START_MENU SAVE_FILE
MENU_TYPE="$1" MENU_TYPE=$1
START_MENU="$2" START_MENU=$2
SAVE_FILE="$3"
if [ -n "$SAVE_FILE" -a -e "$SAVE_FILE" ]; then
. "$SAVE_FILE"
fi
menu_init "$MENU_TYPE" "$START_MENU" menu_init "$MENU_TYPE" "$START_MENU"
menu_handle "$MENU_TYPE" "$START_MENU" menu_handle "$MENU_TYPE" "$START_MENU"
echo echo
if [ -n "$SAVE_FILE" ]; then
echo "Saving choices..."
menu_save "$MENU_TYPE" "$START_MENU" > "$SAVE_FILE"
fi
# echo "Propagating choices..."
menu_process "$MENU_TYPE" "$START_MENU"
} }
# Description: Load the menu settings from file
# Arguments: $1 - the type of the menu (currently ignored)
# $2 - the name of the menu (currently ignored)
# $3 - the name of the file to load from
# Returns: 0 - if the file was loaded successfully
# 1 - if the file did not exist
menu_load() {
SAVE_FILE=$3
if [ ! -e "$SAVE_FILE" ]; then
return 1
fi
. "$SAVE_FILE"
return 0
}
# Description: Save the menu settings to file
# Arguments: $1 - the type of the menu
# $2 - the name of the menu
# $3 - the name of the file to save to
# Returns: 0 - if the file was saved successfully
menu_save() {
MENU_TYPE=$1
START_MENU=$2
SAVE_FILE=$3
echo "Saving choices..."
menu_save "$MENU_TYPE" "$START_MENU" > "$SAVE_FILE"
return 0
}