summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bf60d0666bdbd66a8dba2e597a51a4e718871aa2 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Maintainer: Xeonacid <h.dwwwwww@gmail.com>
# Contributor: Ivan Marquesi Lerner <ivanmlerner@protonmail.com>
# Contributor: BlackCatDevel0per

pkgname=solana  
epoch=1
pkgver=2.0.24
# https://github.com/anza-xyz/agave/blob/$pkgver/scripts/spl-token-cli-version.sh
_splTokenCliVersion=4.1.1
pkgrel=1
pkgdesc="A fast, secure, and censorship resistant blockchain."
url="https://www.solana.com"
arch=(x86_64)
license=(Apache-2.0)
depends=(bash cargo gcc-libs glibc systemd-libs)
makedepends=(git protobuf clang llvm)
provides=(spl-token)
source=(git+https://github.com/anza-xyz/agave.git#tag=v$pkgver
        git+https://github.com/solana-labs/solana-program-library.git#tag=token-cli-v$_splTokenCliVersion
        $pkgname.sysusers
        $pkgname.tmpfiles
        $pkgname-sbf_sdk-path.patch)
sha256sums=('4879f9db4009e1604dbac6b94580baf26676274a7e34bd8f2127d1148badc0cf'
            'd0d7c7e98b42a6613d4ba1ddc8ec7650434793bab5925bf565de6cf3ba6093a1'
            'bf7e015436e3d15e70fc67f323bbd04163f79a4de7d06a254a5409bd031227b0'
            'a0f9ee2a24ab97da977eed1dd68a92165c2f2e6d5467462fe83c762031f4e02b'
            'ca9915c38949bd275192f0a1761aafc238612e13096c4d227b5a9fc531509eee')
install=$pkgname.install
options=(!lto)

prepare() {
  export RUSTUP_TOOLCHAIN=stable
  cd $srcdir/agave
  patch -Np1 -i ../$pkgname-sbf_sdk-path.patch
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"

  cd $srcdir/solana-program-library
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cd $srcdir/agave
  # https://github.com/anza-xyz/agave/blob/v$pkgver/scripts/cargo-install-all.sh
  BINS=(
    solana
    solana-bench-tps
    solana-faucet
    solana-gossip
    agave-install
    solana-keygen
    agave-ledger-tool
    solana-log-analyzer
    solana-net-shaper
    agave-validator
    rbpf-cli
    cargo-build-bpf
    cargo-build-sbf
    cargo-test-bpf
    cargo-test-sbf
    solana-dos
    agave-install-init
    solana-stake-accounts
    solana-test-validator
    solana-tokens
    agave-watchtower
    solana-genesis
  )
  binargs=()
  for bin in "${BINS[@]}"; do
    binargs+=(--bin "$bin")
  done
  cargo build --frozen --release "${binargs[@]}"
  cargo build --frozen --release --manifest-path programs/bpf_loader/gen-syscall-list/Cargo.toml
  cargo run --frozen --release --bin gen-headers

  cd $srcdir/solana-program-library
  cargo build --frozen --release --bin spl-token
}

package() {
  cd $srcdir/agave
  BINS=(
    solana
    solana-bench-tps
    solana-faucet
    solana-gossip
    agave-install
    solana-keygen
    agave-ledger-tool
    solana-log-analyzer
    solana-net-shaper
    agave-validator
    rbpf-cli
    cargo-build-bpf
    cargo-build-sbf
    cargo-test-bpf
    cargo-test-sbf
    solana-dos
    agave-install-init
    solana-stake-accounts
    solana-test-validator
    solana-tokens
    agave-watchtower
    solana-genesis
  )
  for bin in "${BINS[@]}"; do
    install -Dm755 target/release/$bin -t $pkgdir/usr/bin
  done
  install -dm755 $pkgdir/usr/lib/$pkgname/sdk
  cp -a sdk/sbf $pkgdir/usr/lib/$pkgname/sdk
  install -dm755 $pkgdir/usr/lib/$pkgname/deps
  cp -a target/release/deps/libsolana*program.* $pkgdir/usr/lib/$pkgname/deps

  cd $srcdir/solana-program-library
  install -Dm755 target/release/spl-token -t $pkgdir/usr/bin

  install -Dm644 $srcdir/$pkgname.sysusers $pkgdir/usr/lib/sysusers.d/$pkgname.conf
  install -Dm644 $srcdir/$pkgname.tmpfiles $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
}