Skip to content

Commit c4636bf

Browse files
committed
Staged brotli
1 parent 700c78f commit c4636bf

6 files changed

Lines changed: 304 additions & 771 deletions

File tree

Makefile

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,52 @@ BINDIR?=$(PREFIX)/bin
2121
# Libraries
2222
LIBS = -lz
2323

24+
# Include paths for vendored Brotli sources
25+
CFLAGS += -I./brotli/c -I./brotli/c/include
26+
2427
# Main targets
2528
all: mzip
2629

27-
mzip: mzip.c main.c config.h deflate.inc.c crc32.inc.c zstd.inc.c
28-
$(CC) $(CFLAGS) $(COMPRESSION_FLAGS) -o $@ main.c mzip.c $(LIBS)
30+
# Brotli sources (vendored); compiled into the binary (no external lib)
31+
BROTLI_COMMON_SRCS= \
32+
brotli/c/common/constants.c \
33+
brotli/c/common/context.c \
34+
brotli/c/common/platform.c \
35+
brotli/c/common/shared_dictionary.c \
36+
brotli/c/common/transform.c \
37+
brotli/c/common/dictionary.c
38+
39+
BROTLI_ENC_SRCS= \
40+
brotli/c/enc/backward_references_hq.c \
41+
brotli/c/enc/backward_references.c \
42+
brotli/c/enc/bit_cost.c \
43+
brotli/c/enc/block_splitter.c \
44+
brotli/c/enc/brotli_bit_stream.c \
45+
brotli/c/enc/cluster.c \
46+
brotli/c/enc/command.c \
47+
brotli/c/enc/compound_dictionary.c \
48+
brotli/c/enc/compress_fragment_two_pass.c \
49+
brotli/c/enc/compress_fragment.c \
50+
brotli/c/enc/dictionary_hash.c \
51+
brotli/c/enc/encode.c \
52+
brotli/c/enc/encoder_dict.c \
53+
brotli/c/enc/entropy_encode.c \
54+
brotli/c/enc/fast_log.c \
55+
brotli/c/enc/histogram.c \
56+
brotli/c/enc/literal_cost.c \
57+
brotli/c/enc/memory.c \
58+
brotli/c/enc/metablock.c \
59+
brotli/c/enc/static_dict.c \
60+
brotli/c/enc/utf8_util.c
61+
62+
BROTLI_DEC_SRCS= \
63+
brotli/c/dec/bit_reader.c \
64+
brotli/c/dec/decode.c \
65+
brotli/c/dec/huffman.c \
66+
brotli/c/dec/state.c
67+
68+
mzip: mzip.c main.c config.h deflate.inc.c crc32.inc.c zstd.inc.c $(BROTLI_COMMON_SRCS) $(BROTLI_ENC_SRCS) $(BROTLI_DEC_SRCS)
69+
$(CC) $(CFLAGS) $(COMPRESSION_FLAGS) -o $@ main.c mzip.c $(BROTLI_COMMON_SRCS) $(BROTLI_ENC_SRCS) $(BROTLI_DEC_SRCS) $(LIBS)
2970

3071
install:
3172
mkdir -p $(DESTDIR)$(BINDIR)

0 commit comments

Comments
 (0)