newlib-2.3.0.20160104.ebuild 1.8 KB

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