summaryrefslogtreecommitdiff
path: root/repo/devel/rustc.xibuild
blob: 67f1583b706260ce7af35e6b5a4ed8d71b942c75 (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
#!/bin/sh

MAKEDEPS="cmake "
DEPS="curl gcc libssh2"

PKG_VER=1.58.1
SOURCE=https://static.rust-lang.org/dist/rustc-$PKG_VER-src.tar.gz
DESC="Systems programming language focused on safety, speed and concurrency"

prepare () {
    mkdir -pv $PKG_DEST/opt/rustc-$PKG_VER             &&
    ln -svfin rustc-$PKG_VER $PKG_DEST/opt/rustc

    cat << EOF > config.toml
# see config.toml.example for more possible options
[llvm]

# use ninja
ninja = true

targets = "X86"
# When compiling LLVM, the experimental targets (WebAssembly
# and RISCV) are built by default - omit them
experimental-targets = ""

[build]
# omit HTML docs to save time and space (comment this to build them)
docs = false

# install cargo as well as rust
extended = true

[install]
# Adjust the prefix for the desired destination
#prefix = "/usr"
prefix = "/opt/rustc-$PKG_VER"

# docdir is used even if the full awesome docs are not installed
docdir = "share/doc/rustc-$PKG_VER"

[rust]
channel = "stable"
rpath = false

codegen-tests = false

# get a trace if there is an Internal Compiler Exception
backtrace-on-ice = true

EOF
}

build () {
    export RUSTFLAGS="$RUSTFLAGS -C link-arg=-lffi" &&
    python3 ./x.py build --exclude src/tools/miri

}

package () {
    export LIBSSH2_SYS_USE_PKG_CONFIG=1 &&
    DESTDIR=${PWD}/install python3 ./x.py install &&
    unset LIBSSH2_SYS_USE_PKG_CONFIG

    chown -R root:root install &&
    cp -a install/* $PKG_DEST

    mkdir -pv $PKG_DEST/etc/profile.d/
    cat > $PKG_DEST/etc/profile.d/rustc.sh << "EOF"
# Begin /etc/profile.d/rustc.sh

pathprepend /opt/rustc/bin           PATH

# End /etc/profile.d/rustc.sh
EOF
    mkdir -pv $PKG_DEST/etc/ld.so.conf.d
cat >> $PKG_DEST/etc/ld.so.conf.d/rustc.conf << EOF
# Begin rustc addition

/opt/rustc/lib

# End rustc addition
EOF

}