Use frameworks for libpng and Vorbis if requested and available

This commit is contained in:
Michael Martin
2019-11-16 23:29:56 -08:00
parent 2ad10b9906
commit fdb1a92d5d
3 changed files with 38 additions and 30 deletions
-2
View File
@@ -262,12 +262,10 @@ uqm_prepare_config()
CHOICE_ovcodec_TITLE="Ogg Vorbis codec" CHOICE_ovcodec_TITLE="Ogg Vorbis codec"
CHOICE_ovcodec_OPTION_standard_TITLE="Xiph libogg + libvorbis" CHOICE_ovcodec_OPTION_standard_TITLE="Xiph libogg + libvorbis"
CHOICE_ovcodec_OPTION_standard_PRECOND="have_library vorbisfile" 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 CHOICE_ovcodec_OPTION_standard_ACTION=ovcodec_standard_action
ovcodec_standard_action() { ovcodec_standard_action() {
use_library vorbisfile use_library vorbisfile
OGGVORBIS=vorbisfile OGGVORBIS=vorbisfile
# use_library vorbis
} }
CHOICE_ovcodec_OPTION_tremor_TITLE="Tremor (avoids floating point math)" CHOICE_ovcodec_OPTION_tremor_TITLE="Tremor (avoids floating point math)"
CHOICE_ovcodec_OPTION_tremor_PRECOND="have_library tremor" CHOICE_ovcodec_OPTION_tremor_PRECOND="have_library tremor"
+17 -9
View File
@@ -608,11 +608,13 @@ use_library() {
# If not, do nothing. Do not even mark it as not found; it might # If not, do nothing. Do not even mark it as not found; it might
# be available by some other means. # be available by some other means.
# This function is currently specific to macOS builds. # 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 # DEPS_PATH - environment variable that if set specifies where to
# check for the framework. # check for the framework.
# Pre: LIB_${1}_NAME is expected to exist.
have_framework() { have_framework() {
local TEMP_LIBNAME local TEMP_LIBNAME LIB LIBVAR FRAMEWORK_PATH
# If we aren't on a Mac, there is no framework # If we aren't on a Mac, there is no framework
if [[ "x$HOST_SYSTEM" != "xDarwin" ]]; then if [[ "x$HOST_SYSTEM" != "xDarwin" ]]; then
return 1 return 1
@@ -621,15 +623,21 @@ have_framework() {
if [[ -z "$DEPS_PATH" ]]; then if [[ -z "$DEPS_PATH" ]]; then
return 1 return 1
fi fi
TEMP_LIBNAME="${DEPS_PATH}/${1}.framework" LIBVAR=$1
if [[ -d "$TEMP_LIBNAME" ]]; then LIB=$2
build_message "${1} found in ${DEPS_PATH}." if [[ -z "$2" ]]; then
setVar "LIB_${1}_PRESENT" 0 LIB=$LIBVAR
setVar LIB_$1_CFLAGS "-I${TEMP_LIBNAME}/Headers" fi
setVar LIB_$1_LDFLAGS "-F${DEPS_PATH} -framework ${1}" 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 return 0
fi fi
build_message "${1} not found in ${DEPS_PATH}." build_message "${TEMP_LIBNAME} not found in ${DEPS_PATH}."
return 1 return 1
} }
+21 -19
View File
@@ -116,8 +116,18 @@ LIB_libpng_NAME="libpng"
# #
# To link against a static libpng, set LDFLAGS with an appropriate -L # To link against a static libpng, set LDFLAGS with an appropriate -L
# argument before calling `build.sh uqm config`. # argument before calling `build.sh uqm config`.
LIB_libpng_CFLAGS="" case "$HOST_SYSTEM" in
LIB_libpng_LDFLAGS="-lpng" Darwin)
if not have_framework libpng; then
LIB_libpng_CFLAGS=""
LIB_libpng_LDFLAGS="-lpng"
fi
;;
*)
LIB_libpng_CFLAGS=""
LIB_libpng_LDFLAGS="-lpng"
;;
esac
### OpenAL ### ### OpenAL ###
@@ -176,18 +186,6 @@ esac
LIB_opengl_VERSION="" 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 ### ### Vorbisfile ###
LIB_vorbisfile_NAME="vorbisfile" LIB_vorbisfile_NAME="vorbisfile"
case "$HOST_SYSTEM" in case "$HOST_SYSTEM" in
@@ -200,8 +198,10 @@ case "$HOST_SYSTEM" in
LIB_vorbisfile_LDFLAGS="-lvorbisfile -lvorbis -lm -logg" LIB_vorbisfile_LDFLAGS="-lvorbisfile -lvorbis -lm -logg"
;; ;;
Darwin) Darwin)
LIB_vorbisfile_CFLAGS="-D__MACOSX__" if not have_framework vorbisfile Vorbis; then
LIB_vorbisfile_LDFLAGS="-lvorbisfile -lvorbis" LIB_vorbisfile_CFLAGS="-D__MACOSX__"
LIB_vorbisfile_LDFLAGS="-lvorbisfile -lvorbis"
fi
;; ;;
QNX) QNX)
LIB_vorbisfile_CFLAGS="" LIB_vorbisfile_CFLAGS=""
@@ -235,9 +235,11 @@ case "$HOST_SYSTEM" in
LIB_tremor_LDFLAGS="-L/usr/local/lib -lvorbisidec" LIB_tremor_LDFLAGS="-L/usr/local/lib -lvorbisidec"
;; ;;
Darwin) Darwin)
# Assumed values - please let me know if you can verify this. if not have_framework tremor Tremor; then
LIB_tremor_CFLAGS="" # Assumed values - please let me know if you can verify this.
LIB_tremor_LDFLAGS="-framework Tremor" LIB_tremor_CFLAGS=""
LIB_tremor_LDFLAGS="-framework Tremor"
fi
;; ;;
ARMV5|WINSCW|GCCE) ARMV5|WINSCW|GCCE)
LIB_tremor_DETECT="true" LIB_tremor_DETECT="true"