ocaml-4.05.0_beta3.ebuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit flag-o-matic eutils multilib versionator toolchain-funcs
  5. PATCHLEVEL="9"
  6. MY_P="${P/_/-}"
  7. DESCRIPTION="Type-inferring functional programming language descended from the ML family"
  8. HOMEPAGE="http://www.ocaml.org/"
  9. SRC_URI="https://github.com/ocaml/ocaml/archive/${PV/_/+}.tar.gz -> ${MY_P}.tar.gz
  10. mirror://gentoo/${PN}-patches-${PATCHLEVEL}.tar.bz2"
  11. LICENSE="QPL-1.0 LGPL-2"
  12. # Everytime ocaml is updated to a new version, everything ocaml must be rebuilt,
  13. # so here we go with the subslot.
  14. SLOT="0/${PV}"
  15. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
  16. IUSE="emacs +flambda latex ncurses +ocamlopt spacetime X xemacs"
  17. RDEPEND="
  18. sys-libs/binutils-libs:=
  19. ncurses? ( sys-libs/ncurses:0= )
  20. spacetime? ( sys-libs/libunwind:= )
  21. X? ( x11-libs/libX11 x11-proto/xproto )"
  22. DEPEND="${RDEPEND}
  23. virtual/pkgconfig"
  24. PDEPEND="emacs? ( app-emacs/ocaml-mode )
  25. xemacs? ( app-xemacs/ocaml )"
  26. S="${WORKDIR}/${MY_P}"
  27. pkg_setup() {
  28. # dev-lang/ocaml creates its own objects but calls gcc for linking, which will
  29. # results in relocations if gcc wants to create a PIE executable
  30. if gcc-specs-pie ; then
  31. append-ldflags -nopie
  32. ewarn "Ocaml generates its own native asm, you're using a PIE compiler"
  33. ewarn "We have appended -nopie to ocaml build options"
  34. ewarn "because linking an executable with pie while the objects are not pic will not work"
  35. fi
  36. }
  37. src_prepare() {
  38. EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
  39. }
  40. src_configure() {
  41. export LC_ALL=C
  42. local myconf=""
  43. # Causes build failures because it builds some programs with -pg,
  44. # bug #270920
  45. filter-flags -fomit-frame-pointer
  46. # Bug #285993
  47. filter-mfpmath sse
  48. # -ggdb3 & co makes it behave weirdly, breaks sexplib
  49. replace-flags -ggdb* -ggdb
  50. # It doesn't compile on alpha without this LDFLAGS
  51. use alpha && append-ldflags "-Wl,--no-relax"
  52. use ncurses || myconf="${myconf} -no-curses"
  53. use X || myconf="${myconf} -no-graph"
  54. use flambda && myconf="${myconf} -flambda"
  55. use spacetime && myconf="${myconf} -spacetime"
  56. # ocaml uses a home-brewn configure script, preventing it to use econf.
  57. RAW_LDFLAGS="$(raw-ldflags)" ./configure \
  58. --prefix "${EPREFIX}"/usr \
  59. --bindir "${EPREFIX}"/usr/bin \
  60. --target-bindir "${EPREFIX}"/usr/bin \
  61. --libdir "${EPREFIX}"/usr/$(get_libdir)/ocaml \
  62. --mandir "${EPREFIX}"/usr/share/man \
  63. -target "${CHOST}" \
  64. -host "${CBUILD}" \
  65. -cc "$(tc-getCC)" \
  66. -as "$(tc-getAS)" \
  67. -aspp "$(tc-getCC) -c" \
  68. -partialld "$(tc-getLD) -r" \
  69. --with-pthread ${myconf} || die "configure failed!"
  70. # http://caml.inria.fr/mantis/view.php?id=4698
  71. export CCLINKFLAGS="${LDFLAGS}"
  72. }
  73. src_compile() {
  74. emake world
  75. # Native code generation can be disabled now
  76. if use ocamlopt ; then
  77. # bug #279968
  78. emake opt
  79. emake opt.opt
  80. fi
  81. }
  82. src_test() {
  83. if use ocamlopt ; then
  84. emake -j1 tests
  85. else
  86. ewarn "${PN} testsuite requires ocamlopt useflag"
  87. fi
  88. }
  89. src_install() {
  90. emake BINDIR="${ED}"/usr/bin \
  91. LIBDIR="${ED}"/usr/$(get_libdir)/ocaml \
  92. MANDIR="${ED}"/usr/share/man \
  93. install
  94. # Symlink the headers to the right place
  95. dodir /usr/include
  96. dosym /usr/$(get_libdir)/ocaml/caml /usr/include/caml
  97. dodoc Changes README.adoc
  98. # Create and envd entry for latex input files
  99. if use latex ; then
  100. echo "TEXINPUTS=${EPREFIX}/usr/$(get_libdir)/ocaml/ocamldoc:" > "${T}"/99ocamldoc
  101. doenvd "${T}"/99ocamldoc
  102. fi
  103. # Install ocaml-rebuild portage set
  104. insinto /usr/share/portage/config/sets
  105. doins "${FILESDIR}/ocaml.conf"
  106. }