From 111e0f9ef60e96ccddc716a7ef6a8f321835cf61 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Mon, 19 Jan 2026 08:47:04 +0000 Subject: [PATCH 01/15] Native build for Coverity --- .github/workflows/native-build.yml | 28 ++ cov_docker_script/README.md | 476 +++++++++++++++++++++ cov_docker_script/build_native.sh | 340 +++++++++++++++ cov_docker_script/common_build_utils.sh | 312 ++++++++++++++ cov_docker_script/common_external_build.sh | 92 ++++ cov_docker_script/component_config.json | 66 +++ cov_docker_script/setup_dependencies.sh | 241 +++++++++++ 7 files changed, 1555 insertions(+) create mode 100644 .github/workflows/native-build.yml create mode 100644 cov_docker_script/README.md create mode 100755 cov_docker_script/build_native.sh create mode 100755 cov_docker_script/common_build_utils.sh create mode 100755 cov_docker_script/common_external_build.sh create mode 100644 cov_docker_script/component_config.json create mode 100755 cov_docker_script/setup_dependencies.sh diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml new file mode 100644 index 0000000..0be08e2 --- /dev/null +++ b/.github/workflows/native-build.yml @@ -0,0 +1,28 @@ +name: Build Advanced Security Component in Native Environment + +on: + push: + branches: [ main, 'sprint/**', 'release/**', develop ] + pull_request: + branches: [ main, 'sprint/**', 'release/**', topic/RDK*, develop ] + +jobs: + build-advanced-security-on-pr: + name: Build advanced-security 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: | + chmod +x cov_docker_script/setup_dependencies.sh + ./cov_docker_script/setup_dependencies.sh + chmod +x cov_docker_script/build_native.sh + ./cov_docker_script/build_native.sh + + env: + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} \ No newline at end of file diff --git a/cov_docker_script/README.md b/cov_docker_script/README.md new file mode 100644 index 0000000..f449390 --- /dev/null +++ b/cov_docker_script/README.md @@ -0,0 +1,476 @@ +# Coverity Build System for RDK-B Components + +**Generic, reusable build system for any RDK-B component.** Just copy the scripts and customize `component_config.json`. + +## Quick Start + +### Complete Build (Recommended) + +```bash +cd /path/to/component/cov_docker_script +./common_external_build.sh +``` + +This runs the complete 2-step pipeline: +1. **Setup Dependencies** - Clones repos, copies headers, builds libraries +2. **Build Component** - Applies patches, builds component, installs libraries + +### Clean Build + +```bash +CLEAN_BUILD=true ./common_external_build.sh +``` + +Removes all previous build artifacts before starting. + +## Scripts Overview + +### 1. common_build_utils.sh + +**Purpose:** Shared utility library with common functions used by all build scripts. + +**Key Functions:** +- `log()`, `ok()`, `warn()`, `err()`, `step()` - Color-coded logging +- `expand_path()` - Expands `$HOME` variables in paths +- `check_dependencies()` - Validates required system tools (git, jq, gcc, make) +- `clone_repo()` - Clones git repositories with depth 1 +- `copy_headers()` - Copies header files from source to destination +- `apply_patch()` - Applies patches using Python3 for safe string replacement +- `build_autotools()`, `build_cmake()`, `build_meson()` - Build functions for different systems +- `execute_commands()` - Runs custom command sequences +- `copy_libraries()` - Finds and copies library files (.so, .a, .la) + +**Usage:** +```bash +# This script is sourced by other scripts, not run directly +source common_build_utils.sh +``` + +**Auto-configured:** +- Validates presence of git, jq, gcc, make +- Sets up color-coded terminal output +- Exports all functions for use in other scripts + +--- + +### 2. setup_dependencies.sh + +**Purpose:** Clones dependency repositories, copies headers, and builds required libraries. + +**What it does:** +1. Reads dependency list from `component_config.json` +2. Clones each repository to `$HOME/build/` +3. Copies headers to `$HOME/usr/include/rdkb/` +4. Builds libraries (if `build` section present) +5. Installs libraries to `$HOME/usr/local/lib/` and `$HOME/usr/lib/` +6. Configures PKG_CONFIG_PATH and LD_LIBRARY_PATH + +**Usage:** +```bash +# Use default config (component_config.json in same directory) +./setup_dependencies.sh + +# Use custom config file +./setup_dependencies.sh /path/to/custom_config.json + +# Clean build (removes $HOME/build and $HOME/usr first) +CLEAN_BUILD=true ./setup_dependencies.sh + +# Custom directories +BUILD_DIR=/tmp/build USR_DIR=/opt/rdkb ./setup_dependencies.sh +``` + +**Environment Variables:** +- `BUILD_DIR` - Where to clone repos (default: `$HOME/build`) +- `USR_DIR` - Install directory (default: `$HOME/usr`) +- `CLEAN_BUILD` - Set to `true` to remove previous artifacts + +**Output:** +- Headers: `$HOME/usr/include/rdkb/` +- Libraries: `$HOME/usr/local/lib/` and `$HOME/usr/lib/` + +--- + +### 3. build_native.sh + +**Purpose:** Builds the native component after dependencies are setup. + +**What it does:** +1. Reads component configuration from `component_config.json` +2. Processes native component headers (copies to destination) +3. Applies source patches (if configured) +4. Configures build environment (PKG_CONFIG_PATH, LD_LIBRARY_PATH, CPPFLAGS, LDFLAGS) +5. Runs autogen.sh or autoreconf (for autotools) +6. Executes configure/cmake with specified options +7. Builds component with make (parallel by default) +8. Copies libraries to configured output path + +**Usage:** +```bash +# Use defaults (assumes setup_dependencies.sh already run) +./build_native.sh + +# Specify custom config and component directory +./build_native.sh /path/to/config.json /path/to/component + +# With environment overrides +HEADER_PATH=/custom/include ./build_native.sh +``` + +**Prerequisites:** +- `setup_dependencies.sh` must have run successfully +- Headers and libraries must be in `$HOME/usr/` + +**Output:** +- Component libraries in path specified by `native_component.lib_output_path` +- Default: `$HOME/usr/local/lib/` + +--- + +### 4. common_external_build.sh + +**Purpose:** Orchestrates complete build pipeline (dependencies + component). + +**What it does:** +1. Validates configuration and paths +2. Runs `setup_dependencies.sh` (Step 1/2) +3. Runs `build_native.sh` (Step 2/2) +4. Displays progress banners and status + +**Usage:** +```bash +# Complete build with defaults +./common_external_build.sh + +# With custom config and component directory +./common_external_build.sh /path/to/config.json /path/to/component + +# Clean build +CLEAN_BUILD=true ./common_external_build.sh +``` + +**This is the recommended entry point for complete builds.** + +**Output:** +- Complete dependency setup +- Built component with all libraries +- Success/failure status for entire pipeline + +--- + +### 5. component_config.json + +**Purpose:** JSON configuration defining all dependencies and build settings. + +**Key Sections:** +- `dependencies.repos[]` - List of dependency repositories +- `native_component` - Component-specific build configuration +- `source_patches[]` - Patches to apply before building + +**Not a script, but required by all build scripts.** + +See **Configuration** section below for detailed format. + +--- + +## Configuration + +All build configuration is in **`component_config.json`**. This file defines: +- Dependencies to clone and build +- Headers to copy +- Patches to apply +- Build settings + +### Key Configuration Sections + +#### Dependencies + +```json +{ + "dependencies": { + "repos": [ + { + "name": "repo-name", + "repo": "https://github.com/org/repo.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools|cmake|meson|commands|script", + "configure_flags": "--prefix=$HOME/usr", + "parallel_make": true + } + } + ] + } +} +``` + +**Note:** The `build` section is optional - omit it for header-only dependencies. + +#### Native Component + +```json +{ + "native_component": { + "name": "component-name", + "include_path": "$HOME/usr/include/rdkb/", + "lib_output_path": "$HOME/usr/local/lib/", + "header_sources": [ + { "source": "source/ccsp/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" } + ], + "source_patches": [ + { + "file": "$HOME/usr/include/rdkb/header.h", + "type": "replace", + "search": "old text", + "replace": "new text" + } + ], + "build": { + "type": "autotools|cmake", + "configure_options": [ + "CPPFLAGS=-I$HOME/usr/include/rdkb", + "LDFLAGS=-L$HOME/usr/lib" + ] + } + } +} +``` + +**Configuration Details:** +- `header_sources[]` - Component headers to copy before building. Source paths are relative to component directory. +- `source_patches[]` - Patches to apply after headers are copied. Use absolute paths with `$HOME` for files in install directories. +- `include_path` - Colon-separated include paths for building +- `lib_output_path` - Where to install built libraries + +## Build Types + +### Autotools +```json +"build": { + "type": "autotools", + "configure_flags": "--prefix=$HOME/usr --enable-feature" +} +``` + +### CMake +```json +"build": { + "type": "cmake", + "build_dir": "build", + "cmake_flags": "-DCMAKE_INSTALL_PREFIX=$HOME/usr" +} +``` + +### Meson +```json +"build": { + "type": "meson", + "meson_flags": "--prefix=$HOME/usr" +} +``` + +### Custom Commands +```json +"build": { + "type": "commands", + "commands": ["meson setup build --prefix=$HOME/usr", "meson compile -C build"] +} +``` + +### Custom Script +```json +"build": { + "type": "script", + "script": "cov_docker_script/build.sh" +} +``` + +## Troubleshooting + +### Build fails with "command not found" +**Install required tools:** +```bash +sudo apt-get install git jq gcc make autoconf automake libtool cmake python3 +``` + +### Dependencies fail to build +- Check `$HOME/build/` for build logs +- Verify `configure_flags` in JSON are correct +- Ensure system packages for build type are installed (cmake, meson, etc.) + +### Headers not found during component build +- Verify `setup_dependencies.sh` completed successfully +- Check `$HOME/usr/include/rdkb/` contains expected headers +- Verify `header_paths` in JSON point to correct source directories + +### Libraries not found +- Check library directories: + - `$HOME/usr/local/lib/` - Primary location + - `$HOME/usr/lib/` - Secondary location +- Verify dependencies built successfully (look for `.so`, `.a` files) +- Check build logs for `make install` errors + +### Patches fail to apply +- **File not found:** Verify file path is relative to component directory +- **Use `../`** for files outside component (e.g., `../usr/include/rdkb/header.h`) +- **Exact match required:** Search string must exactly match file content +- **Python3 required:** Ensure Python3 is installed + +### Clean build needed +```bash +# Remove all previous build artifacts +CLEAN_BUILD=true ./common_external_build.sh +``` + +### Validate configuration +```bash +# Check JSON syntax +jq . component_config.json + +# List all dependencies +jq '.dependencies.repos[].name' component_config.json +``` + +## Directory Structure After Build + +``` +$HOME/ +├── build/ # Cloned repositories (removed after build) +└── usr/ + ├── include/ + │ └── rdkb/ # All dependency headers + ├── lib/ # Secondary library location + └── local/ + └── lib/ # Primary library location (.so, .a files) +``` + +## Environment Variables + +These are automatically configured by the scripts: + +- `BUILD_DIR` - Repository clone location (default: `$HOME/build`) +- `USR_DIR` - Install directory (default: `$HOME/usr`) +- `PKG_CONFIG_PATH` - Configured for dependency detection +- `LD_LIBRARY_PATH` - Configured for runtime linking +- `CPPFLAGS` - Include paths for compilation +- `LDFLAGS` - Library paths for linking +- `CLEAN_BUILD` - Set to `true` to clean before build + +## Required System Tools + +- `bash` (version 4.0+) +- `git` - Repository cloning +- `jq` - JSON parsing +- `gcc`/`g++` - C/C++ compiler +- `make` - Build automation +- `python3` - Patch application + +**Optional (based on dependency types):** +- `autoconf`, `automake`, `libtool` - For autotools builds +- `cmake` - For CMake builds +- `meson`, `ninja` - For Meson builds +- `pkg-config` - For dependency detection + +--- + +## Adopting for Another Component + +**These scripts are 100% generic and component-agnostic.** To use them for a different component: + +### Step 1: Copy the Scripts + +```bash +# Copy all scripts to your component's build directory +cp common_build_utils.sh setup_dependencies.sh build_native.sh common_external_build.sh /path/to/new-component/cov_docker_script/ + +# Make executable +chmod +x /path/to/new-component/cov_docker_script/*.sh +``` + +### Step 2: Create component_config.json + +Create a new `component_config.json` for your component: + +```json +{ + "_comment": "Component Build Configuration", + "_version": "2.0", + + "dependencies": { + "repos": [ + { + "name": "your-dependency", + "repo": "https://github.com/org/your-dependency.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "cmake", + "cmake_flags": "-DCMAKE_INSTALL_PREFIX=$HOME/usr" + } + } + ] + }, + + "native_component": { + "name": "your-component-name", + "include_path": "$HOME/usr/include/rdkb/", + "lib_output_path": "$HOME/usr/local/lib/", + "source_patches": [], + "build": { + "type": "autotools", + "configure_options": [ + "CPPFLAGS=-I$HOME/usr/include/rdkb", + "LDFLAGS=-L$HOME/usr/local/lib" + ] + } + } +} +``` + +### Step 3: Run the Build + +```bash +cd /path/to/new-component/cov_docker_script +./common_external_build.sh +``` + +**That's it!** No script modifications needed. The scripts automatically: +- Read component name from JSON +- Find component directory (parent of script directory) +- Clone dependencies listed in JSON +- Copy headers from paths specified in JSON +- Build using build type specified in JSON +- Apply patches listed in JSON + +### What Makes These Scripts Generic? + +✅ **No hardcoded paths** - All paths from JSON or environment variables +✅ **No hardcoded component names** - Component name read from JSON +✅ **No hardcoded dependencies** - All dependencies defined in JSON +✅ **No hardcoded build commands** - Build type and options from JSON +✅ **Flexible build systems** - Supports autotools, cmake, meson, custom commands, custom scripts +✅ **Configurable patches** - All patches defined in JSON + +### Example: Migrating from Utopia to CcspPandM + +```bash +# 1. Copy scripts to CcspPandM +cp utopia/cov_docker_script/*.sh ccsp-p-and-m/cov_docker_script/ + +# 2. Create ccsp-p-and-m/cov_docker_script/component_config.json +# Update: component name, dependencies, build settings + +# 3. Run build +cd ccsp-p-and-m/cov_docker_script +./common_external_build.sh +``` + +**Scripts remain unchanged - only JSON changes!** + +--- diff --git a/cov_docker_script/build_native.sh b/cov_docker_script/build_native.sh new file mode 100755 index 0000000..ce1bd67 --- /dev/null +++ b/cov_docker_script/build_native.sh @@ -0,0 +1,340 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Generic Native Component Build Script +# Usage: ./build_native.sh [config_file] [component_dir] +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CONFIG_FILE="${1:-$SCRIPT_DIR/component_config.json}" +COMPONENT_DIR="${2:-$(cd "$SCRIPT_DIR/.." && pwd)}" + +# Source common utilities +source "$SCRIPT_DIR/common_build_utils.sh" + +# Validate environment +if [[ ! -f "$CONFIG_FILE" ]]; then + err "Config file not found: $CONFIG_FILE" + exit 1 +fi + +if [[ ! -d "$COMPONENT_DIR" ]]; then + err "Component directory not found: $COMPONENT_DIR" + exit 1 +fi + +check_dependencies || exit 1 + +# Read component configuration +COMPONENT_NAME=$(jq -r '.native_component.name' "$CONFIG_FILE") +BUILD_TYPE=$(jq -r '.native_component.build.type' "$CONFIG_FILE") +HEADER_PATH=$(expand_path "$(jq -r '.native_component.include_path' "$CONFIG_FILE")") +LIB_PATH=$(expand_path "$(jq -r '.native_component.lib_output_path' "$CONFIG_FILE")") + +# Configure environment +configure_environment() { + print_banner "Building Native Component: $COMPONENT_NAME" + + log "Component: $COMPONENT_NAME" + log "Build type: $BUILD_TYPE" + log "Component directory: $COMPONENT_DIR" + log "Header path: $HEADER_PATH" + log "Library path: $LIB_PATH" + echo "" + + # Setup PKG_CONFIG_PATH and LD_LIBRARY_PATH + export PKG_CONFIG_PATH="$LIB_PATH/pkgconfig:${PKG_CONFIG_PATH:-}" + export LD_LIBRARY_PATH="$LIB_PATH:${LD_LIBRARY_PATH:-}" + + # Add common include and lib paths + export CPPFLAGS="${CPPFLAGS:-} -I$HEADER_PATH" + export CFLAGS="${CFLAGS:-} -I$HEADER_PATH" + export LDFLAGS="${LDFLAGS:-} -L$LIB_PATH" + + log "Environment configured" + log " PKG_CONFIG_PATH=$PKG_CONFIG_PATH" + log " LD_LIBRARY_PATH=$LD_LIBRARY_PATH" + echo "" +} + +# Apply source patches +apply_source_patches() { + local patch_count + patch_count=$(jq -r '.native_component.source_patches // [] | length' "$CONFIG_FILE") + + if [[ "$patch_count" -eq 0 ]]; then + log "No source patches configured" + return 0 + fi + + step "Applying source patches ($patch_count patches)" + + local i=0 + while [[ $i -lt $patch_count ]]; do + local file search replace type content + file=$(jq -r ".native_component.source_patches[$i].file" "$CONFIG_FILE") + type=$(jq -r ".native_component.source_patches[$i].type // \"replace\"" "$CONFIG_FILE") + search=$(jq -r ".native_component.source_patches[$i].search // \"\"" "$CONFIG_FILE") + replace=$(jq -r ".native_component.source_patches[$i].replace // \"\"" "$CONFIG_FILE") + content=$(jq -r ".native_component.source_patches[$i].content // \"\"" "$CONFIG_FILE") + + # Expand $HOME in file path, then resolve relative paths from COMPONENT_DIR + local expanded_file=$(expand_path "$file") + local target_file + if [[ "$expanded_file" = /* ]]; then + # Absolute path - use as is + target_file="$expanded_file" + else + # Relative path - prepend COMPONENT_DIR + target_file="$COMPONENT_DIR/$expanded_file" + fi + + if ! apply_patch "$target_file" "$search" "$replace" "$type" "$content"; then + err "Failed to apply patch $((i+1))/$patch_count" + return 1 + fi + + i=$((i + 1)) + done + + ok "All patches applied successfully" + echo "" + return 0 +} + +# Process native headers +process_native_headers() { + local header_count + header_count=$(jq -r '.native_component.header_sources // [] | length' "$CONFIG_FILE") + + if [[ "$header_count" -eq 0 ]]; then + log "No header sources configured" + return 0 + fi + + step "Processing native component headers ($header_count sources)" + + local i=0 + while [[ $i -lt $header_count ]]; do + local src dst + src=$(jq -r ".native_component.header_sources[$i].source" "$CONFIG_FILE") + dst=$(jq -r ".native_component.header_sources[$i].destination" "$CONFIG_FILE") + + # Expand paths + src="$COMPONENT_DIR/$src" + dst=$(expand_path "$dst") + + copy_headers "$src" "$dst" + i=$((i + 1)) + done + + ok "All headers processed successfully" + echo "" + return 0 +} + +# Build with autotools +build_component_autotools() { + cd "$COMPONENT_DIR" + + # Read configure options as array + local configure_options=() + local opt_count + opt_count=$(jq -r '.native_component.build.configure_options // [] | length' "$CONFIG_FILE") + + local i=0 + while [[ $i -lt $opt_count ]]; do + local option + option=$(jq -r ".native_component.build.configure_options[$i]" "$CONFIG_FILE") + option=$(expand_path "$option") + configure_options+=("$option") + i=$((i + 1)) + done + + # Run autogen if exists + if [[ -f "./autogen.sh" ]]; then + step "Running autogen.sh" + chmod +x ./autogen.sh + # Set NOCONFIGURE to prevent autogen.sh from automatically running configure + if ! NOCONFIGURE=1 ./autogen.sh; then + err "autogen.sh failed" + return 1 + fi + ok "autogen.sh completed" + echo "" + fi + + # Configure + step "Running configure" + + # Export configure options as environment variables + for option in "${configure_options[@]}"; do + export "$option" + done + + if ! ./configure; then + err "Configure failed" + return 1 + fi + ok "Configure completed" + echo "" + + # Make + local make_targets + make_targets=$(jq -r '.native_component.build.make_targets[]? // "all"' "$CONFIG_FILE" | tr '\n' ' ') + + local parallel_make + parallel_make=$(jq -r '.native_component.build.parallel_make // true' "$CONFIG_FILE") + + local make_jobs="" + [[ "$parallel_make" == "true" ]] && make_jobs="-j$(nproc)" + + step "Running make $make_jobs $make_targets" + if ! make $make_jobs $make_targets; then + err "Make failed" + return 1 + fi + ok "Make completed" + echo "" + + return 0 +} + +# Run pre-build commands from native_component.pre_build_commands[] +run_pre_build_commands() { + + log "copying python files generic..." + copy_python_files_generic + + log "Running pre-build commands..." + + if [[ -z "$CONFIG_FILE" ]] || [[ ! -f "$CONFIG_FILE" ]]; then + err "CONFIG_FILE not set or file missing" + return 1 + fi + + if [[ -z "$COMPONENT_DIR" ]] || [[ ! -d "$COMPONENT_DIR" ]]; then + err "COMPONENT_DIR not set or directory missing" + return 1 + fi + + local cmd_count + cmd_count=$(jq '.native_component.pre_build_commands // [] | length' "$CONFIG_FILE") + + if [[ "$cmd_count" -eq 0 ]]; then + log "No pre-build commands to run" + return 0 + fi + + pushd "$COMPONENT_DIR" >/dev/null || { + err "Failed to enter component root: $COMPONENT_DIR" + return 1 + } + + local i description command + for ((i=0; i/dev/null + return 1 + fi + done + + popd >/dev/null + ok "Pre-build commands completed" + return 0 +} + +# Build with CMake +build_component_cmake() { + cd "$COMPONENT_DIR" + + local build_dir cmake_flags make_targets parallel_make + build_dir=$(jq -r '.native_component.build.build_dir // "build"' "$CONFIG_FILE") + cmake_flags=$(jq -r '.native_component.build.cmake_flags // empty' "$CONFIG_FILE") + cmake_flags=$(expand_path "$cmake_flags") + make_targets=$(jq -r '.native_component.build.make_targets[]? // "all"' "$CONFIG_FILE" | tr '\n' ' ') + parallel_make=$(jq -r '.native_component.build.parallel_make // true' "$CONFIG_FILE") + + build_cmake "$COMPONENT_DIR" "$build_dir" "$cmake_flags" "$make_targets" "$parallel_make" || return 1 + + return 0 +} + +# Install libraries +install_libraries() { + step "Installing libraries to $LIB_PATH" + mkdir -p "$LIB_PATH" + + # Find and copy all library files (shared objects, static, libtool archives) + find "$COMPONENT_DIR" \( -name "*.so*" -o -name "*.a" -o -name "*.la*" \) \( -type f -o -type l \) -exec cp -Pv {} "$LIB_PATH/" \; 2>/dev/null || true + + ok "Libraries installed" + echo "" +} + +# Main execution +main() { + configure_environment + + # Process native headers + if ! process_native_headers; then + err "Header processing failed" + exit 1 + fi + + # Apply patches + if ! apply_source_patches; then + err "Patch application failed" + exit 1 + fi + + # Run pre-build commands + if ! run_pre_build_commands; then + err "Pre-build commands failed" + exit 1 + fi + + # Build based on type + case "$BUILD_TYPE" in + autotools) + if ! build_component_autotools; then + err "Autotools build failed" + exit 1 + fi + ;; + + cmake) + if ! build_component_cmake; then + err "CMake build failed" + exit 1 + fi + ;; + + *) + err "Unsupported build type: $BUILD_TYPE" + exit 1 + ;; + esac + + # Install libraries + install_libraries + + print_banner "Native Component Build Completed Successfully" + log "Component: $COMPONENT_NAME" + log "Headers: $HEADER_PATH" + log "Libraries: $LIB_PATH" + echo "" +} + +main diff --git a/cov_docker_script/common_build_utils.sh b/cov_docker_script/common_build_utils.sh new file mode 100755 index 0000000..4f3e732 --- /dev/null +++ b/cov_docker_script/common_build_utils.sh @@ -0,0 +1,312 @@ +#!/usr/bin/env bash + +################################################################################ +# Common Build Utilities +# Shared functions for dependency and component builds +################################################################################ + +# Colors +RED="\e[31m"; GREEN="\e[32m"; YELLOW="\e[33m" +BLUE="\e[34m"; CYAN="\e[36m"; BOLD="\e[1m"; NC="\e[0m" + +# Logging functions +log() { echo -e "${CYAN}[INFO]${NC} $1"; } +ok() { echo -e "${GREEN}[OK]${NC} $1"; } +warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } +err() { echo -e "${RED}[ERROR]${NC} $1"; } +step() { echo -e "${BLUE}[STEP]${NC} $1"; } + +# Expand $HOME in paths +expand_path() { + echo "${1//\$HOME/$HOME}" +} + +# Validate required tools +check_dependencies() { + local required_tools=("git" "jq" "gcc" "make") + local missing=() + + for tool in "${required_tools[@]}"; do + if ! command -v "$tool" &> /dev/null; then + missing+=("$tool") + fi + done + + if [ ${#missing[@]} -gt 0 ]; then + err "Missing required tools: ${missing[*]}" + err "Please install them before continuing" + return 1 + fi + return 0 +} + +# Clone a git repository +clone_repo() { + local name="$1" repo="$2" branch="$3" dest="$4" + + if [[ -d "$dest" ]]; then + warn "$name already exists, skipping clone" + return 0 + fi + + log "Cloning $name (branch: $branch)" + if ! git clone --branch "$branch" "$repo" "$dest" --depth 1; then + err "Failed to clone $name" + return 1 + fi + ok "$name cloned successfully" + return 0 +} + +# Copy headers from source to destination +copy_headers() { + local src="$1" dst="$2" + + src=$(expand_path "$src") + dst=$(expand_path "$dst") + + mkdir -p "$dst" + + if [[ -d "$src" ]]; then + log "Copying headers: $src → $dst" + if ! find "$src" -maxdepth 1 -name "*.h" -exec cp {} "$dst/" \; 2>/dev/null; then + warn "No headers found in $src" + fi + else + warn "Header source not found: $src" + fi +} + +# Generic API to copy all Python files from a source directory (recursively) to a destination directory (flat, no subdirs) +copy_python_files_generic() { + local src_dir="${PYTHON_SRC_DIR:-$HOME/build}" + local dst_dir="${PYTHON_DST_DIR:-$HOME/usr/include/rdkb}" + if [[ -n "$src_dir" && -n "$dst_dir" ]]; then + log "[PYTHON COPY] Scanning for Python files in: $src_dir" + mkdir -p "$dst_dir" + local py_files + py_files=$(find "$src_dir" -type f -name "*.py") + local count=0 + if [[ -n "$py_files" ]]; then + log "[PYTHON COPY] Copying Python files to: $dst_dir" + while IFS= read -r file; do + cp "$file" "$dst_dir/" + count=$((count+1)) + done <<< "$py_files" + ok "[PYTHON COPY] $count Python file(s) copied to $dst_dir" + else + warn "[PYTHON COPY] No Python files found in $src_dir" + fi + else + warn "[PYTHON COPY] Source or destination directory not set. Skipping copy." + fi +} + +# Apply source patches +apply_patch() { + local file="$1" search="$2" replace="$3" type="${4:-replace}" content="$5" + + if [[ "$type" == "create" ]]; then + log "Creating file: $file" + local dir=$(dirname "$file") + mkdir -p "$dir" + echo -e "$content" > "$file" + if [[ $? -ne 0 ]]; then + err "Failed to create file: $file" + return 1 + fi + ok "File created successfully" + return 0 + fi + + if [[ ! -f "$file" ]]; then + err "Patch target not found: $file" + return 1 + fi + + log "Patching: $file ($type)" + + # Use python for safe string replacement with literal matching + if ! python3 -c " +import sys +with open('$file', 'r') as f: + content = f.read() +content = content.replace('''$search''', '''$replace''') +with open('$file', 'w') as f: + f.write(content) +"; then + err "Failed to apply patch to $file" + return 1 + fi + + ok "Patch applied successfully" + return 0 +} + +# Build with autotools +build_autotools() { + local repo_dir="$1" configure_flags="$2" make_targets="$3" parallel_make="${4:-true}" + + pushd "$repo_dir" >/dev/null || return 1 + + # Run autogen or autoreconf if needed + if [[ -f "autogen.sh" ]]; then + step "Running autogen.sh" + chmod +x autogen.sh + # Set NOCONFIGURE to prevent autogen.sh from automatically running configure + if ! NOCONFIGURE=1 ./autogen.sh; then + err "autogen.sh failed" + popd >/dev/null + return 1 + fi + elif [[ -f "configure.ac" ]] || [[ -f "configure.in" ]]; then + step "Running autoreconf" + if ! autoreconf -fi; then + err "autoreconf failed" + popd >/dev/null + return 1 + fi + fi + + # Configure + step "Running configure" + # Ensure PKG_CONFIG_PATH is set for configure + export PKG_CONFIG_PATH="${HOME}/usr/local/lib/pkgconfig:${HOME}/usr/lib/pkgconfig:${PKG_CONFIG_PATH:-}" + if ! eval "./configure $configure_flags"; then + err "Configure failed" + popd >/dev/null + return 1 + fi + + # Make + local make_jobs="" + [[ "$parallel_make" == "true" ]] && make_jobs="-j$(nproc)" + + step "Running make $make_jobs $make_targets" + if ! make $make_jobs $make_targets; then + err "Make failed" + popd >/dev/null + return 1 + fi + + popd >/dev/null + ok "Autotools build completed" + return 0 +} + +# Build with CMake +build_cmake() { + local repo_dir="$1" build_dir="$2" cmake_flags="$3" make_targets="$4" parallel_make="${5:-true}" + + pushd "$repo_dir" >/dev/null || return 1 + mkdir -p "$build_dir" + + step "Running cmake" + if ! eval "cmake -S . -B $build_dir $cmake_flags"; then + err "CMake configuration failed" + popd >/dev/null + return 1 + fi + + local make_jobs="" + [[ "$parallel_make" == "true" ]] && make_jobs="-j$(nproc)" + + step "Building with make $make_jobs $make_targets" + if ! make $make_jobs -C "$build_dir" $make_targets; then + err "Make failed" + popd >/dev/null + return 1 + fi + + popd >/dev/null + ok "CMake build completed" + return 0 +} + +# Build with Meson +build_meson() { + local repo_dir="$1" build_dir="$2" meson_flags="$3" ninja_targets="$4" + + pushd "$repo_dir" >/dev/null || return 1 + + step "Running meson setup" + if ! eval "meson setup $build_dir $meson_flags"; then + err "Meson setup failed" + popd >/dev/null + return 1 + fi + + step "Running ninja -C $build_dir $ninja_targets" + if ! ninja -C "$build_dir" $ninja_targets; then + err "Ninja build failed" + popd >/dev/null + return 1 + fi + + popd >/dev/null + ok "Meson build completed" + return 0 +} + +# Execute custom commands +execute_commands() { + local repo_dir="$1" config_file="$2" index="$3" + + pushd "$repo_dir" >/dev/null || return 1 + + local cmd_count + cmd_count=$(jq ".dependencies.repos[$index].build.commands | length" "$config_file") + + local i=0 + while [[ $i -lt $cmd_count ]]; do + local cmd + cmd=$(jq -r ".dependencies.repos[$index].build.commands[$i]" "$config_file") + step "Executing: $cmd" + if ! eval "$cmd"; then + err "Command failed: $cmd" + popd >/dev/null + return 1 + fi + i=$((i + 1)) + done + + popd >/dev/null + ok "Commands executed successfully" + return 0 +} + +# Copy shared libraries to destination +copy_libraries() { + local src_dir="$1" dst_dir="$2" + + dst_dir=$(expand_path "$dst_dir") + mkdir -p "$dst_dir" + + log "Copying libraries to $dst_dir" + find "$src_dir" \( -name "*.so*" -o -name "*.a" -o -name "*.la*" \) \( -type f -o -type l \) -exec cp -Pv {} "$dst_dir/" \; 2>/dev/null || true +} + +# Print banner +print_banner() { + local title="$1" + echo "" + echo -e "${BLUE}================================================${NC}" + echo -e "${BLUE} $title${NC}" + echo -e "${BLUE}================================================${NC}" + echo "" +} + +# Print section header +print_section() { + local title="$1" + echo "" + echo -e "${BLUE}------------------------------------------------${NC}" + echo -e "${BOLD}${CYAN}▶ $title${NC}" + echo -e "${BLUE}------------------------------------------------${NC}" +} + +# Export this file's functions +export -f log ok warn err step +export -f expand_path check_dependencies clone_repo copy_headers apply_patch +export -f build_autotools build_cmake build_meson execute_commands copy_libraries +export -f print_banner print_section diff --git a/cov_docker_script/common_external_build.sh b/cov_docker_script/common_external_build.sh new file mode 100755 index 0000000..3826f78 --- /dev/null +++ b/cov_docker_script/common_external_build.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Common External Build Script +# Orchestrates the complete build process: dependencies + native component +# Usage: ./common_external_build.sh [config_file] [component_dir] +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CONFIG_FILE="${1:-$SCRIPT_DIR/component_config.json}" +COMPONENT_DIR="${2:-$(cd "$SCRIPT_DIR/.." && pwd)}" + +# Source common utilities +source "$SCRIPT_DIR/common_build_utils.sh" + +# Validate inputs +if [[ ! -f "$CONFIG_FILE" ]]; then + err "Config file not found: $CONFIG_FILE" + exit 1 +fi + +if [[ ! -d "$COMPONENT_DIR" ]]; then + err "Component directory not found: $COMPONENT_DIR" + exit 1 +fi + +# Get component name from config +COMPONENT_NAME=$(jq -r '.native_component.name' "$CONFIG_FILE") + +# Print main banner +echo "" +echo -e "${BOLD}${BLUE}================================================================${NC}" +echo -e "${BOLD}${BLUE} Complete Build Pipeline for: ${COMPONENT_NAME}${NC}" +echo -e "${BOLD}${BLUE}================================================================${NC}" +echo "" +log "Configuration: $CONFIG_FILE" +log "Component directory: $COMPONENT_DIR" +echo "" + +# Step 1: Setup Dependencies +print_banner "Step 1/2: Setting Up Dependencies" +log "Running dependency setup script..." +echo "" + +if ! "$SCRIPT_DIR/setup_dependencies.sh" "$CONFIG_FILE"; then + err "Dependency setup failed" + exit 1 +fi + +echo "" +ok "Dependencies setup completed successfully" +echo "" + +# Step 2: Build Native Component +print_banner "Step 2/2: Building Native Component" +log "Running native component build script..." +echo "" + +if ! "$SCRIPT_DIR/build_native.sh" "$CONFIG_FILE" "$COMPONENT_DIR"; then + err "Native component build failed" + exit 1 +fi + +echo "" +ok "Native component build completed successfully" +echo "" + +# Final summary +echo "" +echo -e "${BOLD}${GREEN}================================================================${NC}" +echo -e "${BOLD}${GREEN} Complete Build Pipeline Completed Successfully!${NC}" +echo -e "${BOLD}${GREEN}================================================================${NC}" +echo "" +log "Component: ${BOLD}$COMPONENT_NAME${NC}" +log "All dependencies built and installed" +log "Native component compiled successfully" +echo "" + +# Display installation paths +HEADER_PATH=$(jq -r '.native_component.include_path' "$CONFIG_FILE") +LIB_PATH=$(jq -r '.native_component.lib_output_path' "$CONFIG_FILE") +HEADER_PATH="${HEADER_PATH//\$HOME/$HOME}" +LIB_PATH="${LIB_PATH//\$HOME/$HOME}" + +echo -e "${CYAN}Installation Locations:${NC}" +log " Headers: $HEADER_PATH" +log " Libraries: $LIB_PATH" +echo "" + +echo -e "${GREEN}✓ Ready for Coverity analysis or deployment${NC}" +echo "" diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json new file mode 100644 index 0000000..04fe6e6 --- /dev/null +++ b/cov_docker_script/component_config.json @@ -0,0 +1,66 @@ +{ + "_comment": "Component Build Configuration for Coverity/Native Builds", + "_version": "2.0", + "_description": "Defines dependencies and build settings for the native component", + +"dependencies": { + "_comment": "External repositories needed by this component", + "repos": [ + { + "name": "common-library", + "repo": "https://github.com/rdkcentral/common-library.git", + "branch": "feature/native_build_for_coverity", + "header_paths": [ + { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" } + ], + "source_patches": [ + { + "file": "source/ccsp/include/ccsp_message_bus.h", + "search": "typedef struct _CCSP_MESSAGE_BUS_CONNECTION", + "replace": "typedef struct DBusLoop DBusLoop;\n\ntypedef struct _CCSP_MESSAGE_BUS_CONNECTION" + }, + { + "file": "$HOME/usr/include/rdkb/ccsp_message_bus.h", + "search": "typedef struct _CCSP_MESSAGE_BUS_CONNECTION", + "replace": "typedef struct DBusLoop DBusLoop;\n\ntypedef struct _CCSP_MESSAGE_BUS_CONNECTION" + } + ] + }, + { + "name": "rdkb-halif-platform", + "repo": "https://github.com/rdkcentral/rdkb-halif-platform.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb/ccsp" } + ] + }, + { + "name": "rdkb-halif-cm", + "repo": "https://github.com/rdkcentral/rdkb-halif-cm.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb/ccsp" } + ] + } + ] + }, + "native_component": { + "_comment": "Configuration for the main component being built", + "name": "advanced-security", + "include_path": "$HOME/usr/include/rdkb/", + "lib_output_path": "$HOME/usr/local/lib/", + "pre_build_commands": [ + { + "description": "Generate dm_pack_datamodel.c from XML", + "command": "python3 $HOME/usr/include/rdkb/dm_pack_code_gen.py config/TR181-AdvSecurity.xml source/AdvSecuritySsp/dm_pack_datamodel.c" + } + ], + "build": { + "type": "autotools", + "configure_options": [ + "CPPFLAGS=-I$HOME/usr/include/rdkb/ -I/usr/include/ -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/cjson -DSAFEC_DUMMY_API -DCONFIG_VENDOR_NAME", + "LDFLAGS=-L$HOME/usr/local/lib/ -Wl,--allow-shlib-undefined -Wl,--unresolved-symbols=ignore-all" + ] + } + } +} diff --git a/cov_docker_script/setup_dependencies.sh b/cov_docker_script/setup_dependencies.sh new file mode 100755 index 0000000..a4835f8 --- /dev/null +++ b/cov_docker_script/setup_dependencies.sh @@ -0,0 +1,241 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Generic Dependency Setup Script +# Usage: ./setup_dependencies.sh [config_file] +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CONFIG_FILE="${1:-$SCRIPT_DIR/component_config.json}" + +# Source common utilities +source "$SCRIPT_DIR/common_build_utils.sh" + +# Default directories +BUILD_DIR="${BUILD_DIR:-$HOME/build}" +USR_DIR="${USR_DIR:-$HOME/usr}" + +# Validate environment +if [[ ! -f "$CONFIG_FILE" ]]; then + err "Config file not found: $CONFIG_FILE" + exit 1 +fi + +check_dependencies || exit 1 + +# Initialize environment +initialize_environment() { + print_banner "Dependency Setup" + + log "Configuration: $CONFIG_FILE" + log "Build directory: $BUILD_DIR" + log "Install directory: $USR_DIR" + echo "" + + # Clean if requested + if [[ "${CLEAN_BUILD:-false}" == "true" ]]; then + warn "Cleaning previous build artifacts" + [[ -d "$BUILD_DIR" ]] && rm -rf "$BUILD_DIR" + [[ -d "$USR_DIR" ]] && rm -rf "$USR_DIR" + fi + + # Create directories + mkdir -p "$BUILD_DIR" + mkdir -p "$USR_DIR/include/rdkb" + mkdir -p "$USR_DIR/local/lib" + mkdir -p "$USR_DIR/local/lib/pkgconfig" + mkdir -p "$USR_DIR/lib" + + # Setup PKG_CONFIG_PATH and LD_LIBRARY_PATH for dependencies + export PKG_CONFIG_PATH="$USR_DIR/local/lib/pkgconfig:$USR_DIR/lib/pkgconfig:${PKG_CONFIG_PATH:-}" + export LD_LIBRARY_PATH="$USR_DIR/local/lib:$USR_DIR/lib:${LD_LIBRARY_PATH:-}" + export CPPFLAGS="${CPPFLAGS:-} -I$USR_DIR/include" + export LDFLAGS="${LDFLAGS:-} -L$USR_DIR/local/lib" + + log "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" + log "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" + echo "" + + ok "Environment initialized" +} + +# Process header paths for a repository +process_headers() { + local index="$1" + local repo_dir="$2" + local name="$3" + + local count + count=$(jq ".dependencies.repos[$index].header_paths | length" "$CONFIG_FILE") + + if [[ "$count" -eq 0 ]]; then + log "No headers configured for $name" + return 0 + fi + + local i=0 + while [[ $i -lt $count ]]; do + local src dst + src=$(jq -r ".dependencies.repos[$index].header_paths[$i].source" "$CONFIG_FILE") + dst=$(jq -r ".dependencies.repos[$index].header_paths[$i].destination" "$CONFIG_FILE") + + copy_headers "$repo_dir/$src" "$dst" + i=$((i + 1)) + done + + return 0 +} + +# Build a repository +build_repository() { + local index="$1" + local repo_dir="$2" + local name="$3" + + local build_type + build_type=$(jq -r ".dependencies.repos[$index].build.type // empty" "$CONFIG_FILE") + + if [[ -z "$build_type" ]]; then + log "No build configuration for $name (headers only)" + return 0 + fi + + step "Building $name (type: $build_type)" + + case "$build_type" in + autotools) + local configure_flags make_targets parallel_make + configure_flags=$(jq -r ".dependencies.repos[$index].build.configure_flags // empty" "$CONFIG_FILE") + make_targets=$(jq -r ".dependencies.repos[$index].build.make_targets[]? // \"all\"" "$CONFIG_FILE" | tr '\n' ' ') + parallel_make=$(jq -r ".dependencies.repos[$index].build.parallel_make // true" "$CONFIG_FILE") + + build_autotools "$repo_dir" "$configure_flags" "$make_targets" "$parallel_make" || return 1 + ;; + + cmake) + local build_dir cmake_flags make_targets parallel_make + build_dir=$(jq -r ".dependencies.repos[$index].build.build_dir // \"build\"" "$CONFIG_FILE") + cmake_flags=$(jq -r ".dependencies.repos[$index].build.cmake_flags // empty" "$CONFIG_FILE") + make_targets=$(jq -r ".dependencies.repos[$index].build.make_targets[]? // \"all\"" "$CONFIG_FILE" | tr '\n' ' ') + parallel_make=$(jq -r ".dependencies.repos[$index].build.parallel_make // true" "$CONFIG_FILE") + + build_cmake "$repo_dir" "$build_dir" "$cmake_flags" "$make_targets" "$parallel_make" || return 1 + ;; + + meson) + local build_dir meson_flags ninja_targets + build_dir=$(jq -r ".dependencies.repos[$index].build.build_dir // \"builddir\"" "$CONFIG_FILE") + meson_flags=$(jq -r ".dependencies.repos[$index].build.meson_flags // empty" "$CONFIG_FILE") + ninja_targets=$(jq -r ".dependencies.repos[$index].build.ninja_targets[]? // \"all\"" "$CONFIG_FILE" | tr '\n' ' ') + + build_meson "$repo_dir" "$build_dir" "$meson_flags" "$ninja_targets" || return 1 + ;; + + commands) + execute_commands "$repo_dir" "$CONFIG_FILE" "$index" || return 1 + ;; + + script) + local script_path + script_path=$(jq -r ".dependencies.repos[$index].build.script" "$CONFIG_FILE") + local full_script="$repo_dir/$script_path" + + if [[ -f "$full_script" ]]; then + step "Executing build script: $script_path" + chmod +x "$full_script" + + export PARENT_BUILD_DIR="$BUILD_DIR" + export PARENT_USR_DIR="$USR_DIR" + + pushd "$repo_dir" >/dev/null || return 1 + if ! "$full_script"; then + err "Build script failed" + popd >/dev/null + return 1 + fi + popd >/dev/null + + unset PARENT_BUILD_DIR PARENT_USR_DIR + else + err "Build script not found: $full_script" + return 1 + fi + ;; + + *) + err "Unknown build type: $build_type" + return 1 + ;; + esac + + # Copy libraries + copy_libraries "$repo_dir" "$USR_DIR/local/lib" + copy_libraries "$repo_dir" "$USR_DIR/lib" + + ok "$name build completed" + return 0 +} + +# Process a single dependency +process_dependency() { + local index="$1" + + local name repo branch + name=$(jq -r ".dependencies.repos[$index].name" "$CONFIG_FILE") + repo=$(jq -r ".dependencies.repos[$index].repo" "$CONFIG_FILE") + branch=$(jq -r ".dependencies.repos[$index].branch" "$CONFIG_FILE") + + local repo_dir="$BUILD_DIR/$name" + + print_section "Processing: $name" + + # Clone repository + if ! clone_repo "$name" "$repo" "$branch" "$repo_dir"; then + err "Failed to process $name" + return 1 + fi + + # Copy headers + if ! process_headers "$index" "$repo_dir" "$name"; then + err "Failed to copy headers for $name" + return 1 + fi + + # Build if needed + if ! build_repository "$index" "$repo_dir" "$name"; then + err "Failed to build $name" + return 1 + fi + + ok "$name processed successfully" + return 0 +} + +# Main execution +main() { + initialize_environment + + local count + count=$(jq ".dependencies.repos | length" "$CONFIG_FILE") + + log "Found $count dependencies to process" + echo "" + + local i=0 + while [[ $i -lt $count ]]; do + if ! process_dependency "$i"; then + err "Dependency setup failed" + exit 1 + fi + i=$((i + 1)) + done + + echo "" + print_banner "Dependencies Setup Completed Successfully" + log "Headers installed: $USR_DIR/include/rdkb" + log "Libraries installed: $USR_DIR/local/lib and $USR_DIR/lib" + echo "" +} + +main From ade908b13053eb985f03269b42c11c1ed0e5c802 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah <162420027+sowmiyachelliah@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:13:29 +0530 Subject: [PATCH 02/15] Update component_config.json --- cov_docker_script/component_config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index 04fe6e6..acc6838 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -11,7 +11,8 @@ "repo": "https://github.com/rdkcentral/common-library.git", "branch": "feature/native_build_for_coverity", "header_paths": [ - { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" } + { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb/linux" } ], "source_patches": [ { From cde2cec4a87115b56627792eb252656d12b4b2c6 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah <162420027+sowmiyachelliah@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:17:42 +0530 Subject: [PATCH 03/15] Update component_config.json --- cov_docker_script/component_config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index acc6838..3377473 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -12,7 +12,8 @@ "branch": "feature/native_build_for_coverity", "header_paths": [ { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" }, - { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb/linux" } + { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb/linux" }, + { "source": "source/ccsp/custom", "destination": "$HOME/usr/include/rdkb" } ], "source_patches": [ { From 3e3633a4334b4b5c646c2aaf99a033662233589c Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Mon, 19 Jan 2026 11:15:21 +0000 Subject: [PATCH 04/15] Update component_config.json --- cov_docker_script/component_config.json | 50 ++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index 3377473..fb91b29 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -13,7 +13,16 @@ "header_paths": [ { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" }, { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb/linux" }, - { "source": "source/ccsp/custom", "destination": "$HOME/usr/include/rdkb" } + { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb/" }, + { "source": "source/ccsp/custom", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/ccsp/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/debug_api/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/util_api/http/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/ccsp/components/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/util_api/ansc/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/dm_pack", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/cosa/package/slap/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/ccsp/components/common/MessageBusHelper/include", "destination": "$HOME/usr/include/rdkb" } ], "source_patches": [ { @@ -26,7 +35,11 @@ "search": "typedef struct _CCSP_MESSAGE_BUS_CONNECTION", "replace": "typedef struct DBusLoop DBusLoop;\n\ntypedef struct _CCSP_MESSAGE_BUS_CONNECTION" } - ] + ], + "build": { + "type": "script", + "script": "cov_docker_script/common_external_build.sh" + } }, { "name": "rdkb-halif-platform", @@ -43,6 +56,39 @@ "header_paths": [ { "source": "include", "destination": "$HOME/usr/include/rdkb/ccsp" } ] + }, + { + "name": "rbus", + "repo": "https://github.com/rdkcentral/rbus.git", + "branch": "v2.7.0", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb/rbus" }, + { "source": "src/rbus", "destination": "$HOME/usr/include/rdkb/rbus" } + ] + }, + { + "name": "WebconfigFramework", + "repo": "https://github.com/rdkcentral/WebconfigFramework.git", + "branch": "develop", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools", + "configure_flags": "CPPFLAGS=\"-I$HOME/usr/include/rdkb -I$HOME/usr/include/rdkb/rbus -I$HOME/usr/local/include -I$HOME/usr/include/rdkb/rtmessage\" LDFLAGS=\"-L$HOME/usr/local/lib -L$HOME/usr/lib\" LIBS=\"-lrbus -lrtMessage\"" + } + }, + { + "name": "Utopia", + "repo": "https://github.com/rdkcentral/utopia.git", + "branch": "feature/cov_native_build", + "header_paths": [ + { "source": "source/include/syscfg", "destination": "$HOME/usr/include/rdkb/syscfg" } + ], + "build": { + "type": "script", + "script": "cov_docker_script/common_external_build.sh" + } } ] }, From e576e65b399f3da7c8351401f83727f46770feac Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Fri, 30 Jan 2026 07:12:52 +0000 Subject: [PATCH 05/15] Update code --- cov_docker_script/README.md | 707 ++++++++++---------- cov_docker_script/build_native.sh | 340 ---------- cov_docker_script/common_build_utils.sh | 312 --------- cov_docker_script/common_external_build.sh | 92 --- cov_docker_script/component_config.json | 8 +- cov_docker_script/configure_options.conf | 136 ++++ cov_docker_script/run_external_build.sh | 51 ++ cov_docker_script/run_native_build.sh | 51 ++ cov_docker_script/run_setup_dependencies.sh | 67 ++ cov_docker_script/setup_dependencies.sh | 241 ------- 10 files changed, 668 insertions(+), 1337 deletions(-) delete mode 100755 cov_docker_script/build_native.sh delete mode 100755 cov_docker_script/common_build_utils.sh delete mode 100755 cov_docker_script/common_external_build.sh create mode 100644 cov_docker_script/configure_options.conf create mode 100755 cov_docker_script/run_external_build.sh create mode 100755 cov_docker_script/run_native_build.sh create mode 100755 cov_docker_script/run_setup_dependencies.sh delete mode 100755 cov_docker_script/setup_dependencies.sh diff --git a/cov_docker_script/README.md b/cov_docker_script/README.md index f449390..e06d1a2 100644 --- a/cov_docker_script/README.md +++ b/cov_docker_script/README.md @@ -1,476 +1,487 @@ -# Coverity Build System for RDK-B Components +# Component Native Build Configuration -**Generic, reusable build system for any RDK-B component.** Just copy the scripts and customize `component_config.json`. +**Coverity/Native build configuration for RDK-B components.** -## Quick Start +--- -### Complete Build (Recommended) +## 📋 Overview + +This directory contains the configuration and wrapper scripts necessary for building RDK-B components in a native (non-Yocto) environment. This setup enables Coverity static analysis and validates that components can be built with explicitly declared dependencies. + +### Directory Contents -```bash -cd /path/to/component/cov_docker_script -./common_external_build.sh +``` +/cov_docker_script/ +├── README.md # This file +├── component_config.json # Dependency & build configuration +├── configure_options.conf # Autotools configure flags (optional) +├── run_setup_dependencies.sh # Wrapper: Setup build tools & dependencies +├── run_native_build.sh # Wrapper: Build main component +└── run_external_build.sh # Wrapper: For dependency builds (used in component_config.json) ``` -This runs the complete 2-step pipeline: -1. **Setup Dependencies** - Clones repos, copies headers, builds libraries -2. **Build Component** - Applies patches, builds component, installs libraries +### Important: Add to .gitignore -### Clean Build +Add the following to your component's `.gitignore` to exclude temporary build artifacts: -```bash -CLEAN_BUILD=true ./common_external_build.sh +```gitignore +# Build tools (downloaded by wrapper scripts) +build_tools_workflows/ + +# Dependency build artifacts +build/ ``` -Removes all previous build artifacts before starting. +--- -## Scripts Overview +## 🚀 Quick Start -### 1. common_build_utils.sh +### Prerequisites -**Purpose:** Shared utility library with common functions used by all build scripts. +- Docker container with [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) image +- All wrapper scripts have execute permissions -**Key Functions:** -- `log()`, `ok()`, `warn()`, `err()`, `step()` - Color-coded logging -- `expand_path()` - Expands `$HOME` variables in paths -- `check_dependencies()` - Validates required system tools (git, jq, gcc, make) -- `clone_repo()` - Clones git repositories with depth 1 -- `copy_headers()` - Copies header files from source to destination -- `apply_patch()` - Applies patches using Python3 for safe string replacement -- `build_autotools()`, `build_cmake()`, `build_meson()` - Build functions for different systems -- `execute_commands()` - Runs custom command sequences -- `copy_libraries()` - Finds and copies library files (.so, .a, .la) +### Build Commands + +#### Complete Build Pipeline -**Usage:** ```bash -# This script is sourced by other scripts, not run directly -source common_build_utils.sh +# From your component root directory +cd /path/to/your-component + +# Standard build pipeline for main component +./cov_docker_script/run_setup_dependencies.sh +./cov_docker_script/run_native_build.sh + +# Clean build (removes previous artifacts) +CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh +./cov_docker_script/run_native_build.sh ``` -**Auto-configured:** -- Validates presence of git, jq, gcc, make -- Sets up color-coded terminal output -- Exports all functions for use in other scripts +#### Alternative: Single-Script Build (All-in-One) + +If you prefer to run everything in a single command: + +```bash +# Run setup dependencies + native build in one script +./cov_docker_script/run_external_build.sh + +# Clean build +CLEAN_BUILD=true ./cov_docker_script/run_external_build.sh +``` + +**Note:** `run_external_build.sh` performs both dependency setup and component build in one execution. While primarily designed to be invoked by the dependency setup process when specified in `component_config.json` (see [run_external_build.sh](#3-run_external_buildsh) section), it can also be used directly for the main component as a convenience script that handles the complete build pipeline. + +#### Individual Steps + +```bash +# Step 1: Setup dependencies only +./cov_docker_script/run_setup_dependencies.sh + +# Step 2: Build component only (requires Step 1 completed) +./cov_docker_script/run_native_build.sh +``` --- -### 2. setup_dependencies.sh +## 📖 Scripts Reference -**Purpose:** Clones dependency repositories, copies headers, and builds required libraries. +### 1. run_setup_dependencies.sh + +**Purpose:** Sets up build tools and runs dependency setup. **What it does:** -1. Reads dependency list from `component_config.json` -2. Clones each repository to `$HOME/build/` -3. Copies headers to `$HOME/usr/include/rdkb/` -4. Builds libraries (if `build` section present) -5. Installs libraries to `$HOME/usr/local/lib/` and `$HOME/usr/lib/` -6. Configures PKG_CONFIG_PATH and LD_LIBRARY_PATH +1. Clones `build_tools_workflows` repository (develop branch) +2. Verifies required scripts are present +3. Runs `setup_dependencies.sh` from build_tools_workflows with config path to: + - Clone all dependency repositories + - Copy headers to `$HOME/usr/include/rdkb/` + - Build and install dependency libraries +4. Leaves build_tools_workflows in place for run_native_build.sh **Usage:** ```bash -# Use default config (component_config.json in same directory) -./setup_dependencies.sh - -# Use custom config file -./setup_dependencies.sh /path/to/custom_config.json - -# Clean build (removes $HOME/build and $HOME/usr first) -CLEAN_BUILD=true ./setup_dependencies.sh +./run_setup_dependencies.sh -# Custom directories -BUILD_DIR=/tmp/build USR_DIR=/opt/rdkb ./setup_dependencies.sh +# Clean build +CLEAN_BUILD=true ./run_setup_dependencies.sh ``` -**Environment Variables:** -- `BUILD_DIR` - Where to clone repos (default: `$HOME/build`) -- `USR_DIR` - Install directory (default: `$HOME/usr`) -- `CLEAN_BUILD` - Set to `true` to remove previous artifacts +**Required files:** +- `component_config.json` (defines dependencies) -**Output:** +**Outputs:** +- Downloads: `$HOME/build/` (dependency repositories) - Headers: `$HOME/usr/include/rdkb/` -- Libraries: `$HOME/usr/local/lib/` and `$HOME/usr/lib/` +- Libraries: `$HOME/usr/local/lib/`, `$HOME/usr/lib/` +- build_tools_workflows: Remains in place for run_native_build.sh + +**Environment Variables:** +- `BUILD_DIR` - Override build directory (default: `$HOME/build`) +- `USR_DIR` - Override install directory (default: `$HOME/usr`) +- `CLEAN_BUILD` - Set to `true` to remove previous builds --- -### 3. build_native.sh +### 2. run_native_build.sh -**Purpose:** Builds the native component after dependencies are setup. +**Purpose:** Verifies build tools and builds the component. **What it does:** -1. Reads component configuration from `component_config.json` -2. Processes native component headers (copies to destination) -3. Applies source patches (if configured) -4. Configures build environment (PKG_CONFIG_PATH, LD_LIBRARY_PATH, CPPFLAGS, LDFLAGS) -5. Runs autogen.sh or autoreconf (for autotools) -6. Executes configure/cmake with specified options -7. Builds component with make (parallel by default) -8. Copies libraries to configured output path +1. Verifies `build_tools_workflows` directory exists (cloned by `run_setup_dependencies.sh`) +2. Verifies `build_native.sh` is present +3. Runs `build_native.sh` from build_tools_workflows with config and component paths to: + - Apply patches to source code + - Configure build environment + - Build component + - Install libraries +4. Cleans up build_tools_workflows directory **Usage:** ```bash -# Use defaults (assumes setup_dependencies.sh already run) -./build_native.sh - -# Specify custom config and component directory -./build_native.sh /path/to/config.json /path/to/component - -# With environment overrides -HEADER_PATH=/custom/include ./build_native.sh +./run_native_build.sh ``` **Prerequisites:** -- `setup_dependencies.sh` must have run successfully -- Headers and libraries must be in `$HOME/usr/` +- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows) +- All dependency headers/libraries must be available + +**Required files:** +- `component_config.json` (defines component build settings) +- `configure_options.conf` (autotools configuration) -**Output:** -- Component libraries in path specified by `native_component.lib_output_path` -- Default: `$HOME/usr/local/lib/` +**Outputs:** +- Component libraries in `$HOME/usr/local/lib/` +- Build artifacts in component root directory --- -### 4. common_external_build.sh +### 3. run_external_build.sh -**Purpose:** Orchestrates complete build pipeline (dependencies + component). +**Purpose:** Builds dependencies with complex build requirements (invoked from component_config.json). + +**Key Differences from run_native_build.sh:** +- Designed for **dependency repositories**, not the main component +- Invokes `common_external_build.sh` without arguments (dependencies manage their own configuration) +- Does **NOT** clean up `build_tools_workflows` (may be used by multiple dependencies) +- Typically called automatically during dependency setup, not manually **What it does:** -1. Validates configuration and paths -2. Runs `setup_dependencies.sh` (Step 1/2) -3. Runs `build_native.sh` (Step 2/2) -4. Displays progress banners and status +1. Clones `build_tools_workflows` if not present (or verifies it exists) +2. Verifies `common_external_build.sh` is present +3. Runs `common_external_build.sh` from build_tools_workflows +4. Preserves `build_tools_workflows` directory for subsequent use **Usage:** ```bash -# Complete build with defaults -./common_external_build.sh +./run_external_build.sh +``` + +**Prerequisites:** +- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows) +- All dependency headers/libraries must be available -# With custom config and component directory -./common_external_build.sh /path/to/config.json /path/to/component +**Outputs:** +- Build artifacts based on common_external_build.sh implementation +- build_tools_workflows remains in place (not cleaned up) -# Clean build -CLEAN_BUILD=true ./common_external_build.sh +**Primary Use Case - Dependency Builds in component_config.json:** + +This script is primarily used to build **dependency repositories** that have complex build requirements. When a dependency has its own `cov_docker_script/run_external_build.sh`, it can be invoked from the parent component's `component_config.json`. + +**Example configuration in component_config.json:** + +```json +{ + "name": "Utopia", + "repo": "https://github.com/rdkcentral/utopia.git", + "branch": "feature/cov_native_build", + "header_paths": [ + { "source": "source/include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "script", + "script": "cov_docker_script/run_external_build.sh" + } +} ``` -**This is the recommended entry point for complete builds.** +**How it works for dependencies:** +1. The parent component's `setup_dependencies.sh` clones the dependency repository (e.g., Utopia) +2. The dependency's `run_external_build.sh` is executed from the dependency's directory +3. This script internally: + - Sets up the dependency's own build tools and dependencies + - Runs the dependency's native build process + - Produces shared libraries (`.so` files) +4. The generated shared libraries are installed to `$HOME/usr/local/lib/` or `$HOME/usr/lib/` +5. These libraries are then available for the parent component's native build + +**When to use this approach:** +- Dependency has complex multi-step build requirements +- Dependency has its own sub-dependencies that need to be built +- Dependency requires custom build logic beyond standard autotools/cmake/meson +- Dependency repository already has a `cov_docker_script/run_external_build.sh` script -**Output:** -- Complete dependency setup -- Built component with all libraries -- Success/failure status for entire pipeline +**Note:** This approach allows dependencies to manage their own complete build pipeline, producing the necessary shared libraries that the parent component links against during its native compilation. --- -### 5. component_config.json +## 📝 Configuration Files -**Purpose:** JSON configuration defining all dependencies and build settings. +### component_config.json -**Key Sections:** -- `dependencies.repos[]` - List of dependency repositories -- `native_component` - Component-specific build configuration -- `source_patches[]` - Patches to apply before building +**JSON configuration defining all dependencies and build settings.** -**Not a script, but required by all build scripts.** +**Key Sections:** -See **Configuration** section below for detailed format. +1. **dependencies.repos[]** - External dependencies required by your component + ```json + { + "name": "rbus", + "repo": "https://github.com/rdkcentral/rbus.git", + "branch": "v2.7.0", + "header_paths": [...], + "build": {...} + } + ``` + +2. **native_component** - Component build configuration + ```json + { + "name": "your-component", + "build": { + "type": "autotools", + "configure_options_file": "cov_docker_script/configure_options.conf" + } + } + ``` + +**Example Dependencies:** +Your component may require dependencies such as: +- rbus +- rdk_logger +- safec +- common-library +- halinterface +- And other component-specific dependencies + +See [component_config.json](component_config.json) for your component's specific dependency configuration. --- -## Configuration +### configure_options.conf -All build configuration is in **`component_config.json`**. This file defines: -- Dependencies to clone and build -- Headers to copy -- Patches to apply -- Build settings +**Autotools configuration file with preprocessor, compiler, and linker flags.** -### Key Configuration Sections +**Format:** +```properties +[CPPFLAGS] +-I$HOME/usr/include/rdkb/ +-DFEATURE_FLAG -#### Dependencies +[CFLAGS] +-Wall -Wextra -```json -{ - "dependencies": { - "repos": [ - { - "name": "repo-name", - "repo": "https://github.com/org/repo.git", - "branch": "main", - "header_paths": [ - { "source": "include", "destination": "$HOME/usr/include/rdkb" } - ], - "build": { - "type": "autotools|cmake|meson|commands|script", - "configure_flags": "--prefix=$HOME/usr", - "parallel_make": true - } - } - ] - } -} +[LDFLAGS] +-L$HOME/usr/local/lib/ ``` -**Note:** The `build` section is optional - omit it for header-only dependencies. +**Sections:** +- `[CPPFLAGS]` - Preprocessor flags (includes `-I`, defines `-D`) +- `[CFLAGS]` - C compiler flags +- `[CXXFLAGS]` - C++ compiler flags +- `[LDFLAGS]` - Linker flags (library paths `-L`, linker options `-Wl`) -#### Native Component +**Component-Specific Flags:** +Customize flags based on your component's requirements: +- Platform defines: `_COSA_INTEL_USG_ARM_`, `_COSA_BCM_ARM_`, etc. +- Product defines: `_XB6_PRODUCT_REQ_`, `_XB7_PRODUCT_REQ_`, etc. +- Feature flags: `FEATURE_SUPPORT_RDKLOG`, component-specific features, etc. -```json -{ - "native_component": { - "name": "component-name", - "include_path": "$HOME/usr/include/rdkb/", - "lib_output_path": "$HOME/usr/local/lib/", - "header_sources": [ - { "source": "source/ccsp/include", "destination": "$HOME/usr/include/rdkb" }, - { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" } - ], - "source_patches": [ - { - "file": "$HOME/usr/include/rdkb/header.h", - "type": "replace", - "search": "old text", - "replace": "new text" - } - ], - "build": { - "type": "autotools|cmake", - "configure_options": [ - "CPPFLAGS=-I$HOME/usr/include/rdkb", - "LDFLAGS=-L$HOME/usr/lib" - ] - } - } -} -``` +See [configure_options.conf](configure_options.conf) for your component's complete flag list. -**Configuration Details:** -- `header_sources[]` - Component headers to copy before building. Source paths are relative to component directory. -- `source_patches[]` - Patches to apply after headers are copied. Use absolute paths with `$HOME` for files in install directories. -- `include_path` - Colon-separated include paths for building -- `lib_output_path` - Where to install built libraries +--- -## Build Types +## 🔧 Build System Architecture -### Autotools -```json -"build": { - "type": "autotools", - "configure_flags": "--prefix=$HOME/usr --enable-feature" -} ``` - -### CMake -```json -"build": { - "type": "cmake", - "build_dir": "build", - "cmake_flags": "-DCMAKE_INSTALL_PREFIX=$HOME/usr" -} +┌─────────────────────────────────────────────────────┐ +│ run_setup_dependencies.sh │ +│ ┌──────────────────────────────────────────────┐ │ +│ │ 1. Clone build_tools_workflows │ │ +│ │ (develop branch) │ │ +│ │ │ │ +│ │ 2. Verify required scripts present │ │ +│ │ │ │ +│ │ 3. Run setup_dependencies.sh from │ │ +│ │ build_tools_workflows with config path │ │ +│ │ - Read component_config.json │ │ +│ │ - Clone dependency repos │ │ +│ │ - Copy headers │ │ +│ │ - Build & install libraries │ │ +│ └──────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────┐ +│ run_native_build.sh │ +│ ┌──────────────────────────────────────────────┐ │ +│ │ 1. Verify build_tools_workflows exists │ │ +│ │ (cloned by run_setup_dependencies.sh) │ │ +│ │ │ │ +│ │ 2. Run build_native.sh from │ │ +│ │ build_tools_workflows with config and │ │ +│ │ component directory paths │ │ +│ │ - Process component headers │ │ +│ │ - Apply source patches (if configured) │ │ +│ │ - Read configure_options.conf │ │ +│ │ - Configure build (autogen/configure) │ │ +│ │ - Build component (make/cmake/meson) │ │ +│ │ - Install libraries │ │ +│ │ │ │ +│ │ 3. Cleanup build_tools_workflows directory │ │ +│ └──────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────┘ ``` -### Meson -```json -"build": { - "type": "meson", - "meson_flags": "--prefix=$HOME/usr" -} -``` +--- -### Custom Commands -```json -"build": { - "type": "commands", - "commands": ["meson setup build --prefix=$HOME/usr", "meson compile -C build"] -} -``` +## 🐛 Troubleshooting -### Custom Script -```json -"build": { - "type": "script", - "script": "cov_docker_script/build.sh" -} -``` +### Build Failures -## Troubleshooting +**Problem:** Missing headers -### Build fails with "command not found" -**Install required tools:** ```bash -sudo apt-get install git jq gcc make autoconf automake libtool cmake python3 +# Solution: Check if dependencies were installed +ls -la $HOME/usr/include/rdkb/ + +# Verify component_config.json has correct header_paths +cat component_config.json | jq '.dependencies.repos[].header_paths' + +# Re-run dependency setup +CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh ``` -### Dependencies fail to build -- Check `$HOME/build/` for build logs -- Verify `configure_flags` in JSON are correct -- Ensure system packages for build type are installed (cmake, meson, etc.) - -### Headers not found during component build -- Verify `setup_dependencies.sh` completed successfully -- Check `$HOME/usr/include/rdkb/` contains expected headers -- Verify `header_paths` in JSON point to correct source directories - -### Libraries not found -- Check library directories: - - `$HOME/usr/local/lib/` - Primary location - - `$HOME/usr/lib/` - Secondary location -- Verify dependencies built successfully (look for `.so`, `.a` files) -- Check build logs for `make install` errors - -### Patches fail to apply -- **File not found:** Verify file path is relative to component directory -- **Use `../`** for files outside component (e.g., `../usr/include/rdkb/header.h`) -- **Exact match required:** Search string must exactly match file content -- **Python3 required:** Ensure Python3 is installed - -### Clean build needed +**Problem:** Missing libraries + ```bash -# Remove all previous build artifacts -CLEAN_BUILD=true ./common_external_build.sh +# Solution: Check library installation +ls -la $HOME/usr/local/lib/ +ls -la $HOME/usr/lib/ + +# Verify PKG_CONFIG_PATH +echo $PKG_CONFIG_PATH + +# Check if dependency build failed +cd $HOME/build/ +cat config.log # For autotools +cat build/meson-log.txt # For meson ``` -### Validate configuration +**Problem:** Configure errors + ```bash -# Check JSON syntax -jq . component_config.json +# Solution: Check configure_options.conf syntax +cat cov_docker_script/configure_options.conf -# List all dependencies -jq '.dependencies.repos[].name' component_config.json +# Verify flags are valid +./configure --help ``` -## Directory Structure After Build +### Script Errors -``` -$HOME/ -├── build/ # Cloned repositories (removed after build) -└── usr/ - ├── include/ - │ └── rdkb/ # All dependency headers - ├── lib/ # Secondary library location - └── local/ - └── lib/ # Primary library location (.so, .a files) -``` +**Problem:** Script not found -## Environment Variables +```bash +# Solution: Ensure scripts are executable +chmod +x cov_docker_script/*.sh -These are automatically configured by the scripts: +# Check if build_tools_workflows was cloned +ls -la ../build_tools_workflows/ +``` -- `BUILD_DIR` - Repository clone location (default: `$HOME/build`) -- `USR_DIR` - Install directory (default: `$HOME/usr`) -- `PKG_CONFIG_PATH` - Configured for dependency detection -- `LD_LIBRARY_PATH` - Configured for runtime linking -- `CPPFLAGS` - Include paths for compilation -- `LDFLAGS` - Library paths for linking -- `CLEAN_BUILD` - Set to `true` to clean before build +**Problem:** Permission denied -## Required System Tools +```bash +# Solution: Fix container permissions +# (Run on host, not in container) +sudo docker exec rdkb-builder groupadd $USER --gid=$(id -g $USER) +sudo docker exec rdkb-builder useradd -m $USER -G users \ + --uid=$(id -u $USER) --gid=$(id -g $USER) +``` -- `bash` (version 4.0+) -- `git` - Repository cloning -- `jq` - JSON parsing -- `gcc`/`g++` - C/C++ compiler -- `make` - Build automation -- `python3` - Patch application +--- + +## 📚 Related Documentation -**Optional (based on dependency types):** -- `autoconf`, `automake`, `libtool` - For autotools builds -- `cmake` - For CMake builds -- `meson`, `ninja` - For Meson builds -- `pkg-config` - For dependency detection +- **Build Tools Repository:** [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/tree/develop) +- **Docker Environment:** [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) +- **Example Component:** [moca-agent](https://github.com/rdkcentral/moca-agent) (reference implementation) +- **Detailed Build Guide:** See `build_tools_workflows/cov_docker_script/README.md` --- -## Adopting for Another Component +## ⚠️ Important Notes -**These scripts are 100% generic and component-agnostic.** To use them for a different component: +### DO NOT Modify -### Step 1: Copy the Scripts +The following scripts are automatically copied from `build_tools_workflows` and **must not be modified locally**: -```bash -# Copy all scripts to your component's build directory -cp common_build_utils.sh setup_dependencies.sh build_native.sh common_external_build.sh /path/to/new-component/cov_docker_script/ +- ❌ `build_native.sh` +- ❌ `common_build_utils.sh` +- ❌ `common_external_build.sh` +- ❌ `setup_dependencies.sh` -# Make executable -chmod +x /path/to/new-component/cov_docker_script/*.sh -``` +Any changes will be overwritten when wrapper scripts run. -### Step 2: Create component_config.json +### DO Modify -Create a new `component_config.json` for your component: +The following files are component-specific and **should be customized**: -```json -{ - "_comment": "Component Build Configuration", - "_version": "2.0", - - "dependencies": { - "repos": [ - { - "name": "your-dependency", - "repo": "https://github.com/org/your-dependency.git", - "branch": "main", - "header_paths": [ - { "source": "include", "destination": "$HOME/usr/include/rdkb" } - ], - "build": { - "type": "cmake", - "cmake_flags": "-DCMAKE_INSTALL_PREFIX=$HOME/usr" - } - } - ] - }, - - "native_component": { - "name": "your-component-name", - "include_path": "$HOME/usr/include/rdkb/", - "lib_output_path": "$HOME/usr/local/lib/", - "source_patches": [], - "build": { - "type": "autotools", - "configure_options": [ - "CPPFLAGS=-I$HOME/usr/include/rdkb", - "LDFLAGS=-L$HOME/usr/local/lib" - ] - } - } -} -``` +- ✅ `component_config.json` - Dependency and build configuration +- ✅ `configure_options.conf` - Autotools flags +- ✅ `run_setup_dependencies.sh` - Wrapper script (if needed) +- ✅ `run_native_build.sh` - Wrapper script (if needed) -### Step 3: Run the Build +--- + +## 🔄 Workflow Integration + +### Local Development ```bash -cd /path/to/new-component/cov_docker_script -./common_external_build.sh +# Make changes to source code +vim source/your_component.c + +# Rebuild component +CLEAN_BUILD=true ./cov_docker_script/run_native_build.sh ``` -**That's it!** No script modifications needed. The scripts automatically: -- Read component name from JSON -- Find component directory (parent of script directory) -- Clone dependencies listed in JSON -- Copy headers from paths specified in JSON -- Build using build type specified in JSON -- Apply patches listed in JSON +### CI/CD Integration -### What Makes These Scripts Generic? +This configuration is used by GitHub Actions to validate builds: -✅ **No hardcoded paths** - All paths from JSON or environment variables -✅ **No hardcoded component names** - Component name read from JSON -✅ **No hardcoded dependencies** - All dependencies defined in JSON -✅ **No hardcoded build commands** - Build type and options from JSON -✅ **Flexible build systems** - Supports autotools, cmake, meson, custom commands, custom scripts -✅ **Configurable patches** - All patches defined in JSON +```yaml +- name: Setup Dependencies + run: ./cov_docker_script/run_setup_dependencies.sh -### Example: Migrating from Utopia to CcspPandM +- name: Build Component + run: ./cov_docker_script/run_native_build.sh +``` -```bash -# 1. Copy scripts to CcspPandM -cp utopia/cov_docker_script/*.sh ccsp-p-and-m/cov_docker_script/ +See `.github/workflows/` for complete CI configuration. + +--- -# 2. Create ccsp-p-and-m/cov_docker_script/component_config.json -# Update: component name, dependencies, build settings +## 📞 Support -# 3. Run build -cd ccsp-p-and-m/cov_docker_script -./common_external_build.sh -``` +For issues or questions: -**Scripts remain unchanged - only JSON changes!** +1. Check [Troubleshooting](#troubleshooting) section +2. Review [build_tools_workflows README](https://github.com/rdkcentral/build_tools_workflows/blob/develop/cov_docker_script/README.md) +3. Raise issue in your component repository or [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/issues) --- + +**Last Updated:** January 2026 diff --git a/cov_docker_script/build_native.sh b/cov_docker_script/build_native.sh deleted file mode 100755 index ce1bd67..0000000 --- a/cov_docker_script/build_native.sh +++ /dev/null @@ -1,340 +0,0 @@ -#!/usr/bin/env bash -set -e - -################################################################################ -# Generic Native Component Build Script -# Usage: ./build_native.sh [config_file] [component_dir] -################################################################################ - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -CONFIG_FILE="${1:-$SCRIPT_DIR/component_config.json}" -COMPONENT_DIR="${2:-$(cd "$SCRIPT_DIR/.." && pwd)}" - -# Source common utilities -source "$SCRIPT_DIR/common_build_utils.sh" - -# Validate environment -if [[ ! -f "$CONFIG_FILE" ]]; then - err "Config file not found: $CONFIG_FILE" - exit 1 -fi - -if [[ ! -d "$COMPONENT_DIR" ]]; then - err "Component directory not found: $COMPONENT_DIR" - exit 1 -fi - -check_dependencies || exit 1 - -# Read component configuration -COMPONENT_NAME=$(jq -r '.native_component.name' "$CONFIG_FILE") -BUILD_TYPE=$(jq -r '.native_component.build.type' "$CONFIG_FILE") -HEADER_PATH=$(expand_path "$(jq -r '.native_component.include_path' "$CONFIG_FILE")") -LIB_PATH=$(expand_path "$(jq -r '.native_component.lib_output_path' "$CONFIG_FILE")") - -# Configure environment -configure_environment() { - print_banner "Building Native Component: $COMPONENT_NAME" - - log "Component: $COMPONENT_NAME" - log "Build type: $BUILD_TYPE" - log "Component directory: $COMPONENT_DIR" - log "Header path: $HEADER_PATH" - log "Library path: $LIB_PATH" - echo "" - - # Setup PKG_CONFIG_PATH and LD_LIBRARY_PATH - export PKG_CONFIG_PATH="$LIB_PATH/pkgconfig:${PKG_CONFIG_PATH:-}" - export LD_LIBRARY_PATH="$LIB_PATH:${LD_LIBRARY_PATH:-}" - - # Add common include and lib paths - export CPPFLAGS="${CPPFLAGS:-} -I$HEADER_PATH" - export CFLAGS="${CFLAGS:-} -I$HEADER_PATH" - export LDFLAGS="${LDFLAGS:-} -L$LIB_PATH" - - log "Environment configured" - log " PKG_CONFIG_PATH=$PKG_CONFIG_PATH" - log " LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - echo "" -} - -# Apply source patches -apply_source_patches() { - local patch_count - patch_count=$(jq -r '.native_component.source_patches // [] | length' "$CONFIG_FILE") - - if [[ "$patch_count" -eq 0 ]]; then - log "No source patches configured" - return 0 - fi - - step "Applying source patches ($patch_count patches)" - - local i=0 - while [[ $i -lt $patch_count ]]; do - local file search replace type content - file=$(jq -r ".native_component.source_patches[$i].file" "$CONFIG_FILE") - type=$(jq -r ".native_component.source_patches[$i].type // \"replace\"" "$CONFIG_FILE") - search=$(jq -r ".native_component.source_patches[$i].search // \"\"" "$CONFIG_FILE") - replace=$(jq -r ".native_component.source_patches[$i].replace // \"\"" "$CONFIG_FILE") - content=$(jq -r ".native_component.source_patches[$i].content // \"\"" "$CONFIG_FILE") - - # Expand $HOME in file path, then resolve relative paths from COMPONENT_DIR - local expanded_file=$(expand_path "$file") - local target_file - if [[ "$expanded_file" = /* ]]; then - # Absolute path - use as is - target_file="$expanded_file" - else - # Relative path - prepend COMPONENT_DIR - target_file="$COMPONENT_DIR/$expanded_file" - fi - - if ! apply_patch "$target_file" "$search" "$replace" "$type" "$content"; then - err "Failed to apply patch $((i+1))/$patch_count" - return 1 - fi - - i=$((i + 1)) - done - - ok "All patches applied successfully" - echo "" - return 0 -} - -# Process native headers -process_native_headers() { - local header_count - header_count=$(jq -r '.native_component.header_sources // [] | length' "$CONFIG_FILE") - - if [[ "$header_count" -eq 0 ]]; then - log "No header sources configured" - return 0 - fi - - step "Processing native component headers ($header_count sources)" - - local i=0 - while [[ $i -lt $header_count ]]; do - local src dst - src=$(jq -r ".native_component.header_sources[$i].source" "$CONFIG_FILE") - dst=$(jq -r ".native_component.header_sources[$i].destination" "$CONFIG_FILE") - - # Expand paths - src="$COMPONENT_DIR/$src" - dst=$(expand_path "$dst") - - copy_headers "$src" "$dst" - i=$((i + 1)) - done - - ok "All headers processed successfully" - echo "" - return 0 -} - -# Build with autotools -build_component_autotools() { - cd "$COMPONENT_DIR" - - # Read configure options as array - local configure_options=() - local opt_count - opt_count=$(jq -r '.native_component.build.configure_options // [] | length' "$CONFIG_FILE") - - local i=0 - while [[ $i -lt $opt_count ]]; do - local option - option=$(jq -r ".native_component.build.configure_options[$i]" "$CONFIG_FILE") - option=$(expand_path "$option") - configure_options+=("$option") - i=$((i + 1)) - done - - # Run autogen if exists - if [[ -f "./autogen.sh" ]]; then - step "Running autogen.sh" - chmod +x ./autogen.sh - # Set NOCONFIGURE to prevent autogen.sh from automatically running configure - if ! NOCONFIGURE=1 ./autogen.sh; then - err "autogen.sh failed" - return 1 - fi - ok "autogen.sh completed" - echo "" - fi - - # Configure - step "Running configure" - - # Export configure options as environment variables - for option in "${configure_options[@]}"; do - export "$option" - done - - if ! ./configure; then - err "Configure failed" - return 1 - fi - ok "Configure completed" - echo "" - - # Make - local make_targets - make_targets=$(jq -r '.native_component.build.make_targets[]? // "all"' "$CONFIG_FILE" | tr '\n' ' ') - - local parallel_make - parallel_make=$(jq -r '.native_component.build.parallel_make // true' "$CONFIG_FILE") - - local make_jobs="" - [[ "$parallel_make" == "true" ]] && make_jobs="-j$(nproc)" - - step "Running make $make_jobs $make_targets" - if ! make $make_jobs $make_targets; then - err "Make failed" - return 1 - fi - ok "Make completed" - echo "" - - return 0 -} - -# Run pre-build commands from native_component.pre_build_commands[] -run_pre_build_commands() { - - log "copying python files generic..." - copy_python_files_generic - - log "Running pre-build commands..." - - if [[ -z "$CONFIG_FILE" ]] || [[ ! -f "$CONFIG_FILE" ]]; then - err "CONFIG_FILE not set or file missing" - return 1 - fi - - if [[ -z "$COMPONENT_DIR" ]] || [[ ! -d "$COMPONENT_DIR" ]]; then - err "COMPONENT_DIR not set or directory missing" - return 1 - fi - - local cmd_count - cmd_count=$(jq '.native_component.pre_build_commands // [] | length' "$CONFIG_FILE") - - if [[ "$cmd_count" -eq 0 ]]; then - log "No pre-build commands to run" - return 0 - fi - - pushd "$COMPONENT_DIR" >/dev/null || { - err "Failed to enter component root: $COMPONENT_DIR" - return 1 - } - - local i description command - for ((i=0; i/dev/null - return 1 - fi - done - - popd >/dev/null - ok "Pre-build commands completed" - return 0 -} - -# Build with CMake -build_component_cmake() { - cd "$COMPONENT_DIR" - - local build_dir cmake_flags make_targets parallel_make - build_dir=$(jq -r '.native_component.build.build_dir // "build"' "$CONFIG_FILE") - cmake_flags=$(jq -r '.native_component.build.cmake_flags // empty' "$CONFIG_FILE") - cmake_flags=$(expand_path "$cmake_flags") - make_targets=$(jq -r '.native_component.build.make_targets[]? // "all"' "$CONFIG_FILE" | tr '\n' ' ') - parallel_make=$(jq -r '.native_component.build.parallel_make // true' "$CONFIG_FILE") - - build_cmake "$COMPONENT_DIR" "$build_dir" "$cmake_flags" "$make_targets" "$parallel_make" || return 1 - - return 0 -} - -# Install libraries -install_libraries() { - step "Installing libraries to $LIB_PATH" - mkdir -p "$LIB_PATH" - - # Find and copy all library files (shared objects, static, libtool archives) - find "$COMPONENT_DIR" \( -name "*.so*" -o -name "*.a" -o -name "*.la*" \) \( -type f -o -type l \) -exec cp -Pv {} "$LIB_PATH/" \; 2>/dev/null || true - - ok "Libraries installed" - echo "" -} - -# Main execution -main() { - configure_environment - - # Process native headers - if ! process_native_headers; then - err "Header processing failed" - exit 1 - fi - - # Apply patches - if ! apply_source_patches; then - err "Patch application failed" - exit 1 - fi - - # Run pre-build commands - if ! run_pre_build_commands; then - err "Pre-build commands failed" - exit 1 - fi - - # Build based on type - case "$BUILD_TYPE" in - autotools) - if ! build_component_autotools; then - err "Autotools build failed" - exit 1 - fi - ;; - - cmake) - if ! build_component_cmake; then - err "CMake build failed" - exit 1 - fi - ;; - - *) - err "Unsupported build type: $BUILD_TYPE" - exit 1 - ;; - esac - - # Install libraries - install_libraries - - print_banner "Native Component Build Completed Successfully" - log "Component: $COMPONENT_NAME" - log "Headers: $HEADER_PATH" - log "Libraries: $LIB_PATH" - echo "" -} - -main diff --git a/cov_docker_script/common_build_utils.sh b/cov_docker_script/common_build_utils.sh deleted file mode 100755 index 4f3e732..0000000 --- a/cov_docker_script/common_build_utils.sh +++ /dev/null @@ -1,312 +0,0 @@ -#!/usr/bin/env bash - -################################################################################ -# Common Build Utilities -# Shared functions for dependency and component builds -################################################################################ - -# Colors -RED="\e[31m"; GREEN="\e[32m"; YELLOW="\e[33m" -BLUE="\e[34m"; CYAN="\e[36m"; BOLD="\e[1m"; NC="\e[0m" - -# Logging functions -log() { echo -e "${CYAN}[INFO]${NC} $1"; } -ok() { echo -e "${GREEN}[OK]${NC} $1"; } -warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } -err() { echo -e "${RED}[ERROR]${NC} $1"; } -step() { echo -e "${BLUE}[STEP]${NC} $1"; } - -# Expand $HOME in paths -expand_path() { - echo "${1//\$HOME/$HOME}" -} - -# Validate required tools -check_dependencies() { - local required_tools=("git" "jq" "gcc" "make") - local missing=() - - for tool in "${required_tools[@]}"; do - if ! command -v "$tool" &> /dev/null; then - missing+=("$tool") - fi - done - - if [ ${#missing[@]} -gt 0 ]; then - err "Missing required tools: ${missing[*]}" - err "Please install them before continuing" - return 1 - fi - return 0 -} - -# Clone a git repository -clone_repo() { - local name="$1" repo="$2" branch="$3" dest="$4" - - if [[ -d "$dest" ]]; then - warn "$name already exists, skipping clone" - return 0 - fi - - log "Cloning $name (branch: $branch)" - if ! git clone --branch "$branch" "$repo" "$dest" --depth 1; then - err "Failed to clone $name" - return 1 - fi - ok "$name cloned successfully" - return 0 -} - -# Copy headers from source to destination -copy_headers() { - local src="$1" dst="$2" - - src=$(expand_path "$src") - dst=$(expand_path "$dst") - - mkdir -p "$dst" - - if [[ -d "$src" ]]; then - log "Copying headers: $src → $dst" - if ! find "$src" -maxdepth 1 -name "*.h" -exec cp {} "$dst/" \; 2>/dev/null; then - warn "No headers found in $src" - fi - else - warn "Header source not found: $src" - fi -} - -# Generic API to copy all Python files from a source directory (recursively) to a destination directory (flat, no subdirs) -copy_python_files_generic() { - local src_dir="${PYTHON_SRC_DIR:-$HOME/build}" - local dst_dir="${PYTHON_DST_DIR:-$HOME/usr/include/rdkb}" - if [[ -n "$src_dir" && -n "$dst_dir" ]]; then - log "[PYTHON COPY] Scanning for Python files in: $src_dir" - mkdir -p "$dst_dir" - local py_files - py_files=$(find "$src_dir" -type f -name "*.py") - local count=0 - if [[ -n "$py_files" ]]; then - log "[PYTHON COPY] Copying Python files to: $dst_dir" - while IFS= read -r file; do - cp "$file" "$dst_dir/" - count=$((count+1)) - done <<< "$py_files" - ok "[PYTHON COPY] $count Python file(s) copied to $dst_dir" - else - warn "[PYTHON COPY] No Python files found in $src_dir" - fi - else - warn "[PYTHON COPY] Source or destination directory not set. Skipping copy." - fi -} - -# Apply source patches -apply_patch() { - local file="$1" search="$2" replace="$3" type="${4:-replace}" content="$5" - - if [[ "$type" == "create" ]]; then - log "Creating file: $file" - local dir=$(dirname "$file") - mkdir -p "$dir" - echo -e "$content" > "$file" - if [[ $? -ne 0 ]]; then - err "Failed to create file: $file" - return 1 - fi - ok "File created successfully" - return 0 - fi - - if [[ ! -f "$file" ]]; then - err "Patch target not found: $file" - return 1 - fi - - log "Patching: $file ($type)" - - # Use python for safe string replacement with literal matching - if ! python3 -c " -import sys -with open('$file', 'r') as f: - content = f.read() -content = content.replace('''$search''', '''$replace''') -with open('$file', 'w') as f: - f.write(content) -"; then - err "Failed to apply patch to $file" - return 1 - fi - - ok "Patch applied successfully" - return 0 -} - -# Build with autotools -build_autotools() { - local repo_dir="$1" configure_flags="$2" make_targets="$3" parallel_make="${4:-true}" - - pushd "$repo_dir" >/dev/null || return 1 - - # Run autogen or autoreconf if needed - if [[ -f "autogen.sh" ]]; then - step "Running autogen.sh" - chmod +x autogen.sh - # Set NOCONFIGURE to prevent autogen.sh from automatically running configure - if ! NOCONFIGURE=1 ./autogen.sh; then - err "autogen.sh failed" - popd >/dev/null - return 1 - fi - elif [[ -f "configure.ac" ]] || [[ -f "configure.in" ]]; then - step "Running autoreconf" - if ! autoreconf -fi; then - err "autoreconf failed" - popd >/dev/null - return 1 - fi - fi - - # Configure - step "Running configure" - # Ensure PKG_CONFIG_PATH is set for configure - export PKG_CONFIG_PATH="${HOME}/usr/local/lib/pkgconfig:${HOME}/usr/lib/pkgconfig:${PKG_CONFIG_PATH:-}" - if ! eval "./configure $configure_flags"; then - err "Configure failed" - popd >/dev/null - return 1 - fi - - # Make - local make_jobs="" - [[ "$parallel_make" == "true" ]] && make_jobs="-j$(nproc)" - - step "Running make $make_jobs $make_targets" - if ! make $make_jobs $make_targets; then - err "Make failed" - popd >/dev/null - return 1 - fi - - popd >/dev/null - ok "Autotools build completed" - return 0 -} - -# Build with CMake -build_cmake() { - local repo_dir="$1" build_dir="$2" cmake_flags="$3" make_targets="$4" parallel_make="${5:-true}" - - pushd "$repo_dir" >/dev/null || return 1 - mkdir -p "$build_dir" - - step "Running cmake" - if ! eval "cmake -S . -B $build_dir $cmake_flags"; then - err "CMake configuration failed" - popd >/dev/null - return 1 - fi - - local make_jobs="" - [[ "$parallel_make" == "true" ]] && make_jobs="-j$(nproc)" - - step "Building with make $make_jobs $make_targets" - if ! make $make_jobs -C "$build_dir" $make_targets; then - err "Make failed" - popd >/dev/null - return 1 - fi - - popd >/dev/null - ok "CMake build completed" - return 0 -} - -# Build with Meson -build_meson() { - local repo_dir="$1" build_dir="$2" meson_flags="$3" ninja_targets="$4" - - pushd "$repo_dir" >/dev/null || return 1 - - step "Running meson setup" - if ! eval "meson setup $build_dir $meson_flags"; then - err "Meson setup failed" - popd >/dev/null - return 1 - fi - - step "Running ninja -C $build_dir $ninja_targets" - if ! ninja -C "$build_dir" $ninja_targets; then - err "Ninja build failed" - popd >/dev/null - return 1 - fi - - popd >/dev/null - ok "Meson build completed" - return 0 -} - -# Execute custom commands -execute_commands() { - local repo_dir="$1" config_file="$2" index="$3" - - pushd "$repo_dir" >/dev/null || return 1 - - local cmd_count - cmd_count=$(jq ".dependencies.repos[$index].build.commands | length" "$config_file") - - local i=0 - while [[ $i -lt $cmd_count ]]; do - local cmd - cmd=$(jq -r ".dependencies.repos[$index].build.commands[$i]" "$config_file") - step "Executing: $cmd" - if ! eval "$cmd"; then - err "Command failed: $cmd" - popd >/dev/null - return 1 - fi - i=$((i + 1)) - done - - popd >/dev/null - ok "Commands executed successfully" - return 0 -} - -# Copy shared libraries to destination -copy_libraries() { - local src_dir="$1" dst_dir="$2" - - dst_dir=$(expand_path "$dst_dir") - mkdir -p "$dst_dir" - - log "Copying libraries to $dst_dir" - find "$src_dir" \( -name "*.so*" -o -name "*.a" -o -name "*.la*" \) \( -type f -o -type l \) -exec cp -Pv {} "$dst_dir/" \; 2>/dev/null || true -} - -# Print banner -print_banner() { - local title="$1" - echo "" - echo -e "${BLUE}================================================${NC}" - echo -e "${BLUE} $title${NC}" - echo -e "${BLUE}================================================${NC}" - echo "" -} - -# Print section header -print_section() { - local title="$1" - echo "" - echo -e "${BLUE}------------------------------------------------${NC}" - echo -e "${BOLD}${CYAN}▶ $title${NC}" - echo -e "${BLUE}------------------------------------------------${NC}" -} - -# Export this file's functions -export -f log ok warn err step -export -f expand_path check_dependencies clone_repo copy_headers apply_patch -export -f build_autotools build_cmake build_meson execute_commands copy_libraries -export -f print_banner print_section diff --git a/cov_docker_script/common_external_build.sh b/cov_docker_script/common_external_build.sh deleted file mode 100755 index 3826f78..0000000 --- a/cov_docker_script/common_external_build.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -set -e - -################################################################################ -# Common External Build Script -# Orchestrates the complete build process: dependencies + native component -# Usage: ./common_external_build.sh [config_file] [component_dir] -################################################################################ - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -CONFIG_FILE="${1:-$SCRIPT_DIR/component_config.json}" -COMPONENT_DIR="${2:-$(cd "$SCRIPT_DIR/.." && pwd)}" - -# Source common utilities -source "$SCRIPT_DIR/common_build_utils.sh" - -# Validate inputs -if [[ ! -f "$CONFIG_FILE" ]]; then - err "Config file not found: $CONFIG_FILE" - exit 1 -fi - -if [[ ! -d "$COMPONENT_DIR" ]]; then - err "Component directory not found: $COMPONENT_DIR" - exit 1 -fi - -# Get component name from config -COMPONENT_NAME=$(jq -r '.native_component.name' "$CONFIG_FILE") - -# Print main banner -echo "" -echo -e "${BOLD}${BLUE}================================================================${NC}" -echo -e "${BOLD}${BLUE} Complete Build Pipeline for: ${COMPONENT_NAME}${NC}" -echo -e "${BOLD}${BLUE}================================================================${NC}" -echo "" -log "Configuration: $CONFIG_FILE" -log "Component directory: $COMPONENT_DIR" -echo "" - -# Step 1: Setup Dependencies -print_banner "Step 1/2: Setting Up Dependencies" -log "Running dependency setup script..." -echo "" - -if ! "$SCRIPT_DIR/setup_dependencies.sh" "$CONFIG_FILE"; then - err "Dependency setup failed" - exit 1 -fi - -echo "" -ok "Dependencies setup completed successfully" -echo "" - -# Step 2: Build Native Component -print_banner "Step 2/2: Building Native Component" -log "Running native component build script..." -echo "" - -if ! "$SCRIPT_DIR/build_native.sh" "$CONFIG_FILE" "$COMPONENT_DIR"; then - err "Native component build failed" - exit 1 -fi - -echo "" -ok "Native component build completed successfully" -echo "" - -# Final summary -echo "" -echo -e "${BOLD}${GREEN}================================================================${NC}" -echo -e "${BOLD}${GREEN} Complete Build Pipeline Completed Successfully!${NC}" -echo -e "${BOLD}${GREEN}================================================================${NC}" -echo "" -log "Component: ${BOLD}$COMPONENT_NAME${NC}" -log "All dependencies built and installed" -log "Native component compiled successfully" -echo "" - -# Display installation paths -HEADER_PATH=$(jq -r '.native_component.include_path' "$CONFIG_FILE") -LIB_PATH=$(jq -r '.native_component.lib_output_path' "$CONFIG_FILE") -HEADER_PATH="${HEADER_PATH//\$HOME/$HOME}" -LIB_PATH="${LIB_PATH//\$HOME/$HOME}" - -echo -e "${CYAN}Installation Locations:${NC}" -log " Headers: $HEADER_PATH" -log " Libraries: $LIB_PATH" -echo "" - -echo -e "${GREEN}✓ Ready for Coverity analysis or deployment${NC}" -echo "" diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index fb91b29..e5e9518 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -9,7 +9,7 @@ { "name": "common-library", "repo": "https://github.com/rdkcentral/common-library.git", - "branch": "feature/native_build_for_coverity", + "branch": "develop", "header_paths": [ { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" }, { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb/linux" }, @@ -38,7 +38,7 @@ ], "build": { "type": "script", - "script": "cov_docker_script/common_external_build.sh" + "script": "cov_docker_script/run_external_build.sh" } }, { @@ -81,13 +81,13 @@ { "name": "Utopia", "repo": "https://github.com/rdkcentral/utopia.git", - "branch": "feature/cov_native_build", + "branch": "develop", "header_paths": [ { "source": "source/include/syscfg", "destination": "$HOME/usr/include/rdkb/syscfg" } ], "build": { "type": "script", - "script": "cov_docker_script/common_external_build.sh" + "script": "cov_docker_script/run_external_build.sh" } } ] diff --git a/cov_docker_script/configure_options.conf b/cov_docker_script/configure_options.conf new file mode 100644 index 0000000..19e09c8 --- /dev/null +++ b/cov_docker_script/configure_options.conf @@ -0,0 +1,136 @@ +# Common Library Agent Configure Options +# This file contains autotools configure options for the common-library component +# Each section can be edited independently for better maintainability + +# ============================================================================ +# CPPFLAGS - Preprocessor flags (includes and defines) +# ============================================================================ +[CPPFLAGS] +# Autotools configuration +-DHAVE_CONFIG_H + +# Include paths +-I$HOME/usr/include/rdkb/ +-I/usr/include/dbus-1.0 +-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include + +# Core system defines +-DSAFEC_DUMMY_API +-D_COSA_HAL_ +-U_COSA_SIM_ +-DCONFIG_SYSTEM_MOCA + +# ANSC framework defines +-D_ANSC_LINUX +-D_ANSC_USER +-D_ANSC_LITTLE_ENDIAN_ +-D_ANSC_USE_OPENSSL_ +-D_ANSC_AES_USED_ +-D_NO_ANSC_ZLIB_ +-U_ANSC_IPV6_COMPATIBLE_ + +# CCSP/Component defines +-D_CCSP_CWMP_TCP_CONNREQ_HANDLER +-D_DSLH_STUN_ +-D_NO_PKI_KB5_SUPPORT +-D_BBHM_SSE_FILE_IO +-DCCSP_SUPPORT_ENABLED + +# Product/Platform defines +-D_COSA_INTEL_USG_ARM_ +-D_COSA_FOR_COMCAST_ +-D_COSA_BCM_ARM_ +-D_XB6_PRODUCT_REQ_ +-D_XB7_PRODUCT_REQ_ +-D_XB8_PRODUCT_REQ_ + +# Vendor/Customer configuration +-DCONFIG_VENDOR_CUSTOMER_COMCAST +-DCONFIG_CISCO_HOTSPOT + +# Security and debugging +-DENABLE_SA_KEY +-D_NO_EXECINFO_H_ +-D_DEBUG +-DINCLUDE_BREAKPAD + +# System features +-DFEATURE_SUPPORT_RDKLOG +-DFEATURE_SUPPORT_SYSLOG +-DBUILD_WEB +-DUSE_NOTIFY_COMPONENT +-DNTPD_ENABLE +-DUTC_ENABLE +-DUTC_ENABLE_ATOM +-DXDNS_ENABLE + +# Network features +-DENABLE_ETH_WAN +-DEROUTER_DHCP_OPTION_MTA +-DETH_4_PORTS +-D_2_5G_ETHERNET_SUPPORT_ +-D_MACSEC_SUPPORT_ +-D_BRIDGE_UTILS_BIN_ +-DAUTOWAN_ENABLE +-DENABLE_WANMODECHANGE_NOREBOOT +-DFEATURE_RDKB_WAN_MANAGER +-DFEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE +-DWAN_MANAGER_UNIFICATION_ENABLED +-DWAN_FAILOVER_SUPPORTED +-DGATEWAY_FAILOVER_SUPPORTED + +# WiFi features +-D_ENABLE_BAND_STEERING_ +-D_BEACONRATE_SUPPORT +-D_TRI_BAND_WIFI_ +-D_WIFI_AX_SUPPORT_ +-D_WIFI_CONSOLIDATED_STANDARDS_ +-DWIFI_HAL_VERSION_3 +-DFEATURE_SUPPORT_MESH +-DFEATURE_SUPPORT_WEBCONFIG +-DFEATURE_SUPPORT_INTERWORKING +-DFEATURE_SUPPORT_PASSPOINT +-DWIFI_STATS_DISABLE_SPEEDTEST_RUNNING +-DFEATURE_SUPPORT_RADIUSGREYLIST +-DFEATURE_SUPPORT_ACL_SELFHEAL +-DFEATURE_CSI +-DFEATURE_SUPPORT_ONBOARD_LOGGING +-DFEATURE_OFF_CHANNEL_SCAN_5G +-DRDK_ONEWIFI +-DWIFI_MANAGE_SUPPORTED + +# Advanced features +-D_PSM_TRANS_RDK_TRIGG_ +-D_CM_HIGHSPLIT_SUPPORTED_ +-DFEATURE_RDKB_INTER_DEVICE_MANAGER +-DFEATURE_SUPPORT_MAPT_NAT46 +-DMAPT_UNIFICATION_ENABLED +-DSPEED_BOOST_SUPPORTED +-DAMENITIES_NETWORK_ENABLED + +# Test/Development +-DCOLUMBO_HWTEST + +# Build system +-DRBUS_BUILD_FLAG_ENABLE + +# Standard defines +-D_GNU_SOURCE +-D__USE_XOPEN + +# ============================================================================ +# CFLAGS - Compiler flags +# ============================================================================ +[CFLAGS] +-ffunction-sections +-fdata-sections +-fomit-frame-pointer +-fno-strict-aliasing + +# ============================================================================ +# LDFLAGS - Linker flags +# ============================================================================ +[LDFLAGS] +-L$HOME/usr/local/lib/ +-Wl,--allow-shlib-undefined +-Wl,--unresolved-symbols=ignore-all diff --git a/cov_docker_script/run_external_build.sh b/cov_docker_script/run_external_build.sh new file mode 100755 index 0000000..162570a --- /dev/null +++ b/cov_docker_script/run_external_build.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# External Build Wrapper Script +# Verifies build tools and runs common_external_build.sh +# Usage: ./run_external_build.sh +# Note: run_setup_dependencies.sh should be executed first +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== External Build Pipeline =====" +echo "" + +# Clone build_tools_workflows if it doesn't exist +if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then + log "build_tools_workflows not found, cloning repository..." + cd "$NATIVE_COMPONENT_DIR" + git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } + ok "Repository cloned successfully" +else + log "build_tools_workflows already exists" +fi + +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh" ]]; then + err "common_external_build.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first." + exit 1 +fi + +log "Build script found, proceeding with build..." + +# Run common_external_build.sh from build_tools_workflows +echo "" +log "Running common_external_build.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh" "$SCRIPT_DIR/component_config.json" "$NATIVE_COMPONENT_DIR" + +echo "" +ok "External build completed successfully!" + +echo "" diff --git a/cov_docker_script/run_native_build.sh b/cov_docker_script/run_native_build.sh new file mode 100755 index 0000000..9d3aea3 --- /dev/null +++ b/cov_docker_script/run_native_build.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Native Build Wrapper Script +# Verifies build tools and runs build_native.sh +# Usage: ./run_native_build.sh +# Note: run_setup_dependencies.sh should be executed first +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== Native Build Pipeline =====" +echo "" + +# Verify build_tools_workflows exists (should be cloned by run_setup_dependencies.sh) +if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then + err "build_tools_workflows directory not found. Please run run_setup_dependencies.sh first." + exit 1 +fi + +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" ]]; then + err "build_native.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first." + exit 1 +fi + +log "Build script found, proceeding with build..." + +# Run build_native.sh from build_tools_workflows +echo "" +log "Running build_native.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" "$SCRIPT_DIR/component_config.json" "$NATIVE_COMPONENT_DIR" + +echo "" +ok "Native build completed successfully!" + +# Cleanup build_tools_workflows directory +log "Cleaning up build_tools_workflows directory..." +rm -rf "$BUILD_TOOLS_DIR" +ok "Cleanup completed" + +echo "" diff --git a/cov_docker_script/run_setup_dependencies.sh b/cov_docker_script/run_setup_dependencies.sh new file mode 100755 index 0000000..5223c84 --- /dev/null +++ b/cov_docker_script/run_setup_dependencies.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Setup Dependencies Wrapper Script +# Sets up build tools and runs setup_dependencies.sh +# Usage: ./run_setup_dependencies.sh +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" +REQUIRED_SCRIPTS=("build_native.sh" "common_build_utils.sh" "common_external_build.sh" "setup_dependencies.sh") + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== Setup Dependencies Pipeline =====" +echo "" + +# Setup build tools +log "Setting up build tools..." + +# Clone build_tools_workflows +if [[ -d "$BUILD_TOOLS_DIR" ]]; then + log "build_tools_workflows already exists, skipping clone" +else + log "Cloning build_tools_workflows (develop)" + cd "$NATIVE_COMPONENT_DIR" + git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } + ok "Repository cloned" +fi + +# Verify required scripts +[[ ! -d "$BUILD_TOOLS_DIR/cov_docker_script" ]] && { err "cov_docker_script not found"; exit 1; } + +log "Verifying required scripts..." +MISSING=() +for script in "${REQUIRED_SCRIPTS[@]}"; do + [[ -f "$BUILD_TOOLS_DIR/cov_docker_script/$script" ]] || MISSING+=("$script") +done + +if [[ ${#MISSING[@]} -gt 0 ]]; then + err "Missing scripts: ${MISSING[*]}" + exit 1 +fi +ok "All required scripts found" + +# Verify setup_dependencies.sh exists before running +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" ]]; then + err "setup_dependencies.sh not found in build_tools_workflows" + exit 1 +fi + +# Run setup_dependencies.sh from build_tools_workflows +echo "" +log "Running setup_dependencies.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" "$SCRIPT_DIR/component_config.json" + +echo "" +echo "[OK] Dependencies setup completed successfully!" +echo "" diff --git a/cov_docker_script/setup_dependencies.sh b/cov_docker_script/setup_dependencies.sh deleted file mode 100755 index a4835f8..0000000 --- a/cov_docker_script/setup_dependencies.sh +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/env bash -set -e - -################################################################################ -# Generic Dependency Setup Script -# Usage: ./setup_dependencies.sh [config_file] -################################################################################ - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -CONFIG_FILE="${1:-$SCRIPT_DIR/component_config.json}" - -# Source common utilities -source "$SCRIPT_DIR/common_build_utils.sh" - -# Default directories -BUILD_DIR="${BUILD_DIR:-$HOME/build}" -USR_DIR="${USR_DIR:-$HOME/usr}" - -# Validate environment -if [[ ! -f "$CONFIG_FILE" ]]; then - err "Config file not found: $CONFIG_FILE" - exit 1 -fi - -check_dependencies || exit 1 - -# Initialize environment -initialize_environment() { - print_banner "Dependency Setup" - - log "Configuration: $CONFIG_FILE" - log "Build directory: $BUILD_DIR" - log "Install directory: $USR_DIR" - echo "" - - # Clean if requested - if [[ "${CLEAN_BUILD:-false}" == "true" ]]; then - warn "Cleaning previous build artifacts" - [[ -d "$BUILD_DIR" ]] && rm -rf "$BUILD_DIR" - [[ -d "$USR_DIR" ]] && rm -rf "$USR_DIR" - fi - - # Create directories - mkdir -p "$BUILD_DIR" - mkdir -p "$USR_DIR/include/rdkb" - mkdir -p "$USR_DIR/local/lib" - mkdir -p "$USR_DIR/local/lib/pkgconfig" - mkdir -p "$USR_DIR/lib" - - # Setup PKG_CONFIG_PATH and LD_LIBRARY_PATH for dependencies - export PKG_CONFIG_PATH="$USR_DIR/local/lib/pkgconfig:$USR_DIR/lib/pkgconfig:${PKG_CONFIG_PATH:-}" - export LD_LIBRARY_PATH="$USR_DIR/local/lib:$USR_DIR/lib:${LD_LIBRARY_PATH:-}" - export CPPFLAGS="${CPPFLAGS:-} -I$USR_DIR/include" - export LDFLAGS="${LDFLAGS:-} -L$USR_DIR/local/lib" - - log "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" - log "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - echo "" - - ok "Environment initialized" -} - -# Process header paths for a repository -process_headers() { - local index="$1" - local repo_dir="$2" - local name="$3" - - local count - count=$(jq ".dependencies.repos[$index].header_paths | length" "$CONFIG_FILE") - - if [[ "$count" -eq 0 ]]; then - log "No headers configured for $name" - return 0 - fi - - local i=0 - while [[ $i -lt $count ]]; do - local src dst - src=$(jq -r ".dependencies.repos[$index].header_paths[$i].source" "$CONFIG_FILE") - dst=$(jq -r ".dependencies.repos[$index].header_paths[$i].destination" "$CONFIG_FILE") - - copy_headers "$repo_dir/$src" "$dst" - i=$((i + 1)) - done - - return 0 -} - -# Build a repository -build_repository() { - local index="$1" - local repo_dir="$2" - local name="$3" - - local build_type - build_type=$(jq -r ".dependencies.repos[$index].build.type // empty" "$CONFIG_FILE") - - if [[ -z "$build_type" ]]; then - log "No build configuration for $name (headers only)" - return 0 - fi - - step "Building $name (type: $build_type)" - - case "$build_type" in - autotools) - local configure_flags make_targets parallel_make - configure_flags=$(jq -r ".dependencies.repos[$index].build.configure_flags // empty" "$CONFIG_FILE") - make_targets=$(jq -r ".dependencies.repos[$index].build.make_targets[]? // \"all\"" "$CONFIG_FILE" | tr '\n' ' ') - parallel_make=$(jq -r ".dependencies.repos[$index].build.parallel_make // true" "$CONFIG_FILE") - - build_autotools "$repo_dir" "$configure_flags" "$make_targets" "$parallel_make" || return 1 - ;; - - cmake) - local build_dir cmake_flags make_targets parallel_make - build_dir=$(jq -r ".dependencies.repos[$index].build.build_dir // \"build\"" "$CONFIG_FILE") - cmake_flags=$(jq -r ".dependencies.repos[$index].build.cmake_flags // empty" "$CONFIG_FILE") - make_targets=$(jq -r ".dependencies.repos[$index].build.make_targets[]? // \"all\"" "$CONFIG_FILE" | tr '\n' ' ') - parallel_make=$(jq -r ".dependencies.repos[$index].build.parallel_make // true" "$CONFIG_FILE") - - build_cmake "$repo_dir" "$build_dir" "$cmake_flags" "$make_targets" "$parallel_make" || return 1 - ;; - - meson) - local build_dir meson_flags ninja_targets - build_dir=$(jq -r ".dependencies.repos[$index].build.build_dir // \"builddir\"" "$CONFIG_FILE") - meson_flags=$(jq -r ".dependencies.repos[$index].build.meson_flags // empty" "$CONFIG_FILE") - ninja_targets=$(jq -r ".dependencies.repos[$index].build.ninja_targets[]? // \"all\"" "$CONFIG_FILE" | tr '\n' ' ') - - build_meson "$repo_dir" "$build_dir" "$meson_flags" "$ninja_targets" || return 1 - ;; - - commands) - execute_commands "$repo_dir" "$CONFIG_FILE" "$index" || return 1 - ;; - - script) - local script_path - script_path=$(jq -r ".dependencies.repos[$index].build.script" "$CONFIG_FILE") - local full_script="$repo_dir/$script_path" - - if [[ -f "$full_script" ]]; then - step "Executing build script: $script_path" - chmod +x "$full_script" - - export PARENT_BUILD_DIR="$BUILD_DIR" - export PARENT_USR_DIR="$USR_DIR" - - pushd "$repo_dir" >/dev/null || return 1 - if ! "$full_script"; then - err "Build script failed" - popd >/dev/null - return 1 - fi - popd >/dev/null - - unset PARENT_BUILD_DIR PARENT_USR_DIR - else - err "Build script not found: $full_script" - return 1 - fi - ;; - - *) - err "Unknown build type: $build_type" - return 1 - ;; - esac - - # Copy libraries - copy_libraries "$repo_dir" "$USR_DIR/local/lib" - copy_libraries "$repo_dir" "$USR_DIR/lib" - - ok "$name build completed" - return 0 -} - -# Process a single dependency -process_dependency() { - local index="$1" - - local name repo branch - name=$(jq -r ".dependencies.repos[$index].name" "$CONFIG_FILE") - repo=$(jq -r ".dependencies.repos[$index].repo" "$CONFIG_FILE") - branch=$(jq -r ".dependencies.repos[$index].branch" "$CONFIG_FILE") - - local repo_dir="$BUILD_DIR/$name" - - print_section "Processing: $name" - - # Clone repository - if ! clone_repo "$name" "$repo" "$branch" "$repo_dir"; then - err "Failed to process $name" - return 1 - fi - - # Copy headers - if ! process_headers "$index" "$repo_dir" "$name"; then - err "Failed to copy headers for $name" - return 1 - fi - - # Build if needed - if ! build_repository "$index" "$repo_dir" "$name"; then - err "Failed to build $name" - return 1 - fi - - ok "$name processed successfully" - return 0 -} - -# Main execution -main() { - initialize_environment - - local count - count=$(jq ".dependencies.repos | length" "$CONFIG_FILE") - - log "Found $count dependencies to process" - echo "" - - local i=0 - while [[ $i -lt $count ]]; do - if ! process_dependency "$i"; then - err "Dependency setup failed" - exit 1 - fi - i=$((i + 1)) - done - - echo "" - print_banner "Dependencies Setup Completed Successfully" - log "Headers installed: $USR_DIR/include/rdkb" - log "Libraries installed: $USR_DIR/local/lib and $USR_DIR/lib" - echo "" -} - -main From 919e89efdfb162752961a49663e212ef7250aa45 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah <162420027+sowmiyachelliah@users.noreply.github.com> Date: Fri, 30 Jan 2026 12:46:19 +0530 Subject: [PATCH 06/15] Update native-build.yml --- .github/workflows/native-build.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml index 0be08e2..60b8dc6 100644 --- a/.github/workflows/native-build.yml +++ b/.github/workflows/native-build.yml @@ -19,10 +19,9 @@ jobs: - name: native build run: | - chmod +x cov_docker_script/setup_dependencies.sh - ./cov_docker_script/setup_dependencies.sh - chmod +x cov_docker_script/build_native.sh - ./cov_docker_script/build_native.sh - + chmod +x cov_docker_script/run_setup_dependencies.sh + ./cov_docker_script/run_setup_dependencies.sh + chmod +x cov_docker_script/run_native_build.sh + ./cov_docker_script/run_native_build.sh env: - GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} From beae32e7f85233ce9ca437827491f5dea4079ec6 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah <162420027+sowmiyachelliah@users.noreply.github.com> Date: Fri, 30 Jan 2026 14:54:57 +0530 Subject: [PATCH 07/15] Update configure_options.conf --- cov_docker_script/configure_options.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cov_docker_script/configure_options.conf b/cov_docker_script/configure_options.conf index 19e09c8..77fa449 100644 --- a/cov_docker_script/configure_options.conf +++ b/cov_docker_script/configure_options.conf @@ -13,6 +13,7 @@ -I$HOME/usr/include/rdkb/ -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include +-I/usr/include/cjson # Core system defines -DSAFEC_DUMMY_API @@ -47,6 +48,7 @@ # Vendor/Customer configuration -DCONFIG_VENDOR_CUSTOMER_COMCAST -DCONFIG_CISCO_HOTSPOT +-DCONFIG_VENDOR_NAME # Security and debugging -DENABLE_SA_KEY From 76dfd2489c660621d16ba4f198fc753ae3b63bf5 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah <162420027+sowmiyachelliah@users.noreply.github.com> Date: Fri, 30 Jan 2026 14:55:24 +0530 Subject: [PATCH 08/15] Update component_config.json --- cov_docker_script/component_config.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index e5e9518..f4639c3 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -105,10 +105,7 @@ ], "build": { "type": "autotools", - "configure_options": [ - "CPPFLAGS=-I$HOME/usr/include/rdkb/ -I/usr/include/ -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/cjson -DSAFEC_DUMMY_API -DCONFIG_VENDOR_NAME", - "LDFLAGS=-L$HOME/usr/local/lib/ -Wl,--allow-shlib-undefined -Wl,--unresolved-symbols=ignore-all" - ] + "configure_options_file": "cov_docker_script/configure_options.conf" } } } From 78d72b08f317c7e0e186600c555040c94ce47b00 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Fri, 30 Jan 2026 09:23:05 +0000 Subject: [PATCH 09/15] Update code --- cov_docker_script/component_config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index f4639c3..9effdac 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -108,4 +108,4 @@ "configure_options_file": "cov_docker_script/configure_options.conf" } } -} +} \ No newline at end of file From a48ab3e50a7944a6313c3d49e9e71f386ff3cc0d Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Mon, 9 Feb 2026 06:00:01 +0000 Subject: [PATCH 10/15] Adding sub-modules --- .github/workflows/native-build.yml | 17 ++++-- .gitmodules | 4 ++ build_tools_workflows | 1 + cov_docker_script/component_config.json | 4 +- cov_docker_script/run_external_build.sh | 51 ---------------- cov_docker_script/run_native_build.sh | 51 ---------------- cov_docker_script/run_setup_dependencies.sh | 67 --------------------- 7 files changed, 20 insertions(+), 175 deletions(-) create mode 100644 .gitmodules create mode 160000 build_tools_workflows delete mode 100755 cov_docker_script/run_external_build.sh delete mode 100755 cov_docker_script/run_native_build.sh delete mode 100755 cov_docker_script/run_setup_dependencies.sh diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml index 60b8dc6..b8c6054 100644 --- a/.github/workflows/native-build.yml +++ b/.github/workflows/native-build.yml @@ -19,9 +19,18 @@ jobs: - name: native build run: | - chmod +x cov_docker_script/run_setup_dependencies.sh - ./cov_docker_script/run_setup_dependencies.sh - chmod +x cov_docker_script/run_native_build.sh - ./cov_docker_script/run_native_build.sh + # Trust the workspace + git config --global --add safe.directory '*' + + # Pull the latest changes for the native build system + git submodule update --init --recursive --remote + + # Build and install dependencies + chmod +x build_tools_workflows/cov_docker_script/setup_dependencies.sh + ./build_tools_workflows/cov_docker_script/setup_dependencies.sh ./cov_docker_script/component_config.json + + # Build component + chmod +x build_tools_workflows/cov_docker_script/build_native.sh + ./build_tools_workflows/cov_docker_script/build_native.sh ./cov_docker_script/component_config.json "$(pwd)" env: GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0512822 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "build_tools_workflows"] + path = build_tools_workflows + url = https://github.com/rdkcentral/build_tools_workflows + branch = develop diff --git a/build_tools_workflows b/build_tools_workflows new file mode 160000 index 0000000..11f1922 --- /dev/null +++ b/build_tools_workflows @@ -0,0 +1 @@ +Subproject commit 11f192263b3b4358e0d99895d57eab7bda5a8115 diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index 9effdac..aed9165 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -38,7 +38,7 @@ ], "build": { "type": "script", - "script": "cov_docker_script/run_external_build.sh" + "script": "build_tools_workflows/cov_docker_script/common_external_build.sh" } }, { @@ -87,7 +87,7 @@ ], "build": { "type": "script", - "script": "cov_docker_script/run_external_build.sh" + "script": "build_tools_workflows/cov_docker_script/common_external_build.sh" } } ] diff --git a/cov_docker_script/run_external_build.sh b/cov_docker_script/run_external_build.sh deleted file mode 100755 index 162570a..0000000 --- a/cov_docker_script/run_external_build.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash -set -e - -################################################################################ -# External Build Wrapper Script -# Verifies build tools and runs common_external_build.sh -# Usage: ./run_external_build.sh -# Note: run_setup_dependencies.sh should be executed first -################################################################################ - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" -BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" -BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" - -# Basic logging functions -log() { echo "[INFO] $*"; } -ok() { echo "[OK] $*"; } -err() { echo "[ERROR] $*" >&2; } - -echo "" -echo "===== External Build Pipeline =====" -echo "" - -# Clone build_tools_workflows if it doesn't exist -if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then - log "build_tools_workflows not found, cloning repository..." - cd "$NATIVE_COMPONENT_DIR" - git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } - ok "Repository cloned successfully" -else - log "build_tools_workflows already exists" -fi - -if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh" ]]; then - err "common_external_build.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first." - exit 1 -fi - -log "Build script found, proceeding with build..." - -# Run common_external_build.sh from build_tools_workflows -echo "" -log "Running common_external_build.sh from build_tools_workflows..." -cd "$NATIVE_COMPONENT_DIR" -"$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh" "$SCRIPT_DIR/component_config.json" "$NATIVE_COMPONENT_DIR" - -echo "" -ok "External build completed successfully!" - -echo "" diff --git a/cov_docker_script/run_native_build.sh b/cov_docker_script/run_native_build.sh deleted file mode 100755 index 9d3aea3..0000000 --- a/cov_docker_script/run_native_build.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash -set -e - -################################################################################ -# Native Build Wrapper Script -# Verifies build tools and runs build_native.sh -# Usage: ./run_native_build.sh -# Note: run_setup_dependencies.sh should be executed first -################################################################################ - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" -BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" - -# Basic logging functions -log() { echo "[INFO] $*"; } -ok() { echo "[OK] $*"; } -err() { echo "[ERROR] $*" >&2; } - -echo "" -echo "===== Native Build Pipeline =====" -echo "" - -# Verify build_tools_workflows exists (should be cloned by run_setup_dependencies.sh) -if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then - err "build_tools_workflows directory not found. Please run run_setup_dependencies.sh first." - exit 1 -fi - -if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" ]]; then - err "build_native.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first." - exit 1 -fi - -log "Build script found, proceeding with build..." - -# Run build_native.sh from build_tools_workflows -echo "" -log "Running build_native.sh from build_tools_workflows..." -cd "$NATIVE_COMPONENT_DIR" -"$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" "$SCRIPT_DIR/component_config.json" "$NATIVE_COMPONENT_DIR" - -echo "" -ok "Native build completed successfully!" - -# Cleanup build_tools_workflows directory -log "Cleaning up build_tools_workflows directory..." -rm -rf "$BUILD_TOOLS_DIR" -ok "Cleanup completed" - -echo "" diff --git a/cov_docker_script/run_setup_dependencies.sh b/cov_docker_script/run_setup_dependencies.sh deleted file mode 100755 index 5223c84..0000000 --- a/cov_docker_script/run_setup_dependencies.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash -set -e - -################################################################################ -# Setup Dependencies Wrapper Script -# Sets up build tools and runs setup_dependencies.sh -# Usage: ./run_setup_dependencies.sh -################################################################################ - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" -BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" -BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" -REQUIRED_SCRIPTS=("build_native.sh" "common_build_utils.sh" "common_external_build.sh" "setup_dependencies.sh") - -# Basic logging functions -log() { echo "[INFO] $*"; } -ok() { echo "[OK] $*"; } -err() { echo "[ERROR] $*" >&2; } - -echo "" -echo "===== Setup Dependencies Pipeline =====" -echo "" - -# Setup build tools -log "Setting up build tools..." - -# Clone build_tools_workflows -if [[ -d "$BUILD_TOOLS_DIR" ]]; then - log "build_tools_workflows already exists, skipping clone" -else - log "Cloning build_tools_workflows (develop)" - cd "$NATIVE_COMPONENT_DIR" - git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } - ok "Repository cloned" -fi - -# Verify required scripts -[[ ! -d "$BUILD_TOOLS_DIR/cov_docker_script" ]] && { err "cov_docker_script not found"; exit 1; } - -log "Verifying required scripts..." -MISSING=() -for script in "${REQUIRED_SCRIPTS[@]}"; do - [[ -f "$BUILD_TOOLS_DIR/cov_docker_script/$script" ]] || MISSING+=("$script") -done - -if [[ ${#MISSING[@]} -gt 0 ]]; then - err "Missing scripts: ${MISSING[*]}" - exit 1 -fi -ok "All required scripts found" - -# Verify setup_dependencies.sh exists before running -if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" ]]; then - err "setup_dependencies.sh not found in build_tools_workflows" - exit 1 -fi - -# Run setup_dependencies.sh from build_tools_workflows -echo "" -log "Running setup_dependencies.sh from build_tools_workflows..." -cd "$NATIVE_COMPONENT_DIR" -"$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" "$SCRIPT_DIR/component_config.json" - -echo "" -echo "[OK] Dependencies setup completed successfully!" -echo "" From 155de6593882062f87993fab8e09c8c3d20ed57b Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Mon, 9 Feb 2026 07:11:33 +0000 Subject: [PATCH 11/15] Updating README.md --- cov_docker_script/README.md | 488 +----------------------------------- 1 file changed, 2 insertions(+), 486 deletions(-) diff --git a/cov_docker_script/README.md b/cov_docker_script/README.md index e06d1a2..e4e293f 100644 --- a/cov_docker_script/README.md +++ b/cov_docker_script/README.md @@ -1,487 +1,3 @@ -# Component Native Build Configuration +# 🔧 Coverity Native Build System for RDK-B Components -**Coverity/Native build configuration for RDK-B components.** - ---- - -## 📋 Overview - -This directory contains the configuration and wrapper scripts necessary for building RDK-B components in a native (non-Yocto) environment. This setup enables Coverity static analysis and validates that components can be built with explicitly declared dependencies. - -### Directory Contents - -``` -/cov_docker_script/ -├── README.md # This file -├── component_config.json # Dependency & build configuration -├── configure_options.conf # Autotools configure flags (optional) -├── run_setup_dependencies.sh # Wrapper: Setup build tools & dependencies -├── run_native_build.sh # Wrapper: Build main component -└── run_external_build.sh # Wrapper: For dependency builds (used in component_config.json) -``` - -### Important: Add to .gitignore - -Add the following to your component's `.gitignore` to exclude temporary build artifacts: - -```gitignore -# Build tools (downloaded by wrapper scripts) -build_tools_workflows/ - -# Dependency build artifacts -build/ -``` - ---- - -## 🚀 Quick Start - -### Prerequisites - -- Docker container with [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) image -- All wrapper scripts have execute permissions - -### Build Commands - -#### Complete Build Pipeline - -```bash -# From your component root directory -cd /path/to/your-component - -# Standard build pipeline for main component -./cov_docker_script/run_setup_dependencies.sh -./cov_docker_script/run_native_build.sh - -# Clean build (removes previous artifacts) -CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh -./cov_docker_script/run_native_build.sh -``` - -#### Alternative: Single-Script Build (All-in-One) - -If you prefer to run everything in a single command: - -```bash -# Run setup dependencies + native build in one script -./cov_docker_script/run_external_build.sh - -# Clean build -CLEAN_BUILD=true ./cov_docker_script/run_external_build.sh -``` - -**Note:** `run_external_build.sh` performs both dependency setup and component build in one execution. While primarily designed to be invoked by the dependency setup process when specified in `component_config.json` (see [run_external_build.sh](#3-run_external_buildsh) section), it can also be used directly for the main component as a convenience script that handles the complete build pipeline. - -#### Individual Steps - -```bash -# Step 1: Setup dependencies only -./cov_docker_script/run_setup_dependencies.sh - -# Step 2: Build component only (requires Step 1 completed) -./cov_docker_script/run_native_build.sh -``` - ---- - -## 📖 Scripts Reference - -### 1. run_setup_dependencies.sh - -**Purpose:** Sets up build tools and runs dependency setup. - -**What it does:** -1. Clones `build_tools_workflows` repository (develop branch) -2. Verifies required scripts are present -3. Runs `setup_dependencies.sh` from build_tools_workflows with config path to: - - Clone all dependency repositories - - Copy headers to `$HOME/usr/include/rdkb/` - - Build and install dependency libraries -4. Leaves build_tools_workflows in place for run_native_build.sh - -**Usage:** -```bash -./run_setup_dependencies.sh - -# Clean build -CLEAN_BUILD=true ./run_setup_dependencies.sh -``` - -**Required files:** -- `component_config.json` (defines dependencies) - -**Outputs:** -- Downloads: `$HOME/build/` (dependency repositories) -- Headers: `$HOME/usr/include/rdkb/` -- Libraries: `$HOME/usr/local/lib/`, `$HOME/usr/lib/` -- build_tools_workflows: Remains in place for run_native_build.sh - -**Environment Variables:** -- `BUILD_DIR` - Override build directory (default: `$HOME/build`) -- `USR_DIR` - Override install directory (default: `$HOME/usr`) -- `CLEAN_BUILD` - Set to `true` to remove previous builds - ---- - -### 2. run_native_build.sh - -**Purpose:** Verifies build tools and builds the component. - -**What it does:** -1. Verifies `build_tools_workflows` directory exists (cloned by `run_setup_dependencies.sh`) -2. Verifies `build_native.sh` is present -3. Runs `build_native.sh` from build_tools_workflows with config and component paths to: - - Apply patches to source code - - Configure build environment - - Build component - - Install libraries -4. Cleans up build_tools_workflows directory - -**Usage:** -```bash -./run_native_build.sh -``` - -**Prerequisites:** -- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows) -- All dependency headers/libraries must be available - -**Required files:** -- `component_config.json` (defines component build settings) -- `configure_options.conf` (autotools configuration) - -**Outputs:** -- Component libraries in `$HOME/usr/local/lib/` -- Build artifacts in component root directory - ---- - -### 3. run_external_build.sh - -**Purpose:** Builds dependencies with complex build requirements (invoked from component_config.json). - -**Key Differences from run_native_build.sh:** -- Designed for **dependency repositories**, not the main component -- Invokes `common_external_build.sh` without arguments (dependencies manage their own configuration) -- Does **NOT** clean up `build_tools_workflows` (may be used by multiple dependencies) -- Typically called automatically during dependency setup, not manually - -**What it does:** -1. Clones `build_tools_workflows` if not present (or verifies it exists) -2. Verifies `common_external_build.sh` is present -3. Runs `common_external_build.sh` from build_tools_workflows -4. Preserves `build_tools_workflows` directory for subsequent use - -**Usage:** -```bash -./run_external_build.sh -``` - -**Prerequisites:** -- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows) -- All dependency headers/libraries must be available - -**Outputs:** -- Build artifacts based on common_external_build.sh implementation -- build_tools_workflows remains in place (not cleaned up) - -**Primary Use Case - Dependency Builds in component_config.json:** - -This script is primarily used to build **dependency repositories** that have complex build requirements. When a dependency has its own `cov_docker_script/run_external_build.sh`, it can be invoked from the parent component's `component_config.json`. - -**Example configuration in component_config.json:** - -```json -{ - "name": "Utopia", - "repo": "https://github.com/rdkcentral/utopia.git", - "branch": "feature/cov_native_build", - "header_paths": [ - { "source": "source/include", "destination": "$HOME/usr/include/rdkb" } - ], - "build": { - "type": "script", - "script": "cov_docker_script/run_external_build.sh" - } -} -``` - -**How it works for dependencies:** -1. The parent component's `setup_dependencies.sh` clones the dependency repository (e.g., Utopia) -2. The dependency's `run_external_build.sh` is executed from the dependency's directory -3. This script internally: - - Sets up the dependency's own build tools and dependencies - - Runs the dependency's native build process - - Produces shared libraries (`.so` files) -4. The generated shared libraries are installed to `$HOME/usr/local/lib/` or `$HOME/usr/lib/` -5. These libraries are then available for the parent component's native build - -**When to use this approach:** -- Dependency has complex multi-step build requirements -- Dependency has its own sub-dependencies that need to be built -- Dependency requires custom build logic beyond standard autotools/cmake/meson -- Dependency repository already has a `cov_docker_script/run_external_build.sh` script - -**Note:** This approach allows dependencies to manage their own complete build pipeline, producing the necessary shared libraries that the parent component links against during its native compilation. - ---- - -## 📝 Configuration Files - -### component_config.json - -**JSON configuration defining all dependencies and build settings.** - -**Key Sections:** - -1. **dependencies.repos[]** - External dependencies required by your component - ```json - { - "name": "rbus", - "repo": "https://github.com/rdkcentral/rbus.git", - "branch": "v2.7.0", - "header_paths": [...], - "build": {...} - } - ``` - -2. **native_component** - Component build configuration - ```json - { - "name": "your-component", - "build": { - "type": "autotools", - "configure_options_file": "cov_docker_script/configure_options.conf" - } - } - ``` - -**Example Dependencies:** -Your component may require dependencies such as: -- rbus -- rdk_logger -- safec -- common-library -- halinterface -- And other component-specific dependencies - -See [component_config.json](component_config.json) for your component's specific dependency configuration. - ---- - -### configure_options.conf - -**Autotools configuration file with preprocessor, compiler, and linker flags.** - -**Format:** -```properties -[CPPFLAGS] --I$HOME/usr/include/rdkb/ --DFEATURE_FLAG - -[CFLAGS] --Wall -Wextra - -[LDFLAGS] --L$HOME/usr/local/lib/ -``` - -**Sections:** -- `[CPPFLAGS]` - Preprocessor flags (includes `-I`, defines `-D`) -- `[CFLAGS]` - C compiler flags -- `[CXXFLAGS]` - C++ compiler flags -- `[LDFLAGS]` - Linker flags (library paths `-L`, linker options `-Wl`) - -**Component-Specific Flags:** -Customize flags based on your component's requirements: -- Platform defines: `_COSA_INTEL_USG_ARM_`, `_COSA_BCM_ARM_`, etc. -- Product defines: `_XB6_PRODUCT_REQ_`, `_XB7_PRODUCT_REQ_`, etc. -- Feature flags: `FEATURE_SUPPORT_RDKLOG`, component-specific features, etc. - -See [configure_options.conf](configure_options.conf) for your component's complete flag list. - ---- - -## 🔧 Build System Architecture - -``` -┌─────────────────────────────────────────────────────┐ -│ run_setup_dependencies.sh │ -│ ┌──────────────────────────────────────────────┐ │ -│ │ 1. Clone build_tools_workflows │ │ -│ │ (develop branch) │ │ -│ │ │ │ -│ │ 2. Verify required scripts present │ │ -│ │ │ │ -│ │ 3. Run setup_dependencies.sh from │ │ -│ │ build_tools_workflows with config path │ │ -│ │ - Read component_config.json │ │ -│ │ - Clone dependency repos │ │ -│ │ - Copy headers │ │ -│ │ - Build & install libraries │ │ -│ └──────────────────────────────────────────────┘ │ -└─────────────────────────────────────────────────────┘ - │ - ▼ -┌─────────────────────────────────────────────────────┐ -│ run_native_build.sh │ -│ ┌──────────────────────────────────────────────┐ │ -│ │ 1. Verify build_tools_workflows exists │ │ -│ │ (cloned by run_setup_dependencies.sh) │ │ -│ │ │ │ -│ │ 2. Run build_native.sh from │ │ -│ │ build_tools_workflows with config and │ │ -│ │ component directory paths │ │ -│ │ - Process component headers │ │ -│ │ - Apply source patches (if configured) │ │ -│ │ - Read configure_options.conf │ │ -│ │ - Configure build (autogen/configure) │ │ -│ │ - Build component (make/cmake/meson) │ │ -│ │ - Install libraries │ │ -│ │ │ │ -│ │ 3. Cleanup build_tools_workflows directory │ │ -│ └──────────────────────────────────────────────┘ │ -└─────────────────────────────────────────────────────┘ -``` - ---- - -## 🐛 Troubleshooting - -### Build Failures - -**Problem:** Missing headers - -```bash -# Solution: Check if dependencies were installed -ls -la $HOME/usr/include/rdkb/ - -# Verify component_config.json has correct header_paths -cat component_config.json | jq '.dependencies.repos[].header_paths' - -# Re-run dependency setup -CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh -``` - -**Problem:** Missing libraries - -```bash -# Solution: Check library installation -ls -la $HOME/usr/local/lib/ -ls -la $HOME/usr/lib/ - -# Verify PKG_CONFIG_PATH -echo $PKG_CONFIG_PATH - -# Check if dependency build failed -cd $HOME/build/ -cat config.log # For autotools -cat build/meson-log.txt # For meson -``` - -**Problem:** Configure errors - -```bash -# Solution: Check configure_options.conf syntax -cat cov_docker_script/configure_options.conf - -# Verify flags are valid -./configure --help -``` - -### Script Errors - -**Problem:** Script not found - -```bash -# Solution: Ensure scripts are executable -chmod +x cov_docker_script/*.sh - -# Check if build_tools_workflows was cloned -ls -la ../build_tools_workflows/ -``` - -**Problem:** Permission denied - -```bash -# Solution: Fix container permissions -# (Run on host, not in container) -sudo docker exec rdkb-builder groupadd $USER --gid=$(id -g $USER) -sudo docker exec rdkb-builder useradd -m $USER -G users \ - --uid=$(id -u $USER) --gid=$(id -g $USER) -``` - ---- - -## 📚 Related Documentation - -- **Build Tools Repository:** [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/tree/develop) -- **Docker Environment:** [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) -- **Example Component:** [moca-agent](https://github.com/rdkcentral/moca-agent) (reference implementation) -- **Detailed Build Guide:** See `build_tools_workflows/cov_docker_script/README.md` - ---- - -## ⚠️ Important Notes - -### DO NOT Modify - -The following scripts are automatically copied from `build_tools_workflows` and **must not be modified locally**: - -- ❌ `build_native.sh` -- ❌ `common_build_utils.sh` -- ❌ `common_external_build.sh` -- ❌ `setup_dependencies.sh` - -Any changes will be overwritten when wrapper scripts run. - -### DO Modify - -The following files are component-specific and **should be customized**: - -- ✅ `component_config.json` - Dependency and build configuration -- ✅ `configure_options.conf` - Autotools flags -- ✅ `run_setup_dependencies.sh` - Wrapper script (if needed) -- ✅ `run_native_build.sh` - Wrapper script (if needed) - ---- - -## 🔄 Workflow Integration - -### Local Development - -```bash -# Make changes to source code -vim source/your_component.c - -# Rebuild component -CLEAN_BUILD=true ./cov_docker_script/run_native_build.sh -``` - -### CI/CD Integration - -This configuration is used by GitHub Actions to validate builds: - -```yaml -- name: Setup Dependencies - run: ./cov_docker_script/run_setup_dependencies.sh - -- name: Build Component - run: ./cov_docker_script/run_native_build.sh -``` - -See `.github/workflows/` for complete CI configuration. - ---- - -## 📞 Support - -For issues or questions: - -1. Check [Troubleshooting](#troubleshooting) section -2. Review [build_tools_workflows README](https://github.com/rdkcentral/build_tools_workflows/blob/develop/cov_docker_script/README.md) -3. Raise issue in your component repository or [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/issues) - ---- - -**Last Updated:** January 2026 +The documentation and source for the RDK-B native build system has been centralized in [rdkcentral/build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/blob/develop/cov_docker_script/README.md) \ No newline at end of file From 056451a3774d165746867e336e4ab21ebb2340d7 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Wed, 11 Feb 2026 07:02:31 +0000 Subject: [PATCH 12/15] Updating configure_options.conf --- cov_docker_script/component_config.json | 26 ++++++- cov_docker_script/configure_options.conf | 92 +++++++++++++++--------- 2 files changed, 85 insertions(+), 33 deletions(-) diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index aed9165..0ed2aca 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -62,7 +62,7 @@ "repo": "https://github.com/rdkcentral/rbus.git", "branch": "v2.7.0", "header_paths": [ - { "source": "include", "destination": "$HOME/usr/include/rdkb/rbus" }, + { "source": "include", "destination": "$HOME/usr/include/rdkb" }, { "source": "src/rbus", "destination": "$HOME/usr/include/rdkb/rbus" } ] }, @@ -89,6 +89,30 @@ "type": "script", "script": "build_tools_workflows/cov_docker_script/common_external_build.sh" } + }, + { + "name": "OneWifi", + "repo": "https://github.com/rdkcentral/OneWifi.git", + "branch": "develop", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb/" } + ] + }, + { + "name": "rdk-wifi-hal", + "repo": "https://github.com/rdkcentral/rdk-wifi-hal.git", + "branch": "develop", + "header_paths": [ + { "source": "src", "destination": "$HOME/usr/include/rdkb" } + ] + }, + { + "name": "rdkb-halif-wifi", + "repo": "https://github.com/rdkcentral/rdkb-halif-wifi.git", + "branch": "develop", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ] } ] }, diff --git a/cov_docker_script/configure_options.conf b/cov_docker_script/configure_options.conf index 77fa449..fa6ebbf 100644 --- a/cov_docker_script/configure_options.conf +++ b/cov_docker_script/configure_options.conf @@ -1,25 +1,37 @@ -# Common Library Agent Configure Options -# This file contains autotools configure options for the common-library component -# Each section can be edited independently for better maintainability +# Advanced-Security Configure Options +# This file contains autotools configure options for the advanced-security component +# Follows the same structure and formatting as the common-library conf # ============================================================================ # CPPFLAGS - Preprocessor flags (includes and defines) # ============================================================================ [CPPFLAGS] + # Autotools configuration -DHAVE_CONFIG_H -# Include paths -I$HOME/usr/include/rdkb/ +-I$HOME/usr/include/rdkb/rbus/ +-I$HOME/usr/include/rdkb/ccsp/ +-I$HOME/usr/include/rdkb/openssl/ +-I$HOME/usr/include/rdkb/trower-base64/ +-I$HOME/usr/include/rdkb/libevent/ -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/cjson -# Core system defines +# Standard/system defines +-DPATH_MAX=1024 +-D__686__ -DSAFEC_DUMMY_API +-DCONFIG_VENDOR_NAME=\"\" + +# Core system / HAL -D_COSA_HAL_ -U_COSA_SIM_ --DCONFIG_SYSTEM_MOCA +-D_COSA_BCM_ARM_ +-D_COSA_INTEL_USG_ARM_ +-D_COSA_FOR_COMCAST_ # ANSC framework defines -D_ANSC_LINUX @@ -37,20 +49,15 @@ -D_BBHM_SSE_FILE_IO -DCCSP_SUPPORT_ENABLED -# Product/Platform defines --D_COSA_INTEL_USG_ARM_ --D_COSA_FOR_COMCAST_ --D_COSA_BCM_ARM_ +# Product/platform defines -D_XB6_PRODUCT_REQ_ -D_XB7_PRODUCT_REQ_ -D_XB8_PRODUCT_REQ_ +-DETH_4_PORTS +-D_2_5G_ETHERNET_SUPPORT_ +-D_MACSEC_SUPPORT_ -# Vendor/Customer configuration --DCONFIG_VENDOR_CUSTOMER_COMCAST --DCONFIG_CISCO_HOTSPOT --DCONFIG_VENDOR_NAME - -# Security and debugging +# Security / debugging -DENABLE_SA_KEY -D_NO_EXECINFO_H_ -D_DEBUG @@ -66,20 +73,25 @@ -DUTC_ENABLE_ATOM -DXDNS_ENABLE +# MoCA features +-DMOCA_DIAGONISTIC +-DMOCA_HOME_ISOLATION + # Network features +-DAUTOWAN_ENABLE +-DENABLE_WANMODECHANGE_NOREBOOT -DENABLE_ETH_WAN -DEROUTER_DHCP_OPTION_MTA --DETH_4_PORTS --D_2_5G_ETHERNET_SUPPORT_ --D_MACSEC_SUPPORT_ +-DWAN_FAILOVER_SUPPORTED +-DGATEWAY_FAILOVER_SUPPORTED -D_BRIDGE_UTILS_BIN_ --DAUTOWAN_ENABLE --DENABLE_WANMODECHANGE_NOREBOOT +-D_CM_HIGHSPLIT_SUPPORTED_ -DFEATURE_RDKB_WAN_MANAGER -DFEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE -DWAN_MANAGER_UNIFICATION_ENABLED --DWAN_FAILOVER_SUPPORTED --DGATEWAY_FAILOVER_SUPPORTED +-DMAPT_UNIFICATION_ENABLED +-DFEATURE_SUPPORT_MAPT_NAT46 +-DFEATURE_RDKB_DHCP_MANAGER # WiFi features -D_ENABLE_BAND_STEERING_ @@ -88,6 +100,7 @@ -D_WIFI_AX_SUPPORT_ -D_WIFI_CONSOLIDATED_STANDARDS_ -DWIFI_HAL_VERSION_3 +-D_FEATURE_OFF_CHANNEL_SCAN_5G -DFEATURE_SUPPORT_MESH -DFEATURE_SUPPORT_WEBCONFIG -DFEATURE_SUPPORT_INTERWORKING @@ -95,39 +108,54 @@ -DWIFI_STATS_DISABLE_SPEEDTEST_RUNNING -DFEATURE_SUPPORT_RADIUSGREYLIST -DFEATURE_SUPPORT_ACL_SELFHEAL --DFEATURE_CSI -DFEATURE_SUPPORT_ONBOARD_LOGGING --DFEATURE_OFF_CHANNEL_SCAN_5G +-DFEATURE_CSI -DRDK_ONEWIFI -DWIFI_MANAGE_SUPPORTED # Advanced features -D_PSM_TRANS_RDK_TRIGG_ --D_CM_HIGHSPLIT_SUPPORTED_ -DFEATURE_RDKB_INTER_DEVICE_MANAGER --DFEATURE_SUPPORT_MAPT_NAT46 --DMAPT_UNIFICATION_ENABLED -DSPEED_BOOST_SUPPORTED -DAMENITIES_NETWORK_ENABLED -# Test/Development --DCOLUMBO_HWTEST +# DML-specific features +-DDML_SUPPORT +-DNON_PRIVILEGED -# Build system +# Build system / misc -DRBUS_BUILD_FLAG_ENABLE +# Test/Development +-DCOLUMBO_HWTEST + # Standard defines -D_GNU_SOURCE -D__USE_XOPEN + # ============================================================================ # CFLAGS - Compiler flags # ============================================================================ [CFLAGS] + +# Optimization / debugging +-Os +-pipe +-g +-feliminate-unused-debug-types + +# Compiler runtime behavior +-Wall +-Wextra +-Wno-error +-fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-strict-aliasing +-fcommon + # ============================================================================ # LDFLAGS - Linker flags @@ -135,4 +163,4 @@ [LDFLAGS] -L$HOME/usr/local/lib/ -Wl,--allow-shlib-undefined --Wl,--unresolved-symbols=ignore-all +-Wl,--unresolved-symbols=ignore-all \ No newline at end of file From c2a5b41622962aa2c9a77c734365cbde08f1f9dc Mon Sep 17 00:00:00 2001 From: sowmiyachelliah <162420027+sowmiyachelliah@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:42:44 +0530 Subject: [PATCH 13/15] Update configure_options.conf --- cov_docker_script/configure_options.conf | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cov_docker_script/configure_options.conf b/cov_docker_script/configure_options.conf index fa6ebbf..e7b200a 100644 --- a/cov_docker_script/configure_options.conf +++ b/cov_docker_script/configure_options.conf @@ -11,11 +11,6 @@ -DHAVE_CONFIG_H -I$HOME/usr/include/rdkb/ --I$HOME/usr/include/rdkb/rbus/ --I$HOME/usr/include/rdkb/ccsp/ --I$HOME/usr/include/rdkb/openssl/ --I$HOME/usr/include/rdkb/trower-base64/ --I$HOME/usr/include/rdkb/libevent/ -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/cjson @@ -163,4 +158,4 @@ [LDFLAGS] -L$HOME/usr/local/lib/ -Wl,--allow-shlib-undefined --Wl,--unresolved-symbols=ignore-all \ No newline at end of file +-Wl,--unresolved-symbols=ignore-all From 2615d0111042ba1e2f70beafd57c7196d8173a73 Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Tue, 17 Feb 2026 05:56:11 +0000 Subject: [PATCH 14/15] Updating configure_options.conf and component_config.json --- cov_docker_script/component_config.json | 12 ---- cov_docker_script/configure_options.conf | 84 +++++++++++------------- 2 files changed, 38 insertions(+), 58 deletions(-) diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index 0ed2aca..9e7059c 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -24,18 +24,6 @@ { "source": "source/cosa/package/slap/include", "destination": "$HOME/usr/include/rdkb" }, { "source": "source/ccsp/components/common/MessageBusHelper/include", "destination": "$HOME/usr/include/rdkb" } ], - "source_patches": [ - { - "file": "source/ccsp/include/ccsp_message_bus.h", - "search": "typedef struct _CCSP_MESSAGE_BUS_CONNECTION", - "replace": "typedef struct DBusLoop DBusLoop;\n\ntypedef struct _CCSP_MESSAGE_BUS_CONNECTION" - }, - { - "file": "$HOME/usr/include/rdkb/ccsp_message_bus.h", - "search": "typedef struct _CCSP_MESSAGE_BUS_CONNECTION", - "replace": "typedef struct DBusLoop DBusLoop;\n\ntypedef struct _CCSP_MESSAGE_BUS_CONNECTION" - } - ], "build": { "type": "script", "script": "build_tools_workflows/cov_docker_script/common_external_build.sh" diff --git a/cov_docker_script/configure_options.conf b/cov_docker_script/configure_options.conf index e7b200a..f0e52b2 100644 --- a/cov_docker_script/configure_options.conf +++ b/cov_docker_script/configure_options.conf @@ -1,6 +1,5 @@ -# Advanced-Security Configure Options +# Advanced Security Configure Options # This file contains autotools configure options for the advanced-security component -# Follows the same structure and formatting as the common-library conf # ============================================================================ # CPPFLAGS - Preprocessor flags (includes and defines) @@ -10,24 +9,12 @@ # Autotools configuration -DHAVE_CONFIG_H +# Include paths -I$HOME/usr/include/rdkb/ -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/cjson -# Standard/system defines --DPATH_MAX=1024 --D__686__ --DSAFEC_DUMMY_API --DCONFIG_VENDOR_NAME=\"\" - -# Core system / HAL --D_COSA_HAL_ --U_COSA_SIM_ --D_COSA_BCM_ARM_ --D_COSA_INTEL_USG_ARM_ --D_COSA_FOR_COMCAST_ - # ANSC framework defines -D_ANSC_LINUX -D_ANSC_USER @@ -37,6 +24,13 @@ -D_NO_ANSC_ZLIB_ -U_ANSC_IPV6_COMPATIBLE_ +# Core system / HAL +-D_COSA_HAL_ +-U_COSA_SIM_ +-D_COSA_INTEL_USG_ARM_ +-D_COSA_BCM_ARM_ +-D_COSA_FOR_COMCAST_ + # CCSP/Component defines -D_CCSP_CWMP_TCP_CONNREQ_HANDLER -D_DSLH_STUN_ @@ -44,14 +38,6 @@ -D_BBHM_SSE_FILE_IO -DCCSP_SUPPORT_ENABLED -# Product/platform defines --D_XB6_PRODUCT_REQ_ --D_XB7_PRODUCT_REQ_ --D_XB8_PRODUCT_REQ_ --DETH_4_PORTS --D_2_5G_ETHERNET_SUPPORT_ --D_MACSEC_SUPPORT_ - # Security / debugging -DENABLE_SA_KEY -D_NO_EXECINFO_H_ @@ -68,24 +54,31 @@ -DUTC_ENABLE_ATOM -DXDNS_ENABLE -# MoCA features --DMOCA_DIAGONISTIC +# Product/Platform defines +-D_XB6_PRODUCT_REQ_ +-D_XB7_PRODUCT_REQ_ +-D_XB8_PRODUCT_REQ_ +-DCONFIG_VENDOR_NAME + +# MoCA-related +-DCONFIG_SYSTEM_MOCA -DMOCA_HOME_ISOLATION +-DMOCA_DIAGONISTIC # Network features --DAUTOWAN_ENABLE --DENABLE_WANMODECHANGE_NOREBOOT -DENABLE_ETH_WAN -DEROUTER_DHCP_OPTION_MTA --DWAN_FAILOVER_SUPPORTED --DGATEWAY_FAILOVER_SUPPORTED +-DETH_4_PORTS +-D_2_5G_ETHERNET_SUPPORT_ +-D_MACSEC_SUPPORT_ -D_BRIDGE_UTILS_BIN_ --D_CM_HIGHSPLIT_SUPPORTED_ +-DAUTOWAN_ENABLE +-DENABLE_WANMODECHANGE_NOREBOOT -DFEATURE_RDKB_WAN_MANAGER -DFEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE -DWAN_MANAGER_UNIFICATION_ENABLED --DMAPT_UNIFICATION_ENABLED --DFEATURE_SUPPORT_MAPT_NAT46 +-DWAN_FAILOVER_SUPPORTED +-DGATEWAY_FAILOVER_SUPPORTED -DFEATURE_RDKB_DHCP_MANAGER # WiFi features @@ -95,7 +88,6 @@ -D_WIFI_AX_SUPPORT_ -D_WIFI_CONSOLIDATED_STANDARDS_ -DWIFI_HAL_VERSION_3 --D_FEATURE_OFF_CHANNEL_SCAN_5G -DFEATURE_SUPPORT_MESH -DFEATURE_SUPPORT_WEBCONFIG -DFEATURE_SUPPORT_INTERWORKING @@ -103,47 +95,47 @@ -DWIFI_STATS_DISABLE_SPEEDTEST_RUNNING -DFEATURE_SUPPORT_RADIUSGREYLIST -DFEATURE_SUPPORT_ACL_SELFHEAL --DFEATURE_SUPPORT_ONBOARD_LOGGING -DFEATURE_CSI +-DFEATURE_SUPPORT_ONBOARD_LOGGING +-DFEATURE_OFF_CHANNEL_SCAN_5G -DRDK_ONEWIFI -DWIFI_MANAGE_SUPPORTED # Advanced features -D_PSM_TRANS_RDK_TRIGG_ +-D_CM_HIGHSPLIT_SUPPORTED_ -DFEATURE_RDKB_INTER_DEVICE_MANAGER +-DFEATURE_SUPPORT_MAPT_NAT46 +-DMAPT_UNIFICATION_ENABLED -DSPEED_BOOST_SUPPORTED -DAMENITIES_NETWORK_ENABLED -# DML-specific features --DDML_SUPPORT --DNON_PRIVILEGED - # Build system / misc -DRBUS_BUILD_FLAG_ENABLE # Test/Development -DCOLUMBO_HWTEST -# Standard defines --D_GNU_SOURCE --D__USE_XOPEN - +# DML specific defines +-DDML_SUPPORT +-DNON_PRIVILEGED # ============================================================================ # CFLAGS - Compiler flags # ============================================================================ [CFLAGS] -# Optimization / debugging +# Optimization -Os -pipe -g -feliminate-unused-debug-types -# Compiler runtime behavior +# Warnings -Wall -Wextra --Wno-error + +# Code generation -fno-exceptions -ffunction-sections -fdata-sections @@ -158,4 +150,4 @@ [LDFLAGS] -L$HOME/usr/local/lib/ -Wl,--allow-shlib-undefined --Wl,--unresolved-symbols=ignore-all +-Wl,--unresolved-symbols=ignore-all \ No newline at end of file From 2bcf44c852360d05a04e16feb7a41c02fe299a9d Mon Sep 17 00:00:00 2001 From: sowmiyachelliah Date: Tue, 17 Feb 2026 07:22:30 +0000 Subject: [PATCH 15/15] Updating component_config.json --- build_tools_workflows | 2 +- cov_docker_script/component_config.json | 24 ------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/build_tools_workflows b/build_tools_workflows index 11f1922..b7c9625 160000 --- a/build_tools_workflows +++ b/build_tools_workflows @@ -1 +1 @@ -Subproject commit 11f192263b3b4358e0d99895d57eab7bda5a8115 +Subproject commit b7c962552e1b7e0467b1b766d263194e7b5e57bf diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json index 9e7059c..89debdb 100644 --- a/cov_docker_script/component_config.json +++ b/cov_docker_script/component_config.json @@ -77,30 +77,6 @@ "type": "script", "script": "build_tools_workflows/cov_docker_script/common_external_build.sh" } - }, - { - "name": "OneWifi", - "repo": "https://github.com/rdkcentral/OneWifi.git", - "branch": "develop", - "header_paths": [ - { "source": "include", "destination": "$HOME/usr/include/rdkb/" } - ] - }, - { - "name": "rdk-wifi-hal", - "repo": "https://github.com/rdkcentral/rdk-wifi-hal.git", - "branch": "develop", - "header_paths": [ - { "source": "src", "destination": "$HOME/usr/include/rdkb" } - ] - }, - { - "name": "rdkb-halif-wifi", - "repo": "https://github.com/rdkcentral/rdkb-halif-wifi.git", - "branch": "develop", - "header_paths": [ - { "source": "include", "destination": "$HOME/usr/include/rdkb" } - ] } ] },