updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / dmd2-git / PKGBUILD
blob73bbba706419c7251c1717c9f36934a7db1643fd
1 # Maintainer: Zenja Ivkovic <izenja@gmail.com> aka izenja
2 pkgname=dmd2-git
3 true && pkgname=('dmd2-git' 'druntime-git' 'libphobos2-git')
4 pkgver=20111216
5 pkgrel=1
6 arch=('i686' 'x86_64')
7 url="http://www.digitalmars.com/d/2.0/"
8 license=('GPL')
9 makedepends=('git')
10 options=('!strip' 'docs')
12 _gitroot=("git://github.com/D-Programming-Language/dmd.git" "git://github.com/D-Programming-Language/druntime.git" "git://github.com/D-Programming-Language/phobos.git")
13 _gitname=('dmd' 'druntime' 'phobos')
15 if [ $CARCH = 'x86_64' ] ; then
16         archstr="64"
18 if [ $CARCH = 'i686' ] ; then
19         archstr="32"
22 build() {
23         cd "$srcdir"
24         msg "Retrieving from repository: dmd"
25         if [ -d ${_gitname[0]} ] ; then
26                 cd ${_gitname[0]} && git pull origin
27         else
28                 git clone ${_gitroot[0]} ${_gitname[0]}
29         fi
30         
31         cd "$srcdir"
32         msg "Retrieving from repository: druntime"
33         if [ -d ${_gitname[1]} ] ; then
34                 cd ${_gitname[1]} && git pull origin
35         else
36                 git clone ${_gitroot[1]} ${_gitname[1]}
37         fi
39         cd "$srcdir"
40         msg "Retrieving from repository: phobos"
41         if [ -d ${_gitname[2]} ] ; then
42                 cd ${_gitname[2]} && git pull origin
43         else
44                 git clone ${_gitroot[2]} ${_gitname[2]}
45         fi
46         
47         msg "Making dmd"
48         rm -rf "$srcdir/${_gitname[0]}-build"
49         git clone "$srcdir/${_gitname[0]}" "$srcdir/${_gitname[0]}-build"
50         cd "$srcdir/${_gitname[0]}-build/src"
51         make -f posix.mak MODEL=$archstr
52                 
53         msg "Making druntime"
54         rm -rf "$srcdir/${_gitname[1]}-build"
55         git clone "$srcdir/${_gitname[1]}" "$srcdir/${_gitname[1]}-build"
56         cd "$srcdir/${_gitname[1]}-build"
57         # stacktrace.d fails to compile on 64 bit, at least for me, and probably pointless to have on linux anyway
58         patch posix.mak <<-'ENDPATCH'
59                 145d144
60                 <       src/core/sys/windows/stacktrace.d \
61                 480d478
62                 <       $(IMPDIR)/core/sys/windows/stacktrace.di \
63         ENDPATCH
64         PATH="$srcdir/${_gitname[0]}-build/src:$PATH" make -f posix.mak MODEL=$archstr
65         
66         msg "Making phobos"
67         rm -rf "$srcdir/${_gitname[2]}-build"
68         git clone "$srcdir/${_gitname[2]}" "$srcdir/${_gitname[2]}-build"
69         cd "$srcdir/${_gitname[2]}-build"
70         # phobos' makefile tries to make ../druntime - make that the build directory we use
71         patch posix.mak <<-ENDPATCH
72                 48c48
73                 < DRUNTIME_PATH = ../druntime
74                 ---
75                 > DRUNTIME_PATH = ../${_gitname[1]}-build
76         ENDPATCH
77         PATH="$srcdir/${_gitname[0]}-build/src:$PATH" make -f posix.mak MODEL=$archstr
80 package_dmd2-git() {
81         provides=("dmd2" "d-compiler")
82         conflicts=("dmd2")
83         cd "$srcdir/${_gitname[0]}-build/src"
84         msg "Packaging dmd"
85         
86         install -Dm755 ./dmd $pkgdir/usr/bin/dmd
87         echo -e "[Environment]\nDFLAGS=-m$archstr -I/usr/include/d -I/usr/include/d/druntime/import -L-L/usr/lib -L-lrt" > $srcdir/dmd.conf
88         install -Dm644 $srcdir/dmd.conf $pkgdir/etc/dmd.conf
89         
90         msg "Packaging dmd man files"
91         cd "$srcdir/${_gitname[0]}-build/docs/man/man1"
92         for x in ./*.1 ; do
93                 install -Dm644 $x "$pkgdir/usr/share/man/man1/$(basename $x)"
94         done
95         for x in ./*.5 ; do
96                 install -Dm644 $x "$pkgdir/usr/share/man/man5/$(basename $x)"
97         done
100 package_druntime-git() {
101         provides=("druntime")
102         conflicts=("druntime")
103         msg "Packaging druntime"
104         
105         install -Dm644 $srcdir/${_gitname[1]}-build/lib/libdruntime.a $pkgdir/usr/lib/libdruntime.a
106         mkdir -p $pkgdir/usr/include/d/druntime
107         cp -Rf $srcdir/${_gitname[1]}-build/import $pkgdir/usr/include/d/druntime
110 package_libphobos2-git() {
111         provides=("libphobos2")
112         conflicts=("libphobos2" "libtango")
113         msg "Packaging phobos"
114         
115         cd "$srcdir/${_gitname[2]}-build"
116         install -Dm644 ./generated/linux/release/$archstr/libphobos2.a $pkgdir/usr/lib/libphobos2.a
117         mkdir -p $pkgdir/usr/include/d
118         cp -Rf std $pkgdir/usr/include/d
119         cp -Rf etc $pkgdir/usr/include/d
120         cp -f {crc32,index,unittest}.d $pkgdir/usr/include/d
123 pkgdesc="Digital Mars D compiler, runtime and standard library (git master branch)"