commit:     06b36e0f648bef1acf5ad451d9eebe3e04df2120
Author:     Mark Wright <gienah <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 29 12:08:33 2022 +0000
Commit:     Mark Wright <gienah <AT> gentoo <DOT> org>
CommitDate: Tue Mar 29 12:08:33 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06b36e0f

dev-lang/ocaml: Bump to 4.14.0, fix clang build.

See: https://github.com/ocaml/ocaml/pull/10774
Closes: https://bugs.gentoo.org/729566
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Mark Wright <gienah <AT> gentoo.org>

 dev-lang/ocaml/Manifest                       |   1 +
 dev-lang/ocaml/files/ocaml-4.14.0-clang.patch | 132 ++++++++++++++++++++++++++
 dev-lang/ocaml/ocaml-4.14.0.ebuild            | 103 ++++++++++++++++++++
 3 files changed, 236 insertions(+)

diff --git a/dev-lang/ocaml/Manifest b/dev-lang/ocaml/Manifest
index 9466e909f6b9..edc6337be4cb 100644
--- a/dev-lang/ocaml/Manifest
+++ b/dev-lang/ocaml/Manifest
@@ -7,4 +7,5 @@ DIST ocaml-4.10.2.tar.gz 4933135 BLAKE2B 
ec5e92adb23c28a254247182c79ab555fd82603
 DIST ocaml-4.11.2.tar.gz 5075323 BLAKE2B 
bdc503d9a8d0e39dd11060febcd0287657b460e50ed81e55578a3e778af990ca5d4ef9011753eee4e1a144da33eb76c95b1672dc99b76e65a2e107eee472fe06
 SHA512 
03d8a9f6e130142c121ff2eb3d54f584f1e7c8475f066a5803bb0edd2fa172ca06a56a3ec548b225f5c8b12112d7a68511b1e16f3ade075b5f02610d4247bbb3
 DIST ocaml-4.12.1.tar.gz 5181696 BLAKE2B 
9d21438e09b1a9680eabb65f5c78d9fe84459592ef7bb797a1933e5383f7b6d5cefffa8cdc184abc102417f5dbc0fca8ef624c9b560f89eaff6537544b5b395f
 SHA512 
e942e5cf5530804690ec45c40936ad2acbb60e11279fc676e0f04181fe1855f84ee5c3cb9c337fc5d01f6ee0e7b2251a6c04f7de56d99c20bb62026dff6c5671
 DIST ocaml-4.13.1.tar.gz 5323203 BLAKE2B 
f1dcb1601ebfa2a37351e3a466a7ca601518c2da403b01aeb182738a54d5887523ab554d747d6591cb09b07b417865e20907f7877117b2d2d069ef6c9edc0fae
 SHA512 
da3434177438c852da53c0fda7bc2519adcda6384d97d45e44137ed0fd384ffb3da61958a7b51296edb3f88f5a5310ca71b6862f6d756aaa4012d1f54e5955f6
+DIST ocaml-4.14.0.tar.gz 5494844 BLAKE2B 
f2f9142a95722c7fc5fda205ea6b951939f7d285963b8aa14dc157ac10202ef9d00c7590beabdc97ed83548d61e5ef28b60a360f1a492420a54f4e26dfbf89f0
 SHA512 
3c5e5b9f00bb109dd99b5f7b0078cf8663d4247e548f3e601d6b2a55582e04bb20f6de85005c4cf2f78ae9aaa449f5ca6f2bab2f6ce83eeb3aeb386e3f2fcc32
 DIST ocaml-patches-9.tar.bz2 1700 BLAKE2B 
4e46b8fb490db28f815414e285f54e251394ea53e1d25c529bbea9f03e426fd19132b1e2c7c2be7d14983fceb4cad073d191b001f6da522fee4226371d4a2eca
 SHA512 
cc19f9104fac69aecc5effa8cb772342e1fb61cdcd38ba0176efe04cf3d710b1c56d5178748f3bd29099af91fa684da432a8ef8d42de76dbd1b6954a255ea6c0

