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
+17 -9
View File
@@ -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
}