Skip to content

Commit 460282b

Browse files
committed
RDKB-62979 RDKB-62980: Native Build for Coverity
1 parent d01bc5c commit 460282b

File tree

2 files changed

+116
-1
lines changed

2 files changed

+116
-1
lines changed

cov_docker_script/README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ This directory contains the configuration and wrapper scripts necessary for buil
1616
├── component_config.json # Dependency & build configuration
1717
├── configure_options.conf # Autotools configure flags (optional)
1818
├── run_setup_dependencies.sh # Wrapper: Setup build tools & dependencies
19-
└── run_native_build.sh # Wrapper: Setup build tools & build component
19+
├── run_native_build.sh # Wrapper: Setup build tools & build component
20+
└── run_external_build.sh # Wrapper: Run external build (legacy/direct)
2021
```
2122

2223
### Important: Add to .gitignore
@@ -55,6 +56,10 @@ cd /path/to/your-component
5556
# Clean build (removes previous artifacts)
5657
CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh
5758
./cov_docker_script/run_native_build.sh
59+
60+
# Alternative: Run external build (legacy/direct method)
61+
./cov_docker_script/run_setup_dependencies.sh
62+
./cov_docker_script/run_external_build.sh
5863
```
5964

6065
#### Individual Steps
@@ -141,6 +146,70 @@ CLEAN_BUILD=true ./run_setup_dependencies.sh
141146

142147
---
143148

149+
### 3. run_external_build.sh
150+
151+
**Purpose:** Runs external build process using common_external_build.sh.
152+
153+
**What it does:**
154+
1. Verifies `build_tools_workflows` directory exists (cloned by `run_setup_dependencies.sh`)
155+
2. Verifies `common_external_build.sh` is present
156+
3. Runs `common_external_build.sh` from build_tools_workflows with no arguments
157+
4. Does NOT clean up build_tools_workflows directory (preserved for subsequent use)
158+
159+
**Usage:**
160+
```bash
161+
./run_external_build.sh
162+
```
163+
164+
**Prerequisites:**
165+
- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows)
166+
- All dependency headers/libraries must be available
167+
168+
**Outputs:**
169+
- Build artifacts based on common_external_build.sh implementation
170+
- build_tools_workflows remains in place (not cleaned up)
171+
172+
**Primary Use Case - Dependency Builds in component_config.json:**
173+
174+
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`.
175+
176+
**Example configuration in component_config.json:**
177+
178+
```json
179+
{
180+
"name": "Utopia",
181+
"repo": "https://github.com/rdkcentral/utopia.git",
182+
"branch": "feature/cov_native_build",
183+
"header_paths": [
184+
{ "source": "source/include", "destination": "$HOME/usr/include/rdkb" }
185+
],
186+
"build": {
187+
"type": "script",
188+
"script": "cov_docker_script/run_external_build.sh"
189+
}
190+
}
191+
```
192+
193+
**How it works for dependencies:**
194+
1. The parent component's `setup_dependencies.sh` clones the dependency repository (e.g., Utopia)
195+
2. The dependency's `run_external_build.sh` is executed from the dependency's directory
196+
3. This script internally:
197+
- Sets up the dependency's own build tools and dependencies
198+
- Runs the dependency's native build process
199+
- Produces shared libraries (`.so` files)
200+
4. The generated shared libraries are installed to `$HOME/usr/local/lib/` or `$HOME/usr/lib/`
201+
5. These libraries are then available for the parent component's native build
202+
203+
**When to use this approach:**
204+
- Dependency has complex multi-step build requirements
205+
- Dependency has its own sub-dependencies that need to be built
206+
- Dependency requires custom build logic beyond standard autotools/cmake/meson
207+
- Dependency repository already has a `cov_docker_script/run_external_build.sh` script
208+
209+
**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.
210+
211+
---
212+
144213
## 📝 Configuration Files
145214

146215
### component_config.json
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
################################################################################
5+
# External Build Wrapper Script
6+
# Verifies build tools and runs common_external_build.sh
7+
# Usage: ./run_external_build.sh
8+
# Note: run_setup_dependencies.sh should be executed first
9+
################################################################################
10+
11+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12+
NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
13+
BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows"
14+
15+
# Basic logging functions
16+
log() { echo "[INFO] $*"; }
17+
ok() { echo "[OK] $*"; }
18+
err() { echo "[ERROR] $*" >&2; }
19+
20+
echo ""
21+
echo "===== External Build Pipeline ====="
22+
echo ""
23+
24+
# Verify build_tools_workflows exists (should be cloned by run_setup_dependencies.sh)
25+
if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then
26+
err "build_tools_workflows directory not found. Please run run_setup_dependencies.sh first."
27+
exit 1
28+
fi
29+
30+
if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh" ]]; then
31+
err "common_external_build.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first."
32+
exit 1
33+
fi
34+
35+
log "Build script found, proceeding with build..."
36+
37+
# Run common_external_build.sh from build_tools_workflows
38+
echo ""
39+
log "Running common_external_build.sh from build_tools_workflows..."
40+
cd "$NATIVE_COMPONENT_DIR"
41+
"$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh"
42+
43+
echo ""
44+
ok "External build completed successfully!"
45+
46+
echo ""

0 commit comments

Comments
 (0)