# Maintainer: fauxpark <fauxpark@gmail.com>

_realname=libc
_target=avr

pkgbase=mingw-w64-${_target}-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_target}-${_realname}
pkgver=2.1.0
pkgrel=1
pkgdesc='The C runtime library for the AVR family of microcontrollers (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
license=('BSD')
url='https://savannah.nongnu.org/projects/avr-libc/'
options=(!strip)
groups=("${MINGW_PACKAGE_PREFIX}-${_target}-toolchain")
depends=("${MINGW_PACKAGE_PREFIX}-${_target}-gcc")
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools")
source=(https://download.savannah.gnu.org/releases/${_target}-${_realname}/${_target}-${_realname}-${pkgver}.tar.bz2{,.sig})
sha256sums=('0b84cee5c08b5d5cba67c36125e5aaa85251bc9accfba5773bfa87bc34b654e8'
            'SKIP')
validpgpkeys=('56628323218C669FF578705C7E9EADC3030D34EB')

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

    CC=avr-gcc
    ../${_target}-${_realname}-${pkgver}/configure \
        --build=${MINGW_CHOST} \
        --host=${_target} \
        --prefix=${MINGW_PREFIX}

    make
}

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

    make DESTDIR="$pkgdir" install
}
