53 lines
1.6 KiB
Bash
Executable File
53 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2024 Joshua Rich <joshua.rich@gmail.com>
|
|
#
|
|
# This software is released under the MIT License.
|
|
# https://opensource.org/licenses/MIT
|
|
|
|
set -e
|
|
|
|
install_deps_debian() {
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
# install build dependencies as per given arch
|
|
apt-get update
|
|
apt-get -y install --no-install-recommends desktop-file-utils pkg-config git ${ccpkg[@]:0}
|
|
for a in "${arch[@]}"; do
|
|
apt-get -y install --no-install-recommends \
|
|
libc6-dev:${a} \
|
|
libgl-dev:${a} libglx-dev:${a} libglvnd-dev:${a} \
|
|
libxcb1-dev:${a} libxau-dev:${a} libxdmcp-dev:${a} \
|
|
libx11-dev:${a} libxcursor-dev:${a} libxrandr-dev:${a} \
|
|
libxinerama-dev:${a} libxi-dev:${a} libxxf86vm-dev:${a}
|
|
done
|
|
|
|
apt-get -y autoremove && apt-get -y clean && rm -rf /var/lib/apt/lists/*
|
|
}
|
|
|
|
install_deps_alpine() {
|
|
apk update && \
|
|
apk add git pkgconfig desktop-file-utils libc-dev \
|
|
gcc libxcursor-dev libxrandr-dev libxinerama-dev \
|
|
libxi-dev linux-headers mesa-dev
|
|
}
|
|
|
|
# set ccpkg and arch as appropriate
|
|
case $1 in
|
|
linux/amd64) ccpkg=(gcc) arch=(amd64) ;;
|
|
linux/arm/*) ccpkg=(gcc gcc-arm-linux-gnueabihf) arch=(armhf) ;;
|
|
linux/arm64) ccpkg=(gcc gcc-aarch64-linux-gnu) arch=(arm64) ;;
|
|
all) ccpkg=(gcc gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu) arch=(armhf arm64 amd64) ;;
|
|
*) echo "Unsupported arch" && exit -1 ;;
|
|
esac
|
|
|
|
# install package dependencies based on distro
|
|
case $2 in
|
|
ubuntu) install_deps_debian ;;
|
|
alpine) install_deps_alpine ;;
|
|
*) echo "Unsupported distro" && exit -1 ;;
|
|
esac
|
|
|
|
exit 0
|