updated on Sat Jan 21 12:00:39 UTC 2012
[aur-mirror.git] / rust-git / PKGBUILD
blob741f324510dc3f0c226c8febb717b946435e6338
1 # Author: Taras Shpot <mrshpot@gmail.com>
3 pkgname=rust-git
4 pkgver=20120121
5 pkgrel=1
6 pkgdesc="A safe, concurrent, practical language from Mozilla."
7 arch=(i686 x86_64)
8 url="http://www.rust-lang.org/"
9 license=('MIT')
10 depends=('gcc-libs')
11 makedepends=('git' 'gcc'
12         'libffi' 'python2'  # for LLVM
13         )
14 optdepends=('pandoc: to build rust.pdf'
15         'llnextgen: for build-time grammar verification'
16         'naturaldocs: to build library doc')
18 _gitroot="git://github.com/mozilla/rust.git"
19 _gitname="rust"
21 build() {
22   cd "$srcdir"
23   msg "Connecting to git server...."
25   if [ -d $_gitname ] ; then
26     cd $_gitname && git pull origin
27     msg "The local files are updated."
28   else
29     git clone $_gitroot $_gitname
30   fi
32   msg "git checkout done or server timeout"
34   rm -rf "$srcdir/$_gitname-build"
35   git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
36   cd "$srcdir/$_gitname-build"
38   git submodule update --init --recursive
39   ./configure --prefix=/usr
40   msg 's/python$/python2/'
41   find . -executable -exec grep -qe 'env python$' '{}' ';' -exec sed -i 's/env python$/env python2/' '{}' ';' -print
43   msg "Starting make..."
44   make || return 1
46   mkdir "$pkgdir/usr"
47   make install DESTDIR="$pkgdir/usr/"
48   
49   _docdir=$pkgdir/usr/share/doc/rust
50   mkdir -p "$_docdir"
51   for _doc in rust.pdf rust.html tutorial.html rust.css core std rust.md ; do
52         if ! [ -e "doc/$_doc" ] ; then continue ; fi
53         cp -r "doc/$_doc" "$_docdir/"
54         chmod -R 644 "$_docdir/$_doc"
55         chown -R root:root "$_docdir/$_doc"
56   done
57   find "$_docdir" -type d -exec chmod 755 '{}' ';'
58