redox/recipes/libs/zlib/recipe.toml
2026-11-01 21:35:15 +07:00

38 lines
1.3 KiB
TOML

# zlib-rs is compatible with zlib
[source]
tar = "https://github.com/trifectatechfoundation/zlib-rs/archive/refs/tags/v0.6.8.tar.gz"
blake3 = "933487029f0a79a923545d60e3828da151194fcbff521acccecfb128ca738ee9"
[build]
template = "custom"
compiler = "no-lto"
script = """
# the dynamic and static lib must exist
COOKBOOK_SOURCE+="/libz-rs-sys-cdylib"
COOKBOOK_CARGO_FLAGS+=(
--no-default-features --features "c-allocator,std,gz,gzprintf"
)
# NOTE: relocation-model=pic is the default on linux and redox,
# it is required by libz-sys as zlib statically linked there
"${COOKBOOK_CARGO}" build \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
${build_flags} -j "${COOKBOOK_MAKE_JOBS}" \
"${COOKBOOK_CARGO_FLAGS[@]}"
mkdir -p "${COOKBOOK_STAGE}/usr/lib/pkgconfig" "${COOKBOOK_STAGE}/usr/include"
cp "./target/$TARGET/$build_type/libz_rs.a" "${COOKBOOK_STAGE}/usr/lib/libz.a"
cp "${COOKBOOK_SOURCE}/include"/*.h "${COOKBOOK_STAGE}/usr/include/"
cp "${COOKBOOK_RECIPE}/zlib.pc" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/"
DYNAMIC_INIT
if [ "${COOKBOOK_DYNAMIC}" = "1" ]; then
"${COOKBOOK_CARGO}" build \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
${build_flags} -j "${COOKBOOK_MAKE_JOBS}" \
"${COOKBOOK_CARGO_FLAGS[@]}"
cp "./target/$TARGET/$build_type/libz_rs.so" "${COOKBOOK_STAGE}/usr/lib/libz.so"
fi
"""