updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / context-minimals-git / PKGBUILD
bloba883170783494fa55d46c28334d9e508c0d321ac
1 # Maintainer: Aditya Mahajan <adityam at umich dot edu>
2 pkgname=context-minimals-git
3 pkgver=20110205
4 pkgrel=1
5 pkgdesc="A standalone ConTeXt distribution"
6 url="http://www.contextgarden.net"
7 license=('GPL')
8 arch=('i686' 'x86_64')
9 makedepends=('rsync')
10 optdepends=('fontconfig: xetex support' 'ruby: pdftex support')
12 conflicts=()
13 replaces=()
14 backup=()
16 install=context-minimals-git.install
18 PKGEXT=".pkg.tar.gz"
20 # ConTeXt minimals uses a different naming convention for architectures
22 declare -A _platform_map
24 _platform_map['i686']='linux'
25 _platform_map['x86_64']='linux-64'
27 _platform=${_platform_map[$CARCH]}
29 _rsyncurl=rsync://contextgarden.net/minimals/setup/${_platform}/bin
30 _dest=/opt/context-minimals
32 # This is the only way to get yaourt to store the files in
33 # /var/abs/local/yaourtbuild so that rsyncing the next time is efficient
35 _gitroot="http://dl.contextgarden.net/distribution/git/"
36 _gitname="master"
38 # Font directories
39 _texlivefontdir="/usr/share/texmf-dist/fonts/"
40 _userfontdir="\$HOME/.fonts"
41 _osfontdir="/usr/share/fonts"
43 build() {
44  msg "Downloading the latest scripts first"
45  rsync -rlptv $_rsyncurl $srcdir 
46  msg "Initializing download directory"
48  mkdir -p $srcdir/tex/texmf-cache
50  msg "Starting download or update of ConTeXt distribution"
51  PATH=$scrdir/tex/texmf-$platform/bin:$PATH \
52  $srcdir/bin/texlua $srcdir/bin/mtxrun --script $srcdir/bin/mtx-update.lua  \
53       --platform=$_platform --texroot=$srcdir/tex --engine=all --extras=all \
54       --context=beta  --update  --force --make || return 1
56  # The setuptex that comes with minimals does not work in a multi-user
57  # environment. So, we modify it appropriately.
59  echo "TEXMFOS=${_dest}/texmf-${_platform}"   > $srcdir/tex/setuptex
60  echo "export TEXMFOS"                       >> $srcdir/tex/setuptex
61  echo ""                                     >> $srcdir/tex/setuptex
62  echo "TEXMFCACHE=\$HOME/texmf-cache"        >> $srcdir/tex/setuptex
63  echo "export TEXMFCACHE"                    >> $srcdir/tex/setuptex
64  echo ""                                     >> $srcdir/tex/setuptex
65  echo "unset TEXINPUTS MPINPUTS MFINPUTS"    >> $srcdir/tex/setuptex
66  echo ""                                     >> $srcdir/tex/setuptex
67  echo "PATH=\$TEXMFOS/bin:\$PATH"            >> $srcdir/tex/setuptex
68  echo "export PATH"                          >> $srcdir/tex/setuptex
69  echo ""                                     >> $srcdir/tex/setuptex
70  echo "OSFONTDIR=\"$_userfontdir;$_osfontdir;\"" \
71                                             >> $srcdir/tex/setuptex
72  echo "export OSFONTDIR"                    >> $srcdir/tex/setuptex
73  # If texlive exists, use fonts from texlive
74  if [ -d $_texlivefontdir ]
75  then
76    mkdir -p $srcdir/tex/texmf-fonts
77    if [ -L $srcdir/tex/texmf-fonts/fonts ]
78    then 
79      rm $srcdir/tex/texmf-fonts/fonts
80    fi
81    ln -s $_texlivefontdir $srcdir/tex/texmf-fonts/fonts
82  fi
85  install -d $pkgdir/opt || return 1
86  msg "Copying files"
87  cp -r --preserve=links $srcdir/tex $pkgdir/$_dest || return 1