#!/bin/bash

pkgname="zlib"
pkgver="1.2.11"

src="https://zlib.net/zlib-${pkgver}.tar.gz"

prepare () {
    [ -f "${pkgname}-src.tar.gz" ] || curl -o "${pkgname}-src.tar.gz" "${src}"
    tar -C "${srcdir}" -xvf "${pkgname}-src.tar.gz"
}

build () {
    cd "${srcdir}/${pkgname}-${pkgver}"
    mkdir build && cd build

    ../configure \
        --prefix=/usr

    make
}

package () {
    cd "${srcdir}/${pkgname}-${pkgver}/build"

    make DESTDIR="${pkgdir}" install
}

. ../common.sh