summaryrefslogtreecommitdiff
path: root/extra/rust/PKGBUILD
blob: 23c6bbaf343613b3a6b9a53b802ac8c6b5480d18 (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
# enable i686-unknown-linux-gnu target
# and replace pentium4 (SSE2) with pentium3 (no SSE2) in the compiler spec file
#
# Also trying to reduce memory usage by building with
# -debuginfo-level-std=1
# see https://github.com/rust-lang/rust/issues/60294

source+=(config.toml.patch)
sha256sums+=('42e861ba90335d0e2e666e10b12d9ff85ea1bdb711176fb3c09e92375e193660')

eval "$(
  declare -f prepare | \
    sed '
      $ i patch -p1 -i "$srcdir/config.toml.patch"
    '
)"

# stop insanity of nproc (see FS#62952)
eval "$(
  declare -f build | \
    sed '
      s/-j"$(nproc)"/-j1/
    '
)"

if [ "${CARCH}" != 'pentium4' ]; then
  eval "$(
    declare -f prepare | \
      sed '
        $ i sed -i "s/pentium4/pentium3/g" "$srcdir/rustc-$pkgver-src/vendor/rustc-ap-rustc_target/spec/i686_unknown_linux_gnu.rs"
        $ i sed -i "s/pentium4/pentium3/g" "$srcdir/rustc-$pkgver-src/src/librustc_target/spec/i686_unknown_linux_gnu.rs"
        $ i sed -i "s/a75a6025d7e3424edf9baf3039056c0f8eea157631a175d00ac5a218aa54b510/484bf8be15015b330fa9a97b6dabb8c7627e59d5cddb2dd0e83478749f8aabad/g" "$srcdir/rustc-$pkgver-src/vendor/rustc-ap-rustc_target/.cargo-checksum.json"
      '
  )"
fi

# Don't move lib32 support into rust32-lib, we are on 32-bit in the end
# and don't draw a symlink to 64-bit libraries (but to 32-bit instead)

pkgname=(
  $(
    printf '%s\n' "${pkgname[@]}" | \
      grep -v '^lib32-rust-libs'
  )
)

eval "$(
  declare -f package_rust | \
    sed '
      /mv.*i686-unknown-linux-gnu.*/d
      /ln /s/x86_64-unknown-linux-gnu/i686-unknown-linux-gnu/g
    '
)"

eval "$(
  declare -f build | \
    sed '
      /mv.*i686-unknown-linux-gnu.*/d
      /ln /s/x86_64-unknown-linux-gnu/i686-unknown-linux-gnu/g
    '
)"

# work around P1024, U1024 typenum bug for old rust releases (bundled
# typenum version contains a buggy version)
if [ "${CARCH}" = "i686" ]; then
  source+=('rustc-1.42.0-src-typenum-U1024.patch')
  sha256sums+=('716e5fad9b8bda690856d36f33359da26a4c258bb5e8ffd635898697177dc4de')
  eval "$(
    declare -f prepare | \
      sed '
        /}/ i \
          patch -Np1 < "$srcdir/rustc-1.42.0-src-typenum-U1024.patch"
      '
  )"

fi

# Enable on demand, if your previous rust is broken use previous version
# from build-support
#makedepends=(${makedepends[@]//rust/})
#makedepends+=('rust141')

# rust 1.41 is built against llvm 9.0, so force that in as a make dependency
#makedepends+=('llvm9-libs')

# LLVM download location changed (also upstream)
source[2]="https://github.com/llvm/llvm-project/releases/download/llvmorg-$_llvm_ver/compiler-rt-$_llvm_ver.src.tar.xz"
source[3]="https://github.com/llvm/llvm-project/releases/download/llvmorg-$_llvm_ver/compiler-rt-$_llvm_ver.src.tar.xz.sig"
sha256sums[2]="6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"