summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7b4e70a2bf2edfb2bfb9d26f8bfdf8b76573e768 (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
# Maintainer: Xeonacid <h.dwwwwww at gmail dot com>
# Contributor: Levi Zim <i at kxxt dot dev>

pkgname=devtools-riscv64
epoch=1
pkgver=1.4.0+patch1
pkgrel=1
pkgdesc='Tools for Arch Linux RISC-V package maintainers'
arch=('x86_64' 'riscv64' 'loong64')
license=('GPL-3.0-or-later')
url='https://github.com/felixonmars/archriscv-packages'
depends=(devtools)
depends_x86_64=(qemu-user-static)
depends_loong64=(qemu-user-static)
source=(makepkg-riscv64.patch
        pacman-extra-riscv64.patch
        fortran-riscv64.patch
        sogrep-riscv64.patch
        valid-repos-riscv64.sh
        z-archriscv-qemu-riscv64.conf)
sha256sums=('efaa0c9ca426564921c7d2d909d0c331fd80ce4840019b26c0a259a15b45a087'
            'f01c8cfdbfffa3212a78117f2ce6e0feb97f6cb3d49f47d4f541e9c9f6136e87'
            'c8432757292df29bb231d500f4be74522eebed4849f46eebcf22169ec319a2a8'
            'c8e9bfc390e42d358007578ca54212bda1d44c754c976be9ef262944d4a0d83c'
            '94ee35597de8e46b1f0c09f95ced34c47ece2f95f92d1a7f2415373f2d129c63'
            'c59273c423e815e4c27e8486632d80a768adddd172119035d48f7c2fac98a87a')

package() {
  install -Dm644 valid-repos-riscv64.sh -t "$pkgdir"/usr/share/devtools/lib
  patch /usr/bin/sogrep -i sogrep-riscv64.patch -o sogrep-riscv64
  install -Dm755 sogrep-riscv64 -t "$pkgdir"/usr/bin/

  ln -s archbuild "$pkgdir"/usr/bin/extra-riscv64-build
  ln -s archbuild "$pkgdir"/usr/bin/core-testing-riscv64-build

  patch /usr/share/devtools/makepkg.conf.d/x86_64.conf -i makepkg-riscv64.patch -o riscv64.conf
  install -Dm644 riscv64.conf -t "$pkgdir"/usr/share/devtools/makepkg.conf.d
  patch /usr/share/devtools/pacman.conf.d/extra.conf -i pacman-extra-riscv64.patch -o extra-riscv64.conf
  # Disable sandbox because some vendor kernels and qemu-user does not support it
  sed -i '/DisableSandbox/s/^#//' extra-riscv64.conf
  install -Dm644 extra-riscv64.conf -t "$pkgdir"/usr/share/devtools/pacman.conf.d
  ln -s extra-riscv64.conf "$pkgdir"/usr/share/devtools/pacman.conf.d/core-testing-riscv64.conf

  install -dm755 "$pkgdir"/usr/share/devtools/makepkg.conf.d/riscv64.conf.d

  patch /usr/share/devtools/makepkg.conf.d/conf.d/fortran.conf -i fortran-riscv64.patch -o fortran-riscv64.conf
  install -Dm644 fortran-riscv64.conf "$pkgdir"/usr/share/devtools/makepkg.conf.d/riscv64.conf.d/fortran.conf

  for conf in rust.conf; do
    ln -s '../conf.d/'$conf "$pkgdir"/usr/share/devtools/makepkg.conf.d/riscv64.conf.d/$conf
  done

  if [[ ! "$CARCH" =~ riscv ]]; then
    install -dm755 "$pkgdir"/usr/share/devtools/setarch-aliases.d
    echo "$CARCH" > "$pkgdir"/usr/share/devtools/setarch-aliases.d/riscv64

    # On Loong Arch Linux, uname -m returns loongarch64 while CARCH is loong64
    [[ "$CARCH" == "loong64" ]] && echo "loongarch64" > "$pkgdir"/usr/share/devtools/setarch-aliases.d/riscv64

    # qemu-user-static-binfmt, but with C flag
    install -Dm644 z-archriscv-qemu-riscv64.conf -t "$pkgdir"/usr/lib/binfmt.d/
  fi
}

# vim: ts=2 sw=2 et: