diff options
| author | Joshua Sing <joshua@joshuasing.dev> | 2026-01-25 20:06:32 +1100 |
|---|---|---|
| committer | Joshua Sing <joshua@joshuasing.dev> | 2026-01-25 20:06:32 +1100 |
| commit | 836c23eb15c1d4c2d408f22c7e2e34e87a3697c2 (patch) | |
| tree | ad6a28ef7bf0a61238ba86532cca3b427870ae6b /scripts | |
| parent | 09c99a505f255164de53a404b81d1aaf3f8c6a23 (diff) | |
| download | portable-836c23eb15c1d4c2d408f22c7e2e34e87a3697c2.tar.gz portable-836c23eb15c1d4c2d408f22c7e2e34e87a3697c2.tar.bz2 portable-836c23eb15c1d4c2d408f22c7e2e34e87a3697c2.zip | |
scripts/test: reorder setup_cross_compiler, fix head -1
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/test | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/scripts/test b/scripts/test index d874b64..2148d52 100755 --- a/scripts/test +++ b/scripts/test | |||
| @@ -16,21 +16,20 @@ ENABLE_ASM="${ENABLE_ASM:=ON}" | |||
| 16 | setup_cross_compiler() { | 16 | setup_cross_compiler() { |
| 17 | cross_prefix=$1 | 17 | cross_prefix=$1 |
| 18 | 18 | ||
| 19 | # Use unversioned symlink if available, otherwise find versioned binary | 19 | CC=${cross_prefix}-gcc |
| 20 | if command -v "${cross_prefix}-gcc" >/dev/null 2>&1; then | 20 | CXX=${cross_prefix}-g++ |
| 21 | CC=${cross_prefix}-gcc | ||
| 22 | CXX=${cross_prefix}-g++ | ||
| 23 | else | ||
| 24 | gcc_ver=$(find /usr/bin -name "${cross_prefix}-gcc-[0-9]*" -prune 2>/dev/null \ | ||
| 25 | | sed "s/.*${cross_prefix}-gcc-//" | sort -n | tail -n 1) | ||
| 26 | CC=${cross_prefix}-gcc-${gcc_ver} | ||
| 27 | CXX=${cross_prefix}-g++-${gcc_ver} | ||
| 28 | fi | ||
| 29 | |||
| 30 | AR=${cross_prefix}-ar | 21 | AR=${cross_prefix}-ar |
| 31 | STRIP=${cross_prefix}-strip | 22 | STRIP=${cross_prefix}-strip |
| 32 | RANLIB=${cross_prefix}-ranlib | 23 | RANLIB=${cross_prefix}-ranlib |
| 33 | 24 | ||
| 25 | # If the unversioned symlink for gcc doesn't exist, find versioned binary. | ||
| 26 | if ! command -v "$CC" >/dev/null 2>&1; then | ||
| 27 | gcc_ver=$(find /usr/bin -name "${CC}-[0-9]*" -prune 2>/dev/null \ | ||
| 28 | | sed "s/.*${CC}-//" | sort -n | tail -n 1) | ||
| 29 | CC=${CC}-${gcc_ver} | ||
| 30 | CXX=${CXX}-${gcc_ver} | ||
| 31 | fi | ||
| 32 | |||
| 34 | # Check all binaries actually exist. | 33 | # Check all binaries actually exist. |
| 35 | for c in "$CC" "$CXX" "$AR" "$STRIP" "$RANLIB"; do | 34 | for c in "$CC" "$CXX" "$AR" "$STRIP" "$RANLIB"; do |
| 36 | if ! command -v "$c" >/dev/null 2>&1; then | 35 | if ! command -v "$c" >/dev/null 2>&1; then |
| @@ -39,7 +38,7 @@ setup_cross_compiler() { | |||
| 39 | fi | 38 | fi |
| 40 | done | 39 | done |
| 41 | 40 | ||
| 42 | echo "##### Using $($CC --version | head -1)" | 41 | echo "##### Using $($CC --version | head -n 1)" |
| 43 | } | 42 | } |
| 44 | 43 | ||
| 45 | if type apt-get >/dev/null 2>&1; then | 44 | if type apt-get >/dev/null 2>&1; then |
