summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7dbf4835b9d3b094eb524e5254218a31d3c2f1b9 (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
# Maintainer: whoami <whoami@systemli.org>

pkgname=vlang-git
pkgver=r76.b6948ad
pkgrel=1
pkgdesc='Simple, fast, safe language created for developing maintainable software'
arch=('x86_64')
url='https://vlang.io'
license=('MIT')
makedepends=('git')
depends=('glfw')
conflicts=('v' 'vlang')
source=('git+https://github.com/vlang/v.git'
        'https://vlang.io/v.c')
sha256sums=('SKIP' 'SKIP')

pkgver() {
    cd v
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    mv v.c v/compiler/
    cd v && current_dir=$(pwd)
    cd compiler
    sed -i \
        "s|os__home_dir(), tos2(\"/code/v/\")|tos2(\"${current_dir}\"), tos2(\"/\")|g" \
        v.c
    sed -i \
        "s|mut lang_dir = os.home_dir() + '/code/v/'|mut lang_dir = '/usr/lib/v/'|g" \
        main.v
}

build() {
    cd v/compiler
    cc -std=gnu11 -w -o vc v.c
    ./vc -o v .
    #make # segfault
}

package() {
    cd v
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm755 compiler/v "$pkgdir/usr/bin/v"
    install -d "$pkgdir/usr/lib/vlang" "$pkgdir/usr/share/vlang"
    mv examples "$pkgdir/usr/share/vlang/"
    rm -r {LICENSE,README.md,compiler}
    cp -a * "$pkgdir/usr/lib/vlang/"
}