diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9c9d1b6..87f7c8d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,3 +4,12 @@ add_subdirectory(simple_executable) # now include actual tests add_subdirectory(core) + +add_test(NAME build_minial_appimage + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build_minimal_appimage_with_custom_apprun.sh + $ + $ + "${CMAKE_CURRENT_SOURCE_DIR}/data/simple_app.desktop" + "${CMAKE_CURRENT_SOURCE_DIR}/data/simple_icon.svg" +) +SET_TESTS_PROPERTIES(build_minial_appimage PROPERTIES DEPENDS "linuxdeploy simple_executable") diff --git a/tests/scripts/build_minimal_appimage_with_custom_apprun.sh b/tests/scripts/build_minimal_appimage_with_custom_apprun.sh new file mode 100755 index 0000000..7246e6d --- /dev/null +++ b/tests/scripts/build_minimal_appimage_with_custom_apprun.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +if [[ -z ${ARCH+x} ]]; then + echo "ARCH not set." + exit -1; +fi + +LINUXDEPLOY=$1 +if [[ -z ${LINUXDEPLOY+x} ]]; then + echo "LINUXDEPLOY path not set." + exit -1; +fi + +RUNNABLE=$2 +if [[ -z ${RUNNABLE+x} ]]; then + echo "RUNNABLE path not set." + exit -1; +fi + +DESKTOP_FILE=$3 +if [[ -z ${DESKTOP_FILE+x} ]]; then + echo "DESKTOP_FILE path not set." + exit -1; +fi + +ICON=$4 +if [[ -z ${ICON+x} ]]; then + echo "ICON path not set." + exit -1; +fi + + +LINUXDEPLOYDIR=`mktemp -d` +pushd "$LINUXDEPLOYDIR" + + cp "$LINUXDEPLOY" . + + wget https://github.com/TheAssassin/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-"$ARCH".AppImage + chmod +x linuxdeploy-plugin-appimage-"$ARCH".AppImage + + filename=$(basename -- "$LINUXDEPLOY") + LINUXDEPLOY="$LINUXDEPLOYDIR/$filename" +popd + +APPDIR=`mktemp -d` + +cp $RUNNABLE "$APPDIR/AppRun" + +mkdir -p "$APPDIR/usr/bin" +cp "$RUNNABLE" "$APPDIR/usr/bin" + +mkdir -p "$APPDIR/usr/share/applications" +cp "$DESKTOP_FILE" "$APPDIR/usr/share/applications" + +mkdir -p "$APPDIR/usr/share/icons/hicolor/scalable/apps" +cp "$ICON" "$APPDIR/usr/share/icons/hicolor/scalable/apps" + +"$LINUXDEPLOY" --appdir "$APPDIR" --output=appimage +SUCCEED=$? + +echo " " +echo " AppDir contents: " +find "$APPDIR" +echo " " + +rm -rf "$APPDIR" +rm -rf "$LINUXDEPLOYDIR" + +exit "$SUCCEED"