diff options
author | Michał Górny <mgorny@gentoo.org> | 2019-07-21 09:13:15 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2019-07-21 09:33:42 +0200 |
commit | 5c3ee97e155d9890044a699e6a6d94f2bae36efc (patch) | |
tree | 2e0a65bdcbbec1b5b99c55ef9084270a7e2b286e /dev-ml | |
parent | dev-python/lit: Add 9.0 branch live ebuild (diff) | |
download | gentoo-5c3ee97e155d9890044a699e6a6d94f2bae36efc.tar.gz gentoo-5c3ee97e155d9890044a699e6a6d94f2bae36efc.tar.bz2 gentoo-5c3ee97e155d9890044a699e6a6d94f2bae36efc.zip |
dev-ml/llvm-ocaml: Add 9.0 branch live ebuild
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-ml')
-rw-r--r-- | dev-ml/llvm-ocaml/llvm-ocaml-9.0.9999.ebuild | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-9.0.9999.ebuild b/dev-ml/llvm-ocaml/llvm-ocaml-9.0.9999.ebuild new file mode 100644 index 000000000000..0d161c49cb65 --- /dev/null +++ b/dev-ml/llvm-ocaml/llvm-ocaml-9.0.9999.ebuild @@ -0,0 +1,127 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python{2_7,3_{5,6,7}} ) + +inherit cmake-utils git-r3 llvm multiprocessing python-any-r1 + +DESCRIPTION="OCaml bindings for LLVM" +HOMEPAGE="https://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/llvm.git + https://github.com/llvm-mirror/llvm.git" +EGIT_BRANCH="release_80" + +# Keep in sync with sys-devel/llvm +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 + NVPTX PowerPC Sparc SystemZ WebAssembly X86 XCore ) +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} + +LICENSE="UoI-NCSA" +SLOT="0/${PV}" +KEYWORDS="" +IUSE="debug test ${ALL_LLVM_TARGETS[*]}" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=dev-lang/ocaml-4.00.0:0= + dev-ml/ocaml-ctypes:= + ~sys-devel/llvm-${PV}:=[${LLVM_TARGET_USEDEPS// /,},debug?] + !sys-devel/llvm[ocaml(-)]" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${RDEPEND} + dev-lang/perl + dev-ml/findlib + test? ( dev-ml/ounit ) + !!<dev-python/configparser-3.3.0.2 + ${PYTHON_DEPS}" + +REQUIRED_USE="${PYTHON_REQUIRED_USE} + || ( ${ALL_LLVM_TARGETS[*]} )" + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +pkg_setup() { + LLVM_MAX_SLOT=${PV%%.*} llvm_pkg_setup + python-any-r1_pkg_setup +} + +src_prepare() { + # Python is needed to run tests using lit + python_setup + + cmake-utils_src_prepare +} + +src_configure() { + local libdir=$(get_libdir) + local mycmakeargs=( + -DLLVM_LIBDIR_SUFFIX=${libdir#lib} + + -DBUILD_SHARED_LIBS=ON + -DLLVM_OCAML_OUT_OF_TREE=ON + -DLLVM_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 + -DWITH_POLLY=OFF + -DLLVM_ENABLE_ASSERTIONS=$(usex debug) + -DLLVM_ENABLE_EH=ON + -DLLVM_ENABLE_RTTI=ON + + -DLLVM_HOST_TRIPLE="${CHOST}" + + # disable go bindings + -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND + + # TODO: ocamldoc + ) + + use test && mycmakeargs+=( + -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" + ) + + # 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-utils_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-utils_src_compile ocaml_all +} + +src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + cmake-utils_src_make check-llvm-bindings-ocaml +} + +src_install() { + DESTDIR="${D}" \ + cmake -P "${BUILD_DIR}"/bindings/ocaml/cmake_install.cmake || die + + dodoc bindings/ocaml/README.txt +} |