Skip to content

Commit

Permalink
Merge pull request #137 from Comcast/kraj/master
Browse files Browse the repository at this point in the history
Fix cppsdk/webbridge for backtrace() API
  • Loading branch information
wouterlucas committed Mar 27, 2017
2 parents 8ffd1c7 + 1d040e3 commit e1edf16
Show file tree
Hide file tree
Showing 8 changed files with 259 additions and 7 deletions.
11 changes: 8 additions & 3 deletions recipes-drm/opencdm/opencdm_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ HOMEPAGE = "https://www.fokus.fraunhofer.de/en"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=ea83f8bc099c40bde8c4f2441a6eb40b"

DEPENDS = "glib-2.0"
DEPENDS = "glib-2.0"
DEPENDS_append_libc-musl = " libtirpc"
CPPFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
CXXFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
LDFLAGS_append_libc-musl = " -ltirpc"

SRCREV = "04669dd00977e23c137d5bb9f84c9c5e1af52165"
SRCREV = "e63c1f67dd3b20b68592972989dd451f98e432a9"
PV = "1.0.gitr${SRCPV}"
S = "${WORKDIR}/git"

SRC_URI = "git://git@github.com/Metrological/open-content-decryption-module.git;protocol=ssh;branch=wpe"
SRC_URI = "git://github.com/WebPlatformForEmbedded/WPEOpenCDM;branch=wpe"

