# Maintainer: Alexey Pavlov # Contributor: Renato Silva _realname=libjpeg-turbo pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=3.0.4 pkgrel=2 pkgdesc="JPEG image codec with accelerated baseline compression and decompression (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64') url="https://libjpeg-turbo.virtualgl.org/" msys2_repository_url="https://github.com/libjpeg-turbo/libjpeg-turbo" msys2_pgp_keys_url="https://libjpeg-turbo.org/Downloads/DigitalSignatures" msys2_references=( "cpe: cpe:/a:d.r.commander:libjpeg-turbo" "cpe: cpe:/a:libjpeg-turbo:libjpeg-turbo" ) license=(custom:'BSD-like') depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs") makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-ninja" $( [[ "${CARCH}" == "aarch64" ]] || echo "${MINGW_PACKAGE_PREFIX}-nasm" )) provides=("${MINGW_PACKAGE_PREFIX}-libjpeg") conflicts=("${MINGW_PACKAGE_PREFIX}-libjpeg") replaces=("${MINGW_PACKAGE_PREFIX}-libjpeg") source=(https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/${pkgver}/libjpeg-turbo-${pkgver}.tar.gz{,.sig} "0001-header-compat.mingw.patch" "libjpeg-turbo-1.3.1-libmng-compatibility.patch") sha256sums=('99130559e7d62e8d695f2c0eaeef912c5828d5b84a0537dcb24c9678c9d5b76b' 'SKIP' '166264f617734b33ac55ec8b70e6636d4e409c0d837667afe158e9d28200e6dd' '16336caddc949a8a082f39c218b3289288d144bb3b87f62565ed1b294ff8e526') validpgpkeys=('0338C8D8D9FDA62CF9C421BD7EC2DBB6F4DBF434') prepare() { cd "${srcdir}/${_realname}-${pkgver}" patch -p1 -i ${srcdir}/0001-header-compat.mingw.patch patch -p1 -i ${srcdir}/libjpeg-turbo-1.3.1-libmng-compatibility.patch } build() { mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}" declare -a _extra_config if check_option "debug" "n"; then _extra_config+=("-DCMAKE_BUILD_TYPE=Release") else _extra_config+=("-DCMAKE_BUILD_TYPE=Debug") fi MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ ${MINGW_PREFIX}/bin/cmake \ -GNinja \ -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ ${_extra_config[@]} \ -DWITH_JPEG8=ON \ ../${_realname}-${pkgver} ${MINGW_PREFIX}/bin/cmake.exe --build . } check() { cd "${srcdir}/build-${MSYSTEM}" ${MINGW_PREFIX}/bin/ctest || true } package() { cd "${srcdir}/build-${MSYSTEM}" DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --install . cp "${srcdir}"/${_realname}-${pkgver}/{jinclude,transupp}.h ${pkgdir}${MINGW_PREFIX}/include/ # Licenses # See https://www.libjpeg-turbo.org/About/License cd "${srcdir}/${_realname}-${pkgver}" install -Dm644 README.ijg "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/README.ijg" install -Dm644 README.md "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/README.md" install -Dm644 LICENSE.md "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.md" install -Dm644 simd/nasm/jsimdext.inc "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/simd/jsimdext.inc" }