zstd-sys-2.0.13+zstd.1.5.6/.cargo_vcs_info.json0000644000000001600000000000100143420ustar { "git": { "sha1": "d698082588384693d4dfe726676187c8213c1b19" }, "path_in_vcs": "zstd-safe/zstd-sys" }zstd-sys-2.0.13+zstd.1.5.6/Cargo.lock0000644000000231150000000000100123220ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "bindgen" version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ "bitflags", "cexpr", "clang-sys", "itertools", "lazy_static", "lazycell", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", "syn", "which", ] [[package]] name = "bitflags" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "cc" version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" dependencies = [ "jobserver", "libc", ] [[package]] name = "cexpr" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ "nom", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ "glob", "libc", "libloading", ] [[package]] name = "either" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "errno" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", "windows-sys", ] [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "home" version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ "windows-sys", ] [[package]] name = "itertools" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "jobserver" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", "windows-targets", ] [[package]] name = "linux-raw-sys" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "memchr" version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nom" version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "pkg-config" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "proc-macro2" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] name = "regex" version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys", ] [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "syn" version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "which" version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", "home", "once_cell", "rustix", ] [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "zstd-sys" version = "2.0.13+zstd.1.5.6" dependencies = [ "bindgen", "cc", "pkg-config", ] zstd-sys-2.0.13+zstd.1.5.6/Cargo.toml0000644000000033140000000000100123440ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" rust-version = "1.64" name = "zstd-sys" version = "2.0.13+zstd.1.5.6" authors = ["Alexandre Bury "] build = "build.rs" links = "zstd" include = [ "/LICENSE*", "!/*.sh", "/build.rs", "/*.h", "/src/", "/wasm-shim/**/*.h", "/zstd/LICENSE", "/zstd/COPYING", "/zstd/lib/**/*.c", "/zstd/lib/**/*.h", "/zstd/lib/**/*.S", ] description = "Low-level bindings for the zstd compression library." readme = "Readme.md" keywords = [ "zstd", "zstandard", "compression", ] categories = [ "api-bindings", "compression", ] license = "MIT/Apache-2.0" repository = "https://github.com/gyscos/zstd-rs" [package.metadata.docs.rs] features = ["experimental"] [lib] doctest = false [build-dependencies.bindgen] version = "0.69" features = [ "runtime", "which-rustfmt", ] optional = true default-features = false [build-dependencies.cc] version = "1.0.45" features = ["parallel"] [build-dependencies.pkg-config] version = "0.3" [features] debug = [] default = [ "legacy", "zdict_builder", ] experimental = [] fat-lto = [] legacy = [] no_asm = [] no_wasm_shim = [] non-cargo = [] pkg-config = [] std = [] thin = [] thin-lto = [] zdict_builder = [] zstdmt = [] zstd-sys-2.0.13+zstd.1.5.6/Cargo.toml.orig0000644000000043450000000000100133100ustar [package] authors = ["Alexandre Bury "] build = "build.rs" categories = [ "api-bindings", "compression", ] description = "Low-level bindings for the zstd compression library." keywords = [ "zstd", "zstandard", "compression", ] license = "MIT/Apache-2.0" links = "zstd" name = "zstd-sys" readme = "Readme.md" repository = "https://github.com/gyscos/zstd-rs" version = "2.0.13+zstd.1.5.6" edition = "2018" rust-version = "1.64" # Use include instead of exclude, as a (temporary) # workaround for https://github.com/rust-lang/cargo/issues/9555 include = [ "/LICENSE*", "!/*.sh", "/build.rs", "/*.h", "/src/", "/wasm-shim/**/*.h", "/zstd/LICENSE", "/zstd/COPYING", "/zstd/lib/**/*.c", "/zstd/lib/**/*.h", "/zstd/lib/**/*.S", ] # exclude = [ # "zstd", # "!zstd/LICENSE", # "!zstd/COPYING", # "!zstd/lib/**/**.h", # "!zstd/lib/**/**.c", # ] [package.metadata.docs.rs] features = ["experimental"] [lib] doctest = false # Documentation is for C code, good luck testing that. [build-dependencies.bindgen] optional = true version = "0.69" default-features = false features = ["runtime", "which-rustfmt"] [build-dependencies.pkg-config] version = "0.3" [build-dependencies.cc] version = "1.0.45" features = ["parallel"] [features] default = ["legacy", "zdict_builder"] debug = [] # Enable zstd debug logs experimental = [] # Expose experimental ZSTD API legacy = [] # Enable legacy ZSTD support (for versions < zstd-0.8) non-cargo = [] # Silence cargo-specific build flags pkg-config = [] # Use pkg-config to build the zstd C library. std = [] # Deprecated: we never use types from std. zstdmt = [] # Enable multi-thread support (with pthread) thin = [] # Optimize binary by size no_asm = [] # Disable ASM files (only on amd64 for decompression) zdict_builder = [] # Enable dictionary building (dictionary _using_ is always supported). no_wasm_shim = [] # Disable wasm shims (in case your wasm toolchain includes a C stdlib). # These two are for cross-language LTO. # Will only work if `clang` is used to build the C library. fat-lto = [] # Enable fat-lto, will override thin-lto if specified thin-lto = [] # Enable thin-lto, will fallback to fat-lto if not supported zstd-sys-2.0.13+zstd.1.5.6/Cargo.toml.orig000064400000000000000000000043451046102023000160320ustar 00000000000000[package] authors = ["Alexandre Bury "] build = "build.rs" categories = [ "api-bindings", "compression", ] description = "Low-level bindings for the zstd compression library." keywords = [ "zstd", "zstandard", "compression", ] license = "MIT/Apache-2.0" links = "zstd" name = "zstd-sys" readme = "Readme.md" repository = "https://github.com/gyscos/zstd-rs" version = "2.0.13+zstd.1.5.6" edition = "2018" rust-version = "1.64" # Use include instead of exclude, as a (temporary) # workaround for https://github.com/rust-lang/cargo/issues/9555 include = [ "/LICENSE*", "!/*.sh", "/build.rs", "/*.h", "/src/", "/wasm-shim/**/*.h", "/zstd/LICENSE", "/zstd/COPYING", "/zstd/lib/**/*.c", "/zstd/lib/**/*.h", "/zstd/lib/**/*.S", ] # exclude = [ # "zstd", # "!zstd/LICENSE", # "!zstd/COPYING", # "!zstd/lib/**/**.h", # "!zstd/lib/**/**.c", # ] [package.metadata.docs.rs] features = ["experimental"] [lib] doctest = false # Documentation is for C code, good luck testing that. [build-dependencies.bindgen] optional = true version = "0.69" default-features = false features = ["runtime", "which-rustfmt"] [build-dependencies.pkg-config] version = "0.3" [build-dependencies.cc] version = "1.0.45" features = ["parallel"] [features] default = ["legacy", "zdict_builder"] debug = [] # Enable zstd debug logs experimental = [] # Expose experimental ZSTD API legacy = [] # Enable legacy ZSTD support (for versions < zstd-0.8) non-cargo = [] # Silence cargo-specific build flags pkg-config = [] # Use pkg-config to build the zstd C library. std = [] # Deprecated: we never use types from std. zstdmt = [] # Enable multi-thread support (with pthread) thin = [] # Optimize binary by size no_asm = [] # Disable ASM files (only on amd64 for decompression) zdict_builder = [] # Enable dictionary building (dictionary _using_ is always supported). no_wasm_shim = [] # Disable wasm shims (in case your wasm toolchain includes a C stdlib). # These two are for cross-language LTO. # Will only work if `clang` is used to build the C library. fat-lto = [] # Enable fat-lto, will override thin-lto if specified thin-lto = [] # Enable thin-lto, will fallback to fat-lto if not supported zstd-sys-2.0.13+zstd.1.5.6/LICENSE000064400000000000000000000000221046102023000141340ustar 00000000000000MIT or Apache-2.0 zstd-sys-2.0.13+zstd.1.5.6/LICENSE.Apache-2.0000064400000000000000000000236761046102023000156350ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS zstd-sys-2.0.13+zstd.1.5.6/LICENSE.Mit000064400000000000000000000020701046102023000146710ustar 00000000000000The MIT License (MIT) Copyright (c) 2016 Alexandre Bury Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. zstd-sys-2.0.13+zstd.1.5.6/Readme.md000064400000000000000000000016471046102023000146640ustar 00000000000000# zstd-sys This is the low-level auto-generated binding to the [zstd] library. You probably don't want to use this library directly; instead, look at [zstd-rs] or [zstd-safe]. # Compile it yourself `zstd` is included as a submodule. To get everything during your clone, use: ``` git clone https://github.com/gyscos/zstd-rs --recursive ``` Or, if you cloned it without the `--recursive` flag, call this from inside the repository: ``` git submodule update --init ``` Then, running `cargo build` in this directory should take care of building the C library and linking to it. # Build-time bindgen This library includes a pre-generated `bindings.rs` file. You can also generate new bindings at build-time, using the `bindgen` feature: ``` cargo build --features bindgen ``` [zstd]: https://github.com/facebook/zstd [zstd-rs]: https://github.com/gyscos/zstd-rs [zstd-safe]: https://github.com/gyscos/zstd-rs/tree/main/zstd-safe zstd-sys-2.0.13+zstd.1.5.6/build.rs000064400000000000000000000225051046102023000146060ustar 00000000000000use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::{env, fmt, fs}; #[cfg(feature = "bindgen")] fn generate_bindings(defs: Vec<&str>, headerpaths: Vec) { let bindings = bindgen::Builder::default().header("zstd.h"); #[cfg(feature = "zdict_builder")] let bindings = bindings.header("zdict.h"); let bindings = bindings .blocklist_type("max_align_t") .size_t_is_usize(true) .use_core() .rustified_enum(".*") .clang_args( headerpaths .into_iter() .map(|path| format!("-I{}", path.display())), ) .clang_args(defs.into_iter().map(|def| format!("-D{}", def))); #[cfg(feature = "experimental")] let bindings = bindings .clang_arg("-DZSTD_STATIC_LINKING_ONLY") .clang_arg("-DZDICT_STATIC_LINKING_ONLY") .clang_arg("-DZSTD_RUST_BINDINGS_EXPERIMENTAL"); #[cfg(not(feature = "std"))] let bindings = bindings.ctypes_prefix("libc"); let bindings = bindings.generate().expect("Unable to generate bindings"); let out_path = PathBuf::from(env::var_os("OUT_DIR").unwrap()); bindings .write_to_file(out_path.join("bindings.rs")) .expect("Could not write bindings"); } #[cfg(not(feature = "bindgen"))] fn generate_bindings(_: Vec<&str>, _: Vec) {} fn pkg_config() -> (Vec<&'static str>, Vec) { let library = pkg_config::Config::new() .statik(true) .cargo_metadata(!cfg!(feature = "non-cargo")) .probe("libzstd") .expect("Can't probe for zstd in pkg-config"); (vec!["PKG_CONFIG"], library.include_paths) } #[cfg(not(feature = "legacy"))] fn set_legacy(_config: &mut cc::Build) {} #[cfg(feature = "legacy")] fn set_legacy(config: &mut cc::Build) { config.define("ZSTD_LEGACY_SUPPORT", Some("1")); config.include("zstd/lib/legacy"); } #[cfg(feature = "zstdmt")] fn set_pthread(config: &mut cc::Build) { config.flag("-pthread"); } #[cfg(not(feature = "zstdmt"))] fn set_pthread(_config: &mut cc::Build) {} #[cfg(feature = "zstdmt")] fn enable_threading(config: &mut cc::Build) { config.define("ZSTD_MULTITHREAD", Some("")); } #[cfg(not(feature = "zstdmt"))] fn enable_threading(_config: &mut cc::Build) {} /// This function would find the first flag in `flags` that is supported /// and add that to `config`. #[allow(dead_code)] fn flag_if_supported_with_fallbacks(config: &mut cc::Build, flags: &[&str]) { let option = flags .iter() .find(|flag| config.is_flag_supported(flag).unwrap_or_default()); if let Some(flag) = option { config.flag(flag); } } fn compile_zstd() { let mut config = cc::Build::new(); // Search the following directories for C files to add to the compilation. for dir in &[ "zstd/lib/common", "zstd/lib/compress", "zstd/lib/decompress", #[cfg(feature = "zdict_builder")] "zstd/lib/dictBuilder", #[cfg(feature = "legacy")] "zstd/lib/legacy", ] { let mut entries: Vec<_> = fs::read_dir(dir) .unwrap() .map(Result::unwrap) .filter_map(|entry| { let filename = entry.file_name(); if Path::new(&filename).extension() == Some(OsStr::new("c")) // Skip xxhash*.c files: since we are using the "PRIVATE API" // mode, it will be inlined in the headers. && !filename.to_string_lossy().contains("xxhash") { Some(entry.path()) } else { None } }) .collect(); entries.sort(); config.files(entries); } // Either include ASM files, or disable ASM entirely. // Also disable it on windows, apparently it doesn't do well with these .S files at the moment. if cfg!(feature = "no_asm") || std::env::var("CARGO_CFG_WINDOWS").is_ok() { config.define("ZSTD_DISABLE_ASM", Some("")); } else { config.file("zstd/lib/decompress/huf_decompress_amd64.S"); } // List out the WASM targets that need wasm-shim. // Note that Emscripten already provides its own C standard library so // wasm32-unknown-emscripten should not be included here. // See: https://github.com/gyscos/zstd-rs/pull/209 let need_wasm_shim = !cfg!(feature = "no_wasm_shim") && env::var("TARGET").map_or(false, |target| { target == "wasm32-unknown-unknown" || target.starts_with("wasm32-wasi") }); if need_wasm_shim { cargo_print(&"rerun-if-changed=wasm-shim/stdlib.h"); cargo_print(&"rerun-if-changed=wasm-shim/string.h"); config.include("wasm-shim/"); } // Some extra parameters config.include("zstd/lib/"); config.include("zstd/lib/common"); config.warnings(false); config.define("ZSTD_LIB_DEPRECATED", Some("0")); config .flag_if_supported("-ffunction-sections") .flag_if_supported("-fdata-sections") .flag_if_supported("-fmerge-all-constants"); if cfg!(feature = "fat-lto") { config.flag_if_supported("-flto"); } else if cfg!(feature = "thin-lto") { flag_if_supported_with_fallbacks( &mut config, &["-flto=thin", "-flto"], ); } #[cfg(feature = "thin")] { // Here we try to build a lib as thin/small as possible. // We cannot use ZSTD_LIB_MINIFY since it is only // used in Makefile to define other options. config .define("HUF_FORCE_DECOMPRESS_X1", Some("1")) .define("ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT", Some("1")) .define("ZSTD_NO_INLINE", Some("1")) // removes the error messages that are // otherwise returned by ZSTD_getErrorName .define("ZSTD_STRIP_ERROR_STRINGS", Some("1")); // Disable use of BMI2 instructions since it involves runtime checking // of the feature and fallback if no BMI2 instruction is detected. config.define("DYNAMIC_BMI2", Some("0")); // Disable support for all legacy formats #[cfg(not(feature = "legacy"))] config.define("ZSTD_LEGACY_SUPPORT", Some("0")); config.opt_level_str("z"); } // Hide symbols from resulting library, // so we can be used with another zstd-linking lib. // See https://github.com/gyscos/zstd-rs/issues/58 config.flag("-fvisibility=hidden"); config.define("XXH_PRIVATE_API", Some("")); config.define("ZSTDLIB_VISIBILITY", Some("")); #[cfg(feature = "zdict_builder")] config.define("ZDICTLIB_VISIBILITY", Some("")); config.define("ZSTDERRORLIB_VISIBILITY", Some("")); // https://github.com/facebook/zstd/blob/d69d08ed6c83563b57d98132e1e3f2487880781e/lib/common/debug.h#L60 /* recommended values for DEBUGLEVEL : * 0 : release mode, no debug, all run-time checks disabled * 1 : enables assert() only, no display * 2 : reserved, for currently active debug path * 3 : events once per object lifetime (CCtx, CDict, etc.) * 4 : events once per frame * 5 : events once per block * 6 : events once per sequence (verbose) * 7+: events at every position (*very* verbose) */ #[cfg(feature = "debug")] if !is_wasm { config.define("DEBUGLEVEL", Some("5")); } set_pthread(&mut config); set_legacy(&mut config); enable_threading(&mut config); // Compile! config.compile("libzstd.a"); let src = env::current_dir().unwrap().join("zstd").join("lib"); let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); let include = dst.join("include"); fs::create_dir_all(&include).unwrap(); fs::copy(src.join("zstd.h"), include.join("zstd.h")).unwrap(); fs::copy(src.join("zstd_errors.h"), include.join("zstd_errors.h")) .unwrap(); #[cfg(feature = "zdict_builder")] fs::copy(src.join("zdict.h"), include.join("zdict.h")).unwrap(); cargo_print(&format_args!("root={}", dst.display())); } /// Print a line for cargo. /// /// If non-cargo is set, do not print anything. fn cargo_print(content: &dyn fmt::Display) { if cfg!(not(feature = "non-cargo")) { println!("cargo:{}", content); } } fn main() { cargo_print(&"rerun-if-env-changed=ZSTD_SYS_USE_PKG_CONFIG"); let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); if target_arch == "wasm32" || target_os == "hermit" { cargo_print(&"rustc-cfg=feature=\"std\""); } // println!("cargo:rustc-link-lib=zstd"); let (defs, headerpaths) = if cfg!(feature = "pkg-config") || env::var_os("ZSTD_SYS_USE_PKG_CONFIG").is_some() { pkg_config() } else { if !Path::new("zstd/lib").exists() { panic!("Folder 'zstd/lib' does not exists. Maybe you forgot to clone the 'zstd' submodule?"); } let manifest_dir = PathBuf::from( env::var_os("CARGO_MANIFEST_DIR") .expect("Manifest dir is always set by cargo"), ); compile_zstd(); (vec![], vec![manifest_dir.join("zstd/lib")]) }; let includes: Vec<_> = headerpaths .iter() .map(|p| p.display().to_string()) .collect(); cargo_print(&format_args!("include={}", includes.join(";"))); generate_bindings(defs, headerpaths); } zstd-sys-2.0.13+zstd.1.5.6/src/lib.rs000064400000000000000000000017501046102023000150430ustar 00000000000000#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![no_std] //! Low-level bindings to the [zstd] library. //! //! [zstd]: https://facebook.github.io/zstd/ #[cfg(target_arch = "wasm32")] extern crate alloc; #[cfg(target_arch = "wasm32")] mod wasm_shim; // If running bindgen, we'll end up with the correct bindings anyway. #[cfg(feature = "bindgen")] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); // The bindings used depend on a few feature flags. #[cfg(all(not(feature = "experimental"), not(feature = "bindgen")))] include!("bindings_zstd.rs"); #[cfg(all( not(feature = "experimental"), feature = "zdict_builder", not(feature = "bindgen") ))] include!("bindings_zdict.rs"); #[cfg(all(feature = "experimental", not(feature = "bindgen")))] include!("bindings_zstd_experimental.rs"); #[cfg(all( feature = "experimental", feature = "zdict_builder", not(feature = "bindgen") ))] include!("bindings_zdict_experimental.rs"); zstd-sys-2.0.13+zstd.1.5.6/src/wasm_shim.rs000064400000000000000000000102301046102023000162550ustar 00000000000000use alloc::alloc::{alloc, alloc_zeroed, dealloc, Layout}; use core::ffi::{c_int, c_void}; const USIZE_ALIGN: usize = core::mem::align_of::(); const USIZE_SIZE: usize = core::mem::size_of::(); #[no_mangle] pub extern "C" fn rust_zstd_wasm_shim_qsort( base: *mut c_void, n_items: usize, size: usize, compar: extern "C" fn(*const c_void, *const c_void) -> c_int, ) { unsafe { match size { 1 => qsort::<1>(base, n_items, compar), 2 => qsort::<2>(base, n_items, compar), 4 => qsort::<4>(base, n_items, compar), 8 => qsort::<8>(base, n_items, compar), 16 => qsort::<16>(base, n_items, compar), _ => panic!("Unsupported qsort item size"), } } } unsafe fn qsort( base: *mut c_void, n_items: usize, compar: extern "C" fn(*const c_void, *const c_void) -> c_int, ) { let base: &mut [[u8; N]] = core::slice::from_raw_parts_mut(base as *mut [u8; N], n_items); base.sort_unstable_by(|a, b| { match compar(a.as_ptr() as *const c_void, b.as_ptr() as *const c_void) { ..=-1 => core::cmp::Ordering::Less, 0 => core::cmp::Ordering::Equal, 1.. => core::cmp::Ordering::Greater, } }); } #[no_mangle] pub extern "C" fn rust_zstd_wasm_shim_malloc(size: usize) -> *mut c_void { wasm_shim_alloc::(size) } #[no_mangle] pub extern "C" fn rust_zstd_wasm_shim_memcmp( str1: *const c_void, str2: *const c_void, n: usize, ) -> i32 { // Safety: function contracts requires str1 and str2 at least `n`-long. unsafe { let str1: &[u8] = core::slice::from_raw_parts(str1 as *const u8, n); let str2: &[u8] = core::slice::from_raw_parts(str2 as *const u8, n); match str1.cmp(str2) { core::cmp::Ordering::Less => -1, core::cmp::Ordering::Equal => 0, core::cmp::Ordering::Greater => 1, } } } #[no_mangle] pub extern "C" fn rust_zstd_wasm_shim_calloc( nmemb: usize, size: usize, ) -> *mut c_void { // note: calloc expects the allocation to be zeroed wasm_shim_alloc::(nmemb * size) } #[inline] fn wasm_shim_alloc(size: usize) -> *mut c_void { // in order to recover the size upon free, we store the size below the allocation // special alignment is never requested via the malloc API, // so it's not stored, and usize-alignment is used // memory layout: [size] [allocation] let full_alloc_size = size + USIZE_SIZE; unsafe { let layout = Layout::from_size_align_unchecked(full_alloc_size, USIZE_ALIGN); let ptr = if ZEROED { alloc_zeroed(layout) } else { alloc(layout) }; // SAFETY: ptr is usize-aligned and we've allocated sufficient memory ptr.cast::().write(full_alloc_size); ptr.add(USIZE_SIZE).cast() } } #[no_mangle] pub unsafe extern "C" fn rust_zstd_wasm_shim_free(ptr: *mut c_void) { // the layout for the allocation needs to be recovered for dealloc // - the size must be recovered from directly below the allocation // - the alignment will always by USIZE_ALIGN let alloc_ptr = ptr.sub(USIZE_SIZE); // SAFETY: the allocation routines must uphold having a valid usize below the provided pointer let full_alloc_size = alloc_ptr.cast::().read(); let layout = Layout::from_size_align_unchecked(full_alloc_size, USIZE_ALIGN); dealloc(alloc_ptr.cast(), layout); } #[no_mangle] pub unsafe extern "C" fn rust_zstd_wasm_shim_memcpy( dest: *mut c_void, src: *const c_void, n: usize, ) -> *mut c_void { core::ptr::copy_nonoverlapping(src as *const u8, dest as *mut u8, n); dest } #[no_mangle] pub unsafe extern "C" fn rust_zstd_wasm_shim_memmove( dest: *mut c_void, src: *const c_void, n: usize, ) -> *mut c_void { core::ptr::copy(src as *const u8, dest as *mut u8, n); dest } #[no_mangle] pub unsafe extern "C" fn rust_zstd_wasm_shim_memset( dest: *mut c_void, c: c_int, n: usize, ) -> *mut c_void { core::ptr::write_bytes(dest as *mut u8, c as u8, n); dest } zstd-sys-2.0.13+zstd.1.5.6/wasm-shim/assert.h000064400000000000000000000001171046102023000165130ustar 00000000000000#ifndef _ASSERT_H #define _ASSERT_H #define assert(expr) #endif // _ASSERT_H zstd-sys-2.0.13+zstd.1.5.6/wasm-shim/stdio.h000064400000000000000000000001771046102023000163420ustar 00000000000000#include #ifndef _STDIO_H #define _STDIO_H 1 #define fprintf(expr, ...) #define fflush(expr) #endif // _STDIO_H zstd-sys-2.0.13+zstd.1.5.6/wasm-shim/stdlib.h000064400000000000000000000012071046102023000164740ustar 00000000000000#include #ifndef _STDLIB_H #define _STDLIB_H 1 void* rust_zstd_wasm_shim_malloc(size_t size); void* rust_zstd_wasm_shim_calloc(size_t nmemb, size_t size); void rust_zstd_wasm_shim_free(void* ptr); void rust_zstd_wasm_shim_qsort(void* base, size_t nitems, size_t size, int (*compar)(const void*, const void*)); #define malloc(size) rust_zstd_wasm_shim_malloc(size) #define calloc(nmemb, size) rust_zstd_wasm_shim_calloc(nmemb, size) #define free(ptr) rust_zstd_wasm_shim_free(ptr) #define qsort(base, nitems, size, compar) \ rust_zstd_wasm_shim_qsort(base, nitems, size, compar) #endif // _STDLIB_H zstd-sys-2.0.13+zstd.1.5.6/wasm-shim/string.h000064400000000000000000000015341046102023000165240ustar 00000000000000#include #ifndef _STRING_H #define _STRING_H 1 int rust_zstd_wasm_shim_memcmp(const void *str1, const void *str2, size_t n); void *rust_zstd_wasm_shim_memcpy(void *restrict dest, const void *restrict src, size_t n); void *rust_zstd_wasm_shim_memmove(void *dest, const void *src, size_t n); void *rust_zstd_wasm_shim_memset(void *dest, int c, size_t n); inline int memcmp(const void *str1, const void *str2, size_t n) { return rust_zstd_wasm_shim_memcmp(str1, str2, n); } inline void *memcpy(void *restrict dest, const void *restrict src, size_t n) { return rust_zstd_wasm_shim_memcpy(dest, src, n); } inline void *memmove(void *dest, const void *src, size_t n) { return rust_zstd_wasm_shim_memmove(dest, src, n); } inline void *memset(void *dest, int c, size_t n) { return rust_zstd_wasm_shim_memset(dest, c, n); } #endif // _STRING_H zstd-sys-2.0.13+zstd.1.5.6/wasm-shim/time.h000064400000000000000000000003451046102023000161530ustar 00000000000000#ifndef _TIME_H #define _TIME_H #define CLOCKS_PER_SEC 1000 typedef unsigned long long clock_t; // Clock is just use for progress reporting, which we disable anyway. inline clock_t clock() { return 0; } #endif // _TIME_H zstd-sys-2.0.13+zstd.1.5.6/zdict.h000064400000000000000000000006171046102023000144270ustar 00000000000000#ifdef PKG_CONFIG /* Just use installed headers */ #include // Don't use experimental features like zstdmt #else // #ifdef PKG_CONFIG #include "zstd/lib/zdict.h" #endif // #ifdef PKG_CONFIG /* This file is used to generate bindings for both headers. * Check update_bindings.sh to see how to use it. * Or use the `bindgen` feature, which will create the bindings automatically. */ zstd-sys-2.0.13+zstd.1.5.6/zstd.h000064400000000000000000000011111046102023000142640ustar 00000000000000#ifdef PKG_CONFIG /* Just use installed headers */ #include #ifdef ZSTD_RUST_BINDINGS_EXPERIMENTAL #include #endif // #ifdef ZSTD_RUST_BINDINGS_EXPERIMENTAL #else // #ifdef PKG_CONFIG #include "zstd/lib/zstd.h" #ifdef ZSTD_RUST_BINDINGS_EXPERIMENTAL #include "zstd/lib/zstd_errors.h" #endif // #ifdef ZSTD_RUST_BINDINGS_EXPERIMENTAL #endif // #ifdef PKG_CONFIG /* This file is used to generate bindings for both headers. * Check update_bindings.sh to see how to use it. * Or use the `bindgen` feature, which will create the bindings automatically. */