do_compile_prepend() {
mkdir -p ${S}/src/browser/wpe/test/bin
Expand Down
7 changes: 6 additions & 1 deletion recipes-drm/opencdmi/opencdmi_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=ea83f8bc099c40bde8c4f2441a6eb40b"

DEPENDS = "rpcbind opencdm openssl"
DEPENDS_append_libc-musl = " libtirpc"
CPPFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
CXXFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
LDFLAGS_append_libc-musl = " -ltirpc"

SRCREV = "a739feb6111143abdc6e26fa587086bba89ded95"
SRCREV = "c147d47cfe30b0e8c93c5e5e72caec7d733db05c"
PV = "1.0.gitr${SRCPV}"
S = "${WORKDIR}/git"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
From 1be47b8dbaa7ee9ccd297b674861793bd7f9231d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 24 Mar 2017 18:31:49 -0700
Subject: [PATCH] Detect libexecinfo if available on platform

Some platform e.g. freebsd or musl based linux platforms
where backtrace() API is not available, there is external
library libexecinfo which provides same funcitonality
try to find this library if available add it to linker
cmdline

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
CMakeLists.txt | 2 ++
cmake/FindExecInfo.cmake | 14 ++++++++++++++
config.h.in | 1 +
generics/CMakeLists.txt | 4 ++++
generics/Portability.cpp | 5 ++++-
generics/SocketPort.cpp | 4 ++++
6 files changed, 29 insertions(+), 1 deletion(-)
create mode 100644 cmake/FindExecInfo.cmake
create mode 100644 config.h.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 13a795c..79990dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ set (CPPSDK_PLATFORM "PC_UNIX" CACHE STRING "Defines on what platform cppsdk wil
add_definitions(-DPLATFORM_${CPPSDK_PLATFORM}=1)

include_directories (${CMAKE_SOURCE_DIR})
+include_directories (${CMAKE_BINARY_DIR})

add_definitions (-Wall -fPIC)

@@ -28,6 +29,7 @@ else()
endif()

find_package(Threads REQUIRED)
+find_package(ExecInfo)

option (CPPSDK_GENERICS
"Include the generics library." ON)
diff --git a/cmake/FindExecInfo.cmake b/cmake/FindExecInfo.cmake
new file mode 100644
index 0000000..b7fb396
--- /dev/null
+++ b/cmake/FindExecInfo.cmake
@@ -0,0 +1,14 @@
+include (CheckIncludeFiles)
+find_library (EXECINFO_LIBRARY NAMES execinfo)
+
+if (EXECINFO_LIBRARY)
+ set (CPPSDK_EXECINFO_LIBRARY ${EXEXINFO_LIBRARY})
+endif()
+
+CHECK_INCLUDE_FILE (execinfo.h HAVE_EXECINFO_H)
+
+configure_file(
+ "${CMAKE_SOURCE_DIR}/config.h.in"
+ "${CMAKE_BINARY_DIR}/config.h"
+ @ONLY)
+
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..6de91b7
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1 @@
+#cmakedefine HAVE_EXECINFO_H 1
diff --git a/generics/CMakeLists.txt b/generics/CMakeLists.txt
index a48eae6..b068367 100755
--- a/generics/CMakeLists.txt
+++ b/generics/CMakeLists.txt
@@ -14,6 +14,9 @@ set(GENERICS_LIBS
${CMAKE_DL_LIBS}
${GENERICS_RT_LIBRARY}
)
+if (EXECINFO_LIBRARY)
+ list(APPEND GENERICS_LIBS ${EXECINFO_LIBRARY})
+endif ()

set(GENERICS_SOURCES
SystemInfo.cpp
@@ -44,6 +47,7 @@ set(GENERICS_SOURCES
ProcessInfo.cpp
)

+
if(${CPPSDK_PLATFORM} STREQUAL "INTELCE")
include_directories( ${INTELCE_OSAL_INCLUDE_DIRS} ${INTELCE_GDL_INCLUDE_DIRS})
list(APPEND GENERICS_LIBS ${INTELCE_OSAL_LIBRARIES} ${INTELCE_GDL_LIBRARIES})
diff --git a/generics/Portability.cpp b/generics/Portability.cpp
index 9f10106..d9ed05b 100644
--- a/generics/Portability.cpp
+++ b/generics/Portability.cpp
@@ -1,12 +1,15 @@
#include <stdlib.h>

+#include "config.h"
#include "Portability.h"
#include "SystemInfo.h"
#include "Sync.h"

#ifdef __LINUX__
#include <signal.h>
-
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
#define CALLSTACK_SIG SIGUSR2
#endif

diff --git a/generics/SocketPort.cpp b/generics/SocketPort.cpp
index 0295676..7aaff33 100644
--- a/generics/SocketPort.cpp
+++ b/generics/SocketPort.cpp
@@ -3,6 +3,7 @@
#include "Sync.h"
#include "Singleton.h"
#include "Timer.h"
+#include "config.h"

#ifdef __POSIX__
#include <arpa/inet.h>
@@ -21,6 +22,9 @@
#include <sys/ioctl.h>
#include <sys/signalfd.h>
#include <signal.h>
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
#endif

#ifdef __WIN32__
--
2.12.1

2 changes: 2 additions & 0 deletions recipes-metrological/cppsdk/cppsdk_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ LICENSE = "CLOSED"
#LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

DEPENDS = "zlib"
DEPENDS_append_libc-musl = " libexecinfo"

PV = "1.0+gitr${SRCPV}"

SRC_URI = "git://git@github.com/Metrological/cppsdk.git;protocol=ssh;branch=master \
file://0001-Detect-libexecinfo-if-available-on-platform.patch \
"

SRCREV = "e3224d996c7180d95821e8d0386101dca682abd2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
From 0b5b9ebd38380315adeeba1a49dae03dfa5d6f74 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 24 Mar 2017 21:42:40 -0700
Subject: [PATCH] Link libexecinfo if platform provides it

Platforms e.g. FreeBSD do not have backtrace APIs which
are glibc specific, also systems based on musl/linux
are in same boat. This patch checks for libexecinfo
which provides backtrace functionality on these platforms

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
CMakeLists.txt | 5 ++++-
WebBridge/CMakeLists.txt | 5 ++++-
WebBridge/WebBridge.cpp | 4 ++++
cmake/FindExecInfo.cmake | 14 ++++++++++++++
config.h.in | 1 +
5 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 cmake/FindExecInfo.cmake
create mode 100644 config.h.in

Index: git/CMakeLists.txt
===================================================================
--- git.orig/CMakeLists.txt
+++ git/CMakeLists.txt
@@ -60,9 +60,12 @@ add_custom_target(install_${PROJECT_NAME
# add cmake custom module directory
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

+include_directories (${CMAKE_BINARY_DIR})
+
find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED)
find_package(Cppsdk REQUIRED COMPONENTS generics)
+find_package(ExecInfo)

# include staging directory.
if (CMAKE_CROSSCOMPILING)
Index: git/WebBridge/CMakeLists.txt
===================================================================
--- git.orig/WebBridge/CMakeLists.txt
+++ git/WebBridge/CMakeLists.txt
@@ -18,11 +18,15 @@ set(WEBBRIDGE_POLICY 0 CACHE STRING "NA"
set(WEBBRIDGE_OOMADJUST 0 CACHE STRING "Adapt the OOM score [-15 - 15]")
set(WEBBRIDGE_STACKSIZE 0 CACHE STRING "Default stack size per thread")

-
set(WEBBRIDGE_WEBBRIDGE_LIBS
webbridgesupport
${LIBGENERICS_LIBRARIES}
)
+
+if (EXECINFO_LIBRARY)
+ list(APPEND WEBBRIDGE_WEBBRIDGE_LIBS ${EXECINFO_LIBRARY})
+endif ()
+
set(WEBBRIDGE_WEBBRIDGE_SOURCES
WebBridge.cpp
Controller.cpp
Index: git/WebBridge/WebBridge.cpp
===================================================================
--- git.orig/WebBridge/WebBridge.cpp
+++ git/WebBridge/WebBridge.cpp
@@ -1,9 +1,14 @@
#include "WebBridgePluginServer.h"
+#include "config.h"

#ifndef __WIN32__
#include <syslog.h>
#endif

+#if defined(__linux__) && defined(HAVE_EXECINFO_H)
+#include <execinfo.h>
+#endif
+
MODULE_NAME_DECLARATION(BUILDREF_WEBBRIDGE)

#define MAX_EXTERNAL_WAITS 2000 /* Wait for 2 Seconds */
Index: git/cmake/FindExecInfo.cmake
===================================================================
--- /dev/null
+++ git/cmake/FindExecInfo.cmake
@@ -0,0 +1,10 @@
+include (CheckIncludeFiles)
+find_library (EXECINFO_LIBRARY NAMES execinfo)
+
+CHECK_INCLUDE_FILE (execinfo.h HAVE_EXECINFO_H)
+
+configure_file(
+ "${CMAKE_SOURCE_DIR}/config.h.in"
+ "${CMAKE_BINARY_DIR}/config.h"
+ @ONLY)
+
Index: git/config.h.in
===================================================================
--- /dev/null
+++ git/config.h.in
@@ -0,0 +1 @@
+#cmakedefine HAVE_EXECINFO_H 1
2 changes: 2 additions & 0 deletions recipes-metrological/webbridge/webbridge_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ LICENSE = "CLOSED"
#LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

DEPENDS = "cppsdk zlib"
DEPENDS_append_libc-musl = " libexecinfo"

# ----------------------------------------------------------------------------

Expand All @@ -21,6 +22,7 @@ BASEPV = "${@ d.getVar('SRCPV', True).replace('AUTOINC+', '')}"

SRC_URI = "git://git@github.com/Metrological/webbridge.git;protocol=ssh;branch=master \
file://0001-Remove-CPPSDK_INCLUDE_DIRS.patch \
file://0001-Link-libexecinfo-if-platform-provides-it.patch \
file://webbridge-init \
file://webbridge.service.in \
"
Expand Down
2 changes: 1 addition & 1 deletion recipes-metrological/webdriver/webdriver-wpe_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HOMEPAGE = "http://www.metrological.com/"
SECTION = "metrological"
LICENSE = "CLOSED"

DEPENDS = "curl glib-2.0 json-c wpe gyp-native"
DEPENDS = "curl glib-2.0 json-c wpewebkit gyp-native"

PV = "1.0+gitr${SRCPV}"

Expand Down
5 changes: 3 additions & 2 deletions recipes-wpe/wpewebkit/wpewebkit_0.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DEPENDS += " \
wpebackend \
bison-native gperf-native harfbuzz-native ninja-native ruby-native chrpath-replacement-native \
cairo fontconfig freetype glib-2.0 gnutls harfbuzz icu jpeg pcre sqlite3 zlib \
libinput libpng libsoup-2.4 libwebp libxml2 libxslt \
libpng libsoup-2.4 libwebp libxml2 libxslt \
virtual/egl virtual/libgles2 \
"

Expand All @@ -34,7 +34,7 @@ PROVISIONING_x86 = ""
PROVISIONING_hikey-32 = ""
PROVISIONING_dragonboard-410c-32 = ""

PACKAGECONFIG ?= "2dcanvas deviceorientation fullscreenapi encryptedmediav1 fetchapi gamepad geolocation indexeddb logs mediasource notifications sampling-profiler shadowdom subtlecrypto udev video webaudio subtitle nativevideo"
PACKAGECONFIG ?= "2dcanvas deviceorientation fullscreenapi encryptedmediav1 fetchapi gamepad geolocation indexeddb libinput logs mediasource notifications sampling-profiler shadowdom subtlecrypto udev video webaudio subtitle nativevideo"

PACKAGECONFIG_remove_libc-musl = "sampling-profiler"

Expand All @@ -60,6 +60,7 @@ PACKAGECONFIG[notifications] = "-DENABLE_NOTIFICATIONS=ON,-DENABLE_NOTIFICATIONS
PACKAGECONFIG[sampling-profiler] = "-DENABLE_SAMPLING_PROFILER=ON,-DENABLE_SAMPLING_PROFILER=OFF,"
PACKAGECONFIG[shadowdom] = "-DENABLE_SHADOW_DOM=ON,-DENABLE_SHADOW_DOM=OFF,"
PACKAGECONFIG[subtlecrypto] = "-DENABLE_SUBTLE_CRYPTO=ON,-DENABLE_SUBTLE_CRYPTO=OFF,"
PACKAGECONFIG[libinput] = "-DUSE_WPEWEBKIT_INPUT_LIBINPUT=ON,-DUSE_WPEWEBKIT_INPUT_LIBINPUT=OFF,libinput"
PACKAGECONFIG[udev] = "-DUSE_WPEWEBKIT_INPUT_UDEV=ON,-DUSE_WPEWEBKIT_INPUT_UDEV=OFF,udev"
PACKAGECONFIG[video] = "-DENABLE_VIDEO=ON -DENABLE_VIDEO_TRACK=ON,-DENABLE_VIDEO=OFF -DENABLE_VIDEO_TRACK=OFF,gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad,${RDEPS_VIDEO}"
PACKAGECONFIG[webaudio] = "-DENABLE_WEB_AUDIO=ON,-DENABLE_WEB_AUDIO=OFF,gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good,${RDEPS_WEBAUDIO}"
Expand Down

0 comments on commit e1edf16

Please sign in to comment.