diff --git a/dev-lang/ocaml/files/ocaml-4.14.0-clang.patch 
b/dev-lang/ocaml/files/ocaml-4.14.0-clang.patch
new file mode 100644
index 000000000000..cd3c042f2639
--- /dev/null
+++ b/dev-lang/ocaml/files/ocaml-4.14.0-clang.patch
@@ -0,0 +1,132 @@
+commit 28b553622bd0f168411d86ddcfba1adab0d87b92
+Author: Yawar Amin <[email protected]>
+Date:   Mon Nov 15 22:40:43 2021 -0500
+
+    Fix ranlib error
+    
+    - Always pass ranlib one file argument at a time to avoid error 'Exactly
+      one archive should be specified'
+    - Call ranlib without cd'ing into the library's directory
+    - Use Makefile functionality to simplify recipes
+
+diff --git a/Makefile b/Makefile
+index c2522c775..2e4e44faa 100644
+--- a/Makefile
++++ b/Makefile
+@@ -549,6 +549,8 @@ else
+ endif
+       $(MAKE) -C tools installopt
+ 
++LIBRARIES = $(addsuffix .$(A), ocamlcommon ocamlbytecomp ocamloptcomp)
++
+ .PHONY: installoptopt
+ installoptopt:
+       $(INSTALL_PROG) ocamlc.opt$(EXE) "$(INSTALL_BINDIR)"
+@@ -585,8 +587,11 @@ endif
+ ifeq "$(INSTALL_OCAMLNAT)" "true"
+         $(INSTALL_PROG) ocamlnat$(EXE) "$(INSTALL_BINDIR)"
+ endif
+-      cd "$(INSTALL_COMPLIBDIR)" && \
+-         $(RANLIB) ocamlcommon.$(A) ocamlbytecomp.$(A) ocamloptcomp.$(A)
++# Some versions of ranlib do not support multiple archives
++      for library in $(LIBRARIES); \
++      do \
++        $(RANLIB) "$(INSTALL_COMPLIBDIR)/$$library"; \
++      done
+ 
+ # Installation of the *.ml sources of compiler-libs
+ .PHONY: install-compiler-sources
+diff --git a/otherlibs/Makefile.otherlibs.common 
b/otherlibs/Makefile.otherlibs.common
+index 95ff4d58f..6a4451e47 100644
+--- a/otherlibs/Makefile.otherlibs.common
++++ b/otherlibs/Makefile.otherlibs.common
+@@ -95,7 +95,7 @@ install::
+       fi
+ ifneq "$(STUBSLIB)" ""
+       $(INSTALL_DATA) $(STUBSLIB) "$(INSTALL_LIBDIR)/"
+-      cd "$(INSTALL_LIBDIR)"; $(RANLIB) lib$(CLIBNAME).$(A)
++      $(RANLIB) "$(INSTALL_LIBDIR)/lib$(CLIBNAME).$(A)"
+ endif
+ 
+       $(INSTALL_DATA) \
+@@ -104,7 +104,7 @@ endif
+ ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
+       $(INSTALL_DATA) \
+         $(CMIFILES:.cmi=.mli) \
+-          $(CMIFILES:.cmi=.cmti) \
++              $(CMIFILES:.cmi=.cmti) \
+         "$(INSTALL_LIBDIR)/"
+ endif
+       if test -n "$(HEADERS)"; then \
+@@ -115,7 +115,7 @@ installopt:
+       $(INSTALL_DATA) \
+          $(CAMLOBJS_NAT) $(LIBNAME).cmxa $(LIBNAME).$(A) \
+          "$(INSTALL_LIBDIR)/"
+-      cd "$(INSTALL_LIBDIR)"; $(RANLIB) $(LIBNAME).a
++      $(RANLIB) "$(INSTALL_LIBDIR)/$(LIBNAME).$(A)"
+       if test -f $(LIBNAME).cmxs; then \
+         $(INSTALL_PROG) $(LIBNAME).cmxs "$(INSTALL_LIBDIR)"; \
+       fi
+diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile
+index 6b02dc197..dccc45103 100644
+--- a/otherlibs/dynlink/Makefile
++++ b/otherlibs/dynlink/Makefile
+@@ -249,12 +249,12 @@ ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
+ endif
+ 
+ installopt:
+-      if $(NATDYNLINK); then \
+-        $(INSTALL_DATA) \
+-          $(NATOBJS) dynlink.cmxa dynlink.$(A) \
+-          "$(INSTALL_LIBDIR)" && \
+-        cd "$(INSTALL_LIBDIR)" && $(RANLIB) dynlink.$(A); \
+-      fi
++ifeq "$(NATDYNLINK)" "true"
++      $(INSTALL_DATA) \
++        $(NATOBJS) dynlink.cmxa dynlink.$(A) \
++        "$(INSTALL_LIBDIR)"
++      $(RANLIB) "$(INSTALL_LIBDIR)/dynlink.$(A)"
++endif
+ 
+ partialclean:
+       rm -f $(extract_crc) *.cm[ioaxt] *.cmti *.cmxa \
+diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile
+index 8fc1bdb92..379c530fa 100644
+--- a/otherlibs/systhreads/Makefile
++++ b/otherlibs/systhreads/Makefile
+@@ -121,7 +121,7 @@ install:
+         $(INSTALL_PROG) dllthreads$(EXT_DLL) "$(INSTALL_STUBLIBDIR)"; \
+       fi
+       $(INSTALL_DATA) libthreads.$(A) "$(INSTALL_LIBDIR)"
+-      cd "$(INSTALL_LIBDIR)"; $(RANLIB) libthreads.$(A)
++      $(RANLIB) "$(INSTALL_LIBDIR)/libthreads.$(A)"
+       mkdir -p "$(INSTALL_THREADSLIBDIR)"
+       $(INSTALL_DATA) \
+         $(CMIFILES) threads.cma \
+@@ -136,11 +136,11 @@ endif
+ 
+ installopt:
+       $(INSTALL_DATA) libthreadsnat.$(A) "$(INSTALL_LIBDIR)"
+-      cd "$(INSTALL_LIBDIR)"; $(RANLIB) libthreadsnat.$(A)
++      $(RANLIB) "$(INSTALL_LIBDIR)/libthreadsnat.$(A)"
+       $(INSTALL_DATA) \
+         $(THREADS_NCOBJS) threads.cmxa threads.$(A) \
+         "$(INSTALL_THREADSLIBDIR)"
+-      cd "$(INSTALL_THREADSLIBDIR)" && $(RANLIB) threads.$(A)
++      $(RANLIB) "$(INSTALL_THREADSLIBDIR)/threads.$(A)"
+ 
+ %.cmi: %.mli
+       $(CAMLC) -c $(COMPFLAGS) $<
+diff --git a/stdlib/Makefile b/stdlib/Makefile
+index df34bc2d4..32c5dab56 100644
+--- a/stdlib/Makefile
++++ b/stdlib/Makefile
+@@ -105,7 +105,7 @@ installopt-default::
+       $(INSTALL_DATA) \
+         stdlib.cmxa stdlib.$(A) std_exit.$(O) *.cmx \
+         "$(INSTALL_LIBDIR)"
+-      cd "$(INSTALL_LIBDIR)"; $(RANLIB) stdlib.$(A)
++      $(RANLIB) "$(INSTALL_LIBDIR)/stdlib.$(A)"
+ 
+ ifeq "$(UNIX_OR_WIN32)" "unix"
+ HEADERPROGRAM = header

