From 6db7d87618e91a10f57b704f816b921c78520b31 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Wed, 18 Mar 2020 17:58:02 +0100 Subject: [PATCH] Compile safestringlib using regular configure This is needed to automatically generate .bc (bitcode) files when postgres is compiled with llvmjit support. It also has the advantage that cmake is not required for the build anymore. --- src/backend/distributed/Makefile | 25 +++++-------------------- src/backend/distributed/safeclib | 1 + 2 files changed, 6 insertions(+), 20 deletions(-) create mode 120000 src/backend/distributed/safeclib diff --git a/src/backend/distributed/Makefile b/src/backend/distributed/Makefile index e3803dbdf..82e11cd11 100644 --- a/src/backend/distributed/Makefile +++ b/src/backend/distributed/Makefile @@ -7,13 +7,6 @@ safestringlib_builddir = $(citus_top_builddir)/vendor/safestringlib/build safestringlib_a = $(safestringlib_builddir)/libsafestring_static.a safestringlib_sources = $(wildcard $(safestringlib_srcdir)/safeclib/*) -# Use cmake3 if it exists, otherwise just use the string "cmake" and let bash -# figure out its exact path later. -# Using "which cmake" instead will make the error very hard to understand if -# you have neither "cmake3" or "cmake" in path. In that case the "CMAKE3" -# variable would be an empty string. -CMAKE3 = $(shell which cmake3 || echo cmake) - MODULE_big = citus EXTENSION = citus @@ -23,7 +16,11 @@ generated_sql_files = $(patsubst %,$(citus_abs_srcdir)/build/%,$(template_sql_fi DATA_built = $(generated_sql_files) # directories with source files -SUBDIRS = . commands connection ddl deparser executor master metadata planner progress relay test transaction utils worker +SUBDIRS = . commands connection ddl deparser executor master metadata planner progress relay safeclib test transaction utils worker + +# Symlinks are not copied over to the build directory if a separete build +# directory is used during configure (such as on CI) +ENSURE_SUBDIRS_EXIST := $(shell mkdir -p $(SUBDIRS)) # That patsubst rule searches all directories listed in SUBDIRS for .c # files, and adds the corresponding .o files to OBJS @@ -50,23 +47,11 @@ utils/citus_version.o: $(CITUS_VERSION_INVALIDATE) SHLIB_LINK += $(filter -lssl -lcrypto -lssleay32 -leay32, $(LIBS)) -override LDFLAGS += $(safestringlib_a) override CPPFLAGS += -I$(libpq_srcdir) -I$(safestringlib_srcdir)/include SQL_DEPDIR=.deps/sql SQL_BUILDDIR=build/sql -$(safestringlib_a): $(safestringlib_sources) - rm -rf $(safestringlib_builddir) - mkdir -p $(safestringlib_builddir) - @# exports of LDFLAGS and CPPFLAGS are to make sure the ones from this - @# Makefile are not used - +cd $(safestringlib_builddir) && \ - export LDFLAGS='' && export CPPFLAGS='' && \ - $(CMAKE3) $(safestringlib_srcdir) && make - -citus.so: $(safestringlib_a) - $(generated_sql_files): $(citus_abs_srcdir)/build/%: % @mkdir -p $(citus_abs_srcdir)/$(SQL_DEPDIR) $(citus_abs_srcdir)/$(SQL_BUILDDIR) cd $(citus_abs_srcdir) && cpp -undef -w -P -MMD -MP -MF$(SQL_DEPDIR)/$(*F).Po -MT$@ $< > $@ diff --git a/src/backend/distributed/safeclib b/src/backend/distributed/safeclib new file mode 120000 index 000000000..c4da5b7ad --- /dev/null +++ b/src/backend/distributed/safeclib @@ -0,0 +1 @@ +../../../vendor/safestringlib/safeclib/ \ No newline at end of file