#build #static #cargo #helper #meant #compiling #libpng

build libpng-src

Helper package for compiling 'libpng' as a static library. Meant to be used as build dependency only.

3 unstable releases

new 0.2.3 Apr 2, 2024
0.2.2 Mar 31, 2024
0.2.1 Mar 31, 2024
0.2.0 Mar 25, 2024
0.1.0 Mar 24, 2024

#142 in Build Utils

Download history 73/week @ 2024-03-18 243/week @ 2024-03-25 307/week @ 2024-04-01

623 downloads per month
Used in libpng-vendored-sys


73K SLoC

C 55K SLoC // 0.2% comments Shell 9K SLoC // 0.2% comments M4 7.5K SLoC // 0.2% comments AWK 794 SLoC // 0.3% comments Python 413 SLoC // 0.1% comments Automake 276 SLoC // 0.2% comments Rust 267 SLoC // 0.0% comments GNU Style Assembly 205 SLoC // 0.1% comments C++ 145 SLoC // 0.2% comments Batch 66 SLoC // 0.2% comments

Contains (autotools obfuscated code, 510KB) libpng/configure, (Windows DLL, 85KB) win-zlib-test-helper/zlib.dll, (obscure autoconf code, 25KB) libpng/configure.ac, (static library, 18KB) win-zlib-include/zlib.lib


Helper Cargo package for compiling libpng into a static C library. Meant to be used as build dependency for dufferent -sys or -vendored packages. Does not provide directly usable libpng functionality or bindings.

Provided version

Compiles libpng with version 1.6.43. Original source code with the license is provided in libpng folder without any modifications.

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.

Dependenencies for hosts

Doesn't depend on any cargo packages for compilation. Uses CMake and libpng provided shell scripts. Depends on zlib library headers for compilation and dynamic library artifact for testing.



Invoke Cargo via Developer Powershell or Developer Command Prompt for correct work.

macOS and iOS


One of the unit tests invokes CTest (part of CMake) under the hood for testing native code.


  • Support cross-compilation for Android;


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

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

No runtime deps