Switch from zlib-ng to zlib-rs

zlib-rs provides the same performance as zlib-ng with minedmap, while
reducing the amount of C code and avoiding the external build dependency
on CMake.
This commit is contained in:
Matthias Schiffer 2025-02-28 12:12:58 +01:00
parent 40bc6cd2a9
commit f8c8ca78ba
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
6 changed files with 21 additions and 27 deletions

View file

@ -45,6 +45,10 @@
- Unknown biome types (from not yet supported or modded versions of Minecraft) - Unknown biome types (from not yet supported or modded versions of Minecraft)
will now use plains biome colors as a fallback instead of resulting in water, will now use plains biome colors as a fallback instead of resulting in water,
grass and foliage blocks to be rendered as transparent pixels grass and foliage blocks to be rendered as transparent pixels
- Switched from zlib-ng to zlib-rs
This should have no noticable effect on the usage of MinedMap, but avoids
an external build dependency on CMake.
## [2.4.0] - 2025-01-11 ## [2.4.0] - 2025-01-11

27
Cargo.lock generated
View file

@ -212,15 +212,6 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
[[package]]
name = "cmake"
version = "0.1.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
version = "1.0.3" version = "1.0.3"
@ -364,7 +355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"libz-ng-sys", "libz-rs-sys",
"miniz_oxide", "miniz_oxide",
] ]
@ -609,13 +600,12 @@ dependencies = [
] ]
[[package]] [[package]]
name = "libz-ng-sys" name = "libz-rs-sys"
version = "1.1.21" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cee1488e961a80d172564fd6fcda11d8a4ac6672c06fe008e9213fa60520c2b" checksum = "902bc563b5d65ad9bba616b490842ef0651066a1a1dc3ce1087113ffcb873c8d"
dependencies = [ dependencies = [
"cmake", "zlib-rs",
"libc",
] ]
[[package]] [[package]]
@ -664,6 +654,7 @@ dependencies = [
"clap", "clap",
"enum-map", "enum-map",
"fastnbt", "fastnbt",
"flate2",
"futures-util", "futures-util",
"git-version", "git-version",
"humantime", "humantime",
@ -1426,6 +1417,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "zlib-rs"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b20717f0917c908dc63de2e44e97f1e6b126ca58d0e391cee86d504eb8fbd05"
[[package]] [[package]]
name = "zstd" name = "zstd"
version = "0.13.3" version = "0.13.3"

View file

@ -42,6 +42,7 @@ bincode = "1.3.3"
clap = { version = "4.1.4", features = ["derive", "wrap_help"] } clap = { version = "4.1.4", features = ["derive", "wrap_help"] }
enum-map = "2.7.3" enum-map = "2.7.3"
fastnbt = "2.3.2" fastnbt = "2.3.2"
flate2 = { version = "1.1.0", features = ["zlib-rs"] }
futures-util = "0.3.28" futures-util = "0.3.28"
git-version = "0.3.5" git-version = "0.3.5"
humantime = "2.1.0" humantime = "2.1.0"
@ -67,7 +68,6 @@ tracing-subscriber = "0.3.17"
zstd = "0.13.0" zstd = "0.13.0"
[features] [features]
default = ["jemalloc-auto", "zlib-ng"] default = ["jemalloc-auto"]
jemalloc-auto = ["dep:minedmap-default-alloc"] jemalloc-auto = ["dep:minedmap-default-alloc"]
jemalloc = ["jemalloc-auto", "minedmap-default-alloc/jemalloc"] jemalloc = ["jemalloc-auto", "minedmap-default-alloc/jemalloc"]
zlib-ng = ["minedmap-nbt/zlib-ng"]

View file

@ -1,7 +1,7 @@
FROM docker.io/library/alpine:latest AS builder FROM docker.io/library/alpine:latest AS builder
WORKDIR /build WORKDIR /build
RUN apk add --no-cache build-base cmake cargo RUN apk add --no-cache build-base cargo
ARG MINEDMAP_VERSION ARG MINEDMAP_VERSION

View file

@ -117,11 +117,6 @@ or newer). The following command can be used to build the current development ve
cargo install --git 'https://github.com/neocturne/MinedMap.git' cargo install --git 'https://github.com/neocturne/MinedMap.git'
``` ```
In addition, CMake is needed to build the zlib-ng library. If you do not have
CMake installed, you can disable the zlib-ng feature by passing `--no-default-features`
to cargo. A pure-Rust zlib implementation will be used, which is more portable,
but slower than zlib-ng.
If you are looking for the older C++ implementation of the MinedMap tile renderer, If you are looking for the older C++ implementation of the MinedMap tile renderer,
see the [v1.19.1](https://github.com/neocturne/MinedMap/tree/v1.19.1) tag. see the [v1.19.1](https://github.com/neocturne/MinedMap/tree/v1.19.1) tag.

View file

@ -11,12 +11,10 @@ repository.workspace = true
anyhow = "1.0.75" anyhow = "1.0.75"
bytemuck = "1.13.1" bytemuck = "1.13.1"
fastnbt = "2.4.4" fastnbt = "2.4.4"
flate2 = "1.0.27" flate2 = "1.1.0"
minedmap-types = { version = "0.1.4", path = "../types" } minedmap-types = { version = "0.1.4", path = "../types" }
serde = "1.0.183" serde = "1.0.183"
[features]
zlib-ng = ["flate2/zlib-ng"]
[dev-dependencies] [dev-dependencies]
clap = { version = "4.3.23", features = ["derive"] } clap = { version = "4.3.23", features = ["derive"] }
flate2 = { version = "1.1.0", features = ["zlib-rs"] }