aboutsummaryrefslogtreecommitdiff
path: root/maint/cargo-check-targets
blob: 863a892ebb4d0b4a7a3cc89acaa16cf8ad8698c8 (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
#!/usr/bin/env bash

set -euo pipefail

SCRIPT_NAME=$(basename "$0")

# all targets with status "maintained" or higher"
# this should match `rustup target list | grep -E '(linux|windows|ios|darwin)' | grep -E '(arm|i.86|x86|aarch|thumb)'`
MAINTAINED_PLATFORMS=(
	"aarch64-apple-darwin"
	"aarch64-apple-ios"
	"aarch64-apple-ios-sim"
	"aarch64-linux-android"
	"aarch64-pc-windows-msvc"
	"aarch64-unknown-linux-gnu"
	"aarch64-unknown-linux-musl"
	#"arm-linux-androideabi" AtomicU64 not supported; breaks coarsetime
	"arm-unknown-linux-gnueabi"
	"arm-unknown-linux-gnueabihf"
	"arm-unknown-linux-musleabi"
	"arm-unknown-linux-musleabihf"
	#"armv5te-unknown-linux-gnueabi" AtomicU64 not supported; breaks coarsetime
	#"armv5te-unknown-linux-musleabi" AtomicU64 not supported; breaks coarsetime
	"armv7-linux-androideabi"
	"armv7-unknown-linux-gnueabi"
	"armv7-unknown-linux-gnueabihf"
	"armv7-unknown-linux-musleabi"
	"armv7-unknown-linux-musleabihf"
	#"i586-pc-windows-msvc" trait `Zeroize` is not implemented for `__m128i`; breaks aes
	#"i586-unknown-linux-gnu" trait `Zeroize` is not implemented for `__m128i`; breaks aes
	#"i586-unknown-linux-musl" trait `Zeroize` is not implemented for `__m128i`; breaks aes
	"i686-linux-android"
	"i686-pc-windows-gnu"
	"i686-pc-windows-msvc"
	"i686-unknown-linux-gnu"
	"i686-unknown-linux-musl"
	"thumbv7neon-linux-androideabi"
	"thumbv7neon-unknown-linux-gnueabihf"
	"x86_64-apple-darwin"
	"x86_64-apple-ios"
	"x86_64-linux-android"
	"x86_64-pc-windows-gnu"
	"x86_64-pc-windows-msvc"
	"x86_64-unknown-linux-gnu"
	# Disabled for now, see #1480 and https://github.com/rust-num/num-bigint/issues/311
	#"x86_64-unknown-linux-gnux32"
	"x86_64-unknown-linux-musl"
)

# SUPPORTTARGET, excluding emulators (x86 android...), and unusual combo (Windows on ARM...)
SUPPORTTARGETED_PLATFORMS=(
	"aarch64-apple-darwin"
	"aarch64-apple-ios"
	"aarch64-linux-android"
	"aarch64-unknown-linux-gnu"
	"armv7-linux-androideabi"
	"i686-pc-windows-gnu"
	"i686-unknown-linux-gnu"
	"x86_64-apple-darwin"
	"x86_64-pc-windows-gnu"
	"x86_64-pc-windows-msvc"
	"x86_64-unknown-linux-gnu"
	"x86_64-unknown-linux-musl"
)

function usage()
{
    cat <<EOF
${SCRIPT_NAME}: Check arti for many targets, with parameters minimizing dependencies
on platform dependent tooling.
   Usage:
  cargo_check_target [opts] : Run cargo check for many targets.

Options:
  -h: Print this message.
  -i: Install the target if they are missing
  -l: Longer test, test ${#MAINTAINED_PLATFORMS[@]} targets instead of ${#SUPPORTTARGETED_PLATFORMS[@]}.
EOF
}

install=no
to_build=("${SUPPORTTARGETED_PLATFORMS[@]}")

while getopts "hil" opt ; do
    case "$opt" in
        h) usage
	   exit 0
	   ;;
	i) install=yes
	   ;;
	l) to_build=("${MAINTAINED_PLATFORMS[@]}")
	   ;;
	*) echo "Unknown option."
           exit 1
           ;;
    esac
done

if [ "$install" = "yes" ]; then
	rustup target add "${to_build[@]}"
fi

CC=$(realpath "$(dirname "$0")")/stunt/fake-cc
export CC
for target in "${to_build[@]}" ; do
	echo "Testing $target"
	# don't include "compression" as it requires a C compiler for the given target
	PKG_CONFIG_ALLOW_CROSS=1 cargo check -p arti --no-default-features --features tokio,native-tls,dns-proxy,harden --target "$target"
done
rm "$CC"