Skip to content

Commit

Permalink
build(go): 🐛 ensure build scripts are committed
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jun 27, 2024
1 parent 25b9ce5 commit ebb9d4f
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
!/*.yml
!/*.json
!/*.toml
!build/*
!build/**/*

!/assets/**/*
!/internal/agent/ui/assets/*
Expand Down
16 changes: 16 additions & 0 deletions build/package/com.github.joshuar.go-hass-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
id: com.github.joshuar.go-hass-agent
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: go-hass-agent
modules:
- name: go-hass-agent
buildsystem: simple
env:
CGO_ENABLED: 1
build-commands:
- go generate ./...
- go build
sources:
- type: dir
path: ./
29 changes: 29 additions & 0 deletions build/scripts/install-build-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# Copyright (c) 2024 Joshua Rich <[email protected]>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

set -e

# 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) ;;
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 "No arch specified" && exit -1 ;;
esac

export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get -y install desktop-file-utils pkg-config git ${ccpkg[@]:0}
for arch in "$@"; do
apt-get -y install \
libgl1-mesa-dev:${arch} xserver-xorg-dev:${arch} \
libxcursor-dev:${arch} libxrandr-dev:${arch} \
libxinerama-dev:${arch} libxi-dev:${arch} \
libgl1-mesa-dev:${arch} libxxf86vm-dev:${arch}
done
28 changes: 28 additions & 0 deletions build/scripts/install-run-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# Copyright (c) 2024 Joshua Rich <[email protected]>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

set -e

# set arch as appropriate
case $1 in
linux/amd64) arch=(amd64) ;;
linux/arm/*) arch=(armhf) ;;
arm64) arch=(arm64) ;;
all) arch=(armhf arm64 amd64) ;;
*) echo "No arch specified" && exit -1 ;;
esac

export DEBIAN_FRONTEND=noninteractive

apt-get update
for arch in "$@"; do
apt-get -y install \
libgl1:${arch} libx11-6:${arch} libglx0:${arch} \
libglvnd0:${arch} libxcb1:${arch} libxau6:${arch} \
libxdmcp6:${arch} dbus-x11:${arch}
done
rm -rf /var/lib/apt/lists/* /var/cache/apt/*

0 comments on commit ebb9d4f

Please sign in to comment.