From 97481d6fdf197303d740790e23582dc6d7bfed69 Mon Sep 17 00:00:00 2001 From: Carsten Teibes Date: Tue, 7 Jun 2022 03:47:05 +0200 Subject: [PATCH] Initial flatpak/CI config - Install icon and desktop file on Linux --- .editorconfig | 4 ++ .github/workflows/ci.yml | 76 +++++++++++++++++++++++ .gitignore | 3 + CMakeLists.txt | 19 +++++- builds/flatpak/org.easyrpg.editor.yml | 43 +++++++++++++ resources/unix/easyrpg-editor.appdata.xml | 1 + resources/unix/easyrpg-editor.desktop | 12 ++++ 7 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 builds/flatpak/org.easyrpg.editor.yml create mode 100644 resources/unix/easyrpg-editor.appdata.xml create mode 100644 resources/unix/easyrpg-editor.desktop diff --git a/.editorconfig b/.editorconfig index ab042f42..ecb1e74d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -30,3 +30,7 @@ indent_size = 4 [*.ui] indent_style = space indent_size = 1 + +[*.yaml,*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2e741173 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,76 @@ +name: Stable Compilation + +on: + push: + pull_request: + workflow_dispatch: + inputs: + git-ref: + description: Git Ref (Optional) + required: false + +defaults: + run: + shell: bash + +jobs: + flatpak: + name: "Flatpak" + runs-on: ubuntu-latest + container: + image: bilelmoussaoui/flatpak-github-actions:kde-5.15-21.08 + options: --privileged + steps: + - uses: actions/checkout@v2 + - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 + with: + bundle: EasyRPG-Editor.flatpak + manifest-path: builds/flatpak/org.easyrpg.editor.yml + cache-key: flatpak-builder-${{ github.sha }} + + docker: + name: ${{ matrix.image }} + runs-on: ubuntu-latest + container: + image: ${{ matrix.image }} + + strategy: + fail-fast: false + matrix: + image: + - ubuntu:20.04 # LTS | CMake 3.16.3 | G++ 9.3.0 | QT 5.12.8 + - debian:11 # stable | CMake 3.18.4 | G++ 10.2.1 | QT 5.15.2 + - ubuntu:22.04 # LTS | CMake 3.22.1 | G++ 11.2.0 | QT 5.15.3 + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.8.0 + + - name: Install dependencies + run: | + export DEBIAN_FRONTEND="noninteractive" + apt-get update + apt-get install -yqq --no-install-recommends --no-install-suggests \ + ca-certificates build-essential cmake ninja-build git \ + libicu-dev libexpat1-dev qttools5-dev-tools qtbase5-dev-tools \ + qtbase5-dev qtmultimedia5-dev libqt5svg5-dev + + - name: Clone Repository + uses: actions/checkout@v2 + if: github.event.inputs.git-ref == '' + - name: Clone Repository (with custom ref) + uses: actions/checkout@v2 + if: github.event.inputs.git-ref != '' + with: + ref: ${{ github.event.inputs.git-ref }} + + - name: Compile + run: | + cmake -G Ninja . -B build-ga \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ + -DEDITOR_BUILD_LIBLCF=ON + cmake --build build-ga + + - name: Install + run: | + cmake --install build-ga diff --git a/.gitignore b/.gitignore index 89238b73..4779056d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ Makefile* /bin/platforms *.cbp +# flatpak +/.flatpak-builder + # liblcf lib/liblcf diff --git a/CMakeLists.txt b/CMakeLists.txt index 974d7b56..6079d3fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -383,9 +383,10 @@ if(EDITOR_BUILD_LIBLCF) option(BUILD_SHARED_LIBS "Not used. Supresses CMP0077 in liblcf" ON) - # Always build static liblcf + # Always build static liblcf and do not install it function(add_liblcf) set(BUILD_SHARED_LIBS OFF) + set(LIBLCF_ENABLE_INSTALL OFF) add_subdirectory(${LIBLCF_PATH}) endfunction() add_liblcf() @@ -472,4 +473,20 @@ else() install(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) + if(UNIX) + # Install desktop entry and icon + install(FILES resources/unix/easyrpg-editor.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) + # legacy path, remove 2030 :) + install(FILES resources/app/easyrpg.png + DESTINATION ${CMAKE_INSTALL_DATADIR}/pixmaps + RENAME easyrpg-editor.png) + # FIXME: use scalable icon + install(FILES resources/app/easyrpg.png + DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps + RENAME easyrpg-editor.png) + # FIXME: Fill appdata file + #install(FILES resources/unix/easyrpg-editor.appdata.xml + # DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata) + endif() endif() diff --git a/builds/flatpak/org.easyrpg.editor.yml b/builds/flatpak/org.easyrpg.editor.yml new file mode 100644 index 00000000..73eb92f2 --- /dev/null +++ b/builds/flatpak/org.easyrpg.editor.yml @@ -0,0 +1,43 @@ +app-id: org.easyrpg.editor +runtime: org.kde.Sdk +runtime-version: '5.15-21.08' +sdk: org.kde.Sdk +command: easyrpg-editor +rename-desktop-file: easyrpg-editor.desktop +#rename-appdata-file: easyrpg-editor.appdata.xml +rename-icon: easyrpg-editor +finish-args: + - --share=ipc + - --socket=wayland + - --socket=fallback-x11 + - --socket=pulseaudio +# insecure: + - --filesystem=host +# more secure: +# - --filesystem=home + - --device=dri + - --allow=devel +modules: + - name: liblcf + buildsystem: cmake-ninja + config-opts: + - -DCMAKE_BUILD_TYPE=RelWithDebInfo + - -DLIBLCF_ENABLE_TOOLS=OFF + - -DLIBLCF_WITH_XML=OFF + - -DLIBLCF_ENABLE_TESTS=OFF + sources: + - type: git + url: https://github.com/EasyRPG/liblcf.git + #tag: '0.7.0' + cleanup: + - /include + - /lib/pkgconfig + - /lib/cmake + - /share + - name: editor + buildsystem: cmake-ninja + config-opts: + - -DCMAKE_BUILD_TYPE=RelWithDebInfo + sources: + - type: git + url: https://github.com/EasyRPG/Editor.git diff --git a/resources/unix/easyrpg-editor.appdata.xml b/resources/unix/easyrpg-editor.appdata.xml new file mode 100644 index 00000000..b9e860d3 --- /dev/null +++ b/resources/unix/easyrpg-editor.appdata.xml @@ -0,0 +1 @@ + diff --git a/resources/unix/easyrpg-editor.desktop b/resources/unix/easyrpg-editor.desktop new file mode 100644 index 00000000..d7ca819b --- /dev/null +++ b/resources/unix/easyrpg-editor.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Terminal=false +Icon=easyrpg-editor +Type=Application +Categories=Game;Qt;X-Editor; +Exec=easyrpg-editor +Name=EasyRPG Editor +GenericName=Game Editor +Comment=Create and edit RPG Maker games +StartupNotify=true +StartupWMClass=org.easyrpg.easyrpg-editor