qb: Support building with the system mbedtls.

Fixes https://github.com/libretro/RetroArch/issues/7639

v2: Fix build failures with griffin.
This commit is contained in:
orbea 2018-12-14 13:56:58 -08:00
parent 9be245ad75
commit dc020f2569
7 changed files with 58 additions and 7 deletions

View File

@ -394,10 +394,9 @@ ifeq ($(HAVE_LIBRETRODB), 1)
endif
ifneq ($(C89_BUILD), 1)
HAVE_GTKPLUS = 0
ifeq ($(HAVE_SSL), 1)
ifeq ($(HAVE_NETWORKING), 1)
ifeq ($(HAVE_NETWORKING), 1)
ifeq ($(HAVE_BUILTINMBEDTLS), 1)
HAVE_SSL = 1
DEFINES += -DHAVE_SSL
ifeq ($(DEBUG), 1)
@ -482,6 +481,9 @@ ifneq ($(C89_BUILD), 1)
deps/mbedtls/ssl_tls.o
OBJ += $(OBJS_TLS_CRYPTO) $(OBJS_TLS_X509) $(OBJS_TLS)
else ifeq ($(HAVE_SSL), 1)
DEFINES += -DHAVE_SSL
LIBS += $(MBEDTLS_LIBS) $(MBEDX509_LIBS) $(MBEDCRYPTO_LIBS)
endif
endif
endif

View File

@ -53,7 +53,7 @@ ifeq ($(GRIFFIN_BUILD), 1)
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
#DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DRC_DISABLE_LUA -DHAVE_SOCKET_LEGACY -DHAVE_THREADS
#-DHAVE_SSL -DMBEDTLS_SSL_DEBUG_ALL
#-DHAVE_SSL -DHAVE_BUILTINMBEDTLS -DMBEDTLS_SSL_DEBUG_ALL
#ssl is currently incompatible with griffin due to use of the "static" flag on repeating functions that will conflict when included in one file
else
HAVE_CC_RESAMPLER = 1

View File

@ -1466,6 +1466,7 @@ SSL
============================================================ */
#if defined(HAVE_SSL)
#if defined(HAVE_NETWORKING)
#if defined(HAVE_BUILTINMBEDTLS)
#include "../deps/mbedtls/aes.c"
#include "../deps/mbedtls/aesni.c"
#include "../deps/mbedtls/arc4.c"
@ -1543,3 +1544,4 @@ SSL
#include "../libretro-common/net/net_socket_ssl.c"
#endif
#endif
#endif

View File

@ -25,6 +25,7 @@
#include <net/net_socket.h>
#include <net/net_socket_ssl.h>
#if defined(HAVE_BUILTINMBEDTLS)
#include "../../deps/mbedtls/mbedtls/config.h"
#include "../../deps/mbedtls/mbedtls/certs.h"
#include "../../deps/mbedtls/mbedtls/debug.h"
@ -33,7 +34,18 @@
#include "../../deps/mbedtls/mbedtls/ssl.h"
#include "../../deps/mbedtls/mbedtls/ctr_drbg.h"
#include "../../deps/mbedtls/mbedtls/entropy.h"
#else
#include <mbedtls/config.h>
#include <mbedtls/certs.h>
#include <mbedtls/debug.h>
#include <mbedtls/platform.h>
#include <mbedtls/net_sockets.h>
#include <mbedtls/ssl.h>
#include <mbedtls/ctr_drbg.h>
#include <mbedtls/entropy.h>
#endif
/* Not part of the mbedtls upstream source */
#include "../../deps/mbedtls/cacert.h"
#define DEBUG_LEVEL 0

View File

@ -503,6 +503,7 @@
OTHER_CFLAGS = (
"-DHAVE_RUNAHEAD",
"-DHAVE_SSL",
"-DHAVE_BUILTINMBEDTLS",
"-DHAVE_GRIFFIN",
"-DHAVE_FLAC",
"-DHAVE_DR_FLAC",
@ -568,6 +569,7 @@
OTHER_CFLAGS = (
"-DHAVE_RUNAHEAD",
"-DHAVE_SSL",
"-DHAVE_BUILTINMBEDTLS",
"-DHAVE_GRIFFIN",
"-DHAVE_FLAC",
"-DHAVE_DR_FLAC",

View File

@ -214,6 +214,7 @@ else
HAVE_NETWORKGAMEPAD='no'
HAVE_CHEEVOS='no'
HAVE_DISCORD='no'
HAVE_SSL='no'
fi
check_lib '' STDIN_CMD "$CLIB" fcntl
@ -315,6 +316,37 @@ fi
check_pkgconf FLAC flac
check_val '' FLAC '-lFLAC'
if [ "$HAVE_SSL" = 'no' ]; then
HAVE_BUILTINMBEDTLS=no
fi
if [ "$HAVE_SSL" != 'no' ]; then
check_header MBEDTLS \
mbedtls/config.h \
mbedtls/certs.h \
mbedtls/debug.h \
mbedtls/platform.h \
mbedtls/net_sockets.h \
mbedtls/ssl.h \
mbedtls/ctr_drbg.h \
mbedtls/entropy.h
check_lib '' MBEDTLS -lmbedtls
check_lib '' MBEDX509 -lmbedx509
check_lib '' MBEDCRYPTO -lmbedcrypto
if [ "$HAVE_MBEDTLS" = 'no' ] ||
[ "$HAVE_MBEDX509" = 'no' ] ||
[ "$HAVE_MBEDCRYPTO" = 'no' ]; then
if [ "$HAVE_BUILTINMBEDTLS" != 'yes' ]; then
die : 'Notice: System mbedtls libraries not found, disabling SSL support.'
HAVE_SSL=no
fi
else
HAVE_SSL=yes
fi
fi
check_pkgconf LIBUSB libusb-1.0 1.0.13
check_val '' LIBUSB -lusb-1.0 libusb-1.0

View File

@ -15,8 +15,9 @@ HAVE_STRIPES=no # Stripes menu
HAVE_ZARCH=no # Zarch menu
HAVE_NUKLEAR=no # Nuklear menu
HAVE_RUNAHEAD=yes # Runahead support
HAVE_SSL=yes # SSL/mbedtls support
C89_SSL=no
HAVE_SSL=auto # SSL/mbedtls support
C89_SSL=no
HAVE_BUILTINMBEDTLS=yes # Bake in the mbedtls library
HAVE_OVERLAY=yes # Overlay support
HAVE_DYNAMIC=yes # Dynamic loading of libretro library
HAVE_SDL=auto # SDL support