From 83a1518bfc88b4528c95bdb0c65214c5157b77eb Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Thu, 5 Jun 2025 19:20:11 +0000 Subject: [PATCH] RDKEMW-4129: Prepare native build script Signed-off-by: yuvaramachandran_gurusamy --- .github/workflows/native_full_build.yml | 4 +- build_dependencies.sh | 41 +++++++++++++- cov_build.sh | 11 +--- server/include/gdial-config.h | 10 +--- stubs/iarm_stubs.cpp | 68 +++++++++++++++++++++++ stubs/securityagent/SecurityTokenUtil.cpp | 56 +++++++++++++++++++ stubs/securityagent/SecurityTokenUtil.h | 50 +++++++++++++++++ 7 files changed, 218 insertions(+), 22 deletions(-) create mode 100644 stubs/iarm_stubs.cpp create mode 100644 stubs/securityagent/SecurityTokenUtil.cpp create mode 100644 stubs/securityagent/SecurityTokenUtil.h diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 757298bf..b241c8d2 100755 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -2,9 +2,9 @@ name: Build Component in Native Environment on: push: - branches: [ main, 'sprint/**', 'release/**', topic/*, develop, topic/RDKEMW-4129 ] + branches: [ main, 'sprint/**', 'release/**', topic/*, develop ] pull_request: - branches: [ main, 'sprint/**', 'release/**', topic/*, develop, topic/RDKEMW-4129 ] + branches: [ main, 'sprint/**', 'release/**', topic/*, develop ] jobs: build-entservices-on-pr: diff --git a/build_dependencies.sh b/build_dependencies.sh index c755d997..86d6c353 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -3,14 +3,14 @@ set -x set -e ############################## GITHUB_WORKSPACE="${PWD}" -ls -la ${GITHUB_WORKSPACE} + cd ${GITHUB_WORKSPACE} # # ############################# #1. Install Dependencies and packages apt update -#apt install -y libsqlite3-dev libcurl4-openssl-dev valgrind lcov clang libsystemd-dev libboost-all-dev libwebsocketpp-dev meson libcunit1 libcunit1-dev curl protobuf-compiler-grpc libgrpc-dev libgrpc++-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev +apt install -y ninja-build meson curl libsoup2.4-dev libxml2-dev libglib2.0-dev gobject-introspection libgirepository1.0-dev libgtk-3-dev valac pandoc pip install jsonref ############################ @@ -26,6 +26,11 @@ cd .. ########################################### # Clone the required repositories +rm -rf iarmbus ThunderTools Thunder entservices-apis entservices-testframework gssdp + + +git clone https://github.com/rdkcentral/iarmbus.git +export IARMBUS_PATH=$GITHUB_WORKSPACE/iarmbus git clone --branch R4.4.3 https://github.com/rdkcentral/ThunderTools.git @@ -35,6 +40,21 @@ git clone --branch main https://github.com/rdkcentral/entservices-apis.git git clone https://$GITHUB_TOKEN@github.com/rdkcentral/entservices-testframework.git +git clone --branch gssdp-1.2.3 https://gitlab.gnome.org/GNOME/gssdp.git + +############################ +# Build gssdp-1.2 +echo "======================================================================================" +echo "buliding gssdp-1.2" +cd gssdp + +rm -rf build +meson setup build + +ninja -C build +ninja -C build install +cd - + ############################ # Build Thunder-Tools echo "======================================================================================" @@ -77,7 +97,6 @@ cmake -G Ninja -S Thunder -B build/Thunder \ cmake --build build/Thunder --target install - ############################ # Build entservices-apis echo "======================================================================================" @@ -93,3 +112,19 @@ cmake -G Ninja -S entservices-apis -B build/entservices-apis \ cmake --build build/entservices-apis --target install +############################ + +############################ +# Build and deploy stubs for IARMBus and WPEFramework securityagent +mkdir -p /usr/include/WPEFramework/securityagent +cp $GITHUB_WORKSPACE/stubs/securityagent/* /usr/include/WPEFramework/securityagent/ -v + +echo "======================================================================================" +echo "Building IARMBus and WPEFramework securityagent stubs" +cd $GITHUB_WORKSPACE +cd ./stubs +g++ -fPIC -shared -o libIARMBus.so iarm_stubs.cpp -I$GITHUB_WORKSPACE/stubs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I$IARMBUS_PATH/core -I$IARMBUS_PATH/core/include -fpermissive +g++ -fPIC -shared -o libWPEFrameworkSecurityUtil.so securityagent/SecurityTokenUtil.cpp -I$GITHUB_WORKSPACE/stubs -fpermissive + +cp libIARMBus.so /usr/local/lib/ +cp libWPEFrameworkSecurityUtil.so /usr/local/lib/ diff --git a/cov_build.sh b/cov_build.sh index 54f3fb84..da227aba 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -9,15 +9,8 @@ ls -la ${GITHUB_WORKSPACE} echo "buliding xdialserver" cd ${GITHUB_WORKSPACE} -cmake -G Ninja -S "$GITHUB_WORKSPACE" -B build/xdialserver \ --DUSE_THUNDER_R4=ON \ --DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install/usr" \ --DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ --DCMAKE_VERBOSE_MAKEFILE=ON \ --DCMAKE_CXX_FLAGS="-DEXCEPTIONS_ENABLE=ON \ --I ${GITHUB_WORKSPACE}/Thunder/Source \ --I ${GITHUB_WORKSPACE}/Thunder/Source/core" \ -cmake --build build/xdialserver --target install +make + echo "======================================================================================" exit 0 diff --git a/server/include/gdial-config.h b/server/include/gdial-config.h index c6b9a9bc..13dd4172 100644 --- a/server/include/gdial-config.h +++ b/server/include/gdial-config.h @@ -17,8 +17,8 @@ * limitations under the License. */ -#ifndef GDIAL_H_ -#define GDIAL_H_ +#ifndef _GDIAL_CONFIG_H_ +#define _GDIAL_CONFIG_H_ #ifdef __cplusplus extern "C" { @@ -81,12 +81,6 @@ extern "C" { #define GDIAL_THROTTLE_DELAY_US 100000 #define GDIAL_DEBUG g_print -enum { - GDIAL_ERROR_NONE = 0, - GDIAL_ERROR_NOT_REGISTERED, - GDIAL_ERROR_FAIL_TO_START, -} GDialError; - #define GDIAL_GERROR_CHECK_AND_FREE(err, msg) \ {\ if (err) {\ diff --git a/stubs/iarm_stubs.cpp b/stubs/iarm_stubs.cpp new file mode 100644 index 00000000..ef10fc2d --- /dev/null +++ b/stubs/iarm_stubs.cpp @@ -0,0 +1,68 @@ +#include "libIBus.h" +#include "libIARMCore.h" +using namespace std; + +IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Init(const char* name) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Connect() +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Term(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Disconnect(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} diff --git a/stubs/securityagent/SecurityTokenUtil.cpp b/stubs/securityagent/SecurityTokenUtil.cpp new file mode 100644 index 00000000..a743d52f --- /dev/null +++ b/stubs/securityagent/SecurityTokenUtil.cpp @@ -0,0 +1,56 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 RDK Management + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "SecurityTokenUtil.h" +/* + * Send thunder security token for localhost. + * This token can be used by native applications to securely access rdkservices. + */ + +using namespace std; + +extern "C" { + /* + * GetSecurityToken - function to obtain a token from SecurityAgent + * + * Parameters + * maxLength - holds the maximum uint8_t length of the buffer + * Id - Buffer to hold the token. + * + * Return value + * < 0 - failure, absolute value returned is the length required to store the token + * > 0 - success, char length of the returned token + * + * Post-condition; return value 0 should not occur + * + */ + int GetSecurityToken(unsigned short maxLength, unsigned char buffer[]) + { + // get a localhost token + string payload = "http://localhost"; + + size_t len = payload.length(); + + if(!memcpy(buffer,payload.c_str(),len)) + return -1; + return 0; + } +} diff --git a/stubs/securityagent/SecurityTokenUtil.h b/stubs/securityagent/SecurityTokenUtil.h new file mode 100644 index 00000000..b32894f5 --- /dev/null +++ b/stubs/securityagent/SecurityTokenUtil.h @@ -0,0 +1,50 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 RDK Management + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#ifdef __WINDOWS__ +#undef EXTERNAL +#ifdef SECURITYUTILITY_EXPORTS +#define EXTERNAL EXTERNAL_EXPORT +#else +#define EXTERNAL EXTERNAL_IMPORT +#endif +#else +#undef EXTERNAL +#define EXTERNAL +#endif + +extern "C" { + /* + * GetSecurityToken - function to obtain a token from SecurityAgent + * + * Parameters + * maxLength - holds the maximum uint8_t length of the buffer + * buffer - Buffer to hold the token. + * + * Return value + * < 0 - failure, absolute value returned is the length required to store the token + * > 0 - success, char length of the returned token + * + * Post-condition; return value 0 should not occur + * + */ + int EXTERNAL GetSecurityToken(unsigned short maxLength, unsigned char buffer[]); +}