# Maintainer: Mihails Strasuns <public@dicebot.lv>
pkgname=('dcd')
pkgver=0.7.2
pkgrel=1
pkgdesc="D Completion Daemon: auto-complete for the D programming language"
license=("GPL3")
groups=('dlang')
arch=('x86_64')
url="https://github.com/Hackerpilot/DCD"
makedepends=('ldc' 'git')
depends=('liblphobos')

source=(
    "git+https://github.com/Hackerpilot/DCD#tag=v$pkgver"
    "dcd.service"
    "dcd.conf"
)
sha256sums=(
    'SKIP'
    '7d3483ee92e42101d07395775aac5f0b277780f847c3823879fb35d1f2a9fbb3'
    'fb765020c49a918b157f5be2cabd71c16bbb050ddd762f1e08c84d1eddd4c97b'
)

build()
{
    cd $srcdir/DCD
    git submodule update --init --recursive
    make ldc
}

package()
{
    cd $srcdir/DCD

    # binaries
    mkdir -p $pkgdir/usr/bin
    install -m755 -t $pkgdir/usr/bin ./bin/dcd-server
    install -m755 -t $pkgdir/usr/bin ./bin/dcd-client

    # documentation
    mkdir -p $pkgdir/usr/share/man/man1
    install -Dm644 man1/* $pkgdir/usr/share/man/man1/

    # systemd service
    install -Dm644 $srcdir/dcd.service ${pkgdir}/usr/lib/systemd/system/dcd.service

    # global config
    install -Dm644 $srcdir/dcd.conf ${pkgdir}/etc/dcd.conf
}
