Merge pull request #3626 from citusdata/vendor-new-directory

Compile safestringlib using regular configure
pull/3629/head
Jelte Fennema 2020-03-19 12:36:38 +01:00 committed by GitHub
commit 30ada54f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 27 deletions

View File

@ -4,6 +4,7 @@ for f in $(git ls-tree -r HEAD --name-only); do
if [ "$f" = "${f%.out}" ] &&
[ "$f" = "${f%.data}" ] &&
[ "$f" = "${f%.png}" ] &&
[ -f "$f" ] &&
[ "$(echo "$f" | cut -d / -f1)" != "vendor" ] &&
[ "$(dirname "$f")" != "src/test/regress/output" ]
then

View File

@ -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$@ $< > $@

View File

@ -0,0 +1 @@
../../../vendor/safestringlib/safeclib/

2
vendor/README.md vendored
View File

@ -6,5 +6,5 @@ git clone https://github.com/intel/safestringlib
rm -rf safestringlib/{.git,unittests}
git add safestringlib/
git commit -m "Update safestringlib"
git cherry-pick -x 92d7a40d1de472d23d05967be9b77eda30af85cb
git cherry-pick -x dc2a371d9f8b28ad0e68c5230bb998b4463d8131
```

View File

@ -145,14 +145,14 @@ set_target_properties(${PROJECT_NAME}_objlib
target_compile_definitions(${PROJECT_NAME}_objlib PRIVATE -DSTDC_HEADERS)
target_compile_options(${PROJECT_NAME}_objlib
PRIVATE -Wall -Wextra -Wsign-compare -Wformat-security)
target_compile_options(${PROJECT_NAME}_objlib
PRIVATE -Wno-unknown-pragmas -Wno-unused-parameter)
if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 7)
target_compile_options(${PROJECT_NAME}_objlib
PRIVATE -Wno-implicit-fallthrough)
endif()
target_compile_options(${PROJECT_NAME}_objlib
PRIVATE -Wall -Wextra -Wsign-compare -Wformat-security)
target_compile_options(${PROJECT_NAME}_objlib
PRIVATE -Wstack-protector -Winit-self)
target_compile_options(${PROJECT_NAME}_objlib
@ -166,10 +166,7 @@ target_compile_options(${PROJECT_NAME}_objlib PRIVATE -fPIE -fPIC)
if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
target_compile_options(${PROJECT_NAME}_objlib PRIVATE -mmitigate-rop)
endif()
if(APPLE)
elseif(UNIX)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now")
option(BUILD_ERROR_ON_WARNING "Fail compilation on warning" OFF)

View File

@ -31,6 +31,8 @@
#include "mem_primitives_lib.h"
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
/*
* mem_primitives_lib.c provides unguarded memory routines
* that are used by the safe_mem_library. These routines

View File

@ -32,6 +32,7 @@
#ifndef __SAFECLIB_PRIVATE_H__
#define __SAFECLIB_PRIVATE_H__
#include "citus_config.h"
#ifdef __KERNEL__
/* linux kernel environment */

View File

@ -54,6 +54,7 @@
#define CHK_FORMAT(X,Y) (((X)==(Y))?1:0)
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
unsigned int
parse_format(const char *format, char pformatList[], unsigned int maxFormats)