ref: cb72ebfc0e08fc33fe4aca23fe414b22195d4254
parent: 163e75b7a70017da234a957f3e82d3dca51287e1
author: nightmareci <nightmareci@gmail.com>
date: Sun Dec 24 08:50:42 EST 2023
Add support for producing Linux AppImage builds
--- a/HOW-TO-COMPILE.txt
+++ b/HOW-TO-COMPILE.txt
@@ -10,12 +10,16 @@
Ubuntu/Debian and similar: build-essential libsdl2-dev
Fedora: gcc gcc-c++ alsa-lib-devel SDL2-devel
Others: www.google.com (you want gcc, g++ (or c++), alsa dev and SDL2 dev)
- 2. Compile the FT2 clone: (folder: "ft2-clone")
- chmod +x make-linux.sh (only needed once)
+ 2. Compile the FT2 clone for command line: (folder: "ft2-clone")
+ chmod +x make-linux.sh (only needed once)
./make-linux.sh
-
+ Compile the FT2 clone as an AppImage:
+ chmod +x make-linux-appimage.sh
+ ./make-linux-appimage.sh
+
Note: If you don't have libstdc++ and/or can't compile rtmidi, try running
- make-linux-nomidi.sh instead.
+ make-linux-nomidi-noflac.sh or make-linux-appimage-nomidi-noflac.sh
+ instead.
Known issues: Audio recording (sampling) can update VERY slowly or not work at
all... I have no idea why, it works really well on Windows/maCOS.
--- /dev/null
+++ b/make-linux-appimage-nomidi-noflac.sh
@@ -1,0 +1,33 @@
+#!/bin/bash
+
+LINUXDEPLOY="linuxdeploy-$(uname -m).AppImage"
+BUILDDIR="release/linux"
+
+rm "$BUILDDIR/$LINUXDEPLOY" &>/dev/null
+rm "$BUILDDIR/ft2-clone.desktop" &>/dev/null
+rm -r "$BUILDDIR/ft2-clone.AppDir" &> /dev/null
+echo Compiling, please wait patiently...
+
+mkdir -p "$BUILDDIR/ft2-clone.AppDir/usr/bin" || exit 1
+
+gcc -DNDEBUG src/gfxdata/*.c src/mixer/*.c src/scopes/*.c src/modloaders/*.c src/smploaders/*.c src/*.c -lSDL2 -lm -Wshadow -Winit-self -Wall -Wno-missing-field-initializers -Wno-unused-result -Wno-strict-aliasing -Wextra -Wunused -Wunreachable-code -Wswitch-default -Wno-stringop-overflow -O3 -o "$BUILDDIR//ft2-clone.AppDir/usr/bin/ft2-clone" || exit 1
+
+rm src/rtmidi/*.o src/gfxdata/*.o src/*.o &> /dev/null
+
+curl "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LINUXDEPLOY" -L -o "$BUILDDIR/$LINUXDEPLOY" || exit 1
+chmod +x "$BUILDDIR/$LINUXDEPLOY" || exit 1
+
+cat >"$BUILDDIR/ft2-clone.desktop" <<EOF
+[Desktop Entry]
+Name=ft2-clone
+Exec=ft2-clone
+Icon=ft2-clone
+Type=Application
+Categories=Audio;AudioVideo;
+EOF
+
+ROOTDIR="$PWD"
+cd "$BUILDDIR"
+"./$LINUXDEPLOY" --appdir ft2-clone.AppDir --output appimage --icon-file "$ROOTDIR/src/gfxdata/icon/ft2-clone.png" --icon-filename "ft2-clone" --desktop-file "ft2-clone.desktop" || exit 1
+
+echo Done. The AppImage can be found at \'$BUILDDIR/ft2-clone-$(uname -m).AppImage\' if everything went well.
--- /dev/null
+++ b/make-linux-appimage.sh
@@ -1,0 +1,33 @@
+#!/bin/bash
+
+LINUXDEPLOY="linuxdeploy-$(uname -m).AppImage"
+BUILDDIR="release/linux"
+
+rm "$BUILDDIR/$LINUXDEPLOY" &>/dev/null
+rm "$BUILDDIR/ft2-clone.desktop" &>/dev/null
+rm -r "$BUILDDIR/ft2-clone.AppDir" &> /dev/null
+echo Compiling, please wait patiently...
+
+mkdir -p "$BUILDDIR/ft2-clone.AppDir/usr/bin" || exit 1
+
+gcc -DNDEBUG -DHAS_MIDI -D__LINUX_ALSA__ -DHAS_LIBFLAC src/rtmidi/*.cpp src/gfxdata/*.c src/mixer/*.c src/scopes/*.c src/modloaders/*.c src/smploaders/*.c src/libflac/*.c src/*.c -lSDL2 -lpthread -lasound -lstdc++ -lm -Wshadow -Winit-self -Wall -Wno-missing-field-initializers -Wno-unused-result -Wno-strict-aliasing -Wextra -Wunused -Wunreachable-code -Wswitch-default -Wno-stringop-overflow -O3 -o "$BUILDDIR/ft2-clone.AppDir/usr/bin/ft2-clone" || exit 1
+
+rm src/rtmidi/*.o src/gfxdata/*.o src/*.o &> /dev/null
+
+curl "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LINUXDEPLOY" -L -o "$BUILDDIR/$LINUXDEPLOY" || exit 1
+chmod +x "$BUILDDIR/$LINUXDEPLOY" || exit 1
+
+cat >"$BUILDDIR/ft2-clone.desktop" <<EOF
+[Desktop Entry]
+Name=ft2-clone
+Exec=ft2-clone
+Icon=ft2-clone
+Type=Application
+Categories=Audio;AudioVideo;
+EOF
+
+ROOTDIR="$PWD"
+cd "$BUILDDIR"
+"./$LINUXDEPLOY" --appdir ft2-clone.AppDir --output appimage --icon-file "$ROOTDIR/src/gfxdata/icon/ft2-clone.png" --icon-filename "ft2-clone" --desktop-file "ft2-clone.desktop" || exit 1
+
+echo Done. The AppImage can be found at \'$BUILDDIR/ft2-clone-$(uname -m).AppImage\' if everything went well.
--- /dev/null
+++ b/release/linux/.gitignore
@@ -1,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
\ No newline at end of file
--- a/src/gfxdata/icon/LICENSE.txt
+++ b/src/gfxdata/icon/LICENSE.txt
@@ -1,6 +1,6 @@
Someone made this icon for me for free, and I don't really know what license it
-has... This icon is only used for the macOS/Windows release binary, so you can
-simply remove it if it causes issue with licensing.
+has... This icon is only used for the macOS/Windows/Linux release binary, so you
+can simply remove it if it causes issue with licensing.
Other than that, I'm fairly sure the creator would be permissive about its use,
so as long as it's not used under commercial circumstances, it should be fine.
binary files /dev/null b/src/gfxdata/icon/ft2-clone.png differ