Skip to content

Commit

Permalink
Add manpage for snappy and bump version to v0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmilk committed Jun 8, 2020
1 parent 38bac13 commit 387885a
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 47 deletions.
14 changes: 10 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@

v0.7
- add snappy (c version)
- update versions: zstd 1.4.5, lz4 1.9.2
- add github workflow actions

v0.6
- update versions: zstd 1.3.8, lz4 1.8.3, brotli 1.0.7

v0.5
- use correct lizard version (v1.0)

v0.4
- added brotli, added lizard (was lz5 v2.0)
- add brotli
- add lizard (was lz5 v2.0)
- add man pages for the sample programs
- merged the target platforms unix and windows to "programs"
- changed options, the tools are like bzip2 or gzip now
- merge the target platforms unix and windows to "programs"
- change options, the tools are like bzip2 or gzip now
- use BSD 2-Clause license for everything

v0.3
- update to zstd 1.1.3 and lz4 1.7.5
- changed options, -T is used for the thread count now (like zstdmt of Yann)
- change options, -T is used for the thread count now (like zstdmt of Yann)

v0.2
- update to zstd 1.1.2, lz4 1.7.4, lz5 1.5
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD License

Copyright (c) 2016 - 2017, Tino Reichardt, All rights reserved.
Copyright (c) 2016 - 2020, Tino Reichardt, All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ size | value | description
[Snappy-c]:https://github.com/andikleen/snappy-c


/TR 2017-05-24
/TR 2020-06-08
51 changes: 46 additions & 5 deletions man/generate-man
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
# /TR 2017-05-22
# /TR 2020-06-08

# lib version
ZSTDMT="v0.4"
ZSTDMT="v0.7"

