1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 HOMEPAGE="https://ocaml.org/"
7 SRC_URI="https://github.com/ocaml/ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz"
8 DESCRIPTION="Programming language supporting functional, imperative & object-oriented styles"
12 KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
13 IUSE="emacs flambda latex +ocamlopt spacetime xemacs"
15 RDEPEND="sys-libs/binutils-libs:=
16 spacetime? ( sys-libs/libunwind:= )"
19 PDEPEND="emacs? ( app-emacs/ocaml-mode )
20 xemacs? ( app-xemacs/ocaml )"
22 PATCHES=("${FILESDIR}"/${PN}-4.09.0-gcc-10.patch)
26 # Upstream build ignores LDFLAGS in several places.
27 sed -i -e 's/\(^MKDLL=.*\)/\1 $(LDFLAGS)/' \
28 -e 's/\(^OC_CFLAGS=.*\)/\1 $(LDFLAGS)/' \
29 -e 's/\(^OC_LDFLAGS=.*\)/\1 $(LDFLAGS)/' \
30 Makefile.config.in || die "LDFLAGS fix failed"
31 # ${P} overrides upstream build's own P due to a wrong assignment operator.
32 sed -i -e 's/^P ?=/P =/' stdlib/StdlibModules || die "P fix failed"
37 --bindir="${EPREFIX}/usr/bin"
38 --libdir="${EPREFIX}/usr/$(get_libdir)/ocaml"
39 --mandir="${EPREFIX}/usr/share/man"
40 --prefix="${EPREFIX}/usr"
42 $(use_enable spacetime)
48 if use ocamlopt ; then
56 if use ocamlopt ; then
57 # OCaml tests only work when run sequentially
58 emake -j1 -C testsuite all
60 ewarn "${PN} was built without 'ocamlopt' USE flag; skipping tests."
67 # Create symlink for header files
68 dosym "../$(get_libdir)/ocaml/caml" /usr/include/caml
69 dodoc Changes README.adoc
70 # Create envd entry for latex input files
72 echo "TEXINPUTS=\"${EPREFIX}/usr/$(get_libdir)/ocaml/ocamldoc:\"" > "${T}/99ocamldoc"
73 doenvd "${T}/99ocamldoc"
75 # Install ocaml-rebuild portage set
76 insinto /usr/share/portage/config/sets
77 doins "${FILESDIR}/ocaml.conf"