Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/native_full_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build Component in Native Environment

on:
push:
branches: [ main, 'sprint/**', 'release/**', develop ]
pull_request:
branches: [ main, 'sprint/**', 'release/**', topic/*, feature/RDK*, develop ]

jobs:
build-entservices-on-pr:
name: Build HdmiCec Component in github rdkcentral
runs-on: ubuntu-latest
container:
image: ghcr.io/rdkcentral/docker-rdk-ci:latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: native build
run: |
./cov_build.sh
97 changes: 97 additions & 0 deletions cov_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash

WORKDIR=`pwd`
export ROOT=/usr
export INSTALL_DIR=${ROOT}/local
mkdir -p $INSTALL_DIR

export CC=gcc
export CXX=g++
export AR=ar
export LD=ld
export NM=nm
export RANLIB=ranlib
export STRIP=strip

apt-get update && apt-get install -y libsoup-3.0 libcjson-dev

cd $ROOT
rm -rf rdk-halif-hdmi_cec
git clone https://github.com/rdkcentral/rdk-halif-hdmi_cec.git
export CEC_HALIF_PATH=$ROOT/rdk-halif-hdmi_cec
mkdir -p $INSTALL_DIR/include/ccec/drivers/
cp $CEC_HALIF_PATH/include/hdmi_cec_driver.h $INSTALL_DIR/include/ccec/drivers/

cd $ROOT
rm -rf telemetry
git clone https://github.com/rdkcentral/telemetry.git
export TELEMETRY_PATH=$ROOT/telemetry

echo "##### Building HdmiCec module"
cd $WORKDIR

# default PATHs - use `man readlink` for more info
# the path to combined build
export RDK_PROJECT_ROOT_PATH=${RDK_PROJECT_ROOT_PATH-`readlink -m ../../..`}

# path to build script (this script)
export RDK_SCRIPTS_PATH=${RDK_SCRIPTS_PATH-`readlink -m $0 | xargs dirname`}

# path to components sources and target
export RDK_SOURCE_PATH=${RDK_SOURCE_PATH-$RDK_SCRIPTS_PATH}

# default component name
export RDK_COMPONENT_NAME=${RDK_COMPONENT_NAME-`basename $RDK_SOURCE_PATH`}
cd ${RDK_SOURCE_PATH}

Check failure on line 45 in cov_build.sh

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'cov_build.sh' (Match: rdk/components/generic/storagemanager/rdk/components/generic/storagemanager/2017q4, 39 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/storagemanager/+archive/rdkv-2017q4.tar.gz, file: rdk_build.sh)

# functional modules
function configure()
{
pd=`pwd`
cd $RDK_SCRIPTS_PATH
aclocal -I cfg
libtoolize --automake
autoheader
automake --foreign --add-missing
rm -f configure
autoconf
./configure --with-libtool-sysroot=/ --disable-static --host=$HOST --disable-silent-rules --prefix=${RDK_FSROOT_PATH}/usr/
}

function clean()
{
pd=`pwd`
CLEAN_BUILD=1
dnames="$RDK_SCRIPTS_PATH"
for dName in $dnames
do
cd $dName
if [ -f Makefile ]; then
make distclean
fi
rm -f configure
rm -rf aclocal.m4 autom4te.cache config.log config.status libtool
rm -rf install
find . -iname "Makefile.in" -exec rm -f {} \;
ls cfg/* | grep -v "Makefile.am" | xargs rm -f
cd $pd
done
true #use this function to provide instructions to clean workspace
}

function build()
{
cd ${RDK_SCRIPTS_PATH}

make VERBOSE=1 AM_CXXFLAGS="-I${WORKDIR}/stubs -I${WORKDIR}/osal/include -I${WORKDIR}/ccec/include -I${TELEMETRY_PATH}/include"
}

function rebuild()
{
clean
configure
build
clean
}

rebuild
165 changes: 165 additions & 0 deletions stubs/safec_lib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the

Check failure on line 2 in stubs/safec_lib.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'stubs/safec_lib.h' (Match: rdkcentral/Thunder/R1, 15 lines, url: https://github.com/rdkcentral/Thunder/archive/R1.zip, file: Source/com/IUnknown.h)
* following copyright and licenses apply:

Check failure on line 3 in stubs/safec_lib.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'IETF' license found in local file 'stubs/safec_lib.h' (Match: rdkcmf/rdkb-CcspCommonLibrary/1, 155 lines, url: https://github.com/rdkcmf/rdkb-CcspCommonLibrary/archive/RDKB-TEST-RELEASE-DUNFELL-1.tar.gz, file: source/cosa/include/safec_lib_common.h)
*
* 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.
*/

#define SAFEC_DUMMY_API 1
#ifndef SAFEC_DUMMY_API
#include "safe_str_lib.h"
#include "safe_mem_lib.h"

/* Macro is defined for non clobbering of the safec secure string API strcpy_s & memcpy_s function*/
/* strcpy_s overwrites the old value and nulls the dest when encounters an error*/
#ifndef STRCPY_S_NOCLOBBER
#define STRCPY_S_NOCLOBBER(dst,dmax,src) ((src != NULL) ? (strlen(src) < dmax ? strcpy_s(dst,dmax,src) : ESNOSPC):ESNULLP)
#endif
#define MEMCPY_S_NOCLOBBER(dst,dmax,src,len) ((src != NULL) ? (len <= dmax ? memcpy_s(dst,dmax,src,len) : ESNOSPC):ESNULLP)
#endif

#define STRCPY_S(dest,size,source) \
{ \
errno_t rc=-1; \
rc=strcpy_s(dest, size, source); \
if(rc!=EOK) \
{ \
RDK_SAFECLIB_ERR(rc); \
}\
}
#define MEMCPY_S(dest,dsize,source,ssize) \
{ \
errno_t safec_rc=-1; \
safec_rc=memcpy_s(dest, dsize, source, ssize); \
if(safec_rc!=EOK) \
{ \
RDK_SAFECLIB_ERR(safec_rc); \
}\
}

/*
* SAFECLIB Error Handling Logging APIs
*/
#define RDK_SAFECLIB_ERR(rc) printf("safeclib error at rc - %d %s %s:%d", rc, __FILE__, __FUNCTION__, __LINE__)

#define ERR_CHK(rc) \
if(rc !=EOK) { \
RDK_SAFECLIB_ERR(rc); \
}

#ifdef SAFEC_DUMMY_API
#include <stdarg.h>
#include <string.h>
#include <strings.h>
typedef int errno_t;
#define EOK 0
#define ESNULLP 400 /* null ptr */
#define ESLEMAX 403 /* length exceeds RSIZE_MAX */
#define ESNOSPC 406 /* not enough space for s2 */

#define strcpy_s(dst,max,src) (src != NULL)?((max > strlen(src))?EOK:ESLEMAX):ESNULLP; \
if((src != NULL) && (max > strlen(src))) strcpy(dst,src);

#define strncpy_s(dst,max,src,len) (src != NULL)?((len <= max)?EOK:ESLEMAX):ESNULLP; \
if((src != NULL) && (len <= max)) strncpy(dst,src,len);

#define memset_s(dst,max_1,c,max) EOK; \
memset(dst,c,max);

#define strcat_s(dst,max,src) (src != NULL)?((max > strlen(src))?EOK:ESLEMAX):ESNULLP; \
if((src != NULL) && (max > strlen(src))) strcat(dst,src);

#define strncat_s(dst,max,src,len) (src != NULL)?((len <= max)?EOK:ESLEMAX):ESNULLP; \
if((src != NULL) && (len <= max)) strncat(dst,src,len);

#define memcpy_s(dst,max,src,len) EOK; \
memcpy(dst,src,len);

#ifndef STRCPY_S_NOCLOBBER
#define STRCPY_S_NOCLOBBER(dst,max,src) (src != NULL)?((max > strlen(src))?EOK:ESLEMAX):ESNULLP; \
if((src != NULL) && (strlen(src) < max)) strcpy(dst, src);
#endif

#define MEMCPY_S_NOCLOBBER(dst,max,src,len) (src != NULL) ? ((len <= max)?EOK:ESLEMAX):ESNULLP; \
if((src != NULL) && (len <= max)) memcpy(dst, src, len);

#define strtok_s(dest, dmax, delim, ptr) strtok_r(dest, delim, ptr)

#define sprintf_s( dst, max, fmt, ... ) (parseFormat(dst, max, fmt, ##__VA_ARGS__) == 0) ? -ESNULLP : sprintf( dst, fmt, ##__VA_ARGS__)

#define STRCPY_S(dest,size,source) \
{ \
errno_t rc=-1; \
rc=strcpy_s(dest, size, source); \
if(rc!=EOK) \
{ \
RDK_SAFECLIB_ERR(rc); \
}\
}
#define MEMCPY_S(dest,dsize,source,ssize) \
{ \
errno_t safec_rc=-1; \
safec_rc=memcpy_s(dest, dsize, source, ssize); \
if(safec_rc!=EOK) \
{ \
RDK_SAFECLIB_ERR(safec_rc); \
}\
}

static inline int parseFormat(const char *dst, int max, const char *fmt, ...)
{
va_list argp;
int len = 0;

if((fmt == NULL) || (dst == NULL) || (max == 0))
{
return 0;
}

va_start(argp, fmt);

len = vsnprintf((char *)dst, (size_t)max, fmt, argp);

va_end(argp);

return (max > len) ? 1 : 0;
}

static inline int strcmp_s(const char *dst, int dmax, const char *src, int *r) {
if((src == NULL) || (dst == NULL) || (dmax == 0))
return ESNULLP;

*r = strcmp(dst, src);
return EOK;
}

static inline int strcasecmp_s(const char *dst, int dmax, const char *src, int *r) {
if((src == NULL) || (dst == NULL) || (dmax == 0))
return ESNULLP;

*r = strcasecmp(dst, src);
return EOK;
}

static inline int memcmp_s(const void *dst, int dmax, const void *src, int len, int *r) {
if((src == NULL) || (dst == NULL) || (dmax == 0))
return ESNULLP;
if(len > dmax)
return ESNOSPC;

*r = memcmp(dst, src,len);
return EOK;
}
#endif
Loading