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
+67-41Lines changed: 67 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,32 @@ in order to make it easier to select or exclude features.
7
7
8
8
#### Building
9
9
10
-
`Makefile` script is provided, supporting all standard [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions),
10
+
`Makefile` script is provided, supporting [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions),
11
11
including commands variables, staged install, directory variables and standard targets.
12
12
-`make` : generates both static and dynamic libraries
13
-
-`make install` : install libraries in default system directories
13
+
-`make install` : install libraries and headers in target system directories
14
14
15
-
`libzstd` default scope includes compression, decompression, dictionary building,
16
-
and decoding support for legacy formats >= v0.5.0.
15
+
`libzstd` default scope is pretty large, including compression, decompression, dictionary builder,
16
+
and support for decoding legacy formats >= v0.5.0.
17
+
The scope can be reduced on demand (see paragraph _modular build_).
18
+
19
+
20
+
#### Multithreading support
21
+
22
+
Multithreading is disabled by default when building with `make`.
23
+
Enabling multithreading requires 2 conditions :
24
+
- set build macro `ZSTD_MULTITHREAD` (`-DZSTD_MULTITHREAD` for `gcc`)
25
+
- for POSIX systems : compile with pthread (`-pthread` compilation flag for `gcc`)
26
+
27
+
Both conditions are automatically applied when invoking `make lib-mt` target.
28
+
29
+
When linking a POSIX program with a multithreaded version of `libzstd`,
30
+
note that it's necessary to request the `-pthread` flag during link stage.
31
+
32
+
Multithreading capabilities are exposed
33
+
via the [advanced API defined in `lib/zstd.h`](https://github.com/facebook/zstd/blob/v1.3.8/lib/zstd.h#L592).
34
+
This API is still labelled experimental,
35
+
but is expected to become "stable" in the near future.
17
36
18
37
19
38
#### API
@@ -26,63 +45,70 @@ Zstandard's stable API is exposed within [lib/zstd.h](zstd.h).
26
45
Optional advanced features are exposed via :
27
46
28
47
-`lib/common/zstd_errors.h` : translates `size_t` function results
29
-
into an `ZSTD_ErrorCode`, for accurate error handling.
48
+
into a `ZSTD_ErrorCode`, for accurate error handling.
49
+
30
50
-`ZSTD_STATIC_LINKING_ONLY` : if this macro is defined _before_ including `zstd.h`,
31
-
it unlocks access to advanced experimental API,
32
-
exposed in second part of `zstd.h`.
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___ !
51
+
it unlocks access to the experimental API,
52
+
exposed in the second part of `zstd.h`.
53
+
All definitions in the experimental APIs are unstable,
54
+
they may still change in the future, or even be removed.
55
+
As a consequence, experimental definitions shall ___never be used with dynamic library___ !
35
56
Only static linking is allowed.
36
57
37
58
38
59
#### Modular build
39
60
40
-
It's possible to compile only a limited set of features.
61
+
It's possible to compile only a limited set of features within `libzstd`.
62
+
The file structure is designed to make this selection manually achievable for any build system :
41
63
42
64
- Directory `lib/common` is always required, for all variants.
65
+
43
66
- Compression source code lies in `lib/compress`
67
+
44
68
- Decompression source code lies in `lib/decompress`
69
+
45
70
- It's possible to include only `compress` or only `decompress`, they don't depend on each other.
71
+
46
72
-`lib/dictBuilder` : makes it possible to generate dictionaries from a set of samples.
47
73
The API is exposed in `lib/dictBuilder/zdict.h`.
48
74
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`.
75
+
76
+
-`lib/legacy` : makes it possible to decompress legacy zstd formats, starting from `v0.1.0`.
50
77
This module depends on `lib/common` and `lib/decompress`.
51
78
To enable this feature, define `ZSTD_LEGACY_SUPPORT` during compilation.
52
79
Specifying a number limits versions supported to that version onward.
53
80
For example, `ZSTD_LEGACY_SUPPORT=2` means : "support legacy formats >= v0.2.0".
54
-
`ZSTD_LEGACY_SUPPORT=3` means : "support legacy formats >= v0.3.0", and so on.
55
-
Currently, the default library setting is `ZST_LEGACY_SUPPORT=5`.
56
-
It can be changed at build by any other value.
57
-
Note that any number >= 8 translates into "do __not__ support legacy formats",
58
-
since all versions of `zstd` >= v0.8 are compatible with v1+ specification.
59
-
`ZSTD_LEGACY_SUPPORT=0` also means "do __not__ support legacy formats".
60
-
Once enabled, this capability is transparently triggered within decompression functions.
61
-
It's also possible to invoke directly legacy API, as exposed in `lib/legacy/zstd_legacy.h`.
62
-
Each version also provides an additional dedicated set of advanced API.
81
+
Conversely, `ZSTD_LEGACY_SUPPORT=0` means "do __not__ support legacy formats".
82
+
By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=5`.
83
+
Decoding supported legacy format is a transparent capability triggered within decompression functions.
84
+
It's also allowed to invoke legacy API directly, exposed in `lib/legacy/zstd_legacy.h`.
85
+
Each version does also provide its own set of advanced API.
63
86
For example, advanced API for version `v0.4` is exposed in `lib/legacy/zstd_v04.h` .
64
-
Note : `lib/legacy` only supports _decoding_ legacy formats.
65
-
- Similarly, you can define `ZSTD_LIB_COMPRESSION, ZSTD_LIB_DECOMPRESSION`, `ZSTD_LIB_DICTBUILDER`,
66
-
and `ZSTD_LIB_DEPRECATED` as 0 to forgo compilation of the corresponding features. This will
67
-
also disable compilation of all dependencies (eg. `ZSTD_LIB_COMPRESSION=0` will also disable
68
-
dictBuilder).
69
87
88
+
- While invoking `make libzstd`, it's possible to define build macros
0 commit comments