From: Waldemar Kozaczuk <[email protected]> Committer: Waldemar Kozaczuk <[email protected]> Branch: master
boost: enhance modules/common.gmk to build against arbitrary boost 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 modules common.gmk (used by tests, and other modules) 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 and the tests modules can be built against arbitrary boost: boost_base=./build/downloaded_packages/x86_64/boost/install ./scripts/build -j4 image=tests Signed-off-by: Waldemar Kozaczuk <[email protected]> --- diff --git a/modules/common.gmk b/modules/common.gmk --- a/modules/common.gmk +++ b/modules/common.gmk @@ -121,26 +121,39 @@ endif # # Let us detect presence of boost headers and library -ifeq ($(CROSS_PREFIX),) - boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system.so)) - ifeq ($(filter /%,$(boost-lib-dir)),) - $(error Error: libboost_system.a needs to be installed.) +# Allow user specify non-default location of boost +ifeq ($(boost_base),) + ifeq ($(CROSS_PREFIX),) + boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system.so)) + ifeq ($(filter /%,$(boost-lib-dir)),) + $(error Error: libboost_system.so needs to be installed.) + 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 = $(src)/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.so))) + LDFLAGS += -L$(boost-lib-dir) + 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 = $(src)/build/downloaded_packages/aarch64/boost/install - ifeq (,$(wildcard $(aarch64_boostbase))) - $(error Missing $(aarch64_boostbase) directory. Please run "./scripts/download_aarch64_packages.py") + ifeq ($(filter /%,$(boost_base)),) + absolute_boost_base := $(src)/$(boost_base)# It must be relative OSv root + else + absolute_boost_base := $(boost_base)# It is absolute already endif - - boost-lib-dir := $(firstword $(dir $(shell find $(aarch64_boostbase)/ -name libboost_system.so))) + # Use boost specified by the user + boost-lib-dir := $(firstword $(dir $(shell find $(absolute_boost_base)/ -name libboost_system.so))) LDFLAGS += -L$(boost-lib-dir) - boost-includes = -isystem $(aarch64_boostbase)/usr/include -endif + boost-includes = -isystem $(absolute_boost_base)/usr/include endif # Let us set INCLUDES given all paths identified above -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/0000000000006da35f05baf48489%40google.com.
