#Contributor (Arch): Akshay Srinivasan <akshaysrinivasan at gmail.com>
pkgname=clx-git
_clname=clx
pkgver=20120421
pkgrel=1
pkgdesc="Xlib for common lisp systems"
arch=('i686' 'x86_64' 'mips64el')
url="http://www.cliki.net/CLX"
license=('custom')
depends=('x-server' 'sbcl')
makedepends=('texinfo')
install=clx.install
source=(README.licensing)        
md5sums=('74858379015567928f1eee186d9db1a4')

conflicts=('clx')
provides=('clx')

makedepends=('git')

_gitroot="git://github.com/sharplispers/clx.git"
_gitname="clx"


build() {

    cat << EOM

	WARNING!

	You are building a package using a snapshot from a repository. The
        resulting package may be unusable or pose a security risk, since
        the install script does not check source file hashes. Do not continue
        if this is undesirable.

EOM
    
    install -d ${pkgdir}/usr/share/common-lisp/systems
    install -d ${pkgdir}/usr/share/common-lisp/source/${_clname}/{debug,demo,test}
    install -d ${pkgdir}/usr/share/licenses/${_clname}
    install -d ${pkgdir}/usr/share/info

         ### Git checkout
    cd "$srcdir"
    msg "Connecting to GIT server...."
    
    if [ -d $_gitname ] ; then
	cd $_gitname && git pull origin
	msg "The local files are updated."
    else
	git clone $_gitroot $_gitname
    fi

    cd ${pkgdir}/usr/share/common-lisp/source/${_clname}

    install -m 644 -t . ${srcdir}/${_gitname}/*.lisp
    install -m 644 -t debug ${srcdir}/${_gitname}/debug/*.lisp
    install -m 644 -t demo ${srcdir}/${_gitname}/demo/*.lisp
    install -m 644 -t test ${srcdir}/${_gitname}/test/*.lisp

    install -m 644 -t . ${srcdir}/${_gitname}/${_clname}.asd
    cd ${pkgdir}/usr/share/common-lisp/systems
	ln -s ../source/${_clname}/${_clname}.asd .

    cd ${srcdir}/${_gitname}/manual
    makeinfo ${_clname}.texinfo
    install -m 644 ${_clname}.info ${pkgdir}/usr/share/info

    install -m 644 ${srcdir}/README.licensing ${pkgdir}/usr/share/licenses/${_clname}

}