You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ext/zstdruby/libzstd/README.md
+32-25Lines changed: 32 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,19 @@ Zstandard library files
2
2
================================
3
3
4
4
The __lib__ directory is split into several sub-directories,
5
-
in order to make it easier to select or exclude specific features.
5
+
in order to make it easier to select or exclude features.
6
6
7
7
8
8
#### Building
9
9
10
-
`Makefile` script is provided, supporting the standard set of commands,
11
-
directories, and variables (see https://www.gnu.org/prep/standards/html_node/Command-Variables.html).
10
+
`Makefile` script is provided, supporting all standard [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions),
11
+
including commands variables, staged install, directory variables and standard targets.
12
12
-`make` : generates both static and dynamic libraries
13
13
-`make install` : install libraries in default system directories
14
14
15
+
`libzstd` default scope includes compression, decompression, dictionary building,
16
+
and decoding support for legacy formats >= v0.4.0.
17
+
15
18
16
19
#### API
17
20
@@ -27,49 +30,54 @@ Optional advanced features are exposed via :
27
30
-`ZSTD_STATIC_LINKING_ONLY` : if this macro is defined _before_ including `zstd.h`,
28
31
it unlocks access to advanced experimental API,
29
32
exposed in second part of `zstd.h`.
30
-
These APIs shall ___never be used with dynamic library___ !
31
-
They are not "stable", their definition may change in the future.
33
+
These APIs are not "stable", their definition may change in the future.
34
+
As a consequence, it shall ___never be used with dynamic library___ !
32
35
Only static linking is allowed.
33
36
34
37
35
38
#### Modular build
36
39
40
+
It's possible to compile only a limited set of features.
41
+
37
42
- Directory `lib/common` is always required, for all variants.
38
43
- Compression source code lies in `lib/compress`
39
44
- Decompression source code lies in `lib/decompress`
40
45
- It's possible to include only `compress` or only `decompress`, they don't depend on each other.
41
46
-`lib/dictBuilder` : makes it possible to generate dictionaries from a set of samples.
42
-
The API is exposed in `lib/dictBuilder/zdict.h`.
43
-
This module depends on both `lib/common` and `lib/compress` .
44
-
-`lib/legacy` : source code to decompress older zstd formats, starting from `v0.1`.
45
-
This module depends on `lib/common` and `lib/decompress`.
46
-
To enable this feature, it's necessary to define `ZSTD_LEGACY_SUPPORT = 1` during compilation.
47
-
Typically, with `gcc`, add argument `-DZSTD_LEGACY_SUPPORT=1`.
48
-
Using higher number limits the number of version supported.
49
-
For example, `ZSTD_LEGACY_SUPPORT=2` means : "support legacy formats starting from v0.2+".
50
-
The API is exposed in `lib/legacy/zstd_legacy.h`.
51
-
Each version also provides a (dedicated) set of advanced API.
52
-
For example, advanced API for version `v0.4` is exposed in `lib/legacy/zstd_v04.h` .
47
+
The API is exposed in `lib/dictBuilder/zdict.h`.
48
+
This module depends on both `lib/common` and `lib/compress` .
49
+
-`lib/legacy` : source code to decompress legacy zstd formats, starting from `v0.1.0`.
50
+
This module depends on `lib/common` and `lib/decompress`.
51
+
To enable this feature, it's required to define `ZSTD_LEGACY_SUPPORT` during compilation.
52
+
Typically, with `gcc`, add argument `-DZSTD_LEGACY_SUPPORT=1`.
53
+
Using higher number limits versions supported.
54
+
For example, `ZSTD_LEGACY_SUPPORT=2` means : "support legacy formats >= v0.2.0".
55
+
`ZSTD_LEGACY_SUPPORT=3` means : "support legacy formats >= v0.3.0", and so on.
56
+
Starting v0.8.0, all versions of `zstd` produce frames compliant with specification.
57
+
As a consequence, `ZSTD_LEGACY_SUPPORT=8` (or more) doesn't trigger legacy support.
58
+
Also, `ZSTD_LEGACY_SUPPORT=0` means "do __not__ support legacy formats".
59
+
Once enabled, this capability is transparently triggered within decompression functions.
60
+
It's also possible to invoke directly legacy API, as exposed in `lib/legacy/zstd_legacy.h`.
61
+
Each version also provides an additional dedicated set of advanced API.
62
+
For example, advanced API for version `v0.4` is exposed in `lib/legacy/zstd_v04.h` .
63
+
Note : `lib/legacy` only supports _decoding_ legacy formats.
53
64
54
65
55
66
#### Multithreading support
56
67
57
68
Multithreading is disabled by default when building with `make`.
58
69
Enabling multithreading requires 2 conditions :
59
70
- set macro `ZSTD_MULTITHREAD`
60
-
- on POSIX systems : compile with pthread (`-pthread` compilation flag for `gcc` for example)
71
+
- on POSIX systems : compile with pthread (`-pthread` compilation flag for `gcc`)
61
72
62
73
Both conditions are automatically triggered by invoking `make lib-mt` target.
63
74
Note that, when linking a POSIX program with a multithreaded version of `libzstd`,
64
75
it's necessary to trigger `-pthread` flag during link stage.
65
76
66
-
Multithreading capabilities are exposed via :
67
-
- private API `lib/compress/zstdmt_compress.h`.
68
-
Symbols defined in this header are currently exposed in `libzstd`, hence usable.
69
-
Note however that this API is planned to be locked and remain strictly internal in the future.
70
-
- advanced API `ZSTD_compress_generic()`, defined in `lib/zstd.h`, experimental section.
71
-
This API is still considered experimental, but is designed to be labelled "stable" at some point in the future.
72
-
It's the recommended entry point for multi-threading operations.
77
+
Multithreading capabilities are exposed
78
+
via [advanced API `ZSTD_compress_generic()` defined in `lib/zstd.h`](https://github.com/facebook/zstd/blob/dev/lib/zstd.h#L919).
79
+
This API is still considered experimental,
80
+
but is expected to become "stable" at some point in the future.
73
81
74
82
75
83
#### Windows : using MinGW+MSYS to create DLL
@@ -92,7 +100,6 @@ The compiled executable will require ZSTD DLL which is available at `dll\libzstd
92
100
93
101
Obsolete API on their way out are stored in directory `lib/deprecated`.
94
102
At this stage, it contains older streaming prototypes, in `lib/deprecated/zbuff.h`.
95
-
Presence in this directory is temporary.
96
103
These prototypes will be removed in some future version.
97
104
Consider migrating code towards supported streaming API exposed in `zstd.h`.
0 commit comments