forked from japaric-archived/std-with-cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.script.sh
executable file
·41 lines (36 loc) · 1.13 KB
/
.travis.script.sh
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
#!/bin/bash
set -e
set -x
export AR_mips_unknown_linux_gnu=mips-openwrt-linux-ar
export CC_mips_unknown_linux_gnu=mips-openwrt-linux-gcc
cd rust/src
cargo new --bin hello
cd hello
mkdir .cargo
cat >.cargo/config <<EOF
[target.mips-unknown-linux-gnu]
ar = "mips-openwrt-linux-ar"
linker = "mips-openwrt-linux-gcc"
EOF
cat >>Cargo.toml <<EOF
[dependencies.std]
path = "../libstd"
EOF
if [[ $BACKTRACE = yes && $JEMALLOC = dynamic ]]; then
echo 'features = ["backtrace", "jemalloc_dynamic"]' >> Cargo.toml
elif [[ $BACKTRACE = yes && $JEMALLOC = no ]]; then
echo 'features = ["backtrace"]' >> Cargo.toml
elif [[ $BACKTRACE = yes && $JEMALLOC = static ]]; then
echo 'features = ["backtrace", "jemalloc"]' >> Cargo.toml
elif [[ $BACKTRACE = no && $JEMALLOC = dynamic ]]; then
echo 'features = ["jemalloc_dynamic"]' >> Cargo.toml
elif [[ $BACKTRACE = no && $JEMALLOC = static ]]; then
echo 'features = ["jemalloc"]' >> Cargo.toml
fi
cat >>Cargo.toml <<EOF
[profile.release]
lto = true
EOF
cat Cargo.toml
cargo rustc --target=mips-unknown-linux-gnu --release --verbose -- -C link-args=-s
ls -hl target/mips-unknown-linux-gnu/release/hello