Skip to content

Commit a56192b

Browse files
committed
Add support for building an AppImage
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
1 parent 97f16b6 commit a56192b

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ demo
33
font_data.h
44
image_data.h
55
music_data.h
6+
AppDir/
7+
appimagetool
8+
InfixDemo-x86_64.AppImage

Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ music_data.h: music.mod
3232
$(TARGET): $(SOURCE) $(HEADERS)
3333
$(CC) $(CFLAGS) -o $(TARGET) $(SOURCE) $(LDLIBS)
3434

35-
debug: $(SOURCE)
35+
debug: $(SOURCE) $(HEADERS)
3636
$(CC) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) $(SOURCE) $(LDLIBS)
3737

3838
run: $(TARGET)
3939
./$(TARGET)
4040

4141
clean:
4242
rm -f $(TARGET) font_data.h image_data.h music_data.h
43+
rm -rf AppDir appimagetool InfixDemo-x86_64.AppImage
4344

4445
docker-build:
4546
docker build -t demo .
@@ -51,4 +52,21 @@ docker-run: docker-build
5152
-v /tmp/.X11-unix:/tmp/.X11-unix \
5253
demo
5354

54-
.PHONY: all clean run debug docker-build docker-run
55+
appimage: $(TARGET)
56+
@echo "Creating AppImage..."
57+
@mkdir -p AppDir/usr/bin
58+
@mkdir -p AppDir/usr/share/applications
59+
@mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
60+
@cp $(TARGET) AppDir/usr/bin/
61+
@printf '[Desktop Entry]\nType=Application\nName=Infix Demo\nExec=usr/bin/demo\nIcon=demo\nCategories=Game;\n' > AppDir/usr/share/applications/demo.desktop
62+
@cp jack.png AppDir/usr/share/icons/hicolor/256x256/apps/demo.png
63+
@ln -sf usr/share/applications/demo.desktop AppDir/demo.desktop
64+
@ln -sf usr/share/icons/hicolor/256x256/apps/demo.png AppDir/demo.png
65+
@ln -sf usr/bin/demo AppDir/AppRun
66+
@wget -q -c https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
67+
@chmod +x appimagetool
68+
@./appimagetool AppDir InfixDemo-x86_64.AppImage
69+
@rm -rf AppDir appimagetool
70+
@echo "AppImage created: InfixDemo-x86_64.AppImage"
71+
72+
.PHONY: all clean run debug appimage docker-build docker-run

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,30 @@ Or run a specific scene:
4848
./demo 2 # Run only the cube scene
4949
```
5050

51-
## Docker
51+
## Distribution
52+
53+
### AppImage (Recommended for sharing)
54+
55+
Create a portable AppImage that works on most Linux distributions:
56+
57+
```
58+
make appimage
59+
```
60+
61+
This creates `InfixDemo-x86_64.AppImage` - a single executable file you can share with friends. They just need to:
62+
63+
1. Download the `.AppImage` file
64+
2. Make it executable: `chmod +x InfixDemo-x86_64.AppImage`
65+
3. Run it: `./InfixDemo-x86_64.AppImage`
66+
67+
**What is AppImage?**
68+
- Single-file executable that works on most Linux distros
69+
- No installation required - just download and run
70+
- Bundles all dependencies (SDL2, fonts, music, textures)
71+
- Works on Ubuntu, Debian, Fedora, Arch, etc.
72+
- Great for distributing demos to friends!
73+
74+
### Docker
5275

5376
```
5477
make docker-run

0 commit comments

Comments
 (0)