On some distributions like CentOS version of boost it comes with
is very old and it is desirable to use version of boost built
independently using the scripts/download_and_build_boost.sh script.
This patch enhances the make makefile to detect and handle new parameter -
boost_base - that points to the base of the folder where boost was
built.
Here is an example of how kernel can be built against arbitrary boost:
boost_base=./build/downloaded_packages/x86_64/boost/install ./scripts/build -j4 image=native-example
Signed-off-by: Waldemar Kozaczuk <
jwkoz...@gmail.com>
---
Makefile | 48 ++++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/Makefile b/Makefile
index 66448a9b..9d80f095 100644
--- a/Makefile
+++ b/Makefile
@@ -1845,32 +1845,40 @@ else
endif
endif
-ifeq ($(CROSS_PREFIX),)
- # link with -mt if present, else the base version (and hope it is multithreaded)
- boost-mt := -mt
- boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
- ifeq ($(filter /%,$(boost-lib-dir)),)
- boost-mt :=
+#Allow user specify non-default location of boost
+ifeq ($(boost_base),)
+ ifeq ($(CROSS_PREFIX),)
+ # link with -mt if present, else the base version (and hope it is multithreaded)
+ boost-mt := -mt
boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
ifeq ($(filter /%,$(boost-lib-dir)),)
- $(error Error: libboost_system.a needs to be installed.)
+ boost-mt :=
+ boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
+ ifeq ($(filter /%,$(boost-lib-dir)),)
+ $(error Error: libboost_system.a needs to be installed.)
+ endif
+ endif
+ # When boost_env=host, we won't use "-nostdinc", so the build machine's
+ # header files will be used normally. So we don't need to add anything
+ # special for Boost.
+ boost-includes =
+ else
+ ifeq ($(arch),aarch64)
+ aarch64_boostbase = build/downloaded_packages/aarch64/boost/install
+ ifeq (,$(wildcard $(aarch64_boostbase)))
+ $(error Missing $(aarch64_boostbase) directory. Please run "./scripts/download_aarch64_packages.py")
+ endif
+
+ boost-lib-dir := $(firstword $(dir $(shell find $(aarch64_boostbase)/ -name libboost_system*.a)))
+ boost-mt := $(if $(filter %-mt.a, $(wildcard $(boost-lib-dir)/*.a)),-mt)
+ boost-includes = -isystem $(aarch64_boostbase)/usr/include
endif
endif
- # When boost_env=host, we won't use "-nostdinc", so the build machine's
- # header files will be used normally. So we don't need to add anything
- # special for Boost.
- boost-includes =
else
-ifeq ($(arch),aarch64)
- aarch64_boostbase = build/downloaded_packages/aarch64/boost/install
- ifeq (,$(wildcard $(aarch64_boostbase)))
- $(error Missing $(aarch64_boostbase) directory. Please run "./scripts/download_aarch64_packages.py")
- endif
-
- boost-lib-dir := $(firstword $(dir $(shell find $(aarch64_boostbase)/ -name libboost_system*.a)))
+ # Use boost specified by the user
+ boost-lib-dir := $(firstword $(dir $(shell find $(boost_base)/ -name libboost_system*.a)))
boost-mt := $(if $(filter %-mt.a, $(wildcard $(boost-lib-dir)/*.a)),-mt)
- boost-includes = -isystem $(aarch64_boostbase)/usr/include
-endif
+ boost-includes = -isystem $(boost_base)/usr/include
endif
boost-libs := $(boost-lib-dir)/libboost_system$(boost-mt).a
--
2.29.2