blob: 7579e4d32b9c83f8abe5c0ff2a7998cb502019b7 [file]
# ----------------------------------------------------------------------
# Apache Cloudberry ThirdParty Library Makefile
#
# This file controls which thirdparty libraries are made available to
# the build of our product(s).
# ----------------------------------------------------------------------
# only load this file once
ifeq "$(BLD_THIRDPARTY_DIR)" ""
# ----------------------------------------------------------------------
# All of the third-party library filesets are stored here:
# $(BLD_THIRDPARTY)/$(BLD_ARCH).
# ----------------------------------------------------------------------
# calculate BLD_TOP in absolute path form
BLD_TOP_ABSOLUTE:=$(shell cd $(BLD_TOP) && pwd)
BLD_THIRDPARTY:=$(BLD_TOP_ABSOLUTE)/ext
ifeq "$(BLD_ARCH)" ""
BLD_ARCH:=$(shell $(BLD_TOP)/releng/set_bld_arch.sh)
endif
rhel6_x86_64_BLD_BITS=64
rhel7_x86_64_BLD_BITS=64
rhel8_x86_64_BLD_BITS=64
BLD_BITS=$($(BLD_ARCH)_BLD_BITS)
# ----------------------------------------------------------------------
# The third-party libraries are managed in two flavors. The first is
# BASE and consists of the "default" set of libraries for the source
# set they accompany. BASE libraries are stored in a single directory
# structure and accessed by single paths by purpose,
# $(BLD_THIRDPARTY_INCLUDE_DIR) and $(BLD_THIRDPARTY_LIB_DIR), for
# example.
#
# EXCEPTIONS is the second flavor. These are libraries not needed by
# the whole build but rather by one or more specific parts of the
# build and may include one or more other versions of a third-party
# library already in the BASE set. Each of the EXCEPTION filesets is
# stored in its own directory structure at
# $(BLD_THIRDPARTY)/$(BLD_ARCH)/$(BLD_<name>-<version>_ID).
# ----------------------------------------------------------------------
# the list of thirdparty libraries available in this source set
BLD_THIRDPARTY_LIBS=$(BLD_THIRDPARTY_LIBS_BASE) $(BLD_THIRDPARTY_LIBS_EXCEPTIONS)
# ----------------------------------------------------------------------
# The BASE set:
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Include and lib locations for the C/C++ compilers and linkers to
# use. These may be passed as values for compiler -I flags and linker
# -L flags and may also be provided to configure scripts.
# ----------------------------------------------------------------------
BLD_THIRDPARTY_DIR=$(BLD_THIRDPARTY)/$(BLD_ARCH)
BLD_THIRDPARTY_BIN_DIR=$(BLD_THIRDPARTY)/$(BLD_ARCH)/bin
BLD_THIRDPARTY_INCLUDE_DIR=$(BLD_THIRDPARTY)/$(BLD_ARCH)/include
BLD_THIRDPARTY_LIB_DIR=$(BLD_THIRDPARTY)/$(BLD_ARCH)/lib
# ----------------------------------------------------------------------
# Set the [DY]LD_LIBRARY_PATH for the linker and for ldd.
#
# Please note that this DOES NOT include any of the paths from the
# EXCEPTIONS libraries. Also, this setting is exported out to the
# environment to affect anything being built by this make instance or
# its children. However, once this make instance exits, this setting
# is gone. Setting [DY]LD_LIBRARY_PATH at runtime is left to other
# mechanisms and should not point to $(BLD_THIRDPARTY) but rather to a
# distribution that includes the libraries from $(BLD_THIRDPARTY).
# Helper make targets are provided for installing these libraries into
# a distri- bution fileset.
# ----------------------------------------------------------------------
ifeq "$(findstring $(BLD_THIRDPARTY_LIB_DIR),$($(BLD_WHERE_THE_LIBRARY_THINGS_ARE)))" ""
tmpLD_LIBRARY_PATH=$(BLD_THIRDPARTY_LIB_DIR):$($(BLD_WHERE_THE_LIBRARY_THINGS_ARE))
export $(BLD_WHERE_THE_LIBRARY_THINGS_ARE):=$(tmpLD_LIBRARY_PATH)
#$(info $(BLD_WHERE_THE_LIBRARY_THINGS_ARE)="$($(BLD_WHERE_THE_LIBRARY_THINGS_ARE))")
endif
# ----------------------------------------------------------------------
# The EXCEPTIONS set:
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# For each third-party library, define its characteristics. They
# include:
#
# ID -- the name listed in the EXCEPTIONS library list
# HOME -- the path to the top of this library's fileset
# LIBS -- the list of the libraries we use from this fileset
# LIBDIR -- the path to the directory inside this library's fileset
# where the actual lib files can be found
# INCDIR -- the path to the directory inside this library's fileset
# where the include files can be found
# ----------------------------------------------------------------------
BLD_ZLIB-1.2.3_ID=zlib/1.2.3
BLD_ZLIB-1.2.3_HOME=$(BLD_THIRDPARTY)/$(BLD_ARCH)/$(BLD_ZLIB-1.2.3_ID)
BLD_ZLIB-1.2.3_LIBS=z
BLD_ZLIB-1.2.3_LIBDIR=$(BLD_ZLIB_HOME)/lib
BLD_ZLIB-1.2.3_INCDIR=$(BLD_ZLIB_HOME)/include
# ----------------------------------------------------------------------
# Helper targets for installing libraries
# ----------------------------------------------------------------------
.PHONY: thirdparty-dist thirdparty-dist-base thirdparty-dist-exceptions
BLD_DYLIB_NAME=so
ifneq "$(wildcard $(BLD_THIRDPARTY_LIB_DIR))" ""
BLD_THIRDPARTY_BASE_SHARED_OBJECTS_DIRS=$(shell find $(BLD_THIRDPARTY_LIB_DIR) -type d)
endif
BLD_THIRDPARTY_BASE_SHARED_OBJECTS=$(foreach dir,$(BLD_THIRDPARTY_BASE_SHARED_OBJECTS_DIRS),$(wildcard $(dir)/*.$(BLD_DYLIB_NAME)*))
BLD_THIRDPARTY_BASE_SHARED_OBJECTS_INSTALLED=$(patsubst $(BLD_THIRDPARTY_LIB_DIR)/%,$(INSTLOC)/lib/%,$(BLD_THIRDPARTY_BASE_SHARED_OBJECTS))
BLD_THIRDPARTY_EXCEPTIONS_DIRS=$(foreach tplib,$(BLD_THIRDPARTY_LIBS_EXCEPTIONS),$(BLD_THIRDPARTY)/$(BLD_ARCH)/$(BLD_$(tplib)_ID))
BLD_THIRDPARTY_EXCEPTIONS_DELIVERABLES=$(foreach tplib,$(BLD_THIRDPARTY_EXCEPTIONS_DIRS),$(wildcard $(tplib)/lib/*.$(BLD_DYLIB_NAME)*))
BLD_THIRDPARTY_EXCEPTIONS_INSTALLED=$(foreach deliverable,$(BLD_THIRDPARTY_EXCEPTIONS_DELIVERABLES),$(INSTLOC)/lib/$(basename $(deliverable)))
thirdparty-dist: thirdparty-dist-base thirdparty-dist-exceptions ;
thirdparty-dist-base: $(BLD_THIRDPARTY_BASE_SHARED_OBJECTS_INSTALLED) ;
thirdparty-dist-exceptions: $(BLD_THIRDPARTY_EXCEPTIONS_INSTALLED) ;
$(INSTLOC)/lib/%: $(BLD_THIRDPARTY_LIB_DIR)/%
@(cd $(?D) && $(TAR) cf - $(@F)) | (cd $(INSTLOC)/lib && $(TAR) xf -)$(check_pipe_for_errors)
$(INSTLOC)/lib/%: $(BLD_THIRDPARTY_EXCEPTIONS_DIRS)/lib/%
@for i in $?; do \
echo "Copying $(?D)/$(@F) to $(@D)..."; \
(cd `dirname $$i` && $(TAR) cf - $(@F)) | (cd $(@D) && $(TAR) xvf -)$(check_pipe_for_errors); \
done
endif