summaryrefslogtreecommitdiff
path: root/community/dmd/PKGBUILD
blob: 819ecb15741d39081001f78226f1e3341023acce (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# $Id: PKGBUILD 106417 2014-03-02 21:15:14Z dicebot $
# Maintainer: Mihails Strasunse <public@dicebot.lv>
# Contributor: 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-devel' 'libphobos')
groups=('dlang' 'dlang-dmd')
pkgbase=dmd
pkgver=2.065.0
pkgrel=3
arch=('i686' 'x86_64')
url="http://www.dlang.org"
makedepends=('git' 'gcc' 'make')
source=("git+http://github.com/D-Programming-Language/dmd.git#tag=v$pkgver"
        "git+http://github.com/D-Programming-Language/druntime.git#tag=v$pkgver"
        "git+http://github.com/D-Programming-Language/phobos.git#tag=v$pkgver")
sha1sums=('SKIP'
          'SKIP'
          'SKIP')

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

build() {
    cd $srcdir/dmd/src
    make -f posix.mak MODEL=$_archbits RELEASE=1

    cd $srcdir/druntime
    make -f posix.mak MODEL=$_archbits DMD=$srcdir/dmd/src/dmd RELEASE=1

    cd $srcdir/phobos
    make -f posix.mak MODEL=$_archbits DMD=$srcdir/dmd/src/dmd RELEASE=1
}

package_dmd() {
    pkgdesc="The D programming language reference compiler"
    backup=('etc/dmd.conf')
    depends=('gcc' 'libphobos-devel')
    optdepends=(
        'dtools: collection of useful utilities for development in D' 'libphobos-devel: standard library, development package'
        'libphobos: standard D library, Phobos; shared library'
    )
    provides=("d-compiler=$pkgver")
    license=('custom')
    backup=('etc/dmd.conf')

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

    mkdir -p $pkgdir/etc
    echo -e "[Environment]\nDFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib -L-L/usr/lib32 -L--no-warn-search-mismatch -L--export-dynamic" > $pkgdir/etc/dmd.conf

    mkdir -p $pkgdir/usr/share/man/man1
    mkdir -p $pkgdir/usr/share/man/man5
    cp -r $srcdir/dmd/docs/man/man1/* $pkgdir/usr/share/man/man1/
    cp -r $srcdir/dmd/docs/man/man5/* $pkgdir/usr/share/man/man5/

    install -Dm644 $srcdir/dmd/src/backendlicense.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE-backend
    install -Dm644 $srcdir/dmd/src/gpl.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE-frontend.1
    install -Dm644 $srcdir/dmd/src/artistic.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE-frontend.2
    install -Dm644 $srcdir/phobos/LICENSE_1_0.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE-phobos

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

    find $pkgdir/usr -type f | xargs chmod 0644
    chmod 755 $pkgdir/usr/bin/*
}

package_libphobos-devel() {
    pkgdesc="The Phobos standard library for D programming language. Modules and static library."
    options=("staticlibs")
    provides=("d-runtime=$pkgver" "d-stdlib=$pkgver")
    license=("custom")

    install -Dm644 $srcdir/phobos/generated/linux/release/$_archbits/libphobos2.a $pkgdir/usr/lib/libphobos2.a

    mkdir -p $pkgdir/usr/include/dlang/dmd
    cp -r $srcdir/phobos/{*.d,etc,std} $pkgdir/usr/include/dlang/dmd
    cp -r $srcdir/druntime/import/* $pkgdir/usr/include/dlang/dmd/

    find $pkgdir/usr -type f | xargs chmod 0644

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

package_libphobos() {
    pkgdesc="The Phobos standard library for D programming language."
    depends=("curl")
    license=("custom")

    install -Dm644 $srcdir/phobos/generated/linux/release/$_archbits/libphobos2.so $pkgdir/usr/lib/libphobos2.so
    install -Dm644 $srcdir/phobos/LICENSE_1_0.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE
}