Skip to content

Commit

Permalink
Prepare build environment
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed Nov 15, 2023
1 parent 31ae88c commit b64d484
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v4

- name: Prepare build environment
run: ./prepare.sh -us | tee -a "$GITHUB_ENV"

- name: Build
run: make build

Expand Down
41 changes: 41 additions & 0 deletions prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

set -o nounset -o pipefail -o errexit

SUDO=${SUDO-}
DISTRO=${DISTRO-}
UPDATE=${UPDATE-}
while getopts "ud:sS:-" OPT; do
case $OPT in
d) DISTRO=$OPTARG ;;
u) UPDATE=1 ;;
s) SUDO=sudo ;;
S) SUDO=$OPTARG ;;
-) break ;;
?) usage 2 ;;
esac
done
shift $((OPTIND-1))

if [ -z "$DISTRO" ]; then
DISTRO=$(lsb_release -is)
fi
echo "distro: $DISTRO" 1>&2

if [ "$DISTRO" = "Arch" ]; then
if [ -n "$UPDATE" ]; then
$SUDO pacman -Sy
fi
$SUDO pacman -S lua libxrandr
elif [ "$DISTRO" = "Ubuntu" ]; then
if [ -n "$UPDATE" ]; then
$SUDO apt-get update 1>&2
fi
$SUDO apt-get install --yes --no-install-recommends 1>&2 \
make \
liblua5.4-dev libxrandr-dev
echo "LUA_PKG=lua54"
else
echo "unconfigured distribution: $DISTRO" 1>&2
exit 1
fi

0 comments on commit b64d484

Please sign in to comment.