package:
  name: libzlib
  version: 1.3.1
  tag:
    - library
    - static_library
    - cmake
source:
  sha256: 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
  url: https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz

build:
  type: static_library
  script: |
    mkdir -p "build"
    pushd "build"
    LDFLAGS="${SIDE_MODULE_LDFLAGS}" emcmake cmake \
      -DBUILD_TESTING=OFF \
      -DBUILD_BENCHMARKS=OFF \
      -DBUILD_DOCUMENTATION=OFF \
      -DCMAKE_C_FLAGS="-fPIC -Wno-deprecated-non-prototype" \
      -DCMAKE_CXX_FLAGS="-fPIC -Wno-deprecated-non-prototype" \
      -DCMAKE_INSTALL_PREFIX=${WASM_LIBRARY_DIR} \
      ../
    emmake make -j ${PYODIDE_JOBS:-3}
    emmake make install
    popd
    # remove shared version of zlib to prevent other libraries using shared version of zlib
    # TODO: remove this after updating zlib version and use ZLIB_BUILD_STATIC flag instead
    rm -rf ${WASM_LIBRARY_DIR}/lib/libz.so
about:
  home: https://zlib.net/
  license: >
    This software is provided 'as-is', without any express or implied warranty.
    In no event will the authors be held liable for any damages arising from the
    use of this software.

    Permission is granted to anyone to use this software for any purpose,
    including commercial applications, and to alter it and redistribute it
    freely, subject to the following restrictions:

    1. The origin of this software must not be misrepresented; you must not
      claim that you wrote the original software. If you use this software in a
      product, an acknowledgment in the product documentation would be
      appreciated but is not required.
    2. Altered source versions must be plainly marked as such, and must not be
      misrepresented as being the original software.
    3. This notice may not be removed or altered from any source distribution.
