xref: /aosp_15_r20/external/ltp/ci/debian.cross-compile.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#!/bin/sh -eux
2*49cdfc7eSAndroid Build Coastguard Worker# SPDX-License-Identifier: GPL-2.0-or-later
3*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) 2018-2020 Petr Vorel <[email protected]>
4*49cdfc7eSAndroid Build Coastguard Worker
5*49cdfc7eSAndroid Build Coastguard Workerif [ -z "$ARCH" ]; then
6*49cdfc7eSAndroid Build Coastguard Worker	echo "missing \$ARCH!" >&2
7*49cdfc7eSAndroid Build Coastguard Worker	exit 1
8*49cdfc7eSAndroid Build Coastguard Workerfi
9*49cdfc7eSAndroid Build Coastguard Worker
10*49cdfc7eSAndroid Build Coastguard Workercase "$ARCH" in
11*49cdfc7eSAndroid Build Coastguard Workerarm64) gcc_arch="aarch64";;
12*49cdfc7eSAndroid Build Coastguard Workerppc64el) gcc_arch="powerpc64le";;
13*49cdfc7eSAndroid Build Coastguard Workers390x) gcc_arch="$ARCH";;
14*49cdfc7eSAndroid Build Coastguard Worker*) echo "unsupported arch: '$ARCH'!" >&2; exit 1;;
15*49cdfc7eSAndroid Build Coastguard Workeresac
16*49cdfc7eSAndroid Build Coastguard Worker
17*49cdfc7eSAndroid Build Coastguard Workerdpkg --add-architecture $ARCH
18*49cdfc7eSAndroid Build Coastguard Workerapt update
19*49cdfc7eSAndroid Build Coastguard Worker
20*49cdfc7eSAndroid Build Coastguard Workerapt install -y --no-install-recommends \
21*49cdfc7eSAndroid Build Coastguard Worker	gcc-${gcc_arch}-linux-gnu \
22*49cdfc7eSAndroid Build Coastguard Worker	libc6-dev-${ARCH}-cross \
23*49cdfc7eSAndroid Build Coastguard Worker	libmnl-dev:$ARCH \
24*49cdfc7eSAndroid Build Coastguard Worker	libtirpc-dev:$ARCH
25