| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- # Copyright 1999-2026 Gentoo Authors
- # Distributed under the terms of the GNU General Public License v2
- EAPI="8"
- CHOST="avr"
- CTARGET="avr"
- inherit flag-o-matic
- DESCRIPTION="C library for Atmel AVR microcontrollers"
- HOMEPAGE="https://github.com/avrdudes/avr-libc https://www.nongnu.org/avr-libc/"
- # Upstream moved from Savannah to GitHub with 2.2.0. The GitHub "release"
- # tarball ships a pre-generated ./configure and the avr/{lib,devices} trees
- # (mlib-gen.py output), so no bootstrap / autotools / python is needed to
- # build it. Manual pages are no longer a separate download; they are built
- # from the tree only when doxygen is present, which we do not pull in.
- MY_TAG="avr-libc-$(ver_rs 1- '_')-release"
- SRC_URI="https://github.com/avrdudes/avr-libc/releases/download/${MY_TAG}/${P}.tar.bz2"
- LICENSE="BSD"
- SLOT="0"
- # 'amd64' is a blessed placeholder for crossdev. It could
- # be any other arch. See bug #620316#c5
- # Don't add more arches to KEYWORDS.
- KEYWORDS="amd64"
- IUSE="headers-only"
- DEPEND=">=sys-devel/crossdev-0.9.1"
- [[ ${CATEGORY/cross-} != ${CATEGORY} ]] \
- && RDEPEND="!dev-embedded/avr-libc" \
- || RDEPEND=""
- DOCS="AUTHORS NEWS NEWS.md README.md"
- pkg_setup() {
- # check for avr-gcc, bug #134738
- ebegin "Checking for avr-gcc"
- if type -p avr-gcc > /dev/null ; then
- eend 0
- else
- eend 1
- eerror
- eerror "Failed to locate 'avr-gcc' in \$PATH. You can install an AVR toolchain using:"
- eerror " $ crossdev -t avr"
- eerror
- die "AVR toolchain not found"
- fi
- }
- src_prepare() {
- default
- # work around broken gcc versions PR45261: drop MCUs the installed
- # avr-gcc does not know about so ./configure does not choke on them.
- local mcu
- for mcu in $(sed -r -n '/CHECK_AVR_DEVICE/{s:.*[(](.*)[)]:\1:;p}' configure.ac) ; do
- if avr-gcc -E - -mmcu=${mcu} <<<"" |& grep -q 'unknown MCU' ; then
- sed -i "/HAS_${mcu}=yes/s:yes:no:" configure || die
- fi
- done
- strip-flags
- strip-unsupported-flags
- }
- src_configure() {
- # --enable-device-lib builds the per-device lib<mcu>.a / crt<mcu>.o.
- # It is on by default with avr-gcc >= 5.1 but be explicit. Docs are
- # off by default in 2.2+; keep them off (no doxygen dependency).
- econf \
- --host=avr \
- --enable-device-lib \
- --disable-doc
- }
- src_install() {
- default
- # Make sure different cross-compilers don't collide #414075
- if [[ -d ${ED}/usr/share/doc/${PF} ]] ; then
- mv "${ED}"/usr/share/doc/{${PF},${CTARGET}-${PF}} || die
- fi
- }
|