1
0
mirror of https://github.com/libretro/RetroArch synced 2025-03-01 07:13:35 +00:00

Merge pull request from orbea/qb

qb: Test for user set variables.
This commit is contained in:
Twinaphex 2019-02-10 19:46:00 +01:00 committed by GitHub
commit 07208c9f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 25 deletions

@ -119,7 +119,7 @@ else
fi fi
[ "$HAVE_DYNAMIC" = 'yes' ] || { [ "$HAVE_DYNAMIC" = 'yes' ] || {
check_lib '' RETRO "$LIBRETRO" retro_init "$DYLIB" '' 'Cannot find libretro, did you forget --with-libretro="-lretro"?' check_lib '' RETRO "$LIBRETRO" retro_init "$DYLIB" '' '' 'Cannot find libretro, did you forget --with-libretro="-lretro"?'
add_define MAKEFILE libretro "$LIBRETRO" add_define MAKEFILE libretro "$LIBRETRO"
} }

@ -85,7 +85,8 @@ check_enabled()
# $4 = function in lib [checked only if non-empty] # $4 = function in lib [checked only if non-empty]
# $5 = extralibs [checked only if non-empty] # $5 = extralibs [checked only if non-empty]
# $6 = headers [checked only if non-empty] # $6 = headers [checked only if non-empty]
# $7 = critical error message [checked only if non-empty] # $7 = include directory [checked only if non-empty]
# $8 = critical error message [checked only if non-empty]
check_lib() check_lib()
{ tmpval="$(eval "printf %s \"\$HAVE_$2\"")" { tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
[ "$tmpval" = 'no' ] && return 0 [ "$tmpval" = 'no' ] && return 0
@ -106,19 +107,30 @@ check_lib()
val="$2" val="$2"
lib="$3" lib="$3"
error="${7:-}" include="${7:-}"
error="${8:-}"
answer='no' answer='no'
eval "set -- $INCLUDE_DIRS $LIBRARY_DIRS $5 $CFLAGS $LDFLAGS $3" eval "set -- $INCLUDE_DIRS $LIBRARY_DIRS $5 $CFLAGS $LDFLAGS $3"
"$COMPILER" -o "$TEMP_EXE" "$TEMP_CODE" "$@" >>config.log 2>&1 && answer='yes' "$COMPILER" -o "$TEMP_EXE" "$TEMP_CODE" "$@" >>config.log 2>&1 && answer='yes'
if [ "$answer" = 'yes' ] && [ "$include" ]; then
eval "set -- $INCLUDES"
for dir do
[ -d "/$dir/$include" ] && { eval "${val}_CFLAGS=\"-I/$dir/$include\""; break; }
done
[ -z "$(eval "printf %s \"\${${val}_CFLAGS}\"")" ] && answer='no'
fi
eval "HAVE_$val=\"$answer\"" eval "HAVE_$val=\"$answer\""
printf %s\\n "$ECHOBUF ... $answer" printf %s\\n "$ECHOBUF ... $answer"
rm -f -- "$TEMP_CODE" "$TEMP_EXE" rm -f -- "$TEMP_CODE" "$TEMP_EXE"
if [ "$answer" = 'no' ]; then if [ "$answer" = 'no' ]; then
[ "$error" ] && die 1 "$error" [ "$error" ] && die 1 "$error"
[ "$tmpval" = 'yes' ] && { setval="$(eval "printf %s \"\$USER_$val\"")"
if [ "$setval" = 'yes' ]; then
die 1 "Forced to build with library $lib, but cannot locate. Exiting ..." die 1 "Forced to build with library $lib, but cannot locate. Exiting ..."
} fi
else else
eval "${val}_LIBS=\"$lib\"" eval "${val}_LIBS=\"$lib\""
PKG_CONF_USED="$PKG_CONF_USED $val" PKG_CONF_USED="$PKG_CONF_USED $val"
@ -170,8 +182,10 @@ check_pkgconf()
printf %s\\n "$ECHOBUF ... $version" printf %s\\n "$ECHOBUF ... $version"
if [ "$answer" = 'no' ]; then if [ "$answer" = 'no' ]; then
[ "$err" ] && die 1 "$err" [ "$err" ] && die 1 "$err"
[ "$tmpval" = 'yes' ] && setval="$(eval "printf %s \"\$USER_$val\"")"
if [ "$setval" = 'yes' ]; then
die 1 "Forced to build with package $pkg, but cannot locate. Exiting ..." die 1 "Forced to build with package $pkg, but cannot locate. Exiting ..."
fi
else else
PKG_CONF_USED="$PKG_CONF_USED $val" PKG_CONF_USED="$PKG_CONF_USED $val"
fi fi
@ -198,8 +212,10 @@ check_header()
eval "HAVE_$val=\"$answer\"" eval "HAVE_$val=\"$answer\""
printf %s\\n "Checking presence of header file $CHECKHEADER ... $answer" printf %s\\n "Checking presence of header file $CHECKHEADER ... $answer"
rm -f -- "$TEMP_C" "$TEMP_EXE" rm -f -- "$TEMP_C" "$TEMP_EXE"
[ "$tmpval" = 'yes' ] && [ "$answer" = 'no' ] && \ setval="$(eval "printf %s \"\$USER_$val\"")"
if [ "$setval" = 'yes' ] && [ "$answer" = 'no' ]; then
die 1 "Build assumed that $header exists, but cannot locate. Exiting ..." die 1 "Build assumed that $header exists, but cannot locate. Exiting ..."
fi
} }
# check_macro: # check_macro:
@ -231,8 +247,10 @@ EOF
eval "HAVE_$val=\"$answer\"" eval "HAVE_$val=\"$answer\""
printf %s\\n "$ECHOBUF ... $answer" printf %s\\n "$ECHOBUF ... $answer"
rm -f -- "$TEMP_C" "$TEMP_EXE" rm -f -- "$TEMP_C" "$TEMP_EXE"
[ "$tmpval" = 'yes' ] && [ "$answer" = 'no' ] && \ setval="$(eval "printf %s \"\$USER_$val\"")"
if [ "$setval" = 'yes' ] && [ "$answer" = 'no' ]; then
die 1 "Build assumed that $macro is defined, but it's not. Exiting ..." die 1 "Build assumed that $macro is defined, but it's not. Exiting ..."
fi
} }
# check_switch: # check_switch:
@ -272,21 +290,7 @@ check_val()
oldval="$(eval "printf %s \"\$TMP_$2\"")" oldval="$(eval "printf %s \"\$TMP_$2\"")"
if [ "$tmpval" = 'no' ] && [ "$oldval" != 'no' ]; then if [ "$tmpval" = 'no' ] && [ "$oldval" != 'no' ]; then
eval "HAVE_$2=auto" eval "HAVE_$2=auto"
check_lib "$1" "$2" "$3" check_lib "$1" "$2" "$3" '' '' '' "$4" ''
if [ "${4:-}" ] && [ "$answer" = 'yes' ]; then
val="$2"
include="$4"
eval "set -- $INCLUDES"
for dir do
[ -d "/$dir/$include" ] && { eval "${val}_CFLAGS=\"-I/$dir/$include\""; break; }
done
[ -z "$(eval "printf %s \"\${${val}_CFLAGS}\"")" ] && eval "HAVE_$val=no"
fi
if [ "$answer" = 'no' ] && [ "$oldval" = 'yes' ]; then
die 1 "Forced to build with library $lib, but cannot locate. Exiting ..."
fi
fi fi
} }

@ -70,7 +70,9 @@ parse_input() # Parse stuff :V
OPTS='' OPTS=''
while read -r VAR _; do while read -r VAR _; do
TMPVAR="${VAR%=*}" TMPVAR="${VAR%=*}"
OPTS="$OPTS ${TMPVAR##HAVE_}" NEWVAR="${TMPVAR##HAVE_}"
OPTS="$OPTS $NEWVAR"
eval "USER_$NEWVAR=no"
done < 'qb/config.params.sh' done < 'qb/config.params.sh'
#OPTS contains all available options in config.params.sh - used to speedup #OPTS contains all available options in config.params.sh - used to speedup
#things in opt_exists() #things in opt_exists()
@ -93,7 +95,6 @@ parse_input() # Parse stuff :V
--disable-*) --disable-*)
opt_exists "${1##--disable-}" "$1" opt_exists "${1##--disable-}" "$1"
eval "HAVE_$opt=no" eval "HAVE_$opt=no"
eval "USER_$opt=no"
eval "HAVE_NO_$opt=yes" eval "HAVE_NO_$opt=yes"
;; ;;
--with-*) --with-*)