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