Commit 8d8ac73c authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/fix-build_oai' into integration_2026_w15 (!4032)

build_oai fixes: harmonize duplicate options, remove wrong --build-lib handling

Correctly handle --build-lib such that missing arguments are still handled
properly. Harmonize, and remove useless code.
parents 8dfb6182 d63dc3a3
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
# file build_oai # file build_oai
# brief OAI automated build tool that can be used to install, compile, run OAI. # brief OAI automated build tool that can be used to install, compile, run OAI.
set -e
# Include helper functions # Include helper functions
THIS_SCRIPT_PATH=$(dirname $(readlink -f "$0")) THIS_SCRIPT_PATH=$(dirname $(readlink -f "$0"))
source "$THIS_SCRIPT_PATH"/tools/build_helper source "$THIS_SCRIPT_PATH"/tools/build_helper
...@@ -132,16 +130,9 @@ function main() { ...@@ -132,16 +130,9 @@ function main() {
--build-tool-opt) --build-tool-opt)
BUILD_TOOL_OPT+=" $2" BUILD_TOOL_OPT+=" $2"
shift 2;; shift 2;;
-c | --clean) -c | --clean | -C | --clean-all)
CLEAN=1 CLEAN=1
shift;; shift;;
-C | --clean-all)
CLEAN_ALL=1
shift;;
--clean-kernel)
clean_kernel
echo_info "Erased iptables config and removed modules from kernel"
shift;;
--cmake-opt) --cmake-opt)
CMAKE_CMD="$CMAKE_CMD $2" CMAKE_CMD="$CMAKE_CMD $2"
shift 2;; shift 2;;
...@@ -330,8 +321,8 @@ function main() { ...@@ -330,8 +321,8 @@ function main() {
echo_info "Enabling build of all optional shared libraries ($OPTIONAL_LIBRARIES)" echo_info "Enabling build of all optional shared libraries ($OPTIONAL_LIBRARIES)"
else else
for reqlib in $2; do for reqlib in $2; do
lib=$(echo $OPTIONAL_LIBRARIES | tr ' ' '\n' | grep -w $reqlib) # search given parameter in list lib=$(echo $OPTIONAL_LIBRARIES | tr ' ' '\n' | grep -w -- $reqlib) # search given parameter in list
[[ $? -ne 0 ]] && echo_fatal "Unknown optional library in $reqlib, valid libraries are $OPTIONAL_LIBRARIES" [[ $? -ne 0 ]] && echo_fatal "Unknown optional library \"$reqlib\", valid libraries are: $OPTIONAL_LIBRARIES"
TARGET_LIST="$TARGET_LIST $lib" # will append the found library TARGET_LIST="$TARGET_LIST $lib" # will append the found library
CMAKE_CMD="$CMAKE_CMD -DENABLE_${lib^^}=ON" CMAKE_CMD="$CMAKE_CMD -DENABLE_${lib^^}=ON"
echo_info "Enabling build of optional shared library $lib" echo_info "Enabling build of optional shared library $lib"
...@@ -384,13 +375,8 @@ function main() { ...@@ -384,13 +375,8 @@ function main() {
echo "OPENAIR_DIR = $OPENAIR_DIR" echo "OPENAIR_DIR = $OPENAIR_DIR"
if [ "$CLEAN_ALL" = "1" ] ; then DIR=$OPENAIR_DIR/cmake_targets
clean_all_files [ "$CLEAN" = "1" ] && rm -rf "$DIR/$BUILD_DIR"
echo "Erased all previously producted files"
fi
dlog=$OPENAIR_DIR/cmake_targets/log
mkdir -p $dlog
if [ "$INSTALL_EXTERNAL" = "1" ] ; then if [ "$INSTALL_EXTERNAL" = "1" ] ; then
echo_info "Installing packages" echo_info "Installing packages"
...@@ -423,10 +409,6 @@ function main() { ...@@ -423,10 +409,6 @@ function main() {
check_install_additional_tools check_install_additional_tools
fi fi
DIR=$OPENAIR_DIR/cmake_targets
[ "$CLEAN" = "1" ] && rm -rf $DIR/$BUILD_DIR/build
if [[ $TARGET_LIST != "" ]] && [[ -f $OPENAIR_DIR/CMakeLists.txt ]]; then if [[ $TARGET_LIST != "" ]] && [[ -f $OPENAIR_DIR/CMakeLists.txt ]]; then
# add some default libraries that should always be built # add some default libraries that should always be built
# for eNB, gNB, UEs, simulators # for eNB, gNB, UEs, simulators
...@@ -441,11 +423,10 @@ function main() { ...@@ -441,11 +423,10 @@ function main() {
# e.g., cmake_targets/ran_build/build, hence the ../../.. # e.g., cmake_targets/ran_build/build, hence the ../../..
CMAKE_CMD="$CMAKE_CMD ../../.." CMAKE_CMD="$CMAKE_CMD ../../.."
echo_info "Running \"$CMAKE_CMD\"" echo_info "Running \"$CMAKE_CMD\""
eval $CMAKE_CMD eval $CMAKE_CMD || echo_fatal "cmake configuration failed"
cmd="$CMAKE --build . --target ${TARGET_LIST} -- ${BUILD_TOOL_OPT}" cmd="$CMAKE --build . --target ${TARGET_LIST} -- ${BUILD_TOOL_OPT}"
echo_info "Running \"${cmd}\"" $green echo_info "Running \"${cmd}\"" $green
eval $cmd eval $cmd || echo_fatal "build failed"
ret=$?
if [ "$UE" = 1 ] ; then if [ "$UE" = 1 ] ; then
echo_info "Generate LTE USIM default sim content UE specific part" echo_info "Generate LTE USIM default sim content UE specific part"
......
...@@ -83,7 +83,7 @@ function(run_asn1c ASN1C_GRAMMAR ASN1C_PREFIX) ...@@ -83,7 +83,7 @@ function(run_asn1c ASN1C_GRAMMAR ASN1C_PREFIX)
get_filename_component(GRAMMAR_FILE ${ASN1C_GRAMMAR} NAME) get_filename_component(GRAMMAR_FILE ${ASN1C_GRAMMAR} NAME)
set(LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/${GRAMMAR_FILE}.log") set(LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/${GRAMMAR_FILE}.log")
add_custom_command(OUTPUT ${ASN1C_OUTPUT} add_custom_command(OUTPUT ${ASN1C_OUTPUT}
COMMAND ASN1C_PREFIX=${ASN1C_PREFIX} ${ASN1C_EXEC} ${ASN1C_OPTIONS} -D ${CMAKE_CURRENT_BINARY_DIR} ${ASN1C_GRAMMAR} > ${LOGFILE} 2>&1 || cat ${LOGFILE} COMMAND ASN1C_PREFIX=${ASN1C_PREFIX} ${ASN1C_EXEC} ${ASN1C_OPTIONS} -D ${CMAKE_CURRENT_BINARY_DIR} ${ASN1C_GRAMMAR} > ${LOGFILE} 2>&1 || ( cat ${LOGFILE} && false )
DEPENDS ${ASN1C_GRAMMAR} DEPENDS ${ASN1C_GRAMMAR}
COMMENT "Generating ${ASN1C_COMMENT} from ${GRAMMAR_FILE}" COMMENT "Generating ${ASN1C_COMMENT} from ${GRAMMAR_FILE}"
) )
......
...@@ -120,32 +120,6 @@ handler_EXIT() { ...@@ -120,32 +120,6 @@ handler_EXIT() {
trap handler_EXIT EXIT trap handler_EXIT EXIT
###########################
# Cleaners
###########################
clean_kernel() {
$SUDO modprobe ip_tables
$SUDO modprobe x_tables
$SUDO iptables -P INPUT ACCEPT
$SUDO iptables -F INPUT
$SUDO iptables -P OUTPUT ACCEPT
$SUDO iptables -F OUTPUT
$SUDO iptables -P FORWARD ACCEPT
$SUDO iptables -F FORWARD
$SUDO iptables -t nat -F
$SUDO iptables -t mangle -F
$SUDO iptables -t filter -F
$SUDO iptables -t raw -F
echo_info "Flushed iptables"
}
clean_all_files() {
set_openair_env
dir=$OPENAIR_DIR/cmake_targets
rm -rf $dir/ran_build $dir/ran_build_noLOG
}
############################################ ############################################
# External packages installers # External packages installers
############################################ ############################################
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment