# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=sassc
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.6.2
pkgrel=1
pkgdesc="C implementation of Sass CSS preprocessor (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://sass-lang.com/libsass#sassc"
msys2_repository_url="https://github.com/sass/sassc"
msys2_references=(
  "cpe: cpe:/a:sass-lang:sassc"
)
license=("spdx:MIT")
depends=("${MINGW_PACKAGE_PREFIX}-libsass")
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/sass/${_realname}/archive/${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('608dc9002b45a91d11ed59e352469ecc05e4f58fc1259fc9a9f5b8f0f8348a03')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  autoreconf -vfi
}

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}

  make
}

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

  make DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/LICENSE \
    "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}
