Skip to content

Commit db48707

Browse files
committed
appimage support
1 parent b6cb84f commit db48707

File tree

3 files changed

+141
-0
lines changed

3 files changed

+141
-0
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ jobs:
121121
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_IPO=ON -DBUILD_WITH_ALL=ON ..
122122
cmake --build . --parallel
123123
124+
- name: Build AppImage
125+
run: |
126+
chmod +x build-appimage.sh
127+
./build-appimage.sh
128+
124129
- name: Deploy
125130
uses: actions/upload-artifact@v4
126131
with:
@@ -129,6 +134,12 @@ jobs:
129134
build/bin/tic80
130135
build/bin/*.so
131136
137+
- name: Deploy AppImage
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: "tic80-appimage"
141+
path: TIC-80.AppImage
142+
132143
- name: Build Pro
133144
run: |
134145
cd build

README-AppImage.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# TIC-80 AppImage Build Instructions
2+
3+
This document describes how to build a TIC-80 AppImage for Linux distribution.
4+
5+
## Prerequisites
6+
7+
- Linux system (Ubuntu, Fedora, etc.)
8+
- TIC-80 must be already built (binary at `build/bin/tic80`)
9+
10+
## Building TIC-80 First
11+
12+
```bash
13+
mkdir build
14+
cd build
15+
cmake .. -DBUILD_SOKOL=ON -DBUILD_WITH_ALL=ON
16+
make -j$(nproc)
17+
cd ..
18+
```
19+
20+
## Building the AppImage
21+
22+
```bash
23+
./build-appimage.sh
24+
```
25+
26+
This script will:
27+
1. Verify the TIC-80 binary exists
28+
2. Create the AppDir structure
29+
3. Copy the tic80 binary, desktop files, and icons
30+
4. Download appimagetool if needed
31+
5. Generate the TIC-80.AppImage file
32+
33+
## What the AppImage contains
34+
35+
The AppImage includes:
36+
- TIC-80 executable (tic80 binary)
37+
- Desktop integration files (.desktop, icon, metainfo)
38+
- AppRun script for proper execution
39+
40+
## Distribution
41+
42+
The resulting `TIC-80.AppImage` file can be distributed and run on any Linux system without installation. Users just need to:
43+
44+
```bash
45+
chmod +x TIC-80.AppImage
46+
./TIC-80.AppImage
47+
```
48+
49+
## CI/CD Integration
50+
51+
The AppImage is automatically built and deployed via GitHub Actions:
52+
53+
- **Workflow**: `.github/workflows/build.yml`
54+
- **Job**: `linux-gcc12` (Ubuntu build)
55+
- **Artifact**: `tic80-appimage` - downloadable from GitHub Actions runs
56+
57+
## Notes
58+
59+
- TIC-80 is designed to be statically linked, so the AppImage should not require external libraries
60+
- Desktop integration works automatically when the AppImage is run
61+
- For development tools and demo assets, users should download the full TIC-80 distribution

build-appimage.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
3+
# Build TIC-80 AppImage for Linux
4+
5+
set -e
6+
7+
# Check if we're on Linux
8+
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
9+
echo "This script must be run on Linux to build AppImage"
10+
exit 1
11+
fi
12+
13+
# Check if tic80 binary exists
14+
if [ ! -f "build/bin/tic80" ]; then
15+
echo "Error: TIC-80 binary not found at build/bin/tic80"
16+
echo "Please build TIC-80 first with: mkdir build && cd build && cmake .. && make"
17+
exit 1
18+
fi
19+
20+
# Create AppDir structure
21+
APPDIR="TIC-80.AppDir"
22+
rm -rf "$APPDIR"
23+
mkdir -p "$APPDIR/usr/bin"
24+
mkdir -p "$APPDIR/usr/lib"
25+
mkdir -p "$APPDIR/usr/share/applications"
26+
mkdir -p "$APPDIR/usr/share/icons/hicolor/256x256/apps"
27+
mkdir -p "$APPDIR/usr/share/metainfo"
28+
29+
# Copy binary
30+
cp build/bin/tic80 "$APPDIR/usr/bin/"
31+
32+
# Copy desktop file
33+
sed 's|Icon=tic80|Icon=tic80.png|' build/linux/tic80.desktop.in > "$APPDIR/usr/share/applications/tic80.desktop"
34+
35+
# Copy icon
36+
cp build/linux/tic80.png "$APPDIR/usr/share/icons/hicolor/256x256/apps/"
37+
38+
# Configure and copy metainfo
39+
sed -e "s/@PROJECT_VERSION@/$(grep VERSION_MAJOR cmake/version.cmake | cut -d'"' -f2).$(grep VERSION_MINOR cmake/version.cmake | cut -d'"' -f2).$(grep VERSION_REVISION cmake/version.cmake | cut -d'"' -f2)/g" \
40+
-e "s/@VERSION_YEAR@/$(date +%Y)/g" \
41+
-e "s/@VERSION_MONTH@/$(date +%m)/g" \
42+
-e "s/@VERSION_DAY@/$(date +%d)/g" \
43+
build/linux/com.tic80.TIC_80.metainfo.xml.in > "$APPDIR/usr/share/metainfo/com.tic80.TIC_80.metainfo.xml"
44+
45+
# Create AppRun script
46+
cat > "$APPDIR/AppRun" << 'EOF'
47+
#!/bin/bash
48+
HERE="$(dirname "$(readlink -f "${0}")")"
49+
export PATH="${HERE}/usr/bin:${PATH}"
50+
export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH}"
51+
exec "${HERE}/usr/bin/tic80" "$@"
52+
EOF
53+
chmod +x "$APPDIR/AppRun"
54+
55+
# Copy required libraries (if any - TIC-80 should be statically linked)
56+
# ldd build/bin/tic80 | grep "=>" | awk '{print $3}' | xargs -I {} cp {} "$APPDIR/usr/lib/" 2>/dev/null || true
57+
58+
# Download appimagetool if not present
59+
if [ ! -f "appimagetool.AppImage" ]; then
60+
echo "Downloading appimagetool..."
61+
wget -O appimagetool.AppImage https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
62+
chmod +x appimagetool.AppImage
63+
fi
64+
65+
# Create AppImage
66+
echo "Creating AppImage..."
67+
./appimagetool.AppImage "$APPDIR" TIC-80.AppImage
68+
69+
echo "AppImage created: TIC-80.AppImage"

0 commit comments

Comments
 (0)