opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: 5b16d89adcfe83eb1f0cf2d518ae1275df9223d6
Parent: ad09f288385f97139eb29d32194c8011ddb30847
Author: Randy Palamar
Date:   Fri,  3 Jan 2025 13:02:10 -0700

add zstd from oasis

Diffstat:
M.gitmodules | 4++++
Mpkg/arch/gen.lua | 1+
Apkg/arch/zstd/config.h | 8++++++++
Apkg/arch/zstd/gen.lua | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/arch/zstd/patch/0001-Only-use-__asm__-on-GNU-compatible-compilers.patch | 25+++++++++++++++++++++++++
Apkg/arch/zstd/patch/0002-ZSTD_VecMask_next-fix-incorrect-variable-name-in-fal.patch | 26++++++++++++++++++++++++++
Apkg/arch/zstd/src | 1+
Apkg/arch/zstd/ver | 1+
Msets.lua | 1+
9 files changed, 125 insertions(+), 0 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -7,6 +7,10 @@ [submodule "pkg/arch/pigz/src"] path = pkg/arch/pigz/src url = https://github.com/madler/pigz.git +[submodule "pkg/arch/zstd/src"] + path = pkg/arch/zstd/src + url = https://github.com/facebook/zstd.git + ignore = all [submodule "pkg/crypt/b3sum/src"] path = pkg/crypt/b3sum/src url = https://git.sr.ht/~mcf/b3sum diff --git a/pkg/arch/gen.lua b/pkg/arch/gen.lua @@ -1 +1,2 @@ subgen('pigz') +subgen('zstd') diff --git a/pkg/arch/zstd/config.h b/pkg/arch/zstd/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/arch/zstd/gen.lua b/pkg/arch/zstd/gen.lua @@ -0,0 +1,58 @@ +cflags({ + '-Wall', '-Wextra', '-Wpedantic', + '-include $dir/config.h', +}) + +pkg.hdrs = { + copy('$outdir/include', '$srcdir/lib', {'zstd.h', 'zdict.h', 'zstd_errors.h'}), +} +pkg.deps = { + '$gendir/headers', + '$dir/config.h', +} + +lib('libzstd.a', [[lib/( + common/( + debug.c + entropy_common.c + error_private.c + fse_decompress.c + pool.c + threading.c + xxhash.c + zstd_common.c + ) + compress/( + fse_compress.c + hist.c + huf_compress.c + zstd_compress.c + zstd_compress_literals.c + zstd_compress_sequences.c + zstd_compress_superblock.c + zstd_double_fast.c + zstd_fast.c + zstd_lazy.c + zstd_ldm.c + zstd_opt.c + zstdmt_compress.c + ) + decompress/( + huf_decompress.c + zstd_ddict.c + zstd_decompress.c + zstd_decompress_block.c + ) +)]]) + +exe('zstd', [[ + programs/(zstdcli.c util.c timefn.c fileio.c) + libzstd.a +]]) +file('bin/zstd', '755', '$outdir/zstd') +sym('bin/unzstd', 'zstd') +sym('bin/zstdcat', 'zstd') + +man({'programs/zstd.1'}) + +fetch('git') diff --git a/pkg/arch/zstd/patch/0001-Only-use-__asm__-on-GNU-compatible-compilers.patch b/pkg/arch/zstd/patch/0001-Only-use-__asm__-on-GNU-compatible-compilers.patch @@ -0,0 +1,25 @@ +From 7bc019c4c96b4eae8fe05dd31c4ea781441d437c Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 10 Jun 2019 01:47:01 -0700 +Subject: [PATCH] Only use __asm__ on GNU-compatible compilers + +--- + lib/common/cpu.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/common/cpu.h b/lib/common/cpu.h +index cb210593..3c43f816 100644 +--- a/lib/common/cpu.h ++++ b/lib/common/cpu.h +@@ -82,7 +82,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) { + : "a"(7), "c"(0) + : "edx"); + } +-#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) ++#elif (defined(__x86_64__) || defined(_M_X64) || defined(__i386__)) && defined(__GNUC__) + U32 n; + __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx"); + if (n >= 1) { +-- +2.29.2 + diff --git a/pkg/arch/zstd/patch/0002-ZSTD_VecMask_next-fix-incorrect-variable-name-in-fal.patch b/pkg/arch/zstd/patch/0002-ZSTD_VecMask_next-fix-incorrect-variable-name-in-fal.patch @@ -0,0 +1,26 @@ +From 0f2837d010dce1f0a384c3ba6f54a86f39c607d5 Mon Sep 17 00:00:00 2001 +From: Dan Nelson <dnelson_1901@yahoo.com> +Date: Sat, 15 May 2021 10:20:37 -0500 +Subject: [PATCH] ZSTD_VecMask_next: fix incorrect variable name in fallback + code path + +--- + lib/compress/zstd_lazy.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c +index 3d523e84..9e13f37c 100644 +--- a/lib/compress/zstd_lazy.c ++++ b/lib/compress/zstd_lazy.c +@@ -1081,7 +1081,7 @@ static U32 ZSTD_VecMask_next(ZSTD_VecMask val) { + 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 + }; +- return multiplyDeBruijnBitPosition[((U32)((v & -(int)v) * 0x077CB531U)) >> 27]; ++ return multiplyDeBruijnBitPosition[((U32)((val & -(int)val) * 0x077CB531U)) >> 27]; + # endif + } + +-- +2.31.1 + diff --git a/pkg/arch/zstd/src b/pkg/arch/zstd/src @@ -0,0 +1 @@ +Subproject commit a488ba114ec17ea1054b9057c26a046fc122b3b6 diff --git a/pkg/arch/zstd/ver b/pkg/arch/zstd/ver @@ -0,0 +1 @@ +1.5.0 r1 diff --git a/sets.lua b/sets.lua @@ -29,6 +29,7 @@ S.bin = { 'transmission', 'u-config', 'vis', + 'zstd', } S.lib = {