Skip to content

Commit

Permalink
dev-ml/llvm-ocaml: Add 19.0.0_pre20240712 snapshot
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Górny <[email protected]>
  • Loading branch information
mgorny committed Jul 13, 2024
1 parent 06ff282 commit 9fa46ba
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-ml/llvm-ocaml/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ DIST llvm-project-17.0.6.src.tar.xz 127838860 BLAKE2B d6ede1a9fda8756995c3e06541
DIST llvm-project-17.0.6.src.tar.xz.sig 438 BLAKE2B 186e75b6a0fbfe1e85408589c149e1800fcc47d685b74e4260018e05cd08bc793d1d1197c9c50e177eea941a3d0c65cb0c583ce6dae449099b920adf8a508ef7 SHA512 f78c55053a6450625f3e95f52c305110b4468a9854fec75831b65b8d6ceee3c9206ab9e63c4b5fda8be9bd344f72cfbdaae0520ed240abd505e08ebeaa25d340
DIST llvm-project-18.1.8.src.tar.xz 132067260 BLAKE2B a950492f1dbfb874dff63b1ffef86468169ba2f211a9733ec2d4cf30040f7f277ef00f048bb44dee9f97d7d762f0f241f19e5a2a7b0b49217d3821ddfc8c354f SHA512 25eeee9984c8b4d0fbc240df90f33cbb000d3b0414baff5c8982beafcc5e59e7ef18f6f85d95b3a5f60cb3d4cd4f877c80487b5768bc21bc833f107698ad93db
DIST llvm-project-18.1.8.src.tar.xz.sig 566 BLAKE2B 6ab0efc5b38d4483f4e32e8b85774b2edd5d88fdf29f23b88eb0b5130a7a7f0e80549612b025f927e92de4a08ff7c292cff224dbda91a5d598244e98f7ad0fbd SHA512 ddfd1e8a06756759af6cbe488c82a6d6a62ba91f3e8a0eb4cece561321824f5d165b08ed91010588790b76e19790931d2651b24dba8567e3b151d3cb43bec25b
DIST llvm-project-1bad7024561bc64ed4bfda0772b16376b475eba5.tar.gz 216657623 BLAKE2B 99c48a95c427e8fae5568e5f59ab9bec8b2d8bec0c5d3cf453c261a738fe1c295b34e2e10e6b08d2b02cae43e3b0cd4c8eb025d19a83ee51f47a49afadd56d3f SHA512 08fc904122ab346edbfc3903cafae4f50ba57e146b2d821a568f8378c0f3ab4d413e07c5df2bf061374f9db4634b5f6b27f204fc4f2f68984303ceec9c963c0c
107 changes: 107 additions & 0 deletions dev-ml/llvm-ocaml/llvm-ocaml-19.0.0_pre20240712.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..13} )
inherit cmake llvm.org llvm-utils python-any-r1

DESCRIPTION="OCaml bindings for LLVM"
HOMEPAGE="https://llvm.org/"

LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
SLOT="0/${PV}"
IUSE="+debug test"
RESTRICT="!test? ( test )"

RDEPEND="
>=dev-lang/ocaml-4.00.0:0=
dev-ml/ocaml-ctypes:=
~sys-devel/llvm-${PV}:=[debug?]
!sys-devel/llvm[ocaml(-)]
"

DEPEND="
${RDEPEND}
"
BDEPEND="
${PYTHON_DEPS}
dev-lang/perl
dev-ml/findlib
"

LLVM_COMPONENTS=( llvm cmake third-party )
LLVM_USE_TARGETS=llvm
llvm.org_set_globals

src_configure() {
llvm_prepend_path "${LLVM_MAJOR}"

local libdir=$(get_libdir)
local mycmakeargs=(
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}

-DBUILD_SHARED_LIBS=OFF
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_LINK_LLVM_DYLIB=ON
-DLLVM_OCAML_OUT_OF_TREE=ON

# cheap hack: LLVM combines both anyway, and the only difference
# is that the former list is explicitly verified at cmake time
-DLLVM_TARGETS_TO_BUILD=""
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
-DLLVM_BUILD_TESTS=$(usex test)

# disable various irrelevant deps and settings
-DLLVM_ENABLE_FFI=OFF
-DLLVM_ENABLE_TERMINFO=OFF
-DHAVE_HISTEDIT_H=NO
-DLLVM_ENABLE_ASSERTIONS=$(usex debug)
-DLLVM_ENABLE_EH=ON
-DLLVM_ENABLE_RTTI=ON

-DLLVM_HOST_TRIPLE="${CHOST}"

-DPython3_EXECUTABLE="${PYTHON}"

# TODO: ocamldoc
)

use test && mycmakeargs+=(
-DLLVM_LIT_ARGS="$(get_lit_flags)"
)

# LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
# also: custom rules for OCaml do not work for CPPFLAGS
use debug || local -x CFLAGS="${CFLAGS} -DNDEBUG"
cmake_src_configure

local llvm_libdir=$(llvm-config --libdir)
# an ugly hack; TODO: figure out a way to pass -L to ocaml...
cd "${BUILD_DIR}/${libdir}" || die
ln -s "${llvm_libdir}"/*.so . || die

if use test; then
local llvm_bindir=$(llvm-config --bindir)
# Force using system-installed tools.
sed -i -e "/llvm_tools_dir/s@\".*\"@\"${llvm_bindir}\"@" \
"${BUILD_DIR}"/test/lit.site.cfg.py || die
fi
}

src_compile() {
cmake_build ocaml_all
}

src_test() {
# respect TMPDIR!
local -x LIT_PRESERVES_TMP=1
cmake_build check-llvm-bindings-ocaml
}

src_install() {
DESTDIR="${D}" \
cmake -P "${BUILD_DIR}"/bindings/ocaml/cmake_install.cmake || die

dodoc bindings/ocaml/README.txt
}

0 comments on commit 9fa46ba

Please sign in to comment.