`make all` exercises substantially more than the default zstd binary. It also builds compression-only and decompression-only archives, older contrib tools that compile program C shims directly, and the single-file amalgamations. The Rust migration had changed symbol ownership without updating every one of those feature and link boundaries. The first failure came from `fileio_asyncio`: it is always compiled, but its codec bindings unconditionally referenced both `zstd_compress` and `zstd_decompress`. A compression-only archive therefore required disabled decoder modules, and the decompression-only configuration had the symmetric problem. Gate the concrete codec imports, callback types, helpers, and exports with their Cargo features. Keep the format probe compilable without the legacy decoder predicate when decompression is disabled. Once that boundary compiled, the remaining `make all` paths exposed related integration gaps. Move the C decompression projection declarations out of the compression preprocessor block, while leaving destination callback types shared. Link the Rust CLI helpers archive into zlibWrapper, pzstd, and largeNbDicts, whose util/time/data-generator C files are now declaration shims rather than implementations. The generated single-file C sources also call Rust-owned symbols now. Build and link an appropriately featured Rust archive in their native smoke tests, and include the pool configuration shim in the decoder case. The full amalgamation combines `zstd_lazy.c` and `zstd_opt.c` into one translation unit, so guard their otherwise translation-unit-local dictionary mode enum against duplicate definition. A Rust-backed amalgamation is no longer a standalone Emscripten input. Remove the obsolete emcc/Docker path and report that limitation explicitly; restoring the WebAssembly smoke test requires a Rust WebAssembly archive and a defined cross-language amalgamation contract. Test Plan: - `cargo check --manifest-path rust/Cargo.toml --no-default-features --features compression` -- passed - `cargo check --manifest-path rust/Cargo.toml --no-default-features --features decompression` -- passed - `sh -n build/single_file_libs/build_decoder_test.sh build/single_file_libs/build_library_test.sh` -- passed - `make all` -- passed, including native single-file and seekable-format tests - `git diff --cached --check` -- passed
76 lines
2.5 KiB
Makefile
76 lines
2.5 KiB
Makefile
# ################################################################
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under both the BSD-style license (found in the
|
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
# in the COPYING file in the root directory of this source tree).
|
|
# ################################################################
|
|
|
|
PROGDIR = ../../programs
|
|
LIBDIR = ../../lib
|
|
CARGO ?= cargo
|
|
RUSTDIR = ../../rust
|
|
RUST_CLI_DIR = $(RUSTDIR)/cli
|
|
RUST_CLI_MANIFEST = $(RUST_CLI_DIR)/Cargo.toml
|
|
RUST_CLI_HELPER_SOURCES = $(RUST_CLI_MANIFEST) $(RUST_CLI_DIR)/Cargo.lock \
|
|
$(RUST_CLI_DIR)/src/lib.rs \
|
|
$(RUSTDIR)/src/timefn.rs $(RUSTDIR)/src/benchfn.rs \
|
|
$(RUSTDIR)/src/datagen.rs $(RUSTDIR)/src/lorem.rs \
|
|
$(RUSTDIR)/src/util.rs
|
|
RUST_CLI_HELPERS_TARGET_DIR = $(RUSTDIR)/target/cli-helpers
|
|
RUST_CLI_HELPERS_STATICLIB = $(RUST_CLI_HELPERS_TARGET_DIR)/release/libzstd_cli_rs.a
|
|
RUST_CLI_HELPERS_CARGO_FLAGS = --manifest-path $(RUST_CLI_MANIFEST) --release \
|
|
--target-dir $(RUST_CLI_HELPERS_TARGET_DIR) \
|
|
--no-default-features --features helpers
|
|
|
|
LIBZSTD = $(LIBDIR)/libzstd.a
|
|
|
|
CPPFLAGS+= -I$(LIBDIR) -I$(LIBDIR)/common -I$(LIBDIR)/dictBuilder -I$(PROGDIR)
|
|
|
|
CFLAGS ?= -O3
|
|
CFLAGS += -std=gnu99
|
|
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
|
-Wstrict-aliasing=1 -Wswitch-enum \
|
|
-Wstrict-prototypes -Wundef -Wpointer-arith \
|
|
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
|
-Wredundant-decls
|
|
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
|
|
|
|
|
default: largeNbDicts
|
|
|
|
all : largeNbDicts
|
|
|
|
largeNbDicts: util.o timefn.o benchfn.o datagen.o xxhash.o largeNbDicts.c $(LIBZSTD) $(RUST_CLI_HELPERS_STATICLIB)
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
.PHONY: $(LIBZSTD)
|
|
$(LIBZSTD):
|
|
$(MAKE) -C $(LIBDIR) libzstd.a CFLAGS="$(CFLAGS)"
|
|
|
|
$(RUST_CLI_HELPERS_STATICLIB): $(RUST_CLI_HELPER_SOURCES)
|
|
$(CARGO) build $(RUST_CLI_HELPERS_CARGO_FLAGS)
|
|
|
|
benchfn.o: $(PROGDIR)/benchfn.c
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
|
|
|
|
timefn.o: $(PROGDIR)/timefn.c
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
|
|
|
|
datagen.o: $(PROGDIR)/datagen.c
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
|
|
|
|
util.o: $(PROGDIR)/util.c
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
|
|
|
|
|
|
xxhash.o : $(LIBDIR)/common/xxhash.c
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
|
|
|
|
|
|
clean:
|
|
$(RM) *.o
|
|
$(MAKE) -C $(LIBDIR) clean > /dev/null
|
|
$(RM) largeNbDicts
|