Merge pull request #1164 from GeorgeLu97/CustomMacros
Partial Compilation Macros
This commit is contained in:
commit
b27c7389e3
@ -30,6 +30,7 @@ matrix:
|
|||||||
|
|
||||||
- env: Cmd='make lz4install && make -C tests test-lz4'
|
- env: Cmd='make lz4install && make -C tests test-lz4'
|
||||||
|
|
||||||
|
- env: Cmd='bash tests/libzstd_partial_builds.sh'
|
||||||
# tag-specific test
|
# tag-specific test
|
||||||
- if: tag =~ ^v[0-9]\.[0-9]
|
- if: tag =~ ^v[0-9]\.[0-9]
|
||||||
env: Cmd='make -C tests checkTag && tests/checkTag $TRAVIS_BRANCH'
|
env: Cmd='make -C tests checkTag && tests/checkTag $TRAVIS_BRANCH'
|
||||||
|
38
lib/Makefile
38
lib/Makefile
@ -28,10 +28,44 @@ DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
|||||||
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
||||||
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
||||||
|
|
||||||
|
ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c))
|
||||||
ZSTD_FILES := $(sort $(wildcard common/*.c compress/*.c decompress/*.c dictBuilder/*.c deprecated/*.c))
|
ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c))
|
||||||
|
ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c))
|
||||||
|
ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c))
|
||||||
|
ZDEPR_FILES := $(sort $(wildcard deprecated/*.c))
|
||||||
|
ZSTD_FILES := $(ZSTDCOMMON_FILES)
|
||||||
|
|
||||||
ZSTD_LEGACY_SUPPORT ?= 4
|
ZSTD_LEGACY_SUPPORT ?= 4
|
||||||
|
ZSTD_LIB_COMPRESSION ?= 1
|
||||||
|
ZSTD_LIB_DECOMPRESSION ?= 1
|
||||||
|
ZSTD_LIB_DICTBUILDER ?= 1
|
||||||
|
ZSTD_LIB_DEPRECATED ?= 1
|
||||||
|
|
||||||
|
ifeq ($(ZSTD_LIB_COMPRESSION), 0)
|
||||||
|
ZSTD_LIB_DICTBUILDER = 0
|
||||||
|
ZSTD_LIB_DEPRECATED = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ZSTD_LIB_DECOMPRESSION), 0)
|
||||||
|
ZSTD_LEGACY_SUPPORT = 0
|
||||||
|
ZSTD_LIB_DEPRECATED = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ZSTD_LIB_COMPRESSION), 0)
|
||||||
|
ZSTD_FILES += $(ZSTDCOMP_FILES)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ZSTD_LIB_DECOMPRESSION), 0)
|
||||||
|
ZSTD_FILES += $(ZSTDDECOMP_FILES)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ZSTD_LIB_DEPRECATED), 0)
|
||||||
|
ZSTD_FILES += $(ZDEPR_FILES)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ZSTD_LIB_DICTBUILDER), 0)
|
||||||
|
ZSTD_FILES += $(ZDICT_FILES)
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
||||||
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
||||||
|
@ -61,6 +61,10 @@ It's possible to compile only a limited set of features.
|
|||||||
Each version also provides an additional dedicated set of advanced API.
|
Each version also provides an additional dedicated set of advanced API.
|
||||||
For example, advanced API for version `v0.4` is exposed in `lib/legacy/zstd_v04.h` .
|
For example, advanced API for version `v0.4` is exposed in `lib/legacy/zstd_v04.h` .
|
||||||
Note : `lib/legacy` only supports _decoding_ legacy formats.
|
Note : `lib/legacy` only supports _decoding_ legacy formats.
|
||||||
|
- Similarly, you can define `ZSTD_LIB_COMPRESSION, ZSTD_LIB_DECOMPRESSION`, `ZSTD_LIB_DICTBUILDER`,
|
||||||
|
and `ZSTD_LIB_DEPRECATED` as 0 to forgo compilation of the corresponding features. This will
|
||||||
|
also disable compilation of all dependencies (eg. `ZSTD_LIB_COMPRESSION=0` will also disable
|
||||||
|
dictBuilder).
|
||||||
|
|
||||||
|
|
||||||
#### Multithreading support
|
#### Multithreading support
|
||||||
|
36
tests/libzstd_partial_builds.sh
Executable file
36
tests/libzstd_partial_builds.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
die() {
|
||||||
|
$ECHO "$@" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
INTOVOID="/dev/null"
|
||||||
|
case "$OS" in
|
||||||
|
Windows*)
|
||||||
|
INTOVOID="NUL"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ZSTD_LIB_COMPRESSION=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID
|
||||||
|
nm $DIR/../lib/libzstd.a | grep ".*\.o:" > tmplog
|
||||||
|
! grep -q "zstd_compress" tmplog && grep -q "zstd_decompress" tmplog && ! grep -q "dict" tmplog && grep -q "zstd_v" tmplog && ! grep -q "zbuff" tmplog && make clean && rm -f tmplog || die "Compression macro failed"
|
||||||
|
|
||||||
|
|
||||||
|
ZSTD_LIB_DECOMPRESSION=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID
|
||||||
|
nm $DIR/../lib/libzstd.a | grep ".*\.o:" > tmplog
|
||||||
|
grep -q "zstd_compress" tmplog && ! grep -q "zstd_decompress" tmplog && grep -q "dict" tmplog && ! grep -q "zstd_v" tmplog && ! grep -q "zbuff" tmplog && make clean && rm -f tmplog || die "Decompression macro failed"
|
||||||
|
|
||||||
|
ZSTD_LIB_DEPRECATED=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID
|
||||||
|
nm $DIR/../lib/libzstd.a | grep ".*\.o:" > tmplog
|
||||||
|
grep -q "zstd_compress" tmplog && grep -q "zstd_decompress" tmplog && grep -q "dict" tmplog && grep -q "zstd_v" tmplog && ! grep -q "zbuff" tmplog && make clean && rm -f tmplog || die "Deprecated macro failed"
|
||||||
|
|
||||||
|
ZSTD_LIB_DICTBUILDER=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID
|
||||||
|
nm $DIR/../lib/libzstd.a | grep ".*\.o:" > tmplog
|
||||||
|
grep -q "zstd_compress" tmplog && grep -q "zstd_decompress" tmplog && ! grep -q "dict" tmplog && grep -q "zstd_v" tmplog && grep -q "zbuff" tmplog && make clean && rm -f tmplog || die "Dictbuilder macro failed"
|
||||||
|
|
||||||
|
ZSTD_LIB_DECOMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID
|
||||||
|
nm $DIR/../lib/libzstd.a | grep ".*\.o:" > tmplog
|
||||||
|
grep -q "zstd_compress" tmplog && ! grep -q "zstd_decompress" tmplog && ! grep -q "dict" tmplog && ! grep -q "zstd_v" tmplog && ! grep -q "zbuff" tmplog && make clean && rm -f tmplog || die "Multi-macro failed"
|
Loading…
x
Reference in New Issue
Block a user