1 |
commit: 15ec24fe2ad9cdc3b02f1dfb10d5b3a9f98025a6 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 3 21:12:48 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 3 22:21:37 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15ec24fe |
7 |
|
8 |
dev-ml/llvm-ocaml: Add a live ebuild for 6.0 branch |
9 |
|
10 |
dev-ml/llvm-ocaml/llvm-ocaml-6.0.9999.ebuild | 132 +++++++++++++++++++++++++++ |
11 |
1 file changed, 132 insertions(+) |
12 |
|
13 |
diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-6.0.9999.ebuild b/dev-ml/llvm-ocaml/llvm-ocaml-6.0.9999.ebuild |
14 |
new file mode 100644 |
15 |
index 00000000000..b8960469aed |
16 |
--- /dev/null |
17 |
+++ b/dev-ml/llvm-ocaml/llvm-ocaml-6.0.9999.ebuild |
18 |
@@ -0,0 +1,132 @@ |
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 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_60" |
37 |
+ |
38 |
+# Keep in sync with sys-devel/llvm |
39 |
+ALL_LLVM_EXPERIMENTAL_TARGETS=( AVR Nios2 RISCV WebAssembly ) |
40 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 |
41 |
+ NVPTX PowerPC Sparc SystemZ X86 XCore |
42 |
+ "${ALL_LLVM_EXPERIMENTAL_TARGETS[@]}" ) |
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_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 |
+ # cheap hack: LLVM combines both anyway, and the only difference |
91 |
+ # is that the former list is explicitly verified at cmake time |
92 |
+ -DLLVM_TARGETS_TO_BUILD="" |
93 |
+ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" |
94 |
+ -DLLVM_BUILD_TESTS=$(usex test) |
95 |
+ |
96 |
+ # disable various irrelevant deps and settings |
97 |
+ -DLLVM_ENABLE_FFI=OFF |
98 |
+ -DLLVM_ENABLE_TERMINFO=OFF |
99 |
+ -DHAVE_HISTEDIT_H=NO |
100 |
+ -DWITH_POLLY=OFF |
101 |
+ -DLLVM_ENABLE_ASSERTIONS=$(usex debug) |
102 |
+ -DLLVM_ENABLE_EH=ON |
103 |
+ -DLLVM_ENABLE_RTTI=ON |
104 |
+ |
105 |
+ -DLLVM_HOST_TRIPLE="${CHOST}" |
106 |
+ |
107 |
+ # disable go bindings |
108 |
+ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND |
109 |
+ |
110 |
+ # TODO: ocamldoc |
111 |
+ ) |
112 |
+ |
113 |
+ use test && mycmakeargs+=( |
114 |
+ -DLLVM_LIT_ARGS="-vv" |
115 |
+ ) |
116 |
+ |
117 |
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 |
118 |
+ # also: custom rules for OCaml do not work for CPPFLAGS |
119 |
+ use debug || local -x CFLAGS="${CFLAGS} -DNDEBUG" |
120 |
+ cmake-utils_src_configure |
121 |
+ |
122 |
+ local llvm_libdir=$(llvm-config --libdir) |
123 |
+ # an ugly hack; TODO: figure out a way to pass -L to ocaml... |
124 |
+ cd "${BUILD_DIR}/${libdir}" || die |
125 |
+ ln -s "${llvm_libdir}"/*.so . || die |
126 |
+ |
127 |
+ if use test; then |
128 |
+ local llvm_bindir=$(llvm-config --bindir) |
129 |
+ # Force using system-installed tools. |
130 |
+ sed -i -e "/llvm_tools_dir/s@\".*\"@\"${llvm_bindir}\"@" \ |
131 |
+ "${BUILD_DIR}"/test/lit.site.cfg.py || die |
132 |
+ fi |
133 |
+} |
134 |
+ |
135 |
+src_compile() { |
136 |
+ cmake-utils_src_compile ocaml_all |
137 |
+} |
138 |
+ |
139 |
+src_test() { |
140 |
+ # respect TMPDIR! |
141 |
+ local -x LIT_PRESERVES_TMP=1 |
142 |
+ cmake-utils_src_make check-llvm-bindings-ocaml |
143 |
+} |
144 |
+ |
145 |
+src_install() { |
146 |
+ DESTDIR="${D}" \ |
147 |
+ cmake -P "${BUILD_DIR}"/bindings/ocaml/cmake_install.cmake || die |
148 |
+ |
149 |
+ dodoc bindings/ocaml/README.txt |
150 |
+} |