diff options
| author | Sam James <sam@gentoo.org> | 2022-02-22 00:29:23 +0000 |
|---|---|---|
| committer | Sam James <sam@gentoo.org> | 2022-02-22 00:41:18 +0000 |
| commit | a5945b83a4ee29d228e1a56101483001da291c54 (patch) | |
| tree | cda7d9a7404f78ca35d436ae068b746ee46da434 /dev-lang/ocaml/ocaml-4.09.0-r3.ebuild | |
| parent | 860e2f272f0a0a2fecb2ab6f160ce68875770f59 (diff) | |
| download | gentoo-a5945b83a4ee29d228e1a56101483001da291c54.tar.gz gentoo-a5945b83a4ee29d228e1a56101483001da291c54.tar.bz2 gentoo-a5945b83a4ee29d228e1a56101483001da291c54.zip | |
dev-lang/ocaml: fix 4.09 with glibc 2.34
Bug: https://bugs.gentoo.org/804498
See: https://github.com/gentoo/gentoo/pull/22851#pullrequestreview-882504245
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-lang/ocaml/ocaml-4.09.0-r3.ebuild')
| -rw-r--r-- | dev-lang/ocaml/ocaml-4.09.0-r3.ebuild | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/dev-lang/ocaml/ocaml-4.09.0-r3.ebuild b/dev-lang/ocaml/ocaml-4.09.0-r3.ebuild new file mode 100644 index 000000000000..8bf41d439d5a --- /dev/null +++ b/dev-lang/ocaml/ocaml-4.09.0-r3.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic + +HOMEPAGE="https://ocaml.org/" +SRC_URI="https://github.com/ocaml/ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz" +DESCRIPTION="Programming language supporting functional, imperative & object-oriented styles" + +LICENSE="LGPL-2.1" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris" +IUSE="emacs flambda latex +ocamlopt spacetime xemacs" + +RDEPEND="sys-libs/binutils-libs:= + spacetime? ( sys-libs/libunwind:= )" +BDEPEND="${RDEPEND} + virtual/pkgconfig" +PDEPEND="emacs? ( app-emacs/ocaml-mode ) + xemacs? ( app-xemacs/ocaml )" + +QA_FLAGS_IGNORED='usr/lib.*/ocaml/bigarray.cmxs' + +PATCHES=( + "${FILESDIR}"/${PN}-4.09.0-gcc-10.patch + "${FILESDIR}"/${P}-cflags.patch + "${FILESDIR}"/${P}-glibc-2.34.patch +) + +src_prepare() { + default + + cp "${FILESDIR}"/ocaml.conf "${T}" || die + + # Broken until 4.12 + # bug #818445 + filter-flags '-flto*' + append-flags -fno-strict-aliasing + + # OCaml generates textrels on 32-bit arches + # We can't do anything about it, but disabling it means that tests + # for OCaml-based packages won't fail on unexpected output + # bug #773226 + if use arm || use ppc || use x86 ; then + append-ldflags "-Wl,-z,notext" + fi + + # Upstream build ignores LDFLAGS in several places. + sed -i -e 's/\(^MKDLL=.*\)/\1 $(LDFLAGS)/' \ + -e 's/\(^OC_CFLAGS=.*\)/\1 $(LDFLAGS)/' \ + -e 's/\(^OC_LDFLAGS=.*\)/\1 $(LDFLAGS)/' \ + Makefile.config.in || die "LDFLAGS fix failed" + # ${P} overrides upstream build's own P due to a wrong assignment operator. + sed -i -e 's/^P ?=/P =/' stdlib/StdlibModules || die "P fix failed" +} + +src_configure() { + local opt=( + --bindir="${EPREFIX}/usr/bin" + --libdir="${EPREFIX}/usr/$(get_libdir)/ocaml" + --mandir="${EPREFIX}/usr/share/man" + --prefix="${EPREFIX}/usr" + $(use_enable flambda) + $(use_enable spacetime) + ) + econf ${opt[@]} +} + +src_compile() { + if use ocamlopt ; then + emake world.opt + else + emake world + fi +} + +src_test() { + if use ocamlopt ; then + # OCaml tests only work when run sequentially + emake -j1 -C testsuite all + else + ewarn "${PN} was built without 'ocamlopt' USE flag; skipping tests." + fi +} + +src_install() { + default + dodir /usr/include + # Create symlink for header files + dosym "../$(get_libdir)/ocaml/caml" /usr/include/caml + dodoc Changes README.adoc + # Create envd entry for latex input files + if use latex ; then + echo "TEXINPUTS=\"${EPREFIX}/usr/$(get_libdir)/ocaml/ocamldoc:\"" > "${T}"/99ocamldoc || die + doenvd "${T}"/99ocamldoc + fi + + sed -i -e "s:lib:$(get_libdir):" "${T}"/ocaml.conf || die + + # Install ocaml-rebuild portage set + insinto /usr/share/portage/config/sets + doins "${T}"/ocaml.conf +} |
