newlib-2.4.0.ebuild 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. # Disable legacy syscall stub code in newlib. These have been
  46. # moved to libgloss for a long time now, so the code in newlib
  47. # itself just gets in the way.
  48. --disable-newlib-supplied-syscalls
  49. )
  50. [[ ${CTARGET} == "spu" ]] \
  51. && myconf+=( --disable-newlib-multithread ) \
  52. || myconf+=( $(use_enable threads newlib-multithread) )
  53. mkdir -p "${NEWLIBBUILD}"
  54. cd "${NEWLIBBUILD}"
  55. ECONF_SOURCE=${S} \
  56. econf \
  57. $(use_enable unicode newlib-mb) \
  58. $(use_enable nls) \
  59. "${myconf[@]}"
  60. }
  61. src_compile() {
  62. emake -C "${NEWLIBBUILD}"
  63. }
  64. src_install() {
  65. cd "${NEWLIBBUILD}"
  66. emake -j1 DESTDIR="${D}" install
  67. # env -uRESTRICT CHOST=${CTARGET} prepallstrip
  68. # minor hack to keep things clean
  69. rm -fR "${D}"/usr/share/info
  70. rm -fR "${D}"/usr/info
  71. }