updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / dmd1-complete / PKGBUILD
blobb8fdab680a10c42c0ac6db89157aaeaa95fea00c
1 pkgname=dmd1-complete
2 mypkgname=dmd1
3 pkgver=1.066
4 pkgrel=2
5 pkgdesc="Runtime library for the D programming language including libphobos, compiled from source"
6 arch=('i686')
7 url="http://www.digitalmars.com/d/1.0/"
8 install="${mypkgname}.install"
9 source=(http://ftp.digitalmars.com/dmd.${pkgver}.zip
10         stackelf.patch
11         makefile.patch
12         slotcompat.patch)
13 noextract="dmd.${pkgver}.zip"
14 depends=()
15 makedepends=(unzip)
16 license=('custom')
17 conflicts=('libtango1' 'dmd1' 'libphobos1')
18 provides=('dmd1' 'libphobos1')
19 md5sums=('fd2c3f8dd46d0fe4597e9d96b4ab86b2'
20          'e1154aeeb871b12cb59c76cfe207ab2e'
21          '452824c5c619c637775dc81bfa245f9c'
22          '48d97c5d156caf6012250a5e096cb107')
24 build() {
25 ## Prepare Source
26         
27         # bsdtar fails, unpack using unzip
28         unzip dmd.${pkgver}.zip
30         # apply patches
31         patch -p0 -i "${srcdir}"/stackelf.patch || return 1
32         patch -p0 -i "${srcdir}"/makefile.patch || return 1
33         patch -p0 -i "${srcdir}"/slotcompat.patch || return 1
35         # remove unnecessary files
36         cd "${srcdir}"/dmd
37         rm -r freebsd html osx linux/lib/* \
38         linux/bin/{README.TXT,dmd,dmd.conf} windows \
39         samples README.TXT || return 1
40         
42 ## Make Source
43         
44         # filer out --as-needed
45         export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"
46         export LDFLAGS="${LDFLAGS//,--as-needed}"
47         export LDFLAGS="${LDFLAGS//--as-needed}"
48         
49         # make dmd
50         cd "${srcdir}"/dmd/src/dmd
51         make -f linux.mak || return 1
52         cp dmd idgen impcnvgen optabgen "${srcdir}"/dmd/linux/bin || return 1
53         chmod +x ../../linux/bin/dmd
55         # make phobos
56         cd "${srcdir}"/dmd/src/phobos
57         # zlib 1.2.5 will be statically linked
58         make -j1 -f linux.mak "DMD="${srcdir}"/dmd/linux/bin/dmd" || return 1
59         cp libphobos.a "${srcdir}"/dmd/linux/lib || return 1
61         # Clean up
62         cd "${srcdir}"/dmd/src/dmd
63         make -f linux.mak clean
64         find "${srcdir}"/dmd \( -name "*.c" -o -name "*.h" -o -name "*.mak" \
65         -o -name "*.obj" -o -name "*.ddoc" -o -name "*.asm" \) -exec rm -v {} \; || return 1
69 package() {
71 ## Install
73         # Lib
74         install -Dm644 "${srcdir}"/dmd/linux/lib/libphobos.a "${pkgdir}"/usr/lib/libphobos.a
76         # dmd compiler
77         install -Dm755 "${srcdir}"/dmd/linux/bin/dmd "${pkgdir}"/usr/bin/dmd
78         install -Dm755 "${srcdir}"/dmd/linux/bin/dumpobj "${pkgdir}"/usr/bin/dumpobj
79         install -Dm755 "${srcdir}"/dmd/linux/bin/obj2asm "${pkgdir}"/usr/bin/obj2asm
80         install -Dm755 "${srcdir}"/dmd/linux/bin/rdmd "${pkgdir}"/usr/bin/rdmd
82         # Build new dmd.conf
83         cd "${srcdir}"/dmd
84         cat > dmd1.conf << END
85 [Environment]
86 DFLAGS=-I/usr/include/d -L-L/usr/lib
87 END
88         install -Dm644 "${srcdir}"/dmd/dmd1.conf "${pkgdir}"/etc/dmd1.conf
89         
90         # Includes
91         install -d "${pkgdir}"/usr/include/d
92         cd "${srcdir}"/dmd/src/phobos
93         cp -Rf std "${pkgdir}"/usr/include/d
94         cp -Rf etc "${pkgdir}"/usr/include/d
95         cp -Rf internal "${pkgdir}"/usr/include/d
96         cp -f {crc32,object,gcstats}.d "${pkgdir}"/usr/include/d
98         # Get rid of this subdirectory; it's just an unpacked zlib source
99         # distribution.
100         rm -rf "${pkgdir}"/usr/include/d/etc/c/zlib
101         
102         # Insure that files and directories under /usr/include/d have
103         # correct permissions.
104         find "${pkgdir}/usr/include/d" -type d -print0 |xargs -0 chmod 755
105         find "${pkgdir}/usr/include/d" -type f -print0 |xargs -0 chmod 644
106         install -Dm644 "${srcdir}"/dmd/license.txt "${pkgdir}"/usr/share/licenses/${mypkgname}/LICENSE
108         # manpages
109         for x in "${srcdir}"/dmd/man/man1/*.1; do
110                 install -Dm644 "$x" "$pkgdir/usr/share/man/man1/$(basename "$x")" || return 1
111         done
113         for x in "${srcdir}"/dmd/man/man1/*.5; do
114                 install -Dm644 "$x" "$pkgdir/usr/share/man/man5/$(basename "$x")" || return 1
115         done