diff --git a/dev-lang/ocaml/ocaml-4.14.0.ebuild 
b/dev-lang/ocaml/ocaml-4.14.0.ebuild
new file mode 100644
index 000000000000..d54fe96af6c3
--- /dev/null
+++ b/dev-lang/ocaml/ocaml-4.14.0.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+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="QPL-1.0 LGPL-2"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 
~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
+IUSE="emacs flambda latex +ocamlopt xemacs"
+
+RDEPEND="sys-libs/binutils-libs:="
+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.14.0-clang.patch
+)
+
+src_prepare() {
+       default
+
+       cp "${FILESDIR}"/ocaml.conf "${T}" || die
+
+       # 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"
+}
+
+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)
+       )
+
+       econf "${opt[@]}"
+}
+
+src_compile() {
+       env -u P emake world
+
+       if use ocamlopt ; then
+               env -u P emake opt
+               env -u P emake opt.opt
+       fi
+}
+
+src_test() {
+       emake -j
+
+       # OCaml tests only work when run sequentially
+       if use ocamlopt ; then
+               emake -j1 ocamltest.opt
+       else
+               emake -j1 ocamltest
+               #ewarn "${PN} was built without 'ocamlopt' USE flag; skipping 
tests."
+       fi
+
+       emake -j1 tests
+}
+
+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
+}

Reply via email to