Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ml/llvm-ocaml/
Date: Wed, 01 Aug 2018 20:53:39
Message-Id: 1533156799.59079df70d51b8a4741fd5b2853f713ccf051f45.mgorny@gentoo
1 commit: 59079df70d51b8a4741fd5b2853f713ccf051f45
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 1 16:38:59 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 1 20:53:19 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59079df7
7
8 dev-ml/llvm-ocaml: Branch out LLVM 7.0
9
10 dev-ml/llvm-ocaml/llvm-ocaml-7.0.9999.ebuild | 127 +++++++++++++++++++++++++++
11 1 file changed, 127 insertions(+)
12
13 diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-7.0.9999.ebuild b/dev-ml/llvm-ocaml/llvm-ocaml-7.0.9999.ebuild
14 new file mode 100644
15 index 00000000000..a42a26046fc
16 --- /dev/null
17 +++ b/dev-ml/llvm-ocaml/llvm-ocaml-7.0.9999.ebuild
18 @@ -0,0 +1,127 @@
19 +# Copyright 1999-2018 Gentoo Foundation
20 +# Distributed under the terms of the GNU General Public License v2
21 +
22 +EAPI=6
23 +
24 +: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
25 +# (needed due to CMAKE_BUILD_TYPE != Gentoo)
26 +CMAKE_MIN_VERSION=3.7.0-r1
27 +PYTHON_COMPAT=( python2_7 )
28 +
29 +inherit cmake-utils git-r3 llvm multiprocessing python-any-r1
30 +
31 +DESCRIPTION="OCaml bindings for LLVM"
32 +HOMEPAGE="https://llvm.org/"
33 +SRC_URI=""
34 +EGIT_REPO_URI="https://git.llvm.org/git/llvm.git
35 + https://github.com/llvm-mirror/llvm.git"
36 +EGIT_BRANCH="release_70"
37 +
38 +# Keep in sync with sys-devel/llvm
39 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
40 + NVPTX PowerPC Sparc SystemZ X86 XCore )
41 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
42 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
43 +
44 +LICENSE="UoI-NCSA"
45 +SLOT="0/${PV}"
46 +KEYWORDS=""
47 +IUSE="debug test ${ALL_LLVM_TARGETS[*]}"
48 +RESTRICT="!test? ( test )"
49 +
50 +RDEPEND="
51 + >=dev-lang/ocaml-4.00.0:0=
52 + dev-ml/ocaml-ctypes:=
53 + ~sys-devel/llvm-${PV}:=[${LLVM_TARGET_USEDEPS// /,},debug?]
54 + !sys-devel/llvm[ocaml(-)]"
55 +# configparser-3.2 breaks the build (3.3 or none at all are fine)
56 +DEPEND="${RDEPEND}
57 + dev-lang/perl
58 + dev-ml/findlib
59 + test? ( dev-ml/ounit )
60 + !!<dev-python/configparser-3.3.0.2
61 + ${PYTHON_DEPS}"
62 +
63 +REQUIRED_USE="${PYTHON_REQUIRED_USE}
64 + || ( ${ALL_LLVM_TARGETS[*]} )"
65 +
66 +# least intrusive of all
67 +CMAKE_BUILD_TYPE=RelWithDebInfo
68 +
69 +pkg_setup() {
70 + LLVM_MAX_SLOT=${PV%%.*} llvm_pkg_setup
71 + python-any-r1_pkg_setup
72 +}
73 +
74 +src_prepare() {
75 + # Python is needed to run tests using lit
76 + python_setup
77 +
78 + cmake-utils_src_prepare
79 +}
80 +
81 +src_configure() {
82 + local libdir=$(get_libdir)
83 + local mycmakeargs=(
84 + -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
85 +
86 + -DBUILD_SHARED_LIBS=ON
87 + -DLLVM_OCAML_OUT_OF_TREE=ON
88 + -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
89 + -DLLVM_BUILD_TESTS=$(usex test)
90 +
91 + # disable various irrelevant deps and settings
92 + -DLLVM_ENABLE_FFI=OFF
93 + -DLLVM_ENABLE_TERMINFO=OFF
94 + -DHAVE_HISTEDIT_H=NO
95 + -DWITH_POLLY=OFF
96 + -DLLVM_ENABLE_ASSERTIONS=$(usex debug)
97 + -DLLVM_ENABLE_EH=ON
98 + -DLLVM_ENABLE_RTTI=ON
99 +
100 + -DLLVM_HOST_TRIPLE="${CHOST}"
101 +
102 + # disable go bindings
103 + -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
104 +
105 + # TODO: ocamldoc
106 + )
107 +
108 + use test && mycmakeargs+=(
109 + -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
110 + )
111 +
112 + # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
113 + # also: custom rules for OCaml do not work for CPPFLAGS
114 + use debug || local -x CFLAGS="${CFLAGS} -DNDEBUG"
115 + cmake-utils_src_configure
116 +
117 + local llvm_libdir=$(llvm-config --libdir)
118 + # an ugly hack; TODO: figure out a way to pass -L to ocaml...
119 + cd "${BUILD_DIR}/${libdir}" || die
120 + ln -s "${llvm_libdir}"/*.so . || die
121 +
122 + if use test; then
123 + local llvm_bindir=$(llvm-config --bindir)
124 + # Force using system-installed tools.
125 + sed -i -e "/llvm_tools_dir/s@\".*\"@\"${llvm_bindir}\"@" \
126 + "${BUILD_DIR}"/test/lit.site.cfg.py || die
127 + fi
128 +}
129 +
130 +src_compile() {
131 + cmake-utils_src_compile ocaml_all
132 +}
133 +
134 +src_test() {
135 + # respect TMPDIR!
136 + local -x LIT_PRESERVES_TMP=1
137 + cmake-utils_src_make check-llvm-bindings-ocaml
138 +}
139 +
140 +src_install() {
141 + DESTDIR="${D}" \
142 + cmake -P "${BUILD_DIR}"/bindings/ocaml/cmake_install.cmake || die
143 +
144 + dodoc bindings/ocaml/README.txt
145 +}