mirror of
https://github.com/facebook/zstd.git
synced 2025-08-05 19:15:58 +03:00
The CLI can be linked to libzstd dynamic library
invoking target zstd-dll
This commit is contained in:
@@ -971,16 +971,11 @@ static size_t ZDICT_addEntropyTablesFromBuffer_advanced(
|
||||
return MIN(dictBufferCapacity, hSize+dictContentSize);
|
||||
}
|
||||
|
||||
/* Hidden declaration for dbio.c */
|
||||
size_t ZDICT_trainFromBuffer_unsafe_legacy(
|
||||
void* dictBuffer, size_t maxDictSize,
|
||||
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
|
||||
ZDICT_legacy_params_t params);
|
||||
/*! ZDICT_trainFromBuffer_unsafe_legacy() :
|
||||
* Warning : `samplesBuffer` must be followed by noisy guard band.
|
||||
* Warning : `samplesBuffer` must be followed by noisy guard band !!!
|
||||
* @return : size of dictionary, or an error code which can be tested with ZDICT_isError()
|
||||
*/
|
||||
size_t ZDICT_trainFromBuffer_unsafe_legacy(
|
||||
static size_t ZDICT_trainFromBuffer_unsafe_legacy(
|
||||
void* dictBuffer, size_t maxDictSize,
|
||||
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
|
||||
ZDICT_legacy_params_t params)
|
||||
|
@@ -264,10 +264,11 @@ typedef struct {
|
||||
* Note: ZDICT_trainFromBuffer_legacy() will send notifications into stderr if instructed to, using notificationLevel>0.
|
||||
*/
|
||||
ZDICTLIB_API size_t ZDICT_trainFromBuffer_legacy(
|
||||
void *dictBuffer, size_t dictBufferCapacity,
|
||||
const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples,
|
||||
void* dictBuffer, size_t dictBufferCapacity,
|
||||
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
|
||||
ZDICT_legacy_params_t parameters);
|
||||
|
||||
|
||||
/* Deprecation warnings */
|
||||
/* It is generally possible to disable deprecation warnings from compiler,
|
||||
for example with -Wno-deprecated-declarations for gcc
|
||||
|
@@ -90,13 +90,13 @@ endif
|
||||
|
||||
# Sort files in alphabetical order for reproducible builds
|
||||
ZSTDLIB_FULL_SRC = $(sort $(ZSTDLIB_CORE_SRC) $(ZSTDLEGACY_SRC) $(ZDICT_SRC))
|
||||
ZSTDLIB_LOCAL_SRC := $(notdir $(ZSTDLIB_FULL_SRC))
|
||||
ZSTDLIB_LOCAL_SRC = $(notdir $(ZSTDLIB_FULL_SRC))
|
||||
ZSTDLIB_LOCAL_OBJ := $(ZSTDLIB_LOCAL_SRC:.c=.o)
|
||||
|
||||
ZSTD_CLI_SRC := $(wildcard *.c)
|
||||
ZSTD_CLI_OBJ := $(ZSTD_CLI_SRC:.c=.o)
|
||||
|
||||
ZSTD_ALL_SRC := $(ZSTDLIB_LOCAL_SRC) $(ZSTD_CLI_SRC)
|
||||
ZSTD_ALL_SRC = $(ZSTDLIB_LOCAL_SRC) $(ZSTD_CLI_SRC)
|
||||
ZSTD_ALL_OBJ := $(ZSTD_ALL_SRC:.c=.o)
|
||||
|
||||
UNAME := $(shell uname)
|
||||
@@ -111,7 +111,7 @@ HASH ?= md5sum
|
||||
HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0)
|
||||
|
||||
ifndef BUILD_DIR
|
||||
HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " ")
|
||||
HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " ")
|
||||
ifeq ($(HAVE_HASH),0)
|
||||
$(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags)
|
||||
BUILD_DIR := obj/generic_noconf
|
||||
@@ -199,7 +199,8 @@ SET_CACHE_DIRECTORY = \
|
||||
CPPFLAGS="$(CPPFLAGS)" \
|
||||
CFLAGS="$(CFLAGS)" \
|
||||
LDFLAGS="$(LDFLAGS)" \
|
||||
LDLIBS="$(LDLIBS)"
|
||||
LDLIBS="$(LDLIBS)" \
|
||||
ZSTD_ALL_SRC="$(ZSTD_ALL_SRC)"
|
||||
|
||||
|
||||
.PHONY: all
|
||||
@@ -289,17 +290,11 @@ zstd-noxz : LZMA_MSG := - xz/lzma support is disabled
|
||||
zstd-noxz : zstd
|
||||
|
||||
## zstd-dll: zstd executable linked to dynamic library libzstd (must already exist)
|
||||
# note : the following target doesn't link
|
||||
# because zstd uses non-public symbols from libzstd
|
||||
# such as XXH64 (for benchmark),
|
||||
# ZDICT_trainFromBuffer_unsafe_legacy (for dictionary builder)
|
||||
# and ZSTD_cycleLog (likely for --patch-from).
|
||||
# It's unclear at this stage if this is a scenario that must be supported
|
||||
.PHONY: zstd-dll
|
||||
zstd-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd
|
||||
zstd-dll : ZSTDLIB_FULL_SRC =
|
||||
zstd-dll : $(ZSTD_CLI_OBJ)
|
||||
$(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS)
|
||||
zstd-dll : LDFLAGS+= -L$(ZSTDDIR)
|
||||
zstd-dll : LDLIBS += -lzstd
|
||||
zstd-dll : ZSTDLIB_LOCAL_SRC = xxhash.c
|
||||
zstd-dll : zstd
|
||||
|
||||
|
||||
## zstd-pgo: zstd executable optimized with PGO.
|
||||
@@ -350,9 +345,11 @@ endif
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) core *.o tmp* result* *.gcda dictionary *.zst \
|
||||
zstd$(EXT) zstd32$(EXT) zstd-compress$(EXT) zstd-decompress$(EXT) \
|
||||
zstd$(EXT) zstd32$(EXT) zstd-dll$(EXT) \
|
||||
zstd-compress$(EXT) zstd-decompress$(EXT) \
|
||||
zstd-small$(EXT) zstd-frugal$(EXT) zstd-nolegacy$(EXT) zstd4$(EXT) \
|
||||
zstd-dictBuilder$(EXT) *.gcda default*.profraw default.profdata have_zlib$(EXT)
|
||||
zstd-dictBuilder$(EXT) \
|
||||
*.gcda default*.profraw default.profdata have_zlib$(EXT)
|
||||
$(RM) -r obj/*
|
||||
@echo Cleaning completed
|
||||
|
||||
|
Reference in New Issue
Block a user