commit:     38368fa1b651054b97a272104ab7350a6e73b819
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  2 21:02:05 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 12:47:22 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38368fa1

dev-ml/llvm-ocaml: Fix install against slotted LLVM

 dev-ml/llvm-ocaml/llvm-ocaml-4.0.0_rc1.ebuild | 22 ++++++++++++++++++----
 dev-ml/llvm-ocaml/llvm-ocaml-9999.ebuild      | 22 ++++++++++++++++++----
 2 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-4.0.0_rc1.ebuild 
b/dev-ml/llvm-ocaml/llvm-ocaml-4.0.0_rc1.ebuild
index e984d57140..3b21af3a47 100644
--- a/dev-ml/llvm-ocaml/llvm-ocaml-4.0.0_rc1.ebuild
+++ b/dev-ml/llvm-ocaml/llvm-ocaml-4.0.0_rc1.ebuild
@@ -9,7 +9,7 @@ EAPI=6
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python2_7 )
 
-inherit cmake-utils python-any-r1
+inherit cmake-utils llvm python-any-r1
 
 MY_P=llvm-${PV/_/}
 DESCRIPTION="OCaml bindings for LLVM"
@@ -54,6 +54,11 @@ python_check_deps() {
                || has_version "dev-python/lit[${PYTHON_USEDEP}]"
 }
 
+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
@@ -94,6 +99,18 @@ src_configure() {
        )
 
        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 || die
+       fi
 }
 
 src_compile() {
@@ -103,9 +120,6 @@ src_compile() {
 src_test() {
        # respect TMPDIR!
        local -x LIT_PRESERVES_TMP=1
-       # Force using system-installed tools.
-       sed -i -e "/llvm_tools_dir/s@\".*\"@\"${EPREFIX}/usr/bin\"@" \
-               "${BUILD_DIR}"/test/lit.site.cfg || die
        cmake-utils_src_make check-llvm-bindings-ocaml
 }
 

diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-9999.ebuild 
b/dev-ml/llvm-ocaml/llvm-ocaml-9999.ebuild
index 49f090910a..472e5dbe27 100644
--- a/dev-ml/llvm-ocaml/llvm-ocaml-9999.ebuild
+++ b/dev-ml/llvm-ocaml/llvm-ocaml-9999.ebuild
@@ -9,7 +9,7 @@ EAPI=6
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python2_7 )
 
-inherit cmake-utils git-r3 python-any-r1
+inherit cmake-utils git-r3 llvm python-any-r1
 
 DESCRIPTION="OCaml bindings for LLVM"
 HOMEPAGE="http://llvm.org/";
@@ -53,6 +53,11 @@ python_check_deps() {
                || has_version "dev-python/lit[${PYTHON_USEDEP}]"
 }
 
+pkg_setup() {
+       llvm_pkg_setup
+       python-any-r1_pkg_setup
+}
+
 src_prepare() {
        # Python is needed to run tests using lit
        python_setup
@@ -93,6 +98,18 @@ src_configure() {
        )
 
        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 || die
+       fi
 }
 
 src_compile() {
@@ -102,9 +119,6 @@ src_compile() {
 src_test() {
        # respect TMPDIR!
        local -x LIT_PRESERVES_TMP=1
-       # Force using system-installed tools.
-       sed -i -e "/llvm_tools_dir/s@\".*\"@\"${EPREFIX}/usr/bin\"@" \
-               "${BUILD_DIR}"/test/lit.site.cfg || die
        cmake-utils_src_make check-llvm-bindings-ocaml
 }
 

Reply via email to