#png #image-processing #static #bindings #rudimentary #libpng #vendoring

sys libpng-vendored-sys

Helper package for vendoring 'libpng' as a static library with rudimentary FFI bindings

3 releases

0.1.2 Apr 2, 2024
0.1.1 Mar 31, 2024
0.1.0 Mar 31, 2024

#902 in Images

Download history 24/week @ 2024-09-22

99 downloads per month

MIT/Apache

545KB
10K SLoC

C 5.5K SLoC // 0.2% comments Rust 2.5K SLoC // 0.0% comments Shell 887 SLoC // 0.2% comments M4 748 SLoC // 0.2% comments AWK 79 SLoC // 0.3% comments Python 41 SLoC // 0.1% comments Automake 27 SLoC // 0.2% comments GNU Style Assembly 20 SLoC // 0.1% comments C++ 14 SLoC // 0.1% comments Batch 6 SLoC

libpng-vendored-sys

Cargo package for compiling libpng and vendoring it as static library.

Main goal of the package is providing static library for linking with other C code, like versions of Leptonica. This package provides just rudimentary FFI bindings. More sophisticated bindings would be proveded in separate package. If you need to bind libpng with the Rust code directly, you should write your own bindings.

Provided version

Compiles and vendors libpng with version 1.6.43 via libpng-src.

Currenlly supported OS and targets

Expected to work for:

  • Linux: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu (no cross-compilation supported yet)
  • Windows: x86_64-pc-windows-msvc, aarch644-pc-windows-msvc (no cross-compilation supported yet)
  • macOS: x86_64-apple-darwin, aarch64-apple-darwin
  • iOS, including simulators (cross-compilation from macOS host): x86_64-apple-ios, aarch64-apple-ios, aarch64-apple-ios-sim

Tested before upload for all the targets, except aarch64-unknown-linux-gnu and aarch64-pc-windows-msvc.

zlib / libz-sys dependency

libpng itself depends on zlib (or libz) C library. The package allows linking with zlib in three different ways which are distinguished by fatures:

  1. link-libz or default feature. Uses zlib-sys package with default features. zlib would look for system-provided version of zlib and link with it dynamically or statically. Usually it's enough, but if your end cargo library is build statically, it may leave zlib unlinked.
  2. link-libz-static feature. This feature forces libz-sys crate to link statically in all cases. Covers more use cases, but increases artifact size.
  3. Use --no-default-features with manual zlib / libz linking in Cargo build script or via native tools.

Dependenencies for hosts

See libpng-src.

TODO

  • Support cross-compilation for Android;

Authors

Rust code and scripts: Alexandr (Alex) Lambov alex.lambov.md@gmail.com, © 2024

libpng - see http://www.libpng.org/pub/png/libpng.html

Dependencies

~0.4–260KB