From a42fa2b57320425a10c47a3b59d866afc805eb87 Mon Sep 17 00:00:00 2001 From: Suganya-Sugumar <222150366+Suganya-Sugumar@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:27:04 +0000 Subject: [PATCH 1/3] RDKB-63013 update cmake build to parse conf file --- cov_docker_script/build_native.sh | 39 ++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/cov_docker_script/build_native.sh b/cov_docker_script/build_native.sh index 7dd2ca1..4ace760 100755 --- a/cov_docker_script/build_native.sh +++ b/cov_docker_script/build_native.sh @@ -182,7 +182,7 @@ parse_configure_options_file() { cppflags="${cppflags//\$HOME/$HOME}" cflags="${cflags//\$HOME/$HOME}" ldflags="${ldflags//\$HOME/$HOME}" - + # Build final options array [[ -n "$cppflags" ]] && options_array+=("CPPFLAGS=${cppflags% }") [[ -n "$cflags" ]] && options_array+=("CFLAGS=${cflags% }") @@ -199,7 +199,6 @@ build_component_autotools() { # Check if using external configure options file local config_file_path config_file_path=$(jq -r '.native_component.build.configure_options_file // empty' "$CONFIG_FILE") - if [[ -n "$config_file_path" ]]; then # Using external configuration file config_file_path=$(expand_path "$config_file_path") @@ -335,16 +334,44 @@ run_pre_build_commands() { # 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 - + + # Parse configure options file if exists + local config_file_path cppflags cflags ldflags + config_file_path=$(jq -r '.native_component.build.configure_options_file // empty' "$CONFIG_FILE") + if [[ -n "$config_file_path" ]]; then + config_file_path=$(expand_path "$config_file_path") + if [[ ! "$config_file_path" = /* ]]; then + config_file_path="$COMPONENT_DIR/$config_file_path" + fi + + step "Reading configure options from: $config_file_path" + local parsed_array=() + if parse_configure_options_file "$config_file_path" parsed_array; then + for opt in "${parsed_array[@]}"; do + case $opt in + CPPFLAGS=*) cppflags="${opt#CPPFLAGS=}" ;; + CFLAGS=*) cflags="${opt#CFLAGS=}" ;; + LDFLAGS=*) ldflags="${opt#LDFLAGS=}" ;; + esac + done + else + err "Failed to parse configure options file (for cmake)" + return 1 + fi + fi + + # Compose cmake flags + local combined_cmake_flags="$cmake_flags" + [[ -n "$cppflags" ]] && combined_cmake_flags+=" -DCMAKE_C_FLAGS=\"$cppflags $cflags\" -DCMAKE_CXX_FLAGS=\"$cppflags $cflags\"" + [[ -n "$ldflags" ]] && combined_cmake_flags+=" -DCMAKE_EXE_LINKER_FLAGS=\"$ldflags\"" + + build_cmake "$COMPONENT_DIR" "$build_dir" "$combined_cmake_flags" "$make_targets" "$parallel_make" || return 1 return 0 } From 9582b45b958a58d32272eeff63074ad54d942c47 Mon Sep 17 00:00:00 2001 From: Suganya-Sugumar <222150366+Suganya-Sugumar@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:29:27 +0000 Subject: [PATCH 2/3] RDKB-63013 update cmake build to parse conf file --- cov_docker_script/build_native.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cov_docker_script/build_native.sh b/cov_docker_script/build_native.sh index 4ace760..14a910b 100755 --- a/cov_docker_script/build_native.sh +++ b/cov_docker_script/build_native.sh @@ -182,7 +182,6 @@ parse_configure_options_file() { cppflags="${cppflags//\$HOME/$HOME}" cflags="${cflags//\$HOME/$HOME}" ldflags="${ldflags//\$HOME/$HOME}" - # Build final options array [[ -n "$cppflags" ]] && options_array+=("CPPFLAGS=${cppflags% }") [[ -n "$cflags" ]] && options_array+=("CFLAGS=${cflags% }") @@ -199,6 +198,7 @@ build_component_autotools() { # Check if using external configure options file local config_file_path config_file_path=$(jq -r '.native_component.build.configure_options_file // empty' "$CONFIG_FILE") + if [[ -n "$config_file_path" ]]; then # Using external configuration file config_file_path=$(expand_path "$config_file_path") @@ -334,6 +334,7 @@ run_pre_build_commands() { # 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") From 4d2cf33ebb25095af83d594e4efc17255cb92112 Mon Sep 17 00:00:00 2001 From: Suganya-Sugumar <222150366+Suganya-Sugumar@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:31:32 +0000 Subject: [PATCH 3/3] RDKB-63013 update cmake build to parse conf file --- cov_docker_script/build_native.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cov_docker_script/build_native.sh b/cov_docker_script/build_native.sh index 14a910b..05a7d7f 100755 --- a/cov_docker_script/build_native.sh +++ b/cov_docker_script/build_native.sh @@ -182,6 +182,7 @@ parse_configure_options_file() { cppflags="${cppflags//\$HOME/$HOME}" cflags="${cflags//\$HOME/$HOME}" ldflags="${ldflags//\$HOME/$HOME}" + # Build final options array [[ -n "$cppflags" ]] && options_array+=("CPPFLAGS=${cppflags% }") [[ -n "$cflags" ]] && options_array+=("CFLAGS=${cflags% }")