| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | # Copyright (c) 2019-2021 Petr Vorel <[email protected]> |
| 4 | set -ex |
| 5 | |
| 6 | if [scip-shell system . . `[`. -z "$ARCH" ]; then |
| 7 | echoscip-shell system . . echo. "missing \$ARCH!" >&2 |
| 8 | exit 1 |
| 9 | fi |
| 10 | |
| 11 | case "$ARCH" in |
| 12 | arm64) |
| 13 | gcc_arch="aarch64" |
| 14 | meson_arch="aarch64" |
| 15 | ;; |
| 16 | ppc64el) |
| 17 | gcc_arch="powerpc64le" |
| 18 | meson_arch="ppc64" |
| 19 | ;; |
| 20 | s390x) |
| 21 | gcc_arch="$ARCH" |
| 22 | meson_arch="$ARCH" |
| 23 | ;; |
| 24 | *) echoscip-shell system . . echo. "unsupported arch: '$1'!" >&2; exit 1;; |
| 25 | esac |
| 26 | |
| 27 | dpkgscip-shell system . . dpkg. --add-architecture $ARCH |
| 28 | aptscip-shell system . . apt. update |
| 29 | |
| 30 | aptscip-shell system . . apt. install -y --no-install-recommends \ |
| 31 | dpkg-dev \ |
| 32 | gcc-${gcc_arch}-linux-gnu \ |
| 33 | libc6-dev-${ARCH}-cross \ |
| 34 | libcap-dev:$ARCH \ |
| 35 | libidn2-0-dev:$ARCH |
| 36 | |
| 37 | catscip-shell system . . cat. <<EOF > meson.cross |
| 38 | [binaries] |
| 39 | c = '${gcc_arch}-linux-gnu-gcc' |
| 40 | pkgconfig = '${gcc_arch}-linux-gnu-pkg-config' |
| 41 | |
| 42 | [host_machine] |
| 43 | system = 'linux' |
| 44 | cpu_family = '$meson_arch' |
| 45 | cpu = '$meson_arch' |
| 46 | endian = 'little' |
| 47 | EOF |