avr-libc-1.7.0.ebuild 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="2"
  4. CHOST="avr"
  5. CTARGET="avr"
  6. inherit flag-o-matic
  7. DESCRIPTION="C library for Atmel AVR microcontrollers"
  8. HOMEPAGE="http://www.nongnu.org/avr-libc/"
  9. SRC_URI="https://savannah.nongnu.org/download/avr-libc/${P}.tar.bz2
  10. https://savannah.nongnu.org/download/avr-libc/${PN}-manpages-${PV}.tar.bz2
  11. doc? ( https://savannah.nongnu.org/download/avr-libc/${PN}-user-manual-${PV}.tar.bz2 )"
  12. LICENSE="BSD"
  13. SLOT="0"
  14. KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
  15. IUSE="doc crosscompile_opts_headers-only"
  16. DEPEND=">=sys-devel/crossdev-0.9.1"
  17. [[ ${CATEGORY/cross-} != ${CATEGORY} ]] \
  18. && RDEPEND="!dev-embedded/avr-libc" \
  19. || RDEPEND=""
  20. pkg_setup() {
  21. # check for avr-gcc, bug #134738
  22. ebegin "Checking for avr-gcc"
  23. if type -p avr-gcc > /dev/null ; then
  24. eend 0
  25. else
  26. eend 1
  27. eerror
  28. eerror "Failed to locate 'avr-gcc' in \$PATH. You can install an AVR toolchain using:"
  29. eerror " $ crossdev -t avr"
  30. eerror
  31. die "AVR toolchain not found"
  32. fi
  33. }
  34. src_prepare() {
  35. # work around broken gcc versions PR45261
  36. local mcu
  37. for mcu in $(sed -r -n '/CHECK_AVR_DEVICE/{s:.*[(](.*)[)]:\1:;p}' configure.ac) ; do
  38. if avr-gcc -E - -mmcu=${mcu} <<<"" |& grep -q 'unknown MCU' ; then
  39. sed -i "/HAS_${mcu}=yes/s:yes:no:" configure
  40. fi
  41. done
  42. strip-flags
  43. strip-unsupported-flags
  44. }
  45. src_install() {
  46. emake DESTDIR="${D}" install || die
  47. dodoc AUTHORS ChangeLog* NEWS README
  48. # man pages can not go into standard locations
  49. # as they would then overwrite libc man pages
  50. dosed "s:\$(VERSION):${PVR}:" /usr/bin/avr-man
  51. insinto /usr/share/doc/${PF}/man/man3
  52. doins "${WORKDIR}"/man/man3/*
  53. prepman /usr/share/doc/${PF}
  54. use doc && dohtml "${WORKDIR}"/${PN}-user-manual-${PV}/*
  55. }