newlib-9999.ebuild 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit flag-o-matic toolchain-funcs
  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_configure() {
  38. # we should fix this ...
  39. unset LDFLAGS
  40. CHOST=${CTARGET} strip-unsupported-flags
  41. local myconf=(
  42. # Disable legacy syscall stub code in newlib. These have been
  43. # moved to libgloss for a long time now, so the code in newlib
  44. # itself just gets in the way.
  45. --disable-newlib-supplied-syscalls
  46. )
  47. [[ ${CTARGET} == "spu" ]] \
  48. && myconf+=( --disable-newlib-multithread ) \
  49. || myconf+=( $(use_enable threads newlib-multithread) )
  50. mkdir -p "${NEWLIBBUILD}"
  51. cd "${NEWLIBBUILD}"
  52. ECONF_SOURCE=${S} \
  53. econf \
  54. $(use_enable unicode newlib-mb) \
  55. $(use_enable nls) \
  56. "${myconf[@]}"
  57. }
  58. src_compile() {
  59. emake -C "${NEWLIBBUILD}"
  60. }
  61. src_install() {
  62. cd "${NEWLIBBUILD}"
  63. emake -j1 DESTDIR="${D}" install
  64. # env -uRESTRICT CHOST=${CTARGET} prepallstrip
  65. # minor hack to keep things clean
  66. rm -fR "${D}"/usr/share/info
  67. rm -fR "${D}"/usr/info
  68. }