Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64 linux #247

Merged
merged 13 commits into from
Jan 22, 2025
33 changes: 32 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ jobs:
- run: chmod +x keyboard-configurator-x86_64.AppImage
- run: xvfb-run ./keyboard-configurator-x86_64.AppImage --help-gtk

linux-arm64:
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install cargo libgtk-3-dev libhidapi-dev libudev-dev patchelf libfuse2
- run: cd linux && ./build.py --arm64 $RELEASE
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: keyboard-configurator-linux-aarch64-${{ github.sha }}
path: linux/keyboard-configurator-aarch64.AppImage

linux-arm64-test:
runs-on: ubuntu-22.04-arm
needs: linux-arm64
steps:
- run: sudo apt-get install xvfb libfuse2
- uses: actions/download-artifact@v4
with:
name: keyboard-configurator-linux-aarch64-${{ github.sha }}
- run: chmod +x keyboard-configurator-aarch64.AppImage
- run: xvfb-run ./keyboard-configurator-aarch64.AppImage --help-gtk

windows-mingw32:
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -145,7 +168,7 @@ jobs:
upload-to-release:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [linux-x86_64, windows-mingw32, macos, macos-arm64]
needs: [linux-x86_64, linux-arm64, windows-mingw32, macos, macos-arm64]
steps:
- uses: actions/checkout@v4
- run: echo VERSION=$(./.github/workflows/version.py) > $GITHUB_ENV
Expand All @@ -158,6 +181,14 @@ jobs:
asset_path: keyboard-configurator-linux-x86_64-${{ github.sha }}/keyboard-configurator-x86_64.AppImage
asset_name: keyboard-configurator-${{ env.VERSION }}-x86_64.AppImage
asset_content_type: application/vnd.appimage
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: keyboard-configurator-linux-aarch64-${{ github.sha }}/keyboard-configurator-aarch64.AppImage
asset_name: keyboard-configurator-${{ env.VERSION }}-aarch64.AppImage
asset_content_type: application/vnd.appimage
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
31 changes: 19 additions & 12 deletions linux/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import os
import shutil
import subprocess
import sys
from urllib.request import urlopen

# Handle commandline arguments
parser = argparse.ArgumentParser()
parser.add_argument('--release', action='store_true')
parser.add_argument('--release', action='store_true', help="Build in release mode")
parser.add_argument('--arm64', action='store_true', help="Build for ARM64 architecture")
args = parser.parse_args()

# Executables to install
Expand All @@ -20,7 +20,7 @@
# Appimage packaging
PKG = "keyboard-configurator"
APPID = "com.system76.keyboardconfigurator"
ARCH = "x86_64"
ARCH = "aarch64" if args.arm64 else "x86_64"

# Remove previous build
for i in glob.glob(f"{PKG}*.AppImage"):
Expand All @@ -43,21 +43,28 @@
LINUXDEPLOY = f"linuxdeploy-{ARCH}.AppImage"
LINUXDEPLOY_URL = f"https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/{LINUXDEPLOY}"
if not os.path.exists(LINUXDEPLOY):
print(f"Downloading {LINUXDEPLOY}...")
with urlopen(LINUXDEPLOY_URL) as u:
with open(LINUXDEPLOY, 'wb') as f:
f.write(u.read())
os.chmod(LINUXDEPLOY, os.stat(LINUXDEPLOY).st_mode | 0o111)
print("Download complete.")

# Copy appdata
os.makedirs(f"{PKG}.AppDir/usr/share/metainfo")
os.makedirs(f"{PKG}.AppDir/usr/share/metainfo", exist_ok=True)
shutil.copy("com.system76.keyboardconfigurator.appdata.xml", f"{PKG}.AppDir/usr/share/metainfo")

# Build appimage
subprocess.check_call([f"./{LINUXDEPLOY}",
f"--appdir={PKG}.AppDir",
f"--executable=system76-keyboard-configurator",
f"--desktop-file={APPID}.desktop",
f"--icon-file={ICON}",
"--plugin", "gtk",
"--output", "appimage"])
shutil.move(f"System76_Keyboard_Configurator-{ARCH}.AppImage", f"{PKG}-{ARCH}.AppImage")
print(f"Building AppImage for {ARCH}...")
subprocess.check_call([
f"./{LINUXDEPLOY}",
f"--appdir={PKG}.AppDir",
f"--executable=system76-keyboard-configurator",
f"--desktop-file={APPID}.desktop",
f"--icon-file={ICON}",
"--plugin", "gtk",
"--output", "appimage"
])
output_file = f"{PKG}-{ARCH}.AppImage"
shutil.move(f"System76_Keyboard_Configurator-{ARCH}.AppImage", output_file)
print(f"AppImage built: {output_file}")
Loading
Loading