dev-ml/llvm-ocaml: Fix install against slotted LLVM
authorMichał Górny <mgorny@gentoo.org>
Thu, 2 Feb 2017 21:02:05 +0000 (22:02 +0100)
committerMichał Górny <mgorny@gentoo.org>
Wed, 15 Feb 2017 12:47:22 +0000 (13:47 +0100)
dev-ml/llvm-ocaml/llvm-ocaml-4.0.0_rc1.ebuild
dev-ml/llvm-ocaml/llvm-ocaml-9999.ebuild

index e984d5714028c88f37159b238eae5c0eb1084dce..3b21af3a478cd3a6d35953a04db45f1fc2ba719f 100644 (file)
@@ -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
 }
 
index 49f090910a248a60c06958786abd93b0e4cdb684..472e5dbe27199ecd668c9471a1862303ba03aae5 100644 (file)
@@ -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
 }