summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9c7970cb4f51da9a992a8f5dc430052a873388ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Maintainer: Jef Roosens

_pkgname='ved'
pkgname='ved-git'
pkgver=r285.151a221
pkgrel=1
pkgdesc='1 MB text editor written in V with hardware accelerated text rendering (development version)'
arch=('x86_64')
url='https://github.com/vlang/ved'

depends=(
    'glibc' 'libx11' 'libglvnd' 'libxcursor' 'libxi' 'gcc-libs' 'libxcb'
    'libxrender' 'libxfixes' 'libxext' 'libxau' 'libxdmcp'
)
makedepends=('git' 'vlang-git')

source=("${_pkgname}::git+https://github.com/vlang/ved")
md5sums=('SKIP')

pkgver() {
    cd "${_pkgname}"

    commit_count="$(git rev-list --count HEAD)"
    commit="$(git rev-parse --short HEAD)"

    echo "r${commit_count}.${commit}"
}

build() {
    cd "${_pkgname}"

    v -cc "${CC:-gcc}" -prod -o ved .
}

package() {
    # ved reads its hardcoded font file from the V resource path. If
    # V_RESOURCE_PATH is not defined, this path is equal to the directory where
    # the called binary resides. Therefore, we install the binary and its font
    # file in /usr/lib and symlink the binary to /usr/bin.
    install -Dm755 "${_pkgname}/ved" "${pkgdir}/usr/lib/${_pkgname}/ved"
    install -m755 -d "${pkgdir}/usr/bin"
    ln -s "/usr/lib/${_pkgname}/ved" "${pkgdir}/usr/bin/ved"

    # ved uses a hardcored font, provided in the repository.
    install -Dm644 "${_pkgname}/RobotoMono-Regular.ttf" "${pkgdir}/usr/lib/${_pkgname}/RobotoMono-Regular.ttf"

    # ved looks for syntax definitions in the directory where the binary is
    # located.
    install -m755 -d "${pkgdir}/usr/lib/${_pkgname}/syntax"
    install -Dm644 "${_pkgname}/syntax"/* "${pkgdir}/usr/lib/${_pkgname}/syntax"
}