Use frameworks for libpng and Vorbis if requested and available
This commit is contained in:
@@ -262,12 +262,10 @@ uqm_prepare_config()
|
||||
CHOICE_ovcodec_TITLE="Ogg Vorbis codec"
|
||||
CHOICE_ovcodec_OPTION_standard_TITLE="Xiph libogg + libvorbis"
|
||||
CHOICE_ovcodec_OPTION_standard_PRECOND="have_library vorbisfile"
|
||||
# CHOICE_ovcodec_OPTION_standard_PRECOND="have_library vorbisfile && have_library vorbis"
|
||||
CHOICE_ovcodec_OPTION_standard_ACTION=ovcodec_standard_action
|
||||
ovcodec_standard_action() {
|
||||
use_library vorbisfile
|
||||
OGGVORBIS=vorbisfile
|
||||
# use_library vorbis
|
||||
}
|
||||
CHOICE_ovcodec_OPTION_tremor_TITLE="Tremor (avoids floating point math)"
|
||||
CHOICE_ovcodec_OPTION_tremor_PRECOND="have_library tremor"
|
||||
|
||||
@@ -608,11 +608,13 @@ use_library() {
|
||||
# If not, do nothing. Do not even mark it as not found; it might
|
||||
# be available by some other means.
|
||||
# This function is currently specific to macOS builds.
|
||||
# Arguments: $1 - framework to check.
|
||||
# Arguments: $1 - The name of the library as used in config_proginfo
|
||||
# $2 - (optional, default $1) the name of the framework
|
||||
# DEPS_PATH - environment variable that if set specifies where to
|
||||
# check for the framework.
|
||||
# Pre: LIB_${1}_NAME is expected to exist.
|
||||
have_framework() {
|
||||
local TEMP_LIBNAME
|
||||
local TEMP_LIBNAME LIB LIBVAR FRAMEWORK_PATH
|
||||
# If we aren't on a Mac, there is no framework
|
||||
if [[ "x$HOST_SYSTEM" != "xDarwin" ]]; then
|
||||
return 1
|
||||
@@ -621,15 +623,21 @@ have_framework() {
|
||||
if [[ -z "$DEPS_PATH" ]]; then
|
||||
return 1
|
||||
fi
|
||||
TEMP_LIBNAME="${DEPS_PATH}/${1}.framework"
|
||||
if [[ -d "$TEMP_LIBNAME" ]]; then
|
||||
build_message "${1} found in ${DEPS_PATH}."
|
||||
setVar "LIB_${1}_PRESENT" 0
|
||||
setVar LIB_$1_CFLAGS "-I${TEMP_LIBNAME}/Headers"
|
||||
setVar LIB_$1_LDFLAGS "-F${DEPS_PATH} -framework ${1}"
|
||||
LIBVAR=$1
|
||||
LIB=$2
|
||||
if [[ -z "$2" ]]; then
|
||||
LIB=$LIBVAR
|
||||
fi
|
||||
TEMP_LIBNAME=`evalVar "LIB_${LIBVAR}_NAME"`
|
||||
FRAMEWORK_PATH="${DEPS_PATH}/${LIB}.framework"
|
||||
if [[ -d "$FRAMEWORK_PATH" ]]; then
|
||||
build_message "${TEMP_LIBNAME} found in ${DEPS_PATH}."
|
||||
setVar "LIB_${LIBVAR}_PRESENT" 0
|
||||
setVar "LIB_${LIBVAR}_CFLAGS" "-F${DEPS_PATH} -I${FRAMEWORK_PATH}/Headers"
|
||||
setVar "LIB_${LIBVAR}_LDFLAGS" "-F${DEPS_PATH} -framework ${LIB}"
|
||||
return 0
|
||||
fi
|
||||
build_message "${1} not found in ${DEPS_PATH}."
|
||||
build_message "${TEMP_LIBNAME} not found in ${DEPS_PATH}."
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -116,8 +116,18 @@ LIB_libpng_NAME="libpng"
|
||||
#
|
||||
# To link against a static libpng, set LDFLAGS with an appropriate -L
|
||||
# argument before calling `build.sh uqm config`.
|
||||
LIB_libpng_CFLAGS=""
|
||||
LIB_libpng_LDFLAGS="-lpng"
|
||||
case "$HOST_SYSTEM" in
|
||||
Darwin)
|
||||
if not have_framework libpng; then
|
||||
LIB_libpng_CFLAGS=""
|
||||
LIB_libpng_LDFLAGS="-lpng"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
LIB_libpng_CFLAGS=""
|
||||
LIB_libpng_LDFLAGS="-lpng"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
### OpenAL ###
|
||||
@@ -176,18 +186,6 @@ esac
|
||||
LIB_opengl_VERSION=""
|
||||
|
||||
|
||||
### Vorbis ###
|
||||
LIB_vorbis_NAME="libvorbis"
|
||||
LIB_vorbis_CFLAGS=""
|
||||
LIB_vorbis_LDFLAGS="-lvorbis"
|
||||
LIB_vorbis_VERSION=""
|
||||
case "$HOST_SYSTEM" in
|
||||
ARMV5|WINSCW|GCCE)
|
||||
LIB_vorbis_DETECT="false"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
### Vorbisfile ###
|
||||
LIB_vorbisfile_NAME="vorbisfile"
|
||||
case "$HOST_SYSTEM" in
|
||||
@@ -200,8 +198,10 @@ case "$HOST_SYSTEM" in
|
||||
LIB_vorbisfile_LDFLAGS="-lvorbisfile -lvorbis -lm -logg"
|
||||
;;
|
||||
Darwin)
|
||||
LIB_vorbisfile_CFLAGS="-D__MACOSX__"
|
||||
LIB_vorbisfile_LDFLAGS="-lvorbisfile -lvorbis"
|
||||
if not have_framework vorbisfile Vorbis; then
|
||||
LIB_vorbisfile_CFLAGS="-D__MACOSX__"
|
||||
LIB_vorbisfile_LDFLAGS="-lvorbisfile -lvorbis"
|
||||
fi
|
||||
;;
|
||||
QNX)
|
||||
LIB_vorbisfile_CFLAGS=""
|
||||
@@ -235,9 +235,11 @@ case "$HOST_SYSTEM" in
|
||||
LIB_tremor_LDFLAGS="-L/usr/local/lib -lvorbisidec"
|
||||
;;
|
||||
Darwin)
|
||||
# Assumed values - please let me know if you can verify this.
|
||||
LIB_tremor_CFLAGS=""
|
||||
LIB_tremor_LDFLAGS="-framework Tremor"
|
||||
if not have_framework tremor Tremor; then
|
||||
# Assumed values - please let me know if you can verify this.
|
||||
LIB_tremor_CFLAGS=""
|
||||
LIB_tremor_LDFLAGS="-framework Tremor"
|
||||
fi
|
||||
;;
|
||||
ARMV5|WINSCW|GCCE)
|
||||
LIB_tremor_DETECT="true"
|
||||
|
||||
Reference in New Issue
Block a user