build: add option to ignore system libs detection

Change-Id: Ib2ee7c69a9105ae33a816bd19c7fcbdb0b58fd32
This commit is contained in:
Kateryna Kostiuk
2025-07-29 12:31:56 -04:00
committed by Adrien Béraud
parent 5d99b9c5fc
commit 33400db731
3 changed files with 21 additions and 3 deletions

View File

@ -141,8 +141,12 @@ if (BUILD_CONTRIB)
set(CC_CONTRIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/contrib/${CC_TARGET})
file(MAKE_DIRECTORY ${CC_CONTRIB_BUILD_PATH})
file(MAKE_DIRECTORY ${CC_CONTRIB_PATH})
set(BOOTSTRAP_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/contrib/bootstrap --host=${CC_TARGET})
if (IGNORE_SYSTEM_LIBS)
list(APPEND BOOTSTRAP_COMMAND --ignore-system-libs)
endif()
execute_process(
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/contrib/bootstrap --host=${CC_TARGET}
COMMAND ${BOOTSTRAP_COMMAND}
WORKING_DIRECTORY ${CC_CONTRIB_BUILD_PATH})
execute_process(COMMAND make list
WORKING_DIRECTORY ${CC_CONTRIB_BUILD_PATH})
@ -188,8 +192,12 @@ if (BUILD_CONTRIB)
set(CONTRIB_PATH ${FAT_CONTRIB_PATH})
else()
message(STATUS "Building contrib for ${TARGET}")
set(BOOTSTRAP_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/contrib/bootstrap --host=${TARGET})
if (IGNORE_SYSTEM_LIBS)
list(APPEND BOOTSTRAP_COMMAND --ignore-system-libs)
endif()
execute_process(
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/contrib/bootstrap --host=${TARGET}
COMMAND ${BOOTSTRAP_COMMAND}
WORKING_DIRECTORY ${CONTRIB_BUILD_PATH})
execute_process(COMMAND make list
WORKING_DIRECTORY ${CONTRIB_BUILD_PATH})

View File

@ -29,6 +29,7 @@ usage()
echo " --cache-dir=DIR the directory where contrib tarballs are cached"
echo " --enable-debug build with debug symbol and extra checks (disabled by default)"
echo " --enable-asan build with address sanitizer (disabled by default)"
echo " --ignore-system-libs build packages regardless of system detection (disabled by default)"
echo " --disable-FOO configure to not build package FOO"
echo " --enable-FOO configure to build package FOO"
}
@ -41,6 +42,7 @@ PKGS_DISABLE=
CACHE_BUILD=
CONF_TARBALLS=
ENABLE_ASAN=
IGNORE_SYSTEM_LIBS=
if test ! -f "../src/main.mak"
then
@ -77,6 +79,9 @@ do
--enable-asan)
ENABLE_ASAN=1
;;
--ignore-system-libs)
IGNORE_SYSTEM_LIBS=1
;;
--host=*)
HOST="${1#--host=}"
;;
@ -142,6 +147,7 @@ CACHE_DIR := $CACHE_DIR
CACHE_BUILD := $CACHE_BUILD
ENABLE_DEBUG := $ENABLE_DEBUG
ENABLE_ASAN := $ENABLE_ASAN
IGNORE_SYSTEM_LIBS := $IGNORE_SYSTEM_LIBS
EOF
add_make()

View File

@ -441,8 +441,12 @@ endif
ifneq ($(filter $(PKGS_DISABLE),$(PKGS_ENABLE)),)
$(error Same package(s) disabled and enabled at the same time)
endif
# Apply automatic selection (= remove distro packages):
ifdef IGNORE_SYSTEM_LIBS
PKGS_AUTOMATIC := $(PKGS)
PKGS_FOUND :=
else
PKGS_AUTOMATIC := $(filter-out $(PKGS_FOUND),$(PKGS))
endif
# Apply manual selection (from bootstrap):
PKGS_MANUAL := $(sort $(PKGS_ENABLE) $(filter-out $(PKGS_DISABLE),$(PKGS_AUTOMATIC)))
# Resolve dependencies: