summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e48fcf12a7e3f1e95ef8d3d34bdbd4585a87ab89 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
# Maintainer: Jesus Alvarez <jeezusjr at gmail dot com>
#
# WARNING: packaging does not work with aurutils, see https://aur.archlinux.org/packages/jakt-git#comment-883725
#
pkgname=jakt-git
pkgver=r2296.7a35484f
pkgrel=1
pkgdesc="The Jakt Programming Language from SerenityOS"
arch=("x86_64")
url="https://github.com/SerenityOS/jakt"
license=("BSD")
depends=("clang")
makedepends=("ninja" "cmake" "git")
provides=("jakt")
conflicts=("jakt")
source=("${pkgname}::git+https://github.com/SerenityOS/jakt.git")
md5sums=('SKIP')

pkgver() {
    cd "${pkgname}"
    ( set -o pipefail
      git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
      printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
    )
}

build() {
    cd "${pkgname}"

    # stage1
    cmake -GNinja -B build \
        -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
        -DCMAKE_CXX_COMPILER=clang++ \
        -DCMAKE_BUILD_TYPE=Release \
        -DFINAL_STAGE=1
    cmake --build build

    # test stage1
    ./build/bin/jakttest

    # stage2
    cmake -B build -DFINAL_STAGE=2
    cmake --build build
}

check() {
    # test stage2
    cd "${pkgname}"
    ./build/bin/jakttest
}

package() {
    cd "${pkgname}"
    install -d "${pkgdir}/usr/bin"
    install -d "${pkgdir}/usr/share/doc/${pkgname}"
    install -d "${pkgdir}/usr/share/licenses/${pkgname}"
    install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
    install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"

    DESTDIR="$pkgdir" cmake --install build

    # WORKAROUND for https://github.com/SerenityOS/jakt/issues/1214
    ln -sv ./jakt_stage1 ${pkgdir}/usr/bin/jakt
}