avr-libc-1.7.1.ebuild 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. CHOST="avr"
  5. CTARGET="avr"
  6. inherit flag-o-matic eutils
  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. DOCS="AUTHORS ChangeLog* NEWS README"
  21. pkg_setup() {
  22. # check for avr-gcc, bug #134738
  23. ebegin "Checking for avr-gcc"
  24. if type -p avr-gcc > /dev/null ; then
  25. eend 0
  26. else
  27. eend 1
  28. eerror
  29. eerror "Failed to locate 'avr-gcc' in \$PATH. You can install an AVR toolchain using:"
  30. eerror " $ crossdev -t avr"
  31. eerror
  32. die "AVR toolchain not found"
  33. fi
  34. }
  35. src_prepare() {
  36. # Fix avr-libc bug #32988 causing an ICE with gcc-4.6.0
  37. epatch "${FILESDIR}/${P}-gcc46.patch"
  38. # work around broken gcc versions PR45261
  39. local mcu
  40. for mcu in $(sed -r -n '/CHECK_AVR_DEVICE/{s:.*[(](.*)[)]:\1:;p}' configure.ac) ; do
  41. if avr-gcc -E - -mmcu=${mcu} <<<"" |& grep -q 'unknown MCU' ; then
  42. sed -i "/HAS_${mcu}=yes/s:yes:no:" configure
  43. fi
  44. done
  45. # Install docs in correct directory
  46. sed -i -e "/DOC_INST_DIR/s:\$(VERSION):${PVR}:" configure || die
  47. strip-flags
  48. strip-unsupported-flags
  49. }
  50. src_install() {
  51. default
  52. # man pages can not go into standard locations
  53. # as they would then overwrite libc man pages
  54. insinto /usr/share/doc/${PF}/man/man3
  55. doins "${WORKDIR}"/man/man3/*
  56. prepman /usr/share/doc/${PF}
  57. use doc && dohtml "${WORKDIR}"/${PN}-user-manual-${PV}/*
  58. }