From cf3c5b5bec62a324408cfdb47cecec990516e2ed Mon Sep 17 00:00:00 2001 From: Laurens Kuiper Date: Wed, 23 Oct 2024 11:05:40 +0200 Subject: [PATCH] add some guards and simplify zstd in package_build --- scripts/package_build.py | 4 +--- third_party/zstd/include/zstd/common/allocations.h | 5 ++--- third_party/zstd/include/zstd/compress/hist.h | 4 ++++ third_party/zstd/include/zstd/deprecated/zbuff.h | 5 +++-- third_party/zstd/include/zstd/dict/cover.h | 5 +++++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/package_build.py b/scripts/package_build.py index 0238f5b65a7e..49a213b2e179 100644 --- a/scripts/package_build.py +++ b/scripts/package_build.py @@ -54,9 +54,7 @@ def third_party_sources(): sources += [os.path.join('third_party', 'libpg_query')] sources += [os.path.join('third_party', 'mbedtls')] sources += [os.path.join('third_party', 'yyjson')] - sources += [os.path.join('third_party', 'zstd', 'common')] - sources += [os.path.join('third_party', 'zstd', 'compress')] - sources += [os.path.join('third_party', 'zstd', 'decompress')] + sources += [os.path.join('third_party', 'zstd')] return sources diff --git a/third_party/zstd/include/zstd/common/allocations.h b/third_party/zstd/include/zstd/common/allocations.h index 32314483617d..0bb1506b9668 100644 --- a/third_party/zstd/include/zstd/common/allocations.h +++ b/third_party/zstd/include/zstd/common/allocations.h @@ -10,6 +10,8 @@ /* This file provides custom allocation primitives */ +#ifndef ZSTD_ALLOCATIONS_H +#define ZSTD_ALLOCATIONS_H #define ZSTD_DEPS_NEED_MALLOC #include "zstd/common/zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */ @@ -18,9 +20,6 @@ #define ZSTD_STATIC_LINKING_ONLY #include "zstd.h" /* ZSTD_customMem */ -#ifndef ZSTD_ALLOCATIONS_H -#define ZSTD_ALLOCATIONS_H - namespace duckdb_zstd { /* custom memory allocation functions */ diff --git a/third_party/zstd/include/zstd/compress/hist.h b/third_party/zstd/include/zstd/compress/hist.h index 083af82c167a..011a5f02ed33 100644 --- a/third_party/zstd/include/zstd/compress/hist.h +++ b/third_party/zstd/include/zstd/compress/hist.h @@ -12,6 +12,8 @@ * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. ****************************************************************** */ +#ifndef ZSTD_HIST_H +#define ZSTD_HIST_H /* --- dependencies --- */ #include "zstd/common/zstd_deps.h" /* size_t */ @@ -76,3 +78,5 @@ unsigned HIST_count_simple(unsigned* count, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize); } // namespace duckdb_zstd + +#endif /* ZSTD_HIST_H */ \ No newline at end of file diff --git a/third_party/zstd/include/zstd/deprecated/zbuff.h b/third_party/zstd/include/zstd/deprecated/zbuff.h index f58a3765d5a5..ebbc5b758864 100644 --- a/third_party/zstd/include/zstd/deprecated/zbuff.h +++ b/third_party/zstd/include/zstd/deprecated/zbuff.h @@ -23,6 +23,7 @@ * Dependencies ***************************************/ #include /* size_t */ +# define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters, ZSTD_customMem */ #include "zstd.h" /* ZSTD_CStream, ZSTD_DStream, ZSTDLIB_API */ namespace duckdb_zstd { @@ -183,8 +184,8 @@ ZBUFF_DEPRECATED("use ZSTD_DStreamOutSize") size_t ZBUFF_recommendedDOutSize(voi /*--- Dependency ---*/ -# define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters, ZSTD_customMem */ -#include "zstd.h" +//# define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters, ZSTD_customMem */ +//#include "zstd.h" namespace duckdb_zstd { diff --git a/third_party/zstd/include/zstd/dict/cover.h b/third_party/zstd/include/zstd/dict/cover.h index dd458ce58b1e..b3c7ce1aaeeb 100644 --- a/third_party/zstd/include/zstd/dict/cover.h +++ b/third_party/zstd/include/zstd/dict/cover.h @@ -8,6 +8,9 @@ * You may select, at your option, one of the above-listed licenses. */ +#ifndef ZSTD_COVER_H +#define ZSTD_COVER_H + #ifndef ZDICT_STATIC_LINKING_ONLY # define ZDICT_STATIC_LINKING_ONLY #endif @@ -154,3 +157,5 @@ void COVER_dictSelectionFree(COVER_dictSelection_t selection); size_t nbCheckSamples, size_t nbSamples, ZDICT_cover_params_t params, size_t* offsets, size_t totalCompressedSize); } // namespace duckdb_zstd + +#endif /* ZSTD_COVER_H */