From 0dc40a2d66506924730850c3cc503633fe11d444 Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 24 Jan 2019 15:38:37 -0800 Subject: [PATCH 1/3] qb: Cleanup config.libs.sh. --- qb/config.libs.sh | 125 ++++++++++++++++---------------------------- qb/config.params.sh | 2 +- qb/qb.libs.sh | 66 +++++++++++++++++++---- 3 files changed, 101 insertions(+), 92 deletions(-) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 67424b03c9..ab7ace414a 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -87,7 +87,6 @@ fi if [ "$HAVE_PRESERVE_DYLIB" = "yes" ]; then die : 'Notice: Disabling dlclose() of shared objects for Valgrind support.' - add_define MAKEFILE HAVE_PRESERVE_DYLIB "1" fi if [ "$HAVE_FLOATHARD" = "yes" ]; then @@ -126,9 +125,7 @@ if [ "$HAVE_SSE" = "yes" ]; then fi if [ "$HAVE_EGL" != "no" ] && [ "$OS" != 'Win32' ]; then - check_pkgconf EGL "$VC_PREFIX"egl - # some systems have EGL libs, but no pkgconfig - check_val '' EGL "-l${VC_PREFIX}EGL $EXTRA_GL_LIBS" + check_val '' EGL "-l${VC_PREFIX}EGL $EXTRA_GL_LIBS" '' "${VC_PREFIX}egl" '' '' if [ "$HAVE_EGL" = "yes" ]; then EGL_LIBS="$EGL_LIBS $EXTRA_GL_LIBS" fi @@ -184,12 +181,6 @@ else check_lib '' DYLIB "$DYLIB" dlopen fi -if [ "$HAVE_CXX" != 'yes' ]; then - HAVE_DISCORD='no' - HAVE_QT='no' - HAVE_VULKAN='no' -fi - check_lib '' NETWORKING "$SOCKETLIB" socket "" "$SOCKETHEADER" if [ "$HAVE_NETWORKING" = 'yes' ]; then @@ -237,8 +228,7 @@ if [ "$HAVE_DYLIB" = 'no' ] && [ "$HAVE_DYNAMIC" = 'yes' ]; then die 1 'Error: Dynamic loading of libretro is enabled, but your platform does not appear to have dlopen(), use --disable-dynamic or --with-libretro="-lretro".' fi -check_pkgconf ALSA alsa -check_val '' ALSA -lasound alsa +check_val '' ALSA -lasound alsa alsa '' '' check_lib '' CACA -lcaca check_lib '' SIXEL -lsixel @@ -271,15 +261,22 @@ fi check_pkgconf RSOUND rsound 1.1 check_pkgconf ROAR libroar -check_pkgconf JACK jack 0.120.1 -check_pkgconf PULSE libpulse -check_pkgconf SDL sdl 1.2.10 -check_pkgconf SDL2 sdl2 2.0.0 +check_val '' JACK -ljack '' jack 0.120.1 '' +check_val '' PULSE -lpulse '' libpulse '' '' +check_val '' SDL -lSDL SDL sdl 1.2.10 '' +check_val '' SDL2 -lSDL2 SDL2 sdl2 2.0.0 '' -check_val '' JACK -ljack -check_val '' PULSE -lpulse -check_val '' SDL -lSDL SDL -check_val '' SDL2 -lSDL2 SDL2 +if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then + die : 'Notice: SDL drivers will be replaced by SDL2 ones.' + HAVE_SDL=no +fi + +check_enabled DISCORD discord + +if [ "$HAVE_DISCORD" != 'no' ]; then + # Enable discord by default if it hasn't been disabled by check_enabled. + HAVE_DISCORD=yes +fi check_enabled QT 'Qt companion' @@ -307,17 +304,11 @@ if [ "$HAVE_QT" != 'no' ]; then #fi fi -if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then - die : 'Notice: SDL drivers will be replaced by SDL2 ones.' - HAVE_SDL=no -fi - if [ "$HAVE_FLAC" = 'no' ]; then HAVE_BUILTINFLAC=no fi -check_pkgconf FLAC flac -check_val '' FLAC '-lFLAC' +check_val '' FLAC '-lFLAC' '' flac '' '' if [ "$HAVE_SSL" = 'no' ]; then HAVE_BUILTINMBEDTLS=no @@ -350,8 +341,7 @@ if [ "$HAVE_SSL" != 'no' ]; then fi fi -check_pkgconf LIBUSB libusb-1.0 1.0.13 -check_val '' LIBUSB -lusb-1.0 libusb-1.0 +check_val '' LIBUSB -lusb-1.0 libusb-1.0 libusb-1.0 1.0.13 '' if [ "$OS" = 'Win32' ]; then check_lib '' DINPUT -ldinput8 @@ -406,12 +396,10 @@ if [ "$HAVE_ZLIB" = 'no' ]; then elif [ "$HAVE_BUILTINZLIB" = 'yes' ]; then HAVE_ZLIB=yes else - check_pkgconf ZLIB zlib - check_val '' ZLIB '-lz' + check_val '' ZLIB '-lz' '' zlib '' '' fi -check_pkgconf MPV mpv -check_val '' MPV -lmpv +check_val '' MPV -lmpv '' mpv '' '' if [ "$HAVE_THREADS" = 'no' ] && [ "$HAVE_FFMPEG" != 'no' ]; then HAVE_FFMPEG='no' @@ -422,21 +410,13 @@ check_header DRMINGW exchndl.h check_lib '' DRMINGW -lexchndl if [ "$HAVE_FFMPEG" != 'no' ]; then - check_pkgconf AVCODEC libavcodec 54 - check_pkgconf AVFORMAT libavformat 54 - check_pkgconf AVDEVICE libavdevice - check_pkgconf SWRESAMPLE libswresample - check_pkgconf AVRESAMPLE libavresample - check_pkgconf AVUTIL libavutil 51 - check_pkgconf SWSCALE libswscale 2.1 - - check_val '' AVCODEC -lavcodec - check_val '' AVFORMAT -lavformat - check_val '' AVDEVICE -lavdevice - check_val '' SWRESAMPLE -lswresample - check_val '' AVRESAMPLE -lavresample - check_val '' AVUTIL -lavutil - check_val '' SWSCALE -lswscale + check_val '' AVCODEC -lavcodec '' libavcodec 54 '' + check_val '' AVFORMAT -lavformat '' libavformat 54 '' + check_val '' AVDEVICE -lavdevice '' libavdevice '' '' + check_val '' SWRESAMPLE -lswresample '' libswresample '' '' + check_val '' AVRESAMPLE -lavresample '' libavresample '' '' + check_val '' AVUTIL -lavutil '' libavutil 51 '' + check_val '' SWSCALE -lswscale '' libswscale 2.1 '' check_header AV_CHANNEL_LAYOUT libavutil/channel_layout.h @@ -454,10 +434,8 @@ if [ "$OS" != 'Win32' ]; then fi if [ "$HAVE_KMS" != "no" ]; then - check_pkgconf GBM gbm 9.0 - check_pkgconf DRM libdrm - check_val '' GBM -lgbm - check_val '' DRM -ldrm libdrm + check_val '' GBM -lgbm '' gbm 9.0 '' + check_val '' DRM -ldrm libdrm libdrm '' '' if [ "$HAVE_GBM" = "yes" ] && [ "$HAVE_DRM" = "yes" ] && [ "$HAVE_EGL" = "yes" ]; then HAVE_KMS=yes @@ -468,8 +446,7 @@ if [ "$HAVE_KMS" != "no" ]; then fi fi -check_pkgconf LIBXML2 libxml-2.0 -check_val '' LIBXML2 -lxml2 libxml2 +check_val '' LIBXML2 -lxml2 libxml2 libxml-2.0 '' '' if [ "$HAVE_EGL" = "yes" ]; then if [ "$HAVE_OPENGLES" != "no" ]; then @@ -485,34 +462,23 @@ if [ "$HAVE_EGL" = "yes" ]; then fi fi fi - check_pkgconf VG "$VC_PREFIX"vg - check_val '' VG "-l${VC_PREFIX}OpenVG $EXTRA_GL_LIBS" + check_val '' VG "-l${VC_PREFIX}OpenVG $EXTRA_GL_LIBS" '' "${VC_PREFIX}vg" '' '' else HAVE_VG=no HAVE_OPENGLES=no fi -check_pkgconf V4L2 libv4l2 -check_pkgconf FREETYPE freetype2 -check_pkgconf X11 x11 -check_pkgconf XCB xcb -check_pkgconf WAYLAND wayland-egl 1.15 -check_pkgconf WAYLAND_CURSOR wayland-cursor 1.15 +check_val '' V4L2 -lv4l2 '' libv4l2 '' '' +check_val '' FREETYPE -lfreetype freetype2 freetype2 '' '' +check_val '' X11 -lX11 '' x11 '' '' +check_val '' XCB -lxcb '' xcb '' '' +check_val '' WAYLAND '-lwayland-egl -lwayland-client' '' wayland-egl 1.15 '' +check_val '' WAYLAND_CURSOR -lwayland-cursor '' wayland-cursor 1.15 '' check_pkgconf WAYLAND_PROTOS wayland-protocols 1.15 -check_pkgconf XKBCOMMON xkbcommon 0.3.2 +check_val '' XKBCOMMON -lxkbcommon '' xkbcommon 0.3.2 '' check_pkgconf DBUS dbus-1 -check_pkgconf XEXT xext -check_pkgconf XF86VM xxf86vm - -check_val '' V4L2 -lv4l2 -check_val '' FREETYPE -lfreetype freetype2 -check_val '' X11 -lX11 -check_val '' XCB -lxcb -check_val '' WAYLAND '-lwayland-egl -lwayland-client' -check_val '' WAYLAND_CURSOR -lwayland-cursor -check_val '' XKBCOMMON -lxkbcommon -check_val '' XEXT -lXext -check_val '' XF86VM -lXxf86vm +check_val '' XEXT -lXext '' xext '' '' +check_val '' XF86VM -lXxf86vm '' xxf86vm '' '' if [ "$HAVE_WAYLAND_PROTOS" = yes ] && [ "$HAVE_WAYLAND" = yes ]; then check_pkgconf WAYLAND_SCANNER wayland-scanner 1.15 @@ -527,20 +493,17 @@ if [ "$HAVE_X11" = 'no' ]; then fi check_lib '' XRANDR -lXrandr -check_pkgconf XINERAMA xinerama -check_val '' XINERAMA -lXinerama +check_val '' XINERAMA -lXinerama '' xinerama '' '' if [ "$HAVE_X11" = 'yes' ] && [ "$HAVE_XEXT" = 'yes' ] && [ "$HAVE_XF86VM" = 'yes' ]; then - check_pkgconf XVIDEO xv - check_val '' XVIDEO -lXv + check_val '' XVIDEO -lXv '' xv '' '' else die : 'Notice: X11, Xext or xf86vm not present. Skipping X11 code paths.' HAVE_X11='no' HAVE_XVIDEO='no' fi -check_pkgconf UDEV libudev -check_val '' UDEV "-ludev" +check_val '' UDEV "-ludev" '' libudev '' '' check_header XSHM X11/Xlib.h X11/extensions/XShm.h check_header PARPORT linux/parport.h diff --git a/qb/config.params.sh b/qb/config.params.sh index 029eb822ef..ed9a6b94ae 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -121,7 +121,7 @@ HAVE_CHEEVOS=yes # Retro Achievements HAVE_NEW_CHEEVOS=no # Use rcheevos to process RetroAchievements C89_NEW_CHEEVOS=no HAVE_LUA=no # Lua support (for Retro Achievements) -HAVE_DISCORD=yes # Discord Integration +HAVE_DISCORD=auto # Discord Integration C89_DISCORD=no HAVE_SHADERPIPELINE=yes # Additional shader-based pipelines C89_SHADERPIPELINE=no diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index 0ecc808080..e3101511ce 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -7,7 +7,10 @@ SHARE_DIR="${SHARE_DIR:-${PREFIX}/share}" add_define() # $1 = MAKEFILE or CONFIG $2 = define $3 = value { eval "${1}_DEFINES=\"\${${1}_DEFINES} $2=$3\""; } -add_dirs() # $1 = INCLUDE or LIBRARY $@ = include or library paths +# add_dirs: +# $1 = INCLUDE or LIBRARY +# $@ = include or library paths +add_dirs() { ADD="$1"; LINK="${1%"${1#?}"}"; shift while [ "$1" ]; do eval "${ADD}_DIRS=\"\${${ADD}_DIRS} -${LINK}${1}\"" @@ -16,7 +19,10 @@ add_dirs() # $1 = INCLUDE or LIBRARY $@ = include or library paths eval "${ADD}_DIRS=\"\${${ADD}_DIRS# }\"" } -check_compiler() # $1 = language $2 = function in lib +# check_compiler: +# $1 = language +# $2 = function in lib +check_compiler() { if [ "$1" = cxx ]; then COMPILER="$CXX" TEMP_CODE="$TEMP_CXX" @@ -28,7 +34,10 @@ check_compiler() # $1 = language $2 = function in lib fi } -check_enabled() # $1 = HAVE_$1 $2 = lib +# check_enabled: +# $1 = HAVE_$1 +# $2 = lib +check_enabled() { [ "$HAVE_CXX" != 'no' ] && return 0 tmpval="$(eval "printf %s \"\$HAVE_$1\"")" @@ -40,7 +49,16 @@ check_enabled() # $1 = HAVE_$1 $2 = lib die 1 "Forced to build with $2 support and the C++ compiler is disabled. Exiting ..." } -check_lib() # $1 = language $2 = HAVE_$2 $3 = lib $4 = function in lib $5 = extralibs $6 = headers $7 = critical error message [checked only if non-empty] +# check_lib: +# Compiles a simple test program to check if a library is available. +# $1 = language +# $2 = HAVE_$2 +# $3 = lib +# $4 = function in lib +# $5 = extralibs +# $6 = headers +# $7 = critical error message [checked only if non-empty] +check_lib() { tmpval="$(eval "printf %s \"\$HAVE_$2\"")" [ "$tmpval" = 'no' ] && return 0 @@ -81,7 +99,13 @@ check_lib() # $1 = language $2 = HAVE_$2 $3 = lib $4 = function in lib $5 = return 0 } -check_pkgconf() # $1 = HAVE_$1 $2 = package $3 = version $4 = critical error message [checked only if non-empty] +# check_pkgconf: +# If available uses $PKG_CONF_PATH to find a library. +# $1 = HAVE_$1 +# $2 = package +# $3 = version [checked only if non-empty] +# $4 = critical error message [checked only if non-empty] +check_pkgconf() { tmpval="$(eval "printf %s \"\$HAVE_$1\"")" eval "TMP_$1=\$tmpval" [ "$tmpval" = 'no' ] && return 0 @@ -115,7 +139,10 @@ check_pkgconf() # $1 = HAVE_$1 $2 = package $3 = version $4 = critical error fi } -check_header() #$1 = HAVE_$1 $2, $3, ... = header files +# check_header: +# $1 = HAVE_$1 +# $@ = header files +check_header() { tmpval="$(eval "printf %s \"\$HAVE_$1\"")" [ "$tmpval" = 'no' ] && return 0 rm -f -- "$TEMP_C" @@ -137,7 +164,11 @@ check_header() #$1 = HAVE_$1 $2, $3, ... = header files die 1 "Build assumed that $header exists, but cannot locate. Exiting ..." } -check_macro() #$1 = HAVE_$1 $2 = macro name $3 = header name [included only if non-empty] +# check_macro: +# $1 = HAVE_$1 +# $2 = macro name +# $3 = header name [included only if non-empty] +check_macro() { tmpval="$(eval "printf %s \"\$HAVE_$1\"")" [ "$tmpval" = 'no' ] && return 0 if [ "${3}" ]; then @@ -166,7 +197,12 @@ EOF die 1 "Build assumed that $macro is defined, but it's not. Exiting ..." } -check_switch() # $1 = language $2 = HAVE_$2 $3 = switch $4 = critical error message [checked only if non-empty] +# check_switch: +# $1 = language +# $2 = HAVE_$2 +# $3 = switch +# $4 = critical error message [checked only if non-empty] +check_switch() { check_compiler "$1" '' ECHOBUF="Checking for availability of switch $3 in $COMPILER" @@ -181,8 +217,18 @@ check_switch() # $1 = language $2 = HAVE_$2 $3 = switch $4 = critical error m } } -check_val() # $1 = language $2 = HAVE_$2 $3 = lib $4 = include directory [checked only if non-empty] -{ tmpval="$(eval "printf %s \"\$HAVE_$2\"")" +# check_val: +# Uses check_pkgconf to find a library and falls back to check_lib if false. +# $1 = language +# $2 = HAVE_$2 +# $3 = lib +# $4 = include directory [checked only if non-empty] +# $5 = package +# $6 = version [checked only if non-empty] +# $7 = critical error message [checked only if non-empty] +check_val() +{ check_pkgconf "$2" "$5" "$6" "${7:-}" + tmpval="$(eval "printf %s \"\$HAVE_$2\"")" oldval="$(eval "printf %s \"\$TMP_$2\"")" if [ "$tmpval" = 'no' ] && [ "$oldval" != 'no' ]; then eval "HAVE_$2=auto" From 352fbc7cc74a4fa545203a12e0d2e9812c0c2a7f Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 24 Jan 2019 22:29:10 -0800 Subject: [PATCH 2/3] qb: Remove duplicate code in config.libs.sh. --- qb/config.libs.sh | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index ab7ace414a..fba2da9f54 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -75,12 +75,6 @@ if [ "$HAVE_VIDEOCORE" = 'yes' ]; then fi fi -if [ "$HAVE_NEON" = "yes" ]; then - CFLAGS="$CFLAGS -mfpu=neon -marm" - CXXFLAGS="$CXXFLAGS -mfpu=neon -marm" - ASFLAGS="$ASFLAGS -mfpu=neon" -fi - if [ "$HAVE_7ZIP" = "yes" ]; then add_dirs INCLUDE ./deps/7zip fi @@ -89,18 +83,6 @@ if [ "$HAVE_PRESERVE_DYLIB" = "yes" ]; then die : 'Notice: Disabling dlclose() of shared objects for Valgrind support.' fi -if [ "$HAVE_FLOATHARD" = "yes" ]; then - CFLAGS="$CFLAGS -mfloat-abi=hard" - CXXFLAGS="$CXXFLAGS -mfloat-abi=hard" - ASFLAGS="$ASFLAGS -mfloat-abi=hard" -fi - -if [ "$HAVE_FLOATSOFTFP" = "yes" ]; then - CFLAGS="$CFLAGS -mfloat-abi=softfp" - CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp" - ASFLAGS="$ASFLAGS -mfloat-abi=softfp" -fi - if [ "$HAVE_NEON" = "yes" ]; then CFLAGS="$CFLAGS -mfpu=neon -marm" CXXFLAGS="$CXXFLAGS -mfpu=neon -marm" From 2cc6505997e8ed7e49d8bf6e7214d07ca6fc61b6 Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 24 Jan 2019 23:07:43 -0800 Subject: [PATCH 3/3] qb: Fix HAVE_RETRO check. --- qb/config.libs.sh | 6 +++--- qb/qb.libs.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index fba2da9f54..bb09b97670 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -128,12 +128,12 @@ fi if [ "$LIBRETRO" ]; then die : 'Notice: Explicit libretro used, disabling dynamic libretro loading ...' HAVE_DYNAMIC='no' -else LIBRETRO="-lretro" +else + LIBRETRO="-lretro" fi [ "$HAVE_DYNAMIC" = 'yes' ] || { - #check_lib '' RETRO "$LIBRETRO" retro_init "$DYLIB" "Cannot find libretro, did you forget --with-libretro=\"-lretro\"?" - check_lib '' RETRO "$LIBRETRO" "$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" } diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index e3101511ce..09006990b0 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -56,7 +56,7 @@ check_enabled() # $3 = lib # $4 = function in lib # $5 = extralibs -# $6 = headers +# $6 = headers [checked only if non-empty] # $7 = critical error message [checked only if non-empty] check_lib() { tmpval="$(eval "printf %s \"\$HAVE_$2\"")"