⛏️ index : haiku.git

SubDir HAIKU_TOP src system kernel lib zstd ;

local zstdSourceDirectory = [ BuildFeatureAttribute zstd : sources : path ] ;
UseHeaders [ FDirName $(zstdSourceDirectory) lib ] ;
UseHeaders [ FDirName $(zstdSourceDirectory) lib common ] ;

# disable -Werror for this directory only
SubDirCcFlags -Wno-error ;

local zstdCommonSources =
	error_private.c
	entropy_common.c fse_decompress.c zstd_common.c
	xxhash.c
	;
local zstdDecSources =
	huf_decompress.c zstd_ddict.c zstd_decompress.c zstd_decompress_block.c
	;

LOCATE on [ FGristFiles $(zstdCommonSources) ] =
	[ FDirName $(zstdSourceDirectory) lib common ] ;
LOCATE on [ FGristFiles $(zstdDecSources) ] =
	[ FDirName $(zstdSourceDirectory) lib decompress ] ;
Depends [ FGristFiles $(zstdCommonSources) $(zstdDecSources) ]
	: [ BuildFeatureAttribute zstd : sources ] ;

# Build zstd with PIC, such that it can be used by kernel add-ons (filesystems).
KernelStaticLibrary kernel_libzstd.a :
	$(zstdCommonSources) $(zstdDecSources)
	;