Better dependency checking.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1504 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-02-01 15:18:16 +00:00
parent 58cba1e5b4
commit f9ab3ae49a
7 changed files with 260 additions and 96 deletions
+3 -1
View File
@@ -82,8 +82,10 @@ uqm_prepare_config()
-Wstrict-prototypes -Wmissing-declarations \ -Wstrict-prototypes -Wmissing-declarations \
-Wwrite-strings -Wimplicit -Wreturn-type -Wformat \ -Wwrite-strings -Wimplicit -Wreturn-type -Wformat \
-Wswitch -Wcomment -Wchar-subscripts \ -Wswitch -Wcomment -Wchar-subscripts \
-Wparentheses -Wcast-align -Waggregate-return \ -Wparentheses -Wcast-align \
-Winline -Wuninitialized" -Winline -Wuninitialized"
# CFLAGS="$CFLAGS -Waggregate-return"
# It's not unreasonable to return structs at times.
# CFLAGS="$CFLAGS "-Wpointer-arith" # CFLAGS="$CFLAGS "-Wpointer-arith"
# Some standard header won't even compile with this on # Some standard header won't even compile with this on
# CFLAGS="$CFLAGS -Wshadow" # CFLAGS="$CFLAGS -Wshadow"
+18 -6
View File
@@ -18,21 +18,21 @@ The files
These are the files in the directory with the build script. These are the files in the directory with the build script.
Of these files only build.config should be modified for a specific build. Of these files only build.config should be modified for a specific build.
For unknown dependancies, additions to config_proginfo might need to be For unknown dependencies, additions to config_proginfo might need to be
made. The other files should not be modified. made. The other files should not be modified.
Only build.sh is to be called directly. Only build.sh is to be called directly.
ansi ansi colour definitions. ansi ansi colour definitions.
build.config configuration options for the program to build. build.config configuration options for the program to build.
It contains the description of the configuration It contains the description of the configuration
menu, and specifies the dependancies. menu, and specifies the dependencies.
The format of the menu description is listed briefly The format of the menu description is listed briefly
below. below.
build.sh the sh script that is to be called for configuration, build.sh the sh script that is to be called for configuration,
building, and installation. building, and installation.
build_functions auxiliary functions to build.sh for building. build_functions auxiliary functions to build.sh for building.
config_functions auxiliary functions to build.sh for configuration. config_functions auxiliary functions to build.sh for configuration.
config_proginfo contains descriptions of dependancies. config_proginfo contains descriptions of dependencies.
The information in this file is used in particular for The information in this file is used in particular for
detecting if those libraries and other external programs detecting if those libraries and other external programs
are present. are present.
@@ -127,13 +127,19 @@ Information about programs used should be supplied in the following form:
This command may include a shell command that modifies any of the This command may include a shell command that modifies any of the
variables PROG_${PROGRAM}_FILE, PROG_${PROGRAM}_ACTION, or variables PROG_${PROGRAM}_FILE, PROG_${PROGRAM}_ACTION, or
PROG_${PROGRAM}_VERSION. PROG_${PROGRAM}_VERSION.
- PROG_${LIB}_DEPEND_DETECT_BIN (optional)
A list of space-separated binaries the detection of this program
depends on.
- PROG_${LIB}_DEPEND_DETECT_LIB (optional)
A list of space-separated libraries the detection of this program
depends on.
- PROG_${PROGRAM}_VERSION (optional) - PROG_${PROGRAM}_VERSION (optional)
A string that evaluates to the version of the executable that is A string that evaluates to the version of the executable that is
present, if it is present. present, if it is present.
- PROG_${PROGRAM}_PRESENT (set by the configuration program) - PROG_${PROGRAM}_PRESENT (set by the configuration program)
0 if the program has been verified to be present 0 if the program has been verified to be present
1 if the program has been verified to be not present 1 if the program has been verified to be not present
<empty> if the program hasn't been verified to be present <empty> if presence of the program hasn't been verified
Library info (from config_proginfo) Library info (from config_proginfo)
@@ -154,14 +160,20 @@ Information about libraries used should be supplied in the following form:
made to compile and link an empty C program with the flags as in made to compile and link an empty C program with the flags as in
LIB_${LIB}_CFLAGS and LIB_${LIB}_LDFLAGS. LIB_${LIB}_CFLAGS and LIB_${LIB}_LDFLAGS.
This command may include a shell command that modifies any of the This command may include a shell command that modifies any of the
variables PROG_${LIB}_FILE, PROG_${LIB}_ACTION, or variables PROG_${LIB}_CFLAGS, PROG_${LIB}_LDFLAGS, or
PROG_${LIB}_VERSION. PROG_${LIB}_VERSION.
- LIB_${LIB}_DEPEND_DETECT_BIN (optional)
A list of space-separated binaries the detection of this library depends
on.
- LIB_${LIB}_DEPEND_DETECT_LIB (optional)
A list of space-separated libraries the detection of this library depends
on.
- LIB_${LIB}_VERSION (optional) - LIB_${LIB}_VERSION (optional)
A string that evaluates to the version of the library that is A string that evaluates to the version of the library that is
present, if it is present. present, if it is present.
- LIB_${LIB}_PRESENT (set by the configuration program) - LIB_${LIB}_PRESENT (set by the configuration program)
0 if the library has been verified to be present 0 if the library has been verified to be present
1 if the library has been verified to be not present 1 if the library has been verified to be not present
<empty> if the library hasn't been verified to be present <empty> if presence of the library hasn't been verified
+1 -1
View File
@@ -118,7 +118,7 @@ case "$2" in
;; ;;
depend) depend)
build_check_config build_check_config
build_rec_dependancies build_rec_dependencies
;; ;;
install) install)
build_check_config build_check_config
+16 -14
View File
@@ -67,21 +67,24 @@ build_do_recursive() {
build_recurse build_recurse
} }
# Build dependancy information for one file # Build dependency information for one file
build_dependancies() { build_dependencies() {
eval $ECHON \$BUILD_WORK/\${${BUILD_PROJECT}_OBJS}\$BUILD_REC_PATH eval $ECHON \$BUILD_WORK/\${${BUILD_PROJECT}_OBJS}\$BUILD_REC_PATH
eval eval \\\$MKDEPEND \"\${${BUILD_PROJECT}_CFLAGS}\" \"\\\$1\" eval eval \\\$MKDEPEND \"\${${BUILD_PROJECT}_CFLAGS}\" \"\\\$1\" | \
grep -v '#'
} }
# Recursively build dependancy information # Recursively build dependency information
build_rec_dependancies() { build_rec_dependencies() {
local DEPEND_FILE EXTRA_OFILES local DEPEND_FILE EXTRA_OFILES
echo "Building dependancy information..." 1>&2 echo "Building dependency information..." 1>&2
BUILD_WORK_ESC=`escape_string "$BUILD_WORK"` BUILD_WORK_ESC=`escape_string "$BUILD_WORK"`
export BUILD_WORK_ESC export BUILD_WORK_ESC
eval DEPEND_FILE="\$BUILD_WORK/\${${BUILD_PROJECT}_OBJS}.depend"
# Remove the old dependency file, if it exists. # Remove the old dependency file, if it exists.
# The .tmp file is used to detect interrupted dependency builds. # The .tmp file is used to detect interrupted dependency builds.
rm -f -- "$DEPEND_FILE".tmp "$DEPEND_FILE" rm -f -- "$DEPEND_FILE".tmp "$DEPEND_FILE"
@@ -93,14 +96,13 @@ build_rec_dependancies() {
BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES
OFILES=`build_do_recursive build_collect_o_files :` OFILES=`build_do_recursive build_collect_o_files :`
eval DEPEND_FILE="\$BUILD_WORK/.depend.\${${BUILD_PROJECT}_NAME}"
{ {
eval $ECHON "\$BUILD_WORK_ESC/target-\${${BUILD_PROJECT}_NAME}:" eval $ECHON "\$BUILD_WORK_ESC/target-\${${BUILD_PROJECT}_NAME}:"
for OFILE in $OFILES $EXTRA_OFILES; do for OFILE in $OFILES $EXTRA_OFILES; do
$ECHON " $OFILE" $ECHON " $OFILE"
done done
echo echo
build_do_recursive build_dependancies : build_do_recursive build_dependencies :
} > "$DEPEND_FILE".tmp } > "$DEPEND_FILE".tmp
mv -f -- "$DEPEND_FILE".tmp "$DEPEND_FILE" mv -f -- "$DEPEND_FILE".tmp "$DEPEND_FILE"
} }
@@ -166,7 +168,7 @@ build_compile() {
eval "${TARGET}_pre_build" 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/\${${BUILD_PROJECT}_OBJS}.depend" \
\$MAKE -f Makefile.build \"\$BUILD_WORK/target-\${${BUILD_PROJECT}_NAME}\" \$MAKE -f Makefile.build \"\$BUILD_WORK/target-\${${BUILD_PROJECT}_NAME}\"
eval "${TARGET}_post_build" eval "${TARGET}_post_build"
} }
@@ -184,7 +186,7 @@ build_clean_dir() {
build_clean() { build_clean() {
local DEPEND_FILE local DEPEND_FILE
eval DEPEND_FILE="\$BUILD_WORK/.depend.\${${BUILD_PROJECT}_NAME%/}" eval DEPEND_FILE="\$BUILD_WORK/\${${BUILD_PROJECT}_OBJS}.depend"
rm -f "$DEPEND_FILE" "$BUILD_WORK/build.vars" \ rm -f "$DEPEND_FILE" "$BUILD_WORK/build.vars" \
"$BUILD_WORK/config.state" "$BUILD_WORK/config_unix.h" "$BUILD_WORK/config.state" "$BUILD_WORK/config_unix.h"
BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES
@@ -220,10 +222,10 @@ build_check_config() {
# Description: check if the necessary .depend file is present, # Description: check if the necessary .depend file is present,
# if not, build it. # if not, build it.
build_check_dependencies() { build_check_dependencies() {
eval DEPEND_FILE="\$BUILD_WORK/.depend.\${${BUILD_PROJECT}_NAME}" eval DEPEND_FILE="\$BUILD_WORK/\${${BUILD_PROJECT}_OBJS}.depend"
[ ! -e "$DEPEND_FILE" -o -n "$BUILD_RUN_DEPEND" ] || return [ ! -e "$DEPEND_FILE" -o -n "$BUILD_RUN_DEPEND" ] || return
build_rec_dependancies || exit $? build_rec_dependencies || exit $?
} }
# Description: check if the program is compiled, and otherwise compile # Description: check if the program is compiled, and otherwise compile
@@ -313,7 +315,7 @@ build_install() {
eval "${TARGET}_pre_install" eval "${TARGET}_pre_install"
local LIB LIBS LIBDIR local LIB LIBS LIBDIR
echo "Installing system-dependant data..." 1>&2 echo "Installing system-dependent data..." 1>&2
eval LIBS="\${${BUILD_PROJECT}_INSTALL_LIBS}" eval LIBS="\${${BUILD_PROJECT}_INSTALL_LIBS}"
eval LIBDIR="\${${BUILD_PROJECT}_INSTALL_LIBDIR%/}/" eval LIBDIR="\${${BUILD_PROJECT}_INSTALL_LIBDIR%/}/"
mkdirhier "$LIBDIR" 0755 mkdirhier "$LIBDIR" 0755
@@ -326,7 +328,7 @@ build_install() {
done done
local SHARE SHARED SHAREDIR local SHARE SHARED SHAREDIR
echo "Installing system-independant data..." 1>&2 echo "Installing system-independent data..." 1>&2
eval SHARED="\${${BUILD_PROJECT}_INSTALL_SHARED}" eval SHARED="\${${BUILD_PROJECT}_INSTALL_SHARED}"
eval SHAREDIR="\${${BUILD_PROJECT}_INSTALL_SHAREDIR%/}/" eval SHAREDIR="\${${BUILD_PROJECT}_INSTALL_SHAREDIR%/}/"
mkdirhier "$SHAREDIR" 0755 mkdirhier "$SHAREDIR" 0755
+128 -5
View File
@@ -94,10 +94,43 @@ lexlt() {
return `expr "$1" ">=" "$2"` return `expr "$1" ">=" "$2"`
} }
# Description: try to detect a list of program dependencies.
# This only makes sure the PROG_xxx_PRESENT flag is set.
# It does not bail out if a dependency is not found.
# This function is called for programs in
# PROG_xxx_DEPEND_DETECT_PROG or LIB_xxx_DEPEND_PROG.
# Using have_program in the respective depend functions would
# not save the PRESENT flag, as it is executed in a subshell.
# Arguments: $1 - the list of programs
detect_dependencies_program() {
local PROGS PROG
PROGS=$1
for PROG in $PROGS; do
have_program "$PROG"
done
}
# Description: try to detect a list of library dependencies.
# This only makes sure the LIB_xxx_PRESENT flag is set.
# It does not bail out if a dependency is not found.
# This function is called for libraries in
# PROG_xxx_DEPEND_DETECT_LIB or LIB_xxx_DEPEND_LIB.
# Using have_library in the respective depend functions would
# not save the PRESENT flag, as it is executed in a subshell.
# Arguments: $1 - the list of libaries
detect_dependencies_library() {
local LIBS LIB
LIBS=$1
for LIB in $LIBS; do
have_library "$LIB"
done
}
# Description: check if a program is present in the path # Description: check if a program is present in the path
# Arguments: # Arguments:
have_program() { have_program() {
local PROG TEMP_NAME TEMP_FILE TEMP_VERSION TEMP_DETECT local PROG TEMP_NAME TEMP_FILE TEMP_VERSION TEMP_PRESENT TEMP_DETECT
local TEMP_DEPEND_DETECT_PROG TEMP_DEPEND_DETECT_LIB
PROG="$1" PROG="$1"
eval eval TEMP_NAME="\\\"\$PROG_${PROG}_NAME\\\"" eval eval TEMP_NAME="\\\"\$PROG_${PROG}_NAME\\\""
@@ -106,12 +139,22 @@ have_program() {
exit 1 exit 1
fi fi
eval TEMP_PRESENT="\$PROG_${PROG}_PRESENT"
if [ -n "$TEMP_PRESENT" ]; then
return "$TEMP_PRESENT"
fi
eval eval TEMP_DETECT="\\\"\$PROG_${PROG}_DETECT\\\"" eval eval TEMP_DETECT="\\\"\$PROG_${PROG}_DETECT\\\""
if [ -n "$TEMP_DETECT" ]; then if [ -n "$TEMP_DETECT" ]; then
eval eval TEMP_DEPEND_PROG="\\\"\$PROG_${PROG}_DEPEND_DETECT_PROG\\\""
eval eval TEMP_DEPEND_LIB="\\\"\$PROG_${PROG}_DEPEND_DETECT_LIB\\\""
detect_dependencies_program "$TEMP_DEPEND_PROG"
detect_dependencies_library "$TEMP_DEPEND_LIB"
$TEMP_DETECT $TEMP_DETECT
# NB. TEMP_DETECT should make sure PROG_${PROG}_VERSION and # NB. TEMP_DETECT should make sure PROG_${PROG}_VERSION and
# PROG_${PROG}_FILE are set. # PROG_${PROG}_FILE are set.
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
eval "PROG_${PROG}_PRESENT"=1
build_message "$TEMP_NAME not found." build_message "$TEMP_NAME not found."
return 1 return 1
fi fi
@@ -121,6 +164,7 @@ have_program() {
type "${TEMP_FILE%% *}" > /dev/null 2>&1 type "${TEMP_FILE%% *}" > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
eval "PROG_${PROG}_PRESENT"=1
build_message "$TEMP_NAME not found." build_message "$TEMP_NAME not found."
return 1 return 1
fi fi
@@ -129,24 +173,29 @@ have_program() {
# Minimum version supplied # Minimum version supplied
eval eval TEMP_VERSION="\\\"\$PROG_${PROG}_VERSION\\\"" eval eval TEMP_VERSION="\\\"\$PROG_${PROG}_VERSION\\\""
if [ -z "$TEMP_VERSION" ]; then if [ -z "$TEMP_VERSION" ]; then
eval "PROG_${PROG}_PRESENT"=1
echo "Fatal: Could not determine version of $TEMP_NAME" >&2 echo "Fatal: Could not determine version of $TEMP_NAME" >&2
exit 1 exit 1
fi fi
if lexlt "$TEMP_VERSION" "$2" ; then if lexlt "$TEMP_VERSION" "$2" ; then
eval "PROG_${PROG}_PRESENT"=1
build_message "Found version $TEMP_VERSION of $TEMP_NAME, \ build_message "Found version $TEMP_VERSION of $TEMP_NAME, \
but version $2 is required!" but version $2 is required!"
return 1 return 1
fi fi
eval "PROG_${PROG}_PRESENT"=0
build_message "$TEMP_NAME version $TEMP_VERSION found." build_message "$TEMP_NAME version $TEMP_VERSION found."
return 0 return 0
fi fi
eval "PROG_${PROG}_PRESENT"=0
build_message "$TEMP_NAME found." build_message "$TEMP_NAME found."
return 0 return 0
} }
# Description: check if a library is present on the system # Description: check if a library is present on the system
# Arguments: $1 - The name of the library without 'lib' of '.so' # Arguments: $1 - The name of the library as used in config_proginfo after
# "LIB_"
# $2 - (optional) minimum version required # $2 - (optional) minimum version required
# Pre: variables LIB_${1}_NAME, LIB_${1}_CFLAGS, and # Pre: variables LIB_${1}_NAME, LIB_${1}_CFLAGS, and
# LIB_${1}_LDFLAGS are expected to exist. If two arguments are # LIB_${1}_LDFLAGS are expected to exist. If two arguments are
@@ -156,11 +205,12 @@ but version $2 is required!"
have_library() { have_library() {
local LIB TEMP_NAME TEMP_PRESENT TEMP_LDFLAGS TEMP_CFLAGS \ local LIB TEMP_NAME TEMP_PRESENT TEMP_LDFLAGS TEMP_CFLAGS \
TEMP_VERSION TEMP_DETECT TEMP_VERSION TEMP_DETECT
local TEMP_DEPEND_DETECT_PROG TEMP_DEPEND_DETECT_LIB
LIB="$1" LIB="$1"
eval eval TEMP_NAME="\\\"\$LIB_${1}_NAME\\\"" eval eval TEMP_NAME="\\\"\$LIB_${LIB}_NAME\\\""
if [ -z "$TEMP_NAME" ]; then if [ -z "$TEMP_NAME" ]; then
echo "Fatal: Library '$1' is not defined!" >&2 echo "Fatal: Library '$LIB' is not defined!" >&2
exit 1 exit 1
fi fi
@@ -172,6 +222,10 @@ have_library() {
eval eval TEMP_DETECT="\\\"\$LIB_${LIB}_DETECT\\\"" eval eval TEMP_DETECT="\\\"\$LIB_${LIB}_DETECT\\\""
if [ -n "$TEMP_DETECT" ]; then if [ -n "$TEMP_DETECT" ]; then
$TEMP_DETECT $TEMP_DETECT
eval eval TEMP_DEPEND_PROG="\\\"\$PROG_${PROG}_DEPEND_DETECT_PROG\\\""
eval eval TEMP_DEPEND_LIB="\\\"\$PROG_${PROG}_DEPEND_DETECT_LIB\\\""
detect_dependencies_program "$TEMP_DEPEND_PROG"
detect_dependencies_library "$TEMP_DEPEND_LIB"
# NB. TEMP_DETECT should make sure PROG_$LIB_VERSION is set. # NB. TEMP_DETECT should make sure PROG_$LIB_VERSION is set.
# return value of $TEMP_DETECT is used below. # return value of $TEMP_DETECT is used below.
else else
@@ -220,7 +274,8 @@ but version $2 is required"
# Description: check if a library is present on the system. # Description: check if a library is present on the system.
# If it is, add the appropriate flags to CFLAGS and LDFLAGS. # If it is, add the appropriate flags to CFLAGS and LDFLAGS.
# If not, bail out. # If not, bail out.
# Arguments: $1 - The name of the library without 'lib' of '.so' # Arguments: $1 - The name of the library as used in config_proginfo after
# "LIB_"
# $2 - (optional) minimum version required # $2 - (optional) minimum version required
# Pre: variables LIB_${1}_NAME, LIB_${1}_CFLAGS, and # Pre: variables LIB_${1}_NAME, LIB_${1}_CFLAGS, and
# LIB_${1}_LDFLAGS are expected to exist. If two arguments are # LIB_${1}_LDFLAGS are expected to exist. If two arguments are
@@ -350,6 +405,74 @@ EOF
fi fi
} }
# Description: If pkg-config is installed, check if there's a pkg-config
# entry for some binary dependency.
# If successful, it sets the appropriate BIN_xxx_VERSION.
# Arguments: $1 - The name of the program as it is known in
# config_proginfo after "BIN_"
# $2 - The name of the dependency as it would be known to
# pkg-config.
try_pkgconfig_prog() {
have_program pkgconfig || return 1
local PROG PKG_NAME TEMP_NAME
PROG=$1
PKG_NAME=$2
eval eval TEMP_NAME="\\\"\$PROG_${PROG}_NAME\\\""
if [ -z "$TEMP_NAME" ]; then
echo "Fatal: Program '$PROG' is not defined!" >&2
exit 1
fi
if $PROG_pkgconfig_FILE --exists "$PKG_NAME"; then
local TEMP_VERSION
TEMP_VERSION=$($PROG_pkgconfig_FILE --modversion "$PKG_NAME")
eval PROG_${PROG}_VERSION=\$TEMP_VERSION
return 0
else
return 1
fi
}
# Description: If pkg-config is installed, check if there's a pkg-config
# entry for some dependency.
# If successful, it sets the appropriate LIB_xxx_VERSION,
# LIB_xxx_CFLAGS and LIB_xxx_LDFLAGS.
# Arguments: $1 - The name of the library as it is known in
# config_proginfo after "LIB_"
# $2 - The name of the dependency as it would be known to
# pkg-config.
try_pkgconfig_lib() {
have_program pkgconfig || return 1
local LIB PKG_NAME TEMP_NAME
LIB=$1
PKG_NAME=$2
eval eval TEMP_NAME="\\\"\$LIB_${LIB}_NAME\\\""
if [ -z "$TEMP_NAME" ]; then
echo "Fatal: Library '$LIB' is not defined!" >&2
exit 1
fi
if $PROG_pkgconfig_FILE --exists "$PKG_NAME"; then
local TEMP_VERSION TEMP_CFLAGS TEMP_LDFLAGS
TEMP_VERSION=$($PROG_pkgconfig_FILE --modversion "$PKG_NAME")
TEMP_CFLAGS=$($PROG_pkgconfig_FILE --cflags "$PKG_NAME")
TEMP_LDFLAGS=$($PROG_pkgconfig_FILE --libs "$PKG_NAME")
eval LIB_${LIB}_VERSION=\$TEMP_VERSION
eval LIB_${LIB}_CFLAGS=\$TEMP_CFLAGS
eval LIB_${LIB}_LDFLAGS=\$TEMP_LDFLAGS
return 0
else
return 1
fi
}
# Description: substitute variables in files. # Description: substitute variables in files.
# Every supplied variable name found between @'s in the # Every supplied variable name found between @'s in the
# supplied files, is replaced by its value. # supplied files, is replaced by its value.
+87 -56
View File
@@ -17,17 +17,26 @@
OSNAME=`uname -s` OSNAME=`uname -s`
# Describe the programs (possibly) used: ##############################################################################
# Describe the programs (possibly) used: #
##############################################################################
### gcc ###
PROG_gcc_NAME="GNU C compiler" PROG_gcc_NAME="GNU C compiler"
PROG_gcc_FILE="gcc" PROG_gcc_FILE="gcc"
PROG_gcc_ACTION="" PROG_gcc_ACTION=""
PROG_gcc_VERSION='$(gcc --version)' PROG_gcc_VERSION='$(gcc --version)'
### sed ###
PROG_sed_NAME="Sed stream editor" PROG_sed_NAME="Sed stream editor"
PROG_sed_FILE="sed" PROG_sed_FILE="sed"
PROG_sed_ACTION="" PROG_sed_ACTION=""
PROG_sed_VERSION='' PROG_sed_VERSION=''
### echo -n ###
PROG_echon_NAME="'echo -n' capable echo" PROG_echon_NAME="'echo -n' capable echo"
PROG_echon_FILE="" PROG_echon_FILE=""
PROG_echon_ACTION="" PROG_echon_ACTION=""
@@ -61,6 +70,8 @@ echon_detect() {
return 1 return 1
} }
### GNU Make ###
PROG_make_NAME="Make" PROG_make_NAME="Make"
case "$OSNAME" in case "$OSNAME" in
FreeBSD|OpenBSD|SunOS) FreeBSD|OpenBSD|SunOS)
@@ -73,106 +84,115 @@ esac
PROG_make_ACTION="" PROG_make_ACTION=""
PROG_make_VERSION='' PROG_make_VERSION=''
### tr ###
PROG_tr_NAME="tr" PROG_tr_NAME="tr"
PROG_tr_FILE="tr" PROG_tr_FILE="tr"
PROG_tr_ACTION="" PROG_tr_ACTION=""
PROG_tr_VERSION='' PROG_tr_VERSION=''
### windres (for Windows) ###
PROG_windres_NAME=windres PROG_windres_NAME=windres
PROG_windres_FILE=windres PROG_windres_FILE=windres
PROG_windres_ACTION="" PROG_windres_ACTION=""
PROG_windres_VERSION='windres --version' PROG_windres_VERSION='windres --version'
### Rez resource compiler (for MacOS X) only ###
PROG_Rez_NAME="Rez resource compiler (Apple Developer Tools)" PROG_Rez_NAME="Rez resource compiler (Apple Developer Tools)"
PROG_Rez_FILE="/Developer/Tools/Rez" PROG_Rez_FILE="/Developer/Tools/Rez"
PROG_Rez_ACTION='' PROG_Rez_ACTION=""
PROG_Rez_VERSION='' PROG_Rez_VERSION=''
### SetFile (for MacOS X) only ###
PROG_SetFile_NAME="SetFile (Apple Developer Tools)" PROG_SetFile_NAME="SetFile (Apple Developer Tools)"
PROG_SetFile_FILE="/Developer/Tools/SetFile" PROG_SetFile_FILE="/Developer/Tools/SetFile"
PROG_SetFile_ACTION='' PROG_SetFile_ACTION=""
PROG_SetFile_VERSION='' PROG_SetFile_VERSION=''
# Describe the libaries (possibly) used: ### pkg-config ###
LIB_SDL_NAME="Simple DirectMedia Layer" PROG_pkgconfig_NAME="pkg-config"
PROG_pkgconfig_FILE="pkg-config"
PROG_pkgconfig_ACTION=""
PROG_pkgconfig_VERSION='$(pkg-config --version)'
##############################################################################
# Describe the libaries (possibly) used: #
##############################################################################
### SDL ###
LIB_SDL_NAME="Simple DirectMedia Layer"
case "$OSNAME" in case "$OSNAME" in
FreeBSD) LIB_SDL_CFLAGS='$(sdl11-config --cflags)' ;; FreeBSD)
Darwin) LIB_SDL_CFLAGS='-I/System/Library/Frameworks/SDL.framework/Headers LIB_SDL_CFLAGS='$(sdl11-config --cflags)'
LIB_SDL_LDFLAGS='$(sdl11-config --libs)'
LIB_SDL_VERSION='$(sdl11-config --version)'
;;
Darwin)
LIB_SDL_CFLAGS='-I/System/Library/Frameworks/SDL.framework/Headers
-I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL.framework/Headers
-I$HOME/Library/Frameworks/SDL.framework/Headers' -I$HOME/Library/Frameworks/SDL.framework/Headers'
;; LIB_SDL_LDFLAGS='-framework SDL -framework Cocoa -lobjc'
*) LIB_SDL_CFLAGS='$(sdl-config --cflags)' ;; LIB_SDL_VERSION=$(echo \
esac
case "$OSNAME" in
FreeBSD) LIB_SDL_LDFLAGS='$(sdl11-config --libs)' ;;
Darwin) LIB_SDL_LDFLAGS='-framework SDL -framework Cocoa -lobjc' ;;
*) LIB_SDL_LDFLAGS='$(sdl-config --libs)' ;;
esac
case "$OSNAME" in
FreeBSD) LIB_SDL_VERSION='$(sdl11-config --version)' ;;
Darwin) LIB_SDL_VERSION=$(echo \
"SDL_MAJOR_VERSION.SDL_MINOR_VERSION.SDL_PATCHLEVEL" | \ "SDL_MAJOR_VERSION.SDL_MINOR_VERSION.SDL_PATCHLEVEL" | \
gcc -E -include SDL_version.h $LIB_SDL_CFLAGS - | \ gcc -E -include SDL_version.h $LIB_SDL_CFLAGS - | \
tail -1 | tr -d ' ') ;; tail -1 | tr -d ' ')
*) LIB_SDL_VERSION='$(sdl-config --version)' ;; ;;
esac *)
case "$OSNAME" in LIB_SDL_CFLAGS='$(sdl-config --cflags)'
Disabled) LIB_SDL_LDFLAGS='$(sdl-config --libs)'
LIB_SDL_DETECT="Darwin_SDL_detect SDL" LIB_SDL_VERSION='$(sdl-config --version)'
Darwin_SDL_detect() {
local LIB TEMP_LDFLAGS TEMP_CFLAGS
LIB=$1
eval eval TEMP_LDFLAGS="\\\"\$LIB_${LIB}_LDFLAGS\\\""
eval eval TEMP_CFLAGS="\\\"\$LIB_${LIB}_CFLAGS\\\""
try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF
#include "SDL.h"
int main(int argc, char *argv[]) {
(void) argc; /* Get rid of unused variable warning */
(void) argv; /* Get rid of unused variable warning */
return 0;
}
EOF
return $?
}
;; ;;
esac esac
### SDL_mixer ###
LIB_SDL_mixer_NAME="SDL_mixer" LIB_SDL_mixer_NAME="SDL_mixer"
LIB_SDL_mixer_CFLAGS="$LIB_SDL_CFLAGS" LIB_SDL_mixer_CFLAGS="$LIB_SDL_CFLAGS"
LIB_SDL_mixer_LDFLAGS="$LIB_SDL_LDFLAGS -lSDL_mixer" LIB_SDL_mixer_LDFLAGS="$LIB_SDL_LDFLAGS -lSDL_mixer"
LIB_SDL_mixer_VERSION="" LIB_SDL_mixer_VERSION=""
case "$OSNAME" in
Disabled) LIB_SDL_mixer_DETECT="Darwin_SDL_detect SDL_mixer" ;;
esac
### SDL_image ###
LIB_SDL_image_NAME="SDL_image" LIB_SDL_image_NAME="SDL_image"
case "$OSNAME" in case "$OSNAME" in
Darwin) LIB_SDL_image_CFLAGS="-I/System/Library/Frameworks/SDL_image.framework/Headers Darwin)
LIB_SDL_image_CFLAGS="-I/System/Library/Frameworks/SDL_image.framework/Headers
-I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers
-I$HOME/Library/Frameworks/SDL_image.framework/Headers" -I$HOME/Library/Frameworks/SDL_image.framework/Headers"
LIB_SDL_image_LDFLAGS="-framework SDL_image"
;;
*)
LIB_SDL_image_CFLAGS="$LIB_SDL_CFLAGS"
LIB_SDL_image_LDFLAGS="$LIB_SDL_LDFLAGS -lSDL_image"
;; ;;
*) LIB_SDL_image_CFLAGS="$LIB_SDL_CFLAGS" ;;
esac
case "$OSNAME" in
Darwin) LIB_SDL_image_LDFLAGS="-framework SDL_image" ;;
*) LIB_SDL_image_LDFLAGS="$LIB_SDL_LDFLAGS -lSDL_image" ;;
esac esac
LIB_SDL_image_VERSION="" LIB_SDL_image_VERSION=""
case "$OSNAME" in
Disabled) LIB_SDL_image_DETECT="Darwin_SDL_detect SDL_image" ;;
esac
### OpenAL ###
LIB_openal_NAME="OpenAL" LIB_openal_NAME="OpenAL"
LIB_openal_CFLAGS="" LIB_openal_CFLAGS=""
case "$OSNAME" in case "$OSNAME" in
FreeBSD|OpenBSD) LIB_openal_LDFLAGS="-L/usr/local/lib -pthread -lopenal" ;; FreeBSD|OpenBSD)
MINGW32*) LIB_openal_LDFLAGS="-lopenal32" ;; LIB_openal_LDFLAGS="-L/usr/local/lib -pthread -lopenal"
*) LIB_openal_LDFLAGS="-lopenal" ;; ;;
MINGW32*)
LIB_openal_LDFLAGS="-lopenal32"
;;
*)
LIB_openal_LDFLAGS="-lopenal"
;;
esac esac
LIB_openal_VERSION="" LIB_openal_VERSION=""
### OpenGL ###
LIB_opengl_NAME="OpenGL" LIB_opengl_NAME="OpenGL"
case "$OSNAME" in case "$OSNAME" in
FreeBSD|OpenBSD) FreeBSD|OpenBSD)
@@ -194,12 +214,16 @@ case "$OSNAME" in
esac esac
LIB_opengl_VERSION="" LIB_opengl_VERSION=""
LIB_vorbis_NAME="Vorbis"
### Vorbis ###
LIB_vorbis_NAME="libvorbis"
LIB_vorbis_CFLAGS="" LIB_vorbis_CFLAGS=""
LIB_vorbis_LDFLAGS="-lvorbis" LIB_vorbis_LDFLAGS="-lvorbis"
LIB_vorbis_VERSION="" LIB_vorbis_VERSION=""
LIB_vorbisfile_NAME="Vorbisfile"
### Vorbisfile ###
LIB_vorbisfile_NAME="vorbisfile"
case "$OSNAME" in case "$OSNAME" in
FreeBSD|OpenBSD) FreeBSD|OpenBSD)
LIB_vorbisfile_CFLAGS="-I/usr/local/include" LIB_vorbisfile_CFLAGS="-I/usr/local/include"
@@ -215,9 +239,16 @@ case "$OSNAME" in
;; ;;
esac esac
LIB_vorbisfile_VERSION="" LIB_vorbisfile_VERSION=""
LIB_vorbisfile_DETECT="try_pkgconfig_lib vorbisfile vorbisfile"
LIB_vorbisfile_DEPEND_DETECT_BIN="pkgconfig"
### zlib ###
LIB_zlib_NAME="zlib" LIB_zlib_NAME="zlib"
LIB_zlib_CFLAGS="" LIB_zlib_CFLAGS=""
LIB_zlib_LDFLAGS="-lz" LIB_zlib_LDFLAGS="-lz"
LIB_zlib_VERSION="" LIB_zlib_VERSION=""
LIB_zlib_DETECT="try_pkgconfig_lib zlib zlib"
LIB_zlib_DEPEND_DETECT_BIN="pkgconfig"
+5 -11
View File
@@ -1,19 +1,13 @@
- flag for an option to set if changing it will trigger a new 'make depend' - flag for an option to set if changing it will trigger a new 'make depend'
- same for 'make clean' - same for 'make clean'
- Specify files to be removed on clean. - Specify files to be removed on clean.
- PROG_*_DETECT, LIB_*_DETECT
- static compilation - static compilation
- error message for './build.sh uqm asdasddsa'
- option to (re)generate files from config.state
(useful for automatic building)
- generating tags files - generating tags files
some docs some docs
- sc2_LDFLAGS etc are only relevant in the top dir - uqm_LDFLAGS etc are only relevant in the top dir
- some variables are 'inherited' from parent dir - some variables are 'inherited' from parent dir
- files are sourced (.) - files are sourced (.)
- make clean
- make distclean
- .depend files
- description of files