Skip to content

Commit

Permalink
dev-ml/llvm-ocaml: Fix install against slotted LLVM
Browse files Browse the repository at this point in the history
  • Loading branch information
mgorny committed Feb 15, 2017
1 parent b20e6ef commit 38368fa
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
22 changes: 18 additions & 4 deletions dev-ml/llvm-ocaml/llvm-ocaml-4.0.0_rc1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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
}

Expand Down
22 changes: 18 additions & 4 deletions dev-ml/llvm-ocaml/llvm-ocaml-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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
}

Expand Down

0 comments on commit 38368fa

Please sign in to comment.