summaryrefslogtreecommitdiff
path: root/community/dmd/PKGBUILD
blob: e0ad22dc17eb683b5028f34a5572d0aa78893298 (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
68
69
70
71
72
73
74
75
# $Id: PKGBUILD 63477 2012-02-04 17:14:55Z svenstaro $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Chris Brannon <cmbrannon79@gmail.com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Anders Bergh <anders1@gmail.com>
# Contributor: Alexander Fehr <pizzapunk gmail com>

pkgname=('dmd' 'libphobos')
pkgbase=dmd
pkgver=2.057
pkgrel=2
pkgdesc="The Digital Mars D compiler"
arch=('i686' 'x86_64')
url="http://www.digitalmars.com/d/2.0/"
source=(http://ftp.digitalmars.com/$pkgname.$pkgver.zip
        tools.tar.gz::https://github.com/D-Programming-Language/tools/tarball/v2.057beta)
md5sums=('531c4b60eb002ea8abbe5c80b2eb677d'
         '5a0e4a9fe31f55bc69a1dd02486b9c3a')
license=('custom')

[[ $CARCH == "x86_64" ]] && _archbits="64"
[[ $CARCH == "i686" ]] && _archbits="32"

build() {
    cd $srcdir/dmd2/src/

    cd dmd
    make -f posix.mak MODEL=$_archbits

    cd ../druntime
    make -f posix.mak MODEL=$_archbits DMD=../dmd/dmd

    cd ../phobos
    make -f posix.mak MODEL=$_archbits DMD=../dmd/dmd

    cd $srcdir/D-Programming-Language-tools-*
    $srcdir/dmd2/src/dmd/dmd -I$srcdir/dmd2/src/druntime/import/ -I$srcdir/dmd2/src/phobos -L-L$srcdir/dmd2/src/phobos/generated/linux/release/$_archbits/ rdmd.d
}

package_dmd() {
  depends=('libphobos' 'gcc-libs')

  install -Dm755 $srcdir/dmd2/src/dmd/dmd $pkgdir/usr/bin/dmd

  mkdir -p $pkgdir/etc
  echo -e "[Environment]\nDFLAGS=-I/usr/include/d -I/usr/include/d/druntime/import -L-L/usr/lib -L-lrt" > $pkgdir/etc/dmd.conf

  install -Dm644 $srcdir/dmd2/man/man1/dmd.1 $pkgdir/usr/share/man/man1/dmd.1
  install -Dm644 $srcdir/dmd2/man/man1/rdmd.1 $pkgdir/usr/share/man/man1/rdmd.1
  install -Dm644 $srcdir/dmd2/man/man1/dmd.conf.5 $pkgdir/usr/share/man/man5/dmd.conf.5

  install -Dm644 $srcdir/dmd2/license.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE

  mkdir -p $pkgdir/usr/share/d/samples/
  cp -r $srcdir/dmd2/samples/d/* $pkgdir/usr/share/d/samples/

  install -Dm755 $srcdir/D-Programming-Language-tools-*/rdmd $pkgdir/usr/bin/rdmd
}

package_libphobos() {
  install -Dm644 $srcdir/dmd2/src/druntime/lib/libdruntime.a $pkgdir/usr/lib/libdruntime.a
  install -Dm644 $srcdir/dmd2/src/phobos/generated/linux/release/$_archbits/libphobos2.a $pkgdir/usr/lib/libphobos2.a

  mkdir -p $pkgdir/usr/include/d
  cp -r $srcdir/dmd2/src/phobos/{*.d,etc,std} $pkgdir/usr/include/d

  mkdir -p $pkgdir/usr/include/d/druntime
  cp -r $srcdir/dmd2/src/druntime/import $pkgdir/usr/include/d/druntime

  mkdir -p $pkgdir/usr/share/doc/d/
  cp -r $srcdir/dmd2/html $pkgdir/usr/share/doc/d/

  install -Dm644 $srcdir/dmd2/src/druntime/LICENSE_1_0.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE-druntime
  install -Dm644 $srcdir/dmd2/src/phobos/phoboslicense.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE-phobos
}