summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4ff0eab597dcc7dc7cb77ef04cc3e946981755f0 (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
# Maintainer: mfw <espadonne@outlook.com>

pkgname=lupin
pkgver=0.1.62
pkgrel=1
pkgdesc='The reference interpreter for the wolf language, and the compiler differential oracle'
arch=('x86_64' 'aarch64')
url='https://github.com/wolffe-lang/wolf-interp'
license=('GPL-3.0-or-later')
# Built from source here, so it links against the builder's own glibc;
# no floor to declare. (The release archives import at most GLIBC_2.34
# since 0.1.39, wolf-lang#447's lupin half.)
depends=('gcc-libs' 'glibc')
makedepends=('rust' 'cargo' 'git')
optdepends=('wolf-lang: the compiler lupin is differentially tested against')
provides=('lupin')
conflicts=('lupin-bin')
# D57, and the reason this is a git source and not the release tarball:
# build.rs reads the git commit and the tags pointing at HEAD, and
# `lupin --version` prints the bare version only when `v$pkgver` is one
# of them. A GitHub archive tarball has no .git, so it would build a
# binary that answers `0.1.27+dev.unknown`.
source=("git+https://github.com/wolffe-lang/wolf-interp.git#tag=v$pkgver")
sha256sums=('SKIP')

prepare() {
    cd wolf-interp
    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    cd wolf-interp
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    # The spec and corpus come from the tracked vendor/upstream snapshot;
    # the upstream/ submodule is not needed for a build (docs/manual/00).
    cargo build --frozen --release
}

check() {
    cd wolf-interp
    export RUSTUP_TOOLCHAIN=stable
    # The whole suite, and it can fail (homebrew-wolf#22). Two tests are
    # skipped by name, and not for want of a counterparty: both drive
    # lupin against ITSELF and assert what a DEBUG build of it says
    # (`UNOPTIMIZED build`, wolf-interp#63), so under --release they are
    # red by construction. The `|| true` this replaces hid those two and,
    # because cargo stops at the first failing test binary, every target
    # after tests/differ_cli.rs too.
    cargo test --frozen --release -- \
        --skip a_debug_harness_is_refused_by_name_before_it_can_compare \
        --skip the_door_is_loud_and_stamps_the_profile_on_the_report
}

package() {
    cd wolf-interp

    install -Dm755 target/release/lupin "$pkgdir/usr/bin/lupin"
    install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
    install -Dm644 CHANGELOG.md "$pkgdir/usr/share/doc/$pkgname/CHANGELOG.md"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}