avr-libc-2.3.2.ebuild 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Copyright 1999-2026 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="8"
  4. CHOST="avr"
  5. CTARGET="avr"
  6. inherit flag-o-matic
  7. DESCRIPTION="C library for Atmel AVR microcontrollers"
  8. HOMEPAGE="https://github.com/avrdudes/avr-libc https://www.nongnu.org/avr-libc/"
  9. # Upstream moved from Savannah to GitHub with 2.2.0. The GitHub "release"
  10. # tarball ships a pre-generated ./configure and the avr/{lib,devices} trees
  11. # (mlib-gen.py output), so no bootstrap / autotools / python is needed to
  12. # build it. Manual pages are no longer a separate download; they are built
  13. # from the tree only when doxygen is present, which we do not pull in.
  14. MY_TAG="avr-libc-$(ver_rs 1- '_')-release"
  15. SRC_URI="https://github.com/avrdudes/avr-libc/releases/download/${MY_TAG}/${P}.tar.bz2"
  16. LICENSE="BSD"
  17. SLOT="0"
  18. # 'amd64' is a blessed placeholder for crossdev. It could
  19. # be any other arch. See bug #620316#c5
  20. # Don't add more arches to KEYWORDS.
  21. KEYWORDS="amd64"
  22. IUSE="headers-only"
  23. DEPEND=">=sys-devel/crossdev-0.9.1"
  24. [[ ${CATEGORY/cross-} != ${CATEGORY} ]] \
  25. && RDEPEND="!dev-embedded/avr-libc" \
  26. || RDEPEND=""
  27. DOCS="AUTHORS NEWS NEWS.md README.md"
  28. pkg_setup() {
  29. # check for avr-gcc, bug #134738
  30. ebegin "Checking for avr-gcc"
  31. if type -p avr-gcc > /dev/null ; then
  32. eend 0
  33. else
  34. eend 1
  35. eerror
  36. eerror "Failed to locate 'avr-gcc' in \$PATH. You can install an AVR toolchain using:"
  37. eerror " $ crossdev -t avr"
  38. eerror
  39. die "AVR toolchain not found"
  40. fi
  41. }
  42. src_prepare() {
  43. default
  44. # work around broken gcc versions PR45261: drop MCUs the installed
  45. # avr-gcc does not know about so ./configure does not choke on them.
  46. local mcu
  47. for mcu in $(sed -r -n '/CHECK_AVR_DEVICE/{s:.*[(](.*)[)]:\1:;p}' configure.ac) ; do
  48. if avr-gcc -E - -mmcu=${mcu} <<<"" |& grep -q 'unknown MCU' ; then
  49. sed -i "/HAS_${mcu}=yes/s:yes:no:" configure || die
  50. fi
  51. done
  52. strip-flags
  53. strip-unsupported-flags
  54. }
  55. src_configure() {
  56. # --enable-device-lib builds the per-device lib<mcu>.a / crt<mcu>.o.
  57. # It is on by default with avr-gcc >= 5.1 but be explicit. Docs are
  58. # off by default in 2.2+; keep them off (no doxygen dependency).
  59. econf \
  60. --host=avr \
  61. --enable-device-lib \
  62. --disable-doc
  63. }
  64. src_install() {
  65. default
  66. # Make sure different cross-compilers don't collide #414075
  67. if [[ -d ${ED}/usr/share/doc/${PF} ]] ; then
  68. mv "${ED}"/usr/share/doc/{${PF},${CTARGET}-${PF}} || die
  69. fi
  70. }