# Maintainer: fauxpark <fauxpark@gmail.com>

_realname=libc
_target=avr

pkgbase=mingw-w64-${_target}-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_target}-${_realname}
pkgver=2.0.0
pkgrel=3
pkgdesc='The C runtime library for the AVR family of microcontrollers (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
license=('BSD')
url='https://savannah.nongnu.org/projects/avr-libc/'
options=(!strip)
groups=("${MINGW_PACKAGE_PREFIX}-${_target}-toolchain")
depends=("${MINGW_PACKAGE_PREFIX}-${_target}-gcc")
source=("https://download.savannah.gnu.org/releases/${_target}-${_realname}/${_target}-${_realname}-${pkgver}.tar.bz2")
sha256sums=('b2dd7fd2eefd8d8646ef6a325f6f0665537e2f604ed02828ced748d49dc85b97')

prepare() {
    cd ${srcdir}/${_target}-${_realname}-${pkgver}

    mkdir ${_realname}-build
}

build() {
    cd ${srcdir}/${_target}-${_realname}-${pkgver}/${_realname}-build

    ../configure \
        --build=${MINGW_CHOST} \
        --host=${_target} \
        --prefix=${MINGW_PREFIX}
    make
}

package() {
    cd ${srcdir}/${_target}-${_realname}-${pkgver}/${_realname}-build

    make DESTDIR="$pkgdir" install
}
