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: Tue, 27 Jun 2017 19:18:12
Message-Id: 1498591066.8ebdf97ca34a1f1d892dabd601932895b2334eb9.mgorny@gentoo
1 commit: 8ebdf97ca34a1f1d892dabd601932895b2334eb9
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 26 14:47:50 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 27 19:17:46 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ebdf97c
7
8 dev-ml/llvm-ocaml: Bump to 4.0.1
9
10 dev-ml/llvm-ocaml/Manifest | 1 +
11 dev-ml/llvm-ocaml/llvm-ocaml-4.0.1.ebuild | 130 ++++++++++++++++++++++++++++++
12 2 files changed, 131 insertions(+)
13
14 diff --git a/dev-ml/llvm-ocaml/Manifest b/dev-ml/llvm-ocaml/Manifest
15 index fc11f231595..a0a5bf2ee81 100644
16 --- a/dev-ml/llvm-ocaml/Manifest
17 +++ b/dev-ml/llvm-ocaml/Manifest
18 @@ -1 +1,2 @@
19 DIST llvm-4.0.0.src.tar.xz 21016340 SHA256 8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be SHA512 cf681f0626ef6d568d951cdc3e143471a1d7715a0ba11e52aa273cf5d8d421e1357ef2645cc85879eaefcd577e99e74d07b01566825b3d0461171ef2cbfc7704 WHIRLPOOL 9783e8f47306c1deb2e114d4b46a7db9b0260b4965076345c88765413c5fc8e73fab5f88ae4903adbdea31406022948b16d32ae47d98f5def074509d5d794579
20 +DIST llvm-4.0.1.src.tar.xz 21065652 SHA256 da783db1f82d516791179fe103c71706046561f7972b18f0049242dee6712b51 SHA512 16adc39b34ddb628f81b171119a8e2a0e9138b25011e803ef0b688e2fbea116fc4953d3a1b61b90a98a75e33619f81566b7cb06a9a2ea4d04ac5e0eb303a2d1d WHIRLPOOL 1626ff270f7ce4801d02a0797b227fda9314ff5c0c01d653111599e9a4d2854c4d9edc3c698a7abee8d79d6bce8b18dc619fbced3c07ca610d44a248d65830cc
21
22 diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-4.0.1.ebuild b/dev-ml/llvm-ocaml/llvm-ocaml-4.0.1.ebuild
23 new file mode 100644
24 index 00000000000..0f2af09760f
25 --- /dev/null
26 +++ b/dev-ml/llvm-ocaml/llvm-ocaml-4.0.1.ebuild
27 @@ -0,0 +1,130 @@
28 +# Copyright 1999-2017 Gentoo Foundation
29 +# Distributed under the terms of the GNU General Public License v2
30 +
31 +EAPI=6
32 +
33 +: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
34 +# (needed due to CMAKE_BUILD_TYPE != Gentoo)
35 +CMAKE_MIN_VERSION=3.7.0-r1
36 +PYTHON_COMPAT=( python2_7 )
37 +
38 +inherit cmake-utils llvm python-any-r1
39 +
40 +MY_P=llvm-${PV/_/}
41 +DESCRIPTION="OCaml bindings for LLVM"
42 +HOMEPAGE="http://llvm.org/"
43 +SRC_URI="http://releases.llvm.org/${PV/_//}/${MY_P/_/}.src.tar.xz"
44 +
45 +# Keep in sync with sys-devel/llvm
46 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
47 + NVPTX PowerPC RISCV Sparc SystemZ X86 XCore )
48 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
49 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
50 +
51 +LICENSE="UoI-NCSA"
52 +SLOT="0/${PV}"
53 +KEYWORDS="~amd64 ~arm ~x86"
54 +IUSE="test ${ALL_LLVM_TARGETS[*]}"
55 +
56 +RDEPEND="
57 + >=dev-lang/ocaml-4.00.0:0=
58 + dev-ml/ocaml-ctypes:=
59 + ~sys-devel/llvm-${PV}:=[${LLVM_TARGET_USEDEPS// /,}]
60 + !sys-devel/llvm[ocaml(-)]"
61 +# configparser-3.2 breaks the build (3.3 or none at all are fine)
62 +DEPEND="${RDEPEND}
63 + dev-lang/perl
64 + dev-ml/findlib
65 + test? ( dev-ml/ounit
66 + $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") )
67 + !!<dev-python/configparser-3.3.0.2
68 + ${PYTHON_DEPS}"
69 +
70 +REQUIRED_USE="${PYTHON_REQUIRED_USE}
71 + || ( ${ALL_LLVM_TARGETS[*]} )"
72 +
73 +S=${WORKDIR}/${MY_P/_/}.src
74 +
75 +# least intrusive of all
76 +CMAKE_BUILD_TYPE=RelWithDebInfo
77 +
78 +python_check_deps() {
79 + ! use test \
80 + || has_version "dev-python/lit[${PYTHON_USEDEP}]"
81 +}
82 +
83 +pkg_setup() {
84 + LLVM_MAX_SLOT=${PV%%.*} llvm_pkg_setup
85 + python-any-r1_pkg_setup
86 +}
87 +
88 +src_prepare() {
89 + # Python is needed to run tests using lit
90 + python_setup
91 +
92 + # User patches
93 + eapply_user
94 +}
95 +
96 +src_configure() {
97 + local libdir=$(get_libdir)
98 + local mycmakeargs=(
99 + -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
100 +
101 + -DBUILD_SHARED_LIBS=ON
102 + -DLLVM_OCAML_OUT_OF_TREE=ON
103 + -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
104 + -DLLVM_BUILD_TESTS=$(usex test)
105 +
106 + # disable various irrelevant deps and settings
107 + -DLLVM_ENABLE_FFI=OFF
108 + -DLLVM_ENABLE_TERMINFO=OFF
109 + -DHAVE_HISTEDIT_H=NO
110 + -DWITH_POLLY=OFF
111 + -DLLVM_ENABLE_ASSERTIONS=OFF
112 + -DLLVM_ENABLE_EH=ON
113 + -DLLVM_ENABLE_RTTI=ON
114 +
115 + -DLLVM_HOST_TRIPLE="${CHOST}"
116 +
117 + # disable go bindings
118 + -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
119 +
120 + # TODO: ocamldoc
121 + )
122 +
123 + use test && mycmakeargs+=(
124 + -DLIT_COMMAND="${EPREFIX}/usr/bin/lit"
125 + )
126 +
127 + cmake-utils_src_configure
128 +
129 + local llvm_libdir=$(llvm-config --libdir)
130 + # an ugly hack; TODO: figure out a way to pass -L to ocaml...
131 + cd "${BUILD_DIR}/${libdir}" || die
132 + ln -s "${llvm_libdir}"/*.so . || die
133 +
134 + if use test; then
135 + local llvm_bindir=$(llvm-config --bindir)
136 + # Force using system-installed tools.
137 + sed -i -e "/llvm_tools_dir/s@\".*\"@\"${llvm_bindir}\"@" \
138 + "${BUILD_DIR}"/test/lit.site.cfg || die
139 + fi
140 +}
141 +
142 +src_compile() {
143 + cmake-utils_src_compile ocaml_all
144 +}
145 +
146 +src_test() {
147 + # respect TMPDIR!
148 + local -x LIT_PRESERVES_TMP=1
149 + cmake-utils_src_make check-llvm-bindings-ocaml
150 +}
151 +
152 +src_install() {
153 + DESTDIR="${D}" \
154 + cmake -P "${BUILD_DIR}"/bindings/ocaml/cmake_install.cmake || die
155 +
156 + dodoc bindings/ocaml/README.txt
157 +}