linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
commit b57cf03e89effcdc76c5219087581f1ccef00344 parent c3dafcf62689b8510f866fc50833a85d03e3ea2e Author: Jul <jul@9o.is> Date: Thu, 28 Aug 2025 15:49:40 +0800 use packaged zstd in fspec-tar rule Diffstat:
| M | .gitmodules | | | 4 | ++++ |
| M | gen.sh | | | 1 | + |
| M | ninja/functions.sh | | | 4 | ++++ |
| M | ninja/rules.ninja | | | 2 | +- |
| A | pkg/zstd/gen.sh | | | 65 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | pkg/zstd/include/config.h | | | 8 | ++++++++ |
| A | pkg/zstd/repo | | | 1 | + |
| A | pkg/zstd/version | | | 3 | +++ |
8 files changed, 87 insertions(+), 1 deletion(-)
diff --git a/.gitmodules b/.gitmodules @@ -54,3 +54,7 @@ path = pkg/b3sum/repo url = https://git.sr.ht/~mcf/b3sum ignore = all +[submodule "zstd"] + path = pkg/zstd/repo + url = https://github.com/facebook/zstd + ignore = all diff --git a/gen.sh b/gen.sh @@ -26,5 +26,6 @@ subgen pkg/netbsd-curses subgen pkg/oksh subgen pkg/sbase subgen pkg/zlib +subgen pkg/zstd subgen tpl/example diff --git a/ninja/functions.sh b/ninja/functions.sh @@ -27,6 +27,10 @@ cflags() { setv cflags '$cflags' "$*" } +ldflags() { + setv ldflags '$ldflags' "$*" +} + copy() { _ninja_prefix _src $srcdir $1 _ninja_prefix _out $outdir ${2-$1} diff --git a/ninja/rules.ninja b/ninja/rules.ninja @@ -58,5 +58,5 @@ rule fspec description = FSPEC $out rule fspec-tar - command = $hostdir/fspec-tar <$in | zstd >$out + command = $hostdir/fspec-tar <$in | $hostdir/zstd >$out description = FSPEC-TAR $out diff --git a/pkg/zstd/gen.sh b/pkg/zstd/gen.sh @@ -0,0 +1,65 @@ + +zstd_cflags="\ + -D ZSTD_NOBENCH \ + -D ZSTD_NODICT \ + -D ZSTD_NOTRACE \ + -D ZSTD_NO_UNUSED_FUNCTIONS \ + -D ZSTD_MULTITHREAD \ + -D XXH_NAMESPACE=ZSTD_ \ + -U ZSTD_LEGACY_SUPPORT \ + -D ZSTD_LEGACY_SUPPORT=0" + +libzstda_srcs="\ + lib/common/debug.c \ + lib/common/entropy_common.c \ + lib/common/error_private.c \ + lib/common/fse_decompress.c \ + lib/common/pool.c \ + lib/common/threading.c \ + lib/common/xxhash.c \ + lib/common/zstd_common.c \ + lib/compress/fse_compress.c \ + lib/compress/hist.c \ + lib/compress/huf_compress.c \ + lib/compress/zstd_compress.c \ + lib/compress/zstd_compress_literals.c \ + lib/compress/zstd_compress_sequences.c \ + lib/compress/zstd_compress_superblock.c \ + lib/compress/zstd_double_fast.c \ + lib/compress/zstd_fast.c \ + lib/compress/zstd_lazy.c \ + lib/compress/zstd_ldm.c \ + lib/compress/zstd_opt.c \ + lib/compress/zstd_preSplit.c \ + lib/compress/zstdmt_compress.c \ + lib/decompress/huf_decompress.c \ + lib/decompress/zstd_ddict.c \ + lib/decompress/zstd_decompress.c \ + lib/decompress/zstd_decompress_block.c" + +zstd_srcs="\ + programs/zstdcli.c \ + programs/util.c \ + programs/timefn.c \ + programs/fileio.c \ + programs/fileio_asyncio.c \ + $outdir/libzstd.a" + +if [ $TARGET_ARCH = x86_64 ]; then + zstd_x86_64=lib/decompress/huf_decompress_amd64.S +fi + +host() { + cflags $zstd_cflags -D ZSTD_DISABLE_ASM + lib libzstd.a $libzstda_srcs + exe zstd $zstd_srcs +} + +cflags $zstd_cflags +lib libzstd.a $libzstda_srcs ${zstd_x86_64-} +exe zstd $zstd_srcs + +bin zstd +sym zstd unzstd +sym zstd zstdcat +man programs/zstd.1 diff --git a/pkg/zstd/include/config.h b/pkg/zstd/include/config.h @@ -0,0 +1,8 @@ +#define ZSTD_NO_UNUSED_FUNCTIONS +#define ZSTD_MULTITHREAD +#define XXH_NAMESPACE ZSTD_ +#define ZSTD_NOBENCH +#define ZSTD_NODICT +#define ZSTD_NOTRACE +#define ZSTD_DISABLE_DEPRECATE_WARNINGS +#define ZDICT_DISABLE_DEPRECATE_WARNINGS diff --git a/pkg/zstd/repo b/pkg/zstd/repo @@ -0,0 +1 @@ +Subproject commit 22b44831637be02bff6a63f85e88671e4cb70460 diff --git a/pkg/zstd/version b/pkg/zstd/version @@ -0,0 +1,3 @@ +method=git +ref=22b4483 +rel=0