PORTNAME=	avr-libc
PORTVERSION=	2.2.0
PORTEPOCH=	1
CATEGORIES=	devel
MASTER_SITES=	https://github.com/avrdudes/avr-libc/releases/download/avr-libc-${PORTVERSION:S/./_/g}-release/
# Cannot use USE_GITHUB since the github source tree lacks the
# autoconf'ed files needed to build the source code. Only the release
# files contain them.

MAINTAINER=	joerg@FreeBSD.org
COMMENT=	C and math library for the Atmel AVR controller family
WWW=		https://github.com/avrdudes/avr-libc/

LICENSE=	BSD2CLAUSE
LICENSE_FILE=	${WRKSRC}/LICENSE

BUILD_DEPENDS=	avr-as:devel/binutils@avr \
		avr-ld:devel/binutils@avr \
		avr-gcc:devel/avr-gcc
RUN_DEPENDS=	avr-as:devel/binutils@avr \
		avr-ld:devel/binutils@avr \
		avr-gcc:devel/avr-gcc

USES=		gettext-tools gmake tar:bzip2

HAS_CONFIGURE=	yes
CONFIGURE_ARGS=	--build=`./config.guess` --host=avr --prefix=${PREFIX}
CONFIGURE_ENV=	CC=avr-gcc PREFIX=${PREFIX}

.include <bsd.port.options.mk>

.undef WITHOUT_AVRLIBCDOCS=	true

post-patch:
	${REINPLACE_CMD} -e '/SUBDIRS/s,examples,,' ${WRKSRC}/doc/Makefile.in

do-install:
	${RM} ${TMPPLIST}
	${CAT} ${PLIST} >> ${TMPPLIST}
	@for file in ${PLIST_FILES}; do \
		${ECHO_CMD} $${file} >> ${TMPPLIST}; \
	done
	(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} \
		${MAKE_CMD} ${MAKE_ARGS} install)

.include <bsd.port.mk>
