From f9ab3ae49ad926b90fd876ddf77958a098af4ef3 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Tue, 1 Feb 2005 15:18:16 +0000 Subject: [PATCH] Better dependency checking. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1504 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/build/unix/build.config | 4 +- sc2/build/unix/build.docs | 24 ++++-- sc2/build/unix/build.sh | 2 +- sc2/build/unix/build_functions | 30 ++++--- sc2/build/unix/config_functions | 133 +++++++++++++++++++++++++++-- sc2/build/unix/config_proginfo | 147 +++++++++++++++++++------------- sc2/build/unix/todo | 16 ++-- 7 files changed, 260 insertions(+), 96 deletions(-) diff --git a/sc2/build/unix/build.config b/sc2/build/unix/build.config index e44f9b14c..0a4eb70ea 100644 --- a/sc2/build/unix/build.config +++ b/sc2/build/unix/build.config @@ -82,8 +82,10 @@ uqm_prepare_config() -Wstrict-prototypes -Wmissing-declarations \ -Wwrite-strings -Wimplicit -Wreturn-type -Wformat \ -Wswitch -Wcomment -Wchar-subscripts \ - -Wparentheses -Wcast-align -Waggregate-return \ + -Wparentheses -Wcast-align \ -Winline -Wuninitialized" +# CFLAGS="$CFLAGS -Waggregate-return" + # It's not unreasonable to return structs at times. # CFLAGS="$CFLAGS "-Wpointer-arith" # Some standard header won't even compile with this on # CFLAGS="$CFLAGS -Wshadow" diff --git a/sc2/build/unix/build.docs b/sc2/build/unix/build.docs index 51a0739f3..7290ee735 100644 --- a/sc2/build/unix/build.docs +++ b/sc2/build/unix/build.docs @@ -18,21 +18,21 @@ The files These are the files in the directory with the build script. 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. Only build.sh is to be called directly. ansi ansi colour definitions. build.config configuration options for the program to build. 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 below. build.sh the sh script that is to be called for configuration, building, and installation. build_functions auxiliary functions to build.sh for building. 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 detecting if those libraries and other external programs 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 variables PROG_${PROGRAM}_FILE, PROG_${PROGRAM}_ACTION, or 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) A string that evaluates to the version of the executable that is present, if it is present. - PROG_${PROGRAM}_PRESENT (set by the configuration program) 0 if the program has been verified to be present 1 if the program has been verified to be not present - if the program hasn't been verified to be present + if presence of the program hasn't been verified 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 LIB_${LIB}_CFLAGS and LIB_${LIB}_LDFLAGS. 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. + - 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) A string that evaluates to the version of the library that is present, if it is present. - LIB_${LIB}_PRESENT (set by the configuration program) 0 if the library has been verified to be present 1 if the library has been verified to be not present - if the library hasn't been verified to be present + if presence of the library hasn't been verified diff --git a/sc2/build/unix/build.sh b/sc2/build/unix/build.sh index 80deca6f7..f996c1e83 100644 --- a/sc2/build/unix/build.sh +++ b/sc2/build/unix/build.sh @@ -118,7 +118,7 @@ case "$2" in ;; depend) build_check_config - build_rec_dependancies + build_rec_dependencies ;; install) build_check_config diff --git a/sc2/build/unix/build_functions b/sc2/build/unix/build_functions index 3bf9096f9..8786c6440 100644 --- a/sc2/build/unix/build_functions +++ b/sc2/build/unix/build_functions @@ -67,21 +67,24 @@ build_do_recursive() { build_recurse } -# Build dependancy information for one file -build_dependancies() { +# Build dependency information for one file +build_dependencies() { 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 -build_rec_dependancies() { +# Recursively build dependency information +build_rec_dependencies() { local DEPEND_FILE EXTRA_OFILES - echo "Building dependancy information..." 1>&2 + echo "Building dependency information..." 1>&2 BUILD_WORK_ESC=`escape_string "$BUILD_WORK"` export BUILD_WORK_ESC + eval DEPEND_FILE="\$BUILD_WORK/\${${BUILD_PROJECT}_OBJS}.depend" + # 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" @@ -93,14 +96,13 @@ build_rec_dependancies() { BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES 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}:" for OFILE in $OFILES $EXTRA_OFILES; do $ECHON " $OFILE" done echo - build_do_recursive build_dependancies : + build_do_recursive build_dependencies : } > "$DEPEND_FILE".tmp mv -f -- "$DEPEND_FILE".tmp "$DEPEND_FILE" } @@ -166,7 +168,7 @@ build_compile() { eval "${TARGET}_pre_build" eval CFLAGS="\${${BUILD_PROJECT}_CFLAGS}" \ 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}\" eval "${TARGET}_post_build" } @@ -184,7 +186,7 @@ build_clean_dir() { build_clean() { 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" \ "$BUILD_WORK/config.state" "$BUILD_WORK/config_unix.h" BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES @@ -220,10 +222,10 @@ build_check_config() { # Description: check if the necessary .depend file is present, # if not, build it. 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 - build_rec_dependancies || exit $? + build_rec_dependencies || exit $? } # Description: check if the program is compiled, and otherwise compile @@ -313,7 +315,7 @@ build_install() { eval "${TARGET}_pre_install" 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 LIBDIR="\${${BUILD_PROJECT}_INSTALL_LIBDIR%/}/" mkdirhier "$LIBDIR" 0755 @@ -326,7 +328,7 @@ build_install() { done 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 SHAREDIR="\${${BUILD_PROJECT}_INSTALL_SHAREDIR%/}/" mkdirhier "$SHAREDIR" 0755 diff --git a/sc2/build/unix/config_functions b/sc2/build/unix/config_functions index 7db2a2d74..884c3ecfa 100644 --- a/sc2/build/unix/config_functions +++ b/sc2/build/unix/config_functions @@ -94,10 +94,43 @@ lexlt() { 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 # Arguments: 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" eval eval TEMP_NAME="\\\"\$PROG_${PROG}_NAME\\\"" @@ -106,12 +139,22 @@ have_program() { exit 1 fi + eval TEMP_PRESENT="\$PROG_${PROG}_PRESENT" + if [ -n "$TEMP_PRESENT" ]; then + return "$TEMP_PRESENT" + fi + eval eval TEMP_DETECT="\\\"\$PROG_${PROG}_DETECT\\\"" 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 # NB. TEMP_DETECT should make sure PROG_${PROG}_VERSION and # PROG_${PROG}_FILE are set. if [ $? -ne 0 ]; then + eval "PROG_${PROG}_PRESENT"=1 build_message "$TEMP_NAME not found." return 1 fi @@ -121,6 +164,7 @@ have_program() { type "${TEMP_FILE%% *}" > /dev/null 2>&1 if [ $? -ne 0 ]; then + eval "PROG_${PROG}_PRESENT"=1 build_message "$TEMP_NAME not found." return 1 fi @@ -129,24 +173,29 @@ have_program() { # Minimum version supplied eval eval TEMP_VERSION="\\\"\$PROG_${PROG}_VERSION\\\"" if [ -z "$TEMP_VERSION" ]; then + eval "PROG_${PROG}_PRESENT"=1 echo "Fatal: Could not determine version of $TEMP_NAME" >&2 exit 1 fi if lexlt "$TEMP_VERSION" "$2" ; then + eval "PROG_${PROG}_PRESENT"=1 build_message "Found version $TEMP_VERSION of $TEMP_NAME, \ but version $2 is required!" return 1 fi + eval "PROG_${PROG}_PRESENT"=0 build_message "$TEMP_NAME version $TEMP_VERSION found." return 0 fi + eval "PROG_${PROG}_PRESENT"=0 build_message "$TEMP_NAME found." return 0 } # 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 # Pre: variables LIB_${1}_NAME, LIB_${1}_CFLAGS, and # LIB_${1}_LDFLAGS are expected to exist. If two arguments are @@ -156,11 +205,12 @@ but version $2 is required!" have_library() { local LIB TEMP_NAME TEMP_PRESENT TEMP_LDFLAGS TEMP_CFLAGS \ TEMP_VERSION TEMP_DETECT + local TEMP_DEPEND_DETECT_PROG TEMP_DEPEND_DETECT_LIB LIB="$1" - eval eval TEMP_NAME="\\\"\$LIB_${1}_NAME\\\"" + eval eval TEMP_NAME="\\\"\$LIB_${LIB}_NAME\\\"" if [ -z "$TEMP_NAME" ]; then - echo "Fatal: Library '$1' is not defined!" >&2 + echo "Fatal: Library '$LIB' is not defined!" >&2 exit 1 fi @@ -172,6 +222,10 @@ have_library() { eval eval TEMP_DETECT="\\\"\$LIB_${LIB}_DETECT\\\"" if [ -n "$TEMP_DETECT" ]; then $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. # return value of $TEMP_DETECT is used below. else @@ -220,7 +274,8 @@ but version $2 is required" # Description: check if a library is present on the system. # If it is, add the appropriate flags to CFLAGS and LDFLAGS. # 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 # Pre: variables LIB_${1}_NAME, LIB_${1}_CFLAGS, and # LIB_${1}_LDFLAGS are expected to exist. If two arguments are @@ -350,6 +405,74 @@ EOF 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. # Every supplied variable name found between @'s in the # supplied files, is replaced by its value. diff --git a/sc2/build/unix/config_proginfo b/sc2/build/unix/config_proginfo index 853437ad2..232906980 100644 --- a/sc2/build/unix/config_proginfo +++ b/sc2/build/unix/config_proginfo @@ -17,17 +17,26 @@ OSNAME=`uname -s` -# Describe the programs (possibly) used: +############################################################################## +# Describe the programs (possibly) used: # +############################################################################## + + +### gcc ### PROG_gcc_NAME="GNU C compiler" PROG_gcc_FILE="gcc" PROG_gcc_ACTION="" PROG_gcc_VERSION='$(gcc --version)' + +### sed ### PROG_sed_NAME="Sed stream editor" PROG_sed_FILE="sed" PROG_sed_ACTION="" PROG_sed_VERSION='' + +### echo -n ### PROG_echon_NAME="'echo -n' capable echo" PROG_echon_FILE="" PROG_echon_ACTION="" @@ -61,6 +70,8 @@ echon_detect() { return 1 } + +### GNU Make ### PROG_make_NAME="Make" case "$OSNAME" in FreeBSD|OpenBSD|SunOS) @@ -73,106 +84,115 @@ esac PROG_make_ACTION="" PROG_make_VERSION='' + +### tr ### PROG_tr_NAME="tr" PROG_tr_FILE="tr" PROG_tr_ACTION="" PROG_tr_VERSION='' + +### windres (for Windows) ### PROG_windres_NAME=windres PROG_windres_FILE=windres PROG_windres_ACTION="" PROG_windres_VERSION='windres --version' + +### Rez resource compiler (for MacOS X) only ### PROG_Rez_NAME="Rez resource compiler (Apple Developer Tools)" PROG_Rez_FILE="/Developer/Tools/Rez" -PROG_Rez_ACTION='' +PROG_Rez_ACTION="" PROG_Rez_VERSION='' + +### SetFile (for MacOS X) only ### PROG_SetFile_NAME="SetFile (Apple Developer Tools)" PROG_SetFile_FILE="/Developer/Tools/SetFile" -PROG_SetFile_ACTION='' +PROG_SetFile_ACTION="" PROG_SetFile_VERSION='' -# Describe the libaries (possibly) used: -LIB_SDL_NAME="Simple DirectMedia Layer" +### pkg-config ### +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 - FreeBSD) LIB_SDL_CFLAGS='$(sdl11-config --cflags)' ;; - Darwin) LIB_SDL_CFLAGS='-I/System/Library/Frameworks/SDL.framework/Headers - -I/Library/Frameworks/SDL.framework/Headers - -I$HOME/Library/Frameworks/SDL.framework/Headers' - ;; - *) LIB_SDL_CFLAGS='$(sdl-config --cflags)' ;; -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 \ + FreeBSD) + 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$HOME/Library/Frameworks/SDL.framework/Headers' + LIB_SDL_LDFLAGS='-framework SDL -framework Cocoa -lobjc' + LIB_SDL_VERSION=$(echo \ "SDL_MAJOR_VERSION.SDL_MINOR_VERSION.SDL_PATCHLEVEL" | \ gcc -E -include SDL_version.h $LIB_SDL_CFLAGS - | \ - tail -1 | tr -d ' ') ;; - *) LIB_SDL_VERSION='$(sdl-config --version)' ;; -esac -case "$OSNAME" in - Disabled) - LIB_SDL_DETECT="Darwin_SDL_detect SDL" - 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 $? - } + tail -1 | tr -d ' ') + ;; + *) + LIB_SDL_CFLAGS='$(sdl-config --cflags)' + LIB_SDL_LDFLAGS='$(sdl-config --libs)' + LIB_SDL_VERSION='$(sdl-config --version)' ;; esac + +### SDL_mixer ### LIB_SDL_mixer_NAME="SDL_mixer" LIB_SDL_mixer_CFLAGS="$LIB_SDL_CFLAGS" LIB_SDL_mixer_LDFLAGS="$LIB_SDL_LDFLAGS -lSDL_mixer" 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" 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$HOME/Library/Frameworks/SDL_image.framework/Headers" + LIB_SDL_image_LDFLAGS="-framework SDL_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" ;; + *) + LIB_SDL_image_CFLAGS="$LIB_SDL_CFLAGS" + LIB_SDL_image_LDFLAGS="$LIB_SDL_LDFLAGS -lSDL_image" + ;; esac 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_CFLAGS="" case "$OSNAME" in - FreeBSD|OpenBSD) LIB_openal_LDFLAGS="-L/usr/local/lib -pthread -lopenal" ;; - MINGW32*) LIB_openal_LDFLAGS="-lopenal32" ;; - *) LIB_openal_LDFLAGS="-lopenal" ;; + FreeBSD|OpenBSD) + LIB_openal_LDFLAGS="-L/usr/local/lib -pthread -lopenal" + ;; + MINGW32*) + LIB_openal_LDFLAGS="-lopenal32" + ;; + *) + LIB_openal_LDFLAGS="-lopenal" + ;; esac LIB_openal_VERSION="" + +### OpenGL ### LIB_opengl_NAME="OpenGL" case "$OSNAME" in FreeBSD|OpenBSD) @@ -194,12 +214,16 @@ case "$OSNAME" in esac LIB_opengl_VERSION="" -LIB_vorbis_NAME="Vorbis" + +### Vorbis ### +LIB_vorbis_NAME="libvorbis" LIB_vorbis_CFLAGS="" LIB_vorbis_LDFLAGS="-lvorbis" LIB_vorbis_VERSION="" -LIB_vorbisfile_NAME="Vorbisfile" + +### Vorbisfile ### +LIB_vorbisfile_NAME="vorbisfile" case "$OSNAME" in FreeBSD|OpenBSD) LIB_vorbisfile_CFLAGS="-I/usr/local/include" @@ -215,9 +239,16 @@ case "$OSNAME" in ;; esac LIB_vorbisfile_VERSION="" +LIB_vorbisfile_DETECT="try_pkgconfig_lib vorbisfile vorbisfile" +LIB_vorbisfile_DEPEND_DETECT_BIN="pkgconfig" + +### zlib ### LIB_zlib_NAME="zlib" LIB_zlib_CFLAGS="" LIB_zlib_LDFLAGS="-lz" LIB_zlib_VERSION="" +LIB_zlib_DETECT="try_pkgconfig_lib zlib zlib" +LIB_zlib_DEPEND_DETECT_BIN="pkgconfig" + diff --git a/sc2/build/unix/todo b/sc2/build/unix/todo index 70ecf4143..46ca7255e 100644 --- a/sc2/build/unix/todo +++ b/sc2/build/unix/todo @@ -1,19 +1,13 @@ - flag for an option to set if changing it will trigger a new 'make depend' - same for 'make clean' - Specify files to be removed on clean. -- PROG_*_DETECT, LIB_*_DETECT - static compilation -- error message for './build.sh uqm asdasddsa' -- option to (re)generate files from config.state - (useful for automatic building) - generating tags files + some docs - - sc2_LDFLAGS etc are only relevant in the top dir - - some variables are 'inherited' from parent dir - - files are sourced (.) - - make clean - - make distclean - - .depend files - - description of files +- uqm_LDFLAGS etc are only relevant in the top dir +- some variables are 'inherited' from parent dir +- files are sourced (.) +