function generate() {
PROGNAME="$1"
Expand All @@ -14,16 +14,56 @@ function generate() {
SUFFIX="$7"
HOMEPAGE="$8"

if [ $LMAX == 0 ]; then
LEVELNUMBERS=""
else
LEVELNUMBERS="1234567890"
fi

if [ $ALGORITHM == "lizard" ]; then
LEVELNOTES=`printf "%q" "
.TP
.BI -10..-19
fastLZ4: designed to give better decompression speed than LZ4 i.e. over 2000 MB/s
.TP
.BI -20..-29
LIZv1: designed to give better ratio than LZ4 keeping 75% decompression speed
.TP
.BI -30..-39
fastLZ4 + Huffman: Huffman coding to fastLZ4
.TP
.BI -40..-49
LIZv1 + Huffman: give the best ratio at decompression speed of 1000 MB/s
.br
The default is -3"`
LEVELNOTES=${LEVELNOTES:2:-1}
elif [ $ALGORITHM == "snappy" ]; then
LEVELNOTES=""
else
LEVELNOTES=`printf "%q" "
.TP
.BI -$LMIN..$LMAX
Use the compression method with a level -$LMIN to -$LMAX.
.br
Compression level -$LMIN is the fastest, but provides a poorer level
of compression.
.br
Compression level -$LMAX provides the best level of compression, but is
also the slowest.
.br
The default is -$LDEF"`
LEVELNOTES=${LEVELNOTES:2:-1}
fi

cat generic.man | sed \
-e "s|%PROGNAME%|$PROGNAME|g" \
-e "s|%ALGORITHM%|$ALGORITHM|g" \
-e "s|%LMIN%|$LMIN|g" \
-e "s|%LMAX%|$LMAX|g" \
-e "s|%LDEF%|$LDEF|g" \
-e "s|%VERSION%|$VERSION|g" \
-e "s|%SUFFIX%|$SUFFIX|g" \
-e "s|%HOMEPAGE%|$HOMEPAGE|g" \
-e "s|%ZSTDMT%|$ZSTDMT|g" \
-e "s|%LEVELNUMBERS%|$LEVELNUMBERS|g" \
-e "s|%LEVELNOTES%|$LEVELNOTES|g" \
> "$PROGNAME.1"
}

Expand All @@ -33,3 +73,4 @@ generate "lizard-mt" "lizard" 10 49 3 "v2.0" "liz" "https://github.com/
generate "lz4-mt" "lz4" 1 12 3 "v1.8.3" "lz4" "https://github.com/lz4/lz4"
generate "lz5-mt" "lz5" 1 15 3 "v1.5" "lz5" "https://github.com/inikep/lz5"
generate "zstd-mt" "zstd" 1 22 3 "v1.3.7" "zst" "https://github.com/facebook/zstd"
generate "snappy-mt" "snappy" 0 0 0 "v0.0.0" "snp" "https://github.com/andikleen/snappy-c"
17 changes: 3 additions & 14 deletions man/generic.man
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

.SH SYNOPSIS
.B %PROGNAME%
.RB [ -1234567890cdzfhklLqrtvV ]
.RB [ -%LEVELNUMBERS%cdzfhklLqrtvV ]
.RB [ "-S \fIsuffix\fP" ]
.RB [ "\fIfile\fP ..." ]

Expand All @@ -25,18 +25,7 @@ It's based on the zstdmt library version %ZSTDMT% and version %VERSION% of the %
More information about %ALGORITHM% can be found here: %HOMEPAGE%

.SH OPTIONS

.TP
.BI -%LMIN%..%LMAX%
Use the compression method with a level -%LMIN% to -%LMAX%.
.br
Compression level -%LMIN% is the fastest, but provides a poorer level
of compression.
.br
Compression level -%LMAX% provides the best level of compression, but is
also the slowest.
.br
The default is -%LDEF%.
%LEVELNOTES%

.TP
.BI -c
Expand Down Expand Up @@ -162,7 +151,7 @@ cat somefile.%SUFFIX% | %PROGNAME% -d > somefile
Please report any bugs to https://github.com/mcmilk/zstdmt/issues

.SH AUTHOR
This manual page was written by Tino Reichardt <milky-zstdmt (at) mcmilk dot de>
Tino Reichardt <milky-zstdmt (at) mcmilk.de>

.SH "SEE ALSO"
.BR bzip2 (1),
Expand Down
35 changes: 17 additions & 18 deletions programs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# current versions we're using (tagged in their main repo)
BRO_VER = "v1.0.7"
LIZ_VER = "v1.0"
LZ4_VER = "v1.8.3"
LZ4_VER = "v1.9.2"
LZ5_VER = "v1.5"
ZSTD_VER= "v1.4.5"
SNAP_VER= "v0.0.0"
Expand All @@ -24,8 +24,8 @@ LN = ln -sf
CC = $(CROSS)gcc
RANLIB = $(CROSS)ranlib
STRIP = $(CROSS)strip
#SFLAGS = -R .note -R .comment
SFLAGS = #-R .note .comment
SFLAGS = -R .note -R .comment
#SFLAGS = -R .note .comment

CFLAGS = -W -pthread -Wall -pipe
CFLAGS += -fomit-frame-pointer
Expand All @@ -41,7 +41,7 @@ PRGS = lizard-mt$(EXTENSION) \
lz5-mt$(EXTENSION) \
brotli-mt$(EXTENSION) \
zstd-mt$(EXTENSION) \
snappy-c-mt$(EXTENSION)
snappy-mt$(EXTENSION)

all: loadsource $(PRGS)
again: clean $(PRGS)
Expand Down Expand Up @@ -147,7 +147,7 @@ CF_ZSTD = $(CFLAGS) -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
-I$(ZSTDDIR)/decompress -I$(ZSTDDIR)/legacy

# snappy-c, https://github.com/andikleen/snappy-c
SNAPDIR = snappy-c
SNAPDIR = snappy
LIBSNAP += $(SNAPDIR)/snappy.c
CF_SNAP = $(CFLAGS) -I$(SNAPDIR)

Expand Down Expand Up @@ -184,25 +184,24 @@ zstd-mt$(EXTENSION):
$(LN) $@ un$@
$(LN) $@ zstdcat-mt

snappy-c-mt$(EXTENSION):
snappy-mt$(EXTENSION):
$(CC) $(CF_SNAP) -DVERSION='$(SNAP_VER)' -o $@ $(LIBSNAP) $(LDFLAGS)
$(STRIP) $(SFLAGS) $@
$(LN) $@ un$@
$(LN) $@ snappy-ccat-mt
$(LN) $@ snappycat-mt

loadsource:
test -d lz4 || git clone https://github.com/Cyan4973/lz4 -b $(LZ4_VER) --depth=1 lz4
test -d lz5 || git clone https://github.com/inikep/lz5 -b $(LZ5_VER) --depth=1 lz5
test -d zstd || git clone https://github.com/facebook/zstd -b $(ZSTD_VER) --depth=1 zstd
test -d lizard || git clone https://github.com/inikep/lizard -b $(LIZ_VER) --depth=1 lizard
test -d brotli || git clone https://github.com/google/brotli -b $(BRO_VER) --depth=1 brotli
test -d snappy-c || git clone https://github.com/andikleen/snappy-c --depth=1 snappy-c
# cd snappy && cmake CMakeLists.txt && cd ..
test -d lz4 || git clone https://github.com/Cyan4973/lz4 -b $(LZ4_VER) --depth=1 lz4
test -d lz5 || git clone https://github.com/inikep/lz5 -b $(LZ5_VER) --depth=1 lz5
test -d zstd || git clone https://github.com/facebook/zstd -b $(ZSTD_VER) --depth=1 zstd
test -d lizard || git clone https://github.com/inikep/lizard -b $(LIZ_VER) --depth=1 lizard
test -d brotli || git clone https://github.com/google/brotli -b $(BRO_VER) --depth=1 brotli
test -d snappy || git clone https://github.com/andikleen/snappy-c --depth=1 snappy

# tests are unix / linux only
tests:
@dd if=/dev/urandom of=testbytes.raw bs=1M count=10 2>/dev/null
@for m in brotli lizard lz4 lz5 zstd snappy-c ; do \
@for m in brotli lizard lz4 lz5 zstd snappy ; do \
cat testbytes.raw | ./$$m-mt -z > compressed.$$m ; \
cat compressed.$$m | ./$$m-mt -d > testbytes-$$m.raw ; \
cmp testbytes.raw testbytes-$$m.raw && echo "SUCCESS: $$m" || echo "FAILING: $$m" ; \
Expand All @@ -215,8 +214,8 @@ install:

clean:
rm -f $(PRGS)
rm -f unbrotli-mt unlizard-mt unlz4-mt unlz5-mt unzstd-mt unsnappy-c-mt
rm -f brotlicat-mt lizardcat-mt lz4cat-mt lz5cat-mt zstdcat-mt snappy-ccat-mt
rm -f unbrotli-mt unlizard-mt unlz4-mt unlz5-mt unzstd-mt unsnappy-mt
rm -f brotlicat-mt lizardcat-mt lz4cat-mt lz5cat-mt zstdcat-mt snappycat-mt

mrproper: clean
rm -rf brotli lizard lz4 lz5 zstd snappy-c
rm -rf brotli lizard lz4 lz5 zstd snappy
8 changes: 4 additions & 4 deletions programs/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* Copyright (c) 2017 Tino Reichardt
* Copyright (c) 2017 - 2020 Tino Reichardt
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
Expand Down Expand Up @@ -81,16 +81,16 @@ static void panic(const char *msg)

static void version(void)
{
printf("%s version %s, zstdmt v0.4\n"
"\nCopyright (c) 2016 - 2017 Tino Reichardt" "\n"
printf("%s version %s, zstdmt v0.7\n"
"\nCopyright (c) 2016 - 2020 Tino Reichardt" "\n"
"\n", progname, VERSION);
exit(0);
}

static void license(void)
{
printf("\n %s version %s\n"
"\n Copyright (c) 2016 - 2017 Tino Reichardt"
"\n Copyright (c) 2016 - 2020 Tino Reichardt"
"\n "
"\n Redistribution and use in source and binary forms, with or without modification,"
"\n are permitted provided that the following conditions are met:"
Expand Down

0 comments on commit 387885a

Please sign in to comment.