summaryrefslogtreecommitdiff
path: root/community/ldc/PKGBUILD
blob: 4db3ef56e165bab21744a3b8fd344281902f4ccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# $Id: PKGBUILD 81801 2012-12-30 15:21:03Z foutrelis $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
pkgname=ldc
pkgver=20121225
pkgrel=1
pkgdesc="A D Compiler based on the LLVM Compiler Infrastructure including D runtime and libphobos2"
arch=('i686' 'x86_64')
url="http://www.dsource.org/projects/ldc"
license=('BSD')
depends=('llvm' 'libconfig')
makedepends=('git' 'cmake')
backup=('etc/ldc2.conf')
source=(fix-llvm-IRBuilder.h-include-when-using-LLVM-3.2.patch)
md5sums=('0dacd8e4b8f88030c107dbb2a35bcc42')

_gitroot=git://github.com/ldc-developers/ldc.git
_gitname=ldc
_gitbranch=master

[[ $CARCH == "x86_64" ]] && _multilib="ON"
[[ $CARCH == "i686" ]] && _multilib="OFF"

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [[ -d "$_gitname" ]]; then
    cd "$_gitname" && git pull origin
    msg "The local files are updated."
  else
    git clone --branch "$_gitbranch" "$_gitroot" "$_gitname"
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting build..."

  rm -rf "$srcdir/$_gitname-build"
  git clone --recursive "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"

  # llvm/Support/IRBuilder.h was relocated in LLVM 3.2
  patch -Np1 -i "$srcdir/fix-llvm-IRBuilder.h-include-when-using-LLVM-3.2.patch"

  mkdir build && cd build
  cmake \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DINCLUDE_INSTALL_DIR=/usr/include/d/std-ldc \
      -DMULTILIB=$_multilib \
      ..
  make
}

package() {
  cd "$srcdir/$_gitname-build"

  cd build
  make DESTDIR=$pkgdir install
  cd ..

  mkdir -p $pkgdir/usr/share/bash-completion/
  mv $pkgdir/etc/bash_completion.d $pkgdir/usr/share/bash-completion/completions

  install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE

  # We don't actually want the multilib libs in this package
  rm -rf $pkgdir/usr/lib32
}