name=libjpeg-turbo
version=3.0.3
revision=1
tarball_url="https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/${version}.tar.gz"
tarball_blake2b="cbf0ed5cd065ad5d30d9596ddd10ae0c400a885a3c3c46d5ce286cff003b3af2c12ba23f9c3943026e8de2e6f79dd0383b968811929127f317c2c7d91e2b49f7"
imagedeps="gcc ninja python git nasm"
hostdeps="gcc cmake pkg-config"
deps="core-libs"

build() {
    cmake \
        -GNinja \
        -DCMAKE_TOOLCHAIN_FILE=${base_dir}/build-support/CMakeToolchain.txt \
        -DCMAKE_INSTALL_PREFIX=${prefix} \
        -DCMAKE_BUILD_TYPE=Release \
        -DENABLE_STATIC=FALSE \
        -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib \
        -DCMAKE_SYSTEM_PROCESSOR=x86_64 \
        ${source_dir}

    ninja -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" ninja install

    post_package_strip
}
