newlib-2.0.0.ebuild 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. inherit flag-o-matic toolchain-funcs
  5. export CBUILD=${CBUILD:-${CHOST}}
  6. export CTARGET=${CTARGET:-${CHOST}}
  7. if [[ ${CTARGET} == ${CHOST} ]] ; then
  8. if [[ ${CATEGORY} == cross-* ]] ; then
  9. export CTARGET=${CATEGORY#cross-}
  10. fi
  11. fi
  12. DESCRIPTION="Newlib is a C library intended for use on embedded systems"
  13. HOMEPAGE="https://sourceware.org/newlib/"
  14. SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
  15. LICENSE="NEWLIB LIBGLOSS GPL-2"
  16. SLOT="0"
  17. KEYWORDS="-* arm hppa m68k ~mips ppc ppc64 sh sparc x86"
  18. IUSE="nls threads unicode crosscompile_opts_headers-only"
  19. RESTRICT="strip"
  20. NEWLIBBUILD="${WORKDIR}/build"
  21. pkg_setup() {
  22. # Reject newlib-on-glibc type installs
  23. if [[ ${CTARGET} == ${CHOST} ]] ; then
  24. case ${CHOST} in
  25. *-newlib|*-elf) ;;
  26. *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
  27. esac
  28. fi
  29. }
  30. src_configure() {
  31. # we should fix this ...
  32. unset LDFLAGS
  33. CHOST=${CTARGET} strip-unsupported-flags
  34. local myconf=""
  35. [[ ${CTARGET} == "spu" ]] \
  36. && myconf="${myconf} --disable-newlib-multithread" \
  37. || myconf="${myconf} $(use_enable threads newlib-multithread)"
  38. mkdir -p "${NEWLIBBUILD}"
  39. cd "${NEWLIBBUILD}"
  40. ECONF_SOURCE=${S} \
  41. econf \
  42. $(use_enable unicode newlib-mb) \
  43. $(use_enable nls) \
  44. ${myconf}
  45. }
  46. src_compile() {
  47. emake -C "${NEWLIBBUILD}"
  48. }
  49. src_install() {
  50. cd "${NEWLIBBUILD}"
  51. emake -j1 DESTDIR="${D}" install
  52. # env -uRESTRICT CHOST=${CTARGET} prepallstrip
  53. # minor hack to keep things clean
  54. rm -fR "${D}"/usr/share/info
  55. rm -fR "${D}"/usr/info
  56. }