Commit 73552925 authored by Jakub Jirutka's avatar Jakub Jirutka

main/llvm4: improve abuild's support for non-default LLVM usage

And also fix "replaces", it's inherited to subpackages, so all
subpackages had replaces="llvm".
parent 24bd280a
......@@ -7,12 +7,10 @@ pkgver=4.0.0
_majorver=${pkgver%%.*}
pkgname=$_pkgname$_majorver
pkgrel=4
pkgdesc="Low Level Virtual Machine compiler system (version $_majorver)"
pkgdesc="Low Level Virtual Machine compiler system, version $_majorver"
arch="all"
url="http://llvm.org/"
license="UOI-NCSA"
provides="llvm=$pkgver-r$pkgrel"
replaces="llvm"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="binutils-dev chrpath cmake file libffi-dev paxmark python2 py-setuptools zlib-dev"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev $pkgname-test-utils:_test_utils"
......@@ -32,6 +30,14 @@ case "$CARCH" in
arm*) options="!check";;
esac
# Whether is this package the default (latest) LLVM version.
_default_llvm="yes"
if [ "$_default_llvm" = yes ]; then
provides="llvm=$pkgver-r$pkgrel"
replaces="llvm"
fi
# NOTE: It seems that there's no (sane) way how to change includedir, sharedir
# etc. separately, just the CMAKE_INSTALL_PREFIX. Standard CMake variables and
# even LLVM-specific variables, that are related to these paths, actually
......@@ -126,12 +132,6 @@ package() {
make DESTDIR="$pkgdir" install
# This tool is needed e.g. for running codegen tests in Rust package.
install -D -m 755 bin/FileCheck "$pkgdir"/$_prefix/bin/FileCheck
# This tool is required for the lit testing tool.
install -D -m 755 bin/not "$pkgdir"/$_prefix/bin/not
cd "$pkgdir"/$_prefix
# Remove RPATHs.
......@@ -151,7 +151,7 @@ package() {
esac
# If this package provides=llvm (i.e. it's the default/latest
# llvm package), omit version infix/suffix.
if [ -n "$provides" ]; then
if [ "$_default_llvm" = yes ]; then
newname=$name
fi
case "$name" in
......@@ -175,16 +175,16 @@ package() {
static() {
pkgdesc="LLVM $_majorver static libraries"
provides="llvm-static=$pkgver-r$pkgrel"
_common_subpkg
_mv "$pkgdir"/$_prefix/lib/*.a "$subpkgdir"/$_prefix/lib/
}
libs() {
pkgdesc="LLVM $_majorver runtime library"
provides="llvm-libs=$pkgver-r$pkgrel"
local soname="libLLVM-$_majorver.0.so"
local soname2="libLLVM-$pkgver.so"
_common_subpkg
mkdir -p "$subpkgdir"
cd "$subpkgdir"
......@@ -201,7 +201,7 @@ libs() {
}
dev() {
provides="llvm-dev=$pkgver-r$pkgrel"
_common_subpkg
default_dev
cd "$subpkgdir"
......@@ -213,8 +213,9 @@ dev() {
_test_utils() {
pkgdesc="LLVM $_majorver utilities for executing LLVM and Clang style test suites"
provides="llvm-test-utils=$pkgver-r$pkgrel"
depends="python2"
_common_subpkg
replaces=""
local litver=$(python2 "$builddir"/utils/lit/setup.py --version 2>/dev/null \
| sed 's/\.dev.*$//')
......@@ -222,11 +223,19 @@ _test_utils() {
provides="$provides lit=$litver-r$pkgrel"
cd "$builddir"/build
install -D -m 755 bin/FileCheck "$subpkgdir"/$_prefix/bin/FileCheck
install -D -m 755 bin/not "$subpkgdir"/$_prefix/bin/not
python2 ../utils/lit/setup.py install --prefix=/usr --root="$subpkgdir"
ln -s ../../../bin/lit "$subpkgdir"/$_prefix/bin/lit
}
cd "$subpkgdir"
_mv "$pkgdir"/$_prefix/bin/FileCheck $_prefix/bin/
_mv "$pkgdir"/$_prefix/bin/not $_prefix/bin/
_common_subpkg() {
if [ "$_default_llvm" = yes ]; then
replaces="llvm${subpkgname#$pkgname}"
provides="$replaces=$pkgver-r$pkgrel"
fi
}
_mv() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment