1LIB= zstd 2SRCS= entropy_common.c \ 3 error_private.c \ 4 fse_decompress.c \ 5 pool.c \ 6 threading.c \ 7 xxhash.c \ 8 zstd_common.c \ 9 fse_compress.c \ 10 huf_compress.c \ 11 zstd_compress.c \ 12 zstd_compress_literals.c \ 13 zstd_compress_sequences.c \ 14 zstd_compress_superblock.c \ 15 zstdmt_compress.c \ 16 huf_decompress.c \ 17 zstd_ddict.c \ 18 zstd_decompress.c \ 19 zstd_decompress_block.c \ 20 zbuff_common.c \ 21 zbuff_compress.c \ 22 zbuff_decompress.c \ 23 cover.c \ 24 divsufsort.c \ 25 zdict.c \ 26 zstd_fast.c \ 27 zstd_lazy.c \ 28 zstd_ldm.c \ 29 zstd_opt.c \ 30 zstd_double_fast.c \ 31 debug.c \ 32 hist.c \ 33 fastcover.c 34WARNS?= 2 35INCS= zstd.h 36CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ \ 37 -DZSTD_MULTITHREAD=1 -fvisibility=hidden 38LIBADD= pthread 39 40# ZSTD_ASM_SUPPORTED is 0 on FreeBSD but 1 on macOS and Linux. Since we build 41# this as a bootstrap library and don't include any assembly sources in SRCS, 42# explicitly disable assembly. 43CFLAGS+= -DZSTD_DISABLE_ASM 44 45PRIVATELIB= yes 46PACKAGE= runtime 47 48ZSTDDIR= ${SRCTOP}/sys/contrib/zstd 49.PATH: ${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \ 50 ${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \ 51 ${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib 52 53.include <bsd.compiler.mk> 54 55CFLAGS.huf_decompress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 56 57# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1] 58# "Note that [GCC] autovectorization still does not do a good job on the 59# optimized version, so it's turned off via attribute and flag. I found 60# that neither attribute nor command-line flag were entirely successful in 61# turning off vectorization, which is why there were both." 62.if ${COMPILER_TYPE} == "gcc" 63CFLAGS.zstd_decompress_block.c+= -fno-tree-vectorize 64.endif 65 66# Work around lack of __bswap[sd]i2() intrinsics on riscv. Probably should be 67# added to one of the runtime C libraries instead. 68.if ${MACHINE_CPUARCH} == "riscv" 69.PATH: ${ZSTDDIR}/lib/freebsd 70SRCS+= zstd_kfreebsd.c 71.endif 72 73.include <bsd.lib.mk> 74