Rangi42 / tilemap-studio

A tilemap editor for Game Boy, Color, Advance, DS, and SNES projects. Written in C++ with FLTK.
https://hax.iimarckus.org/topic/7691/
Other
381 stars 30 forks source link

Flatpak #77

Open JakobDev opened 1 year ago

JakobDev commented 1 year ago

I'm going to upload Tilemap Studio to Flathub. These files are needed to build the Flatpak:

io.github.Rangi42.tilemap-studio.yaml

id: io.github.Rangi42.tilemap-studio
runtime: org.freedesktop.Platform
runtime-version: "22.08"
sdk: org.freedesktop.Sdk
command: tilemapstudio
finish-args:
  - --filesystem=host:rw
  - --socket=x11
  - --device=dri
  - --share=ipc

modules:
  - name: fltk
    buildsystem: autotools
    config-opts:
      - --with-abiversion=10307
    sources:
      - type: git
        url: https://github.com/fltk/fltk.git
        tag: release-1.3.8
        commit: 3600522ae7d2244b69552458e4d82f869a36067b
      - type: patch
        path: xdg-dir.patch
    cleanup:
      - /include
      - /share
      - /bin

  - name: polished-map
    buildsystem: simple
    build-commands:
      - make
      - make install PREFIX=$FLATPAK_DEST
      - mv "$FLATPAK_DEST/share/applications/Tilemap Studio.desktop" $FLATPAK_DEST/share/applications/$FLATPAK_ID.desktop
      - desktop-file-edit --set-icon=$FLATPAK_ID --add-category=Game $FLATPAK_DEST/share/applications/$FLATPAK_ID.desktop
      - install -Dm644 $FLATPAK_ID.png -t $FLATPAK_DEST/share/icons/hicolor/128x128/apps
      - install -Dm644 $FLATPAK_ID.metainfo.xml -t $FLATPAK_DEST/share/metainfo
    sources:
      - type: archive
        archive-type: tar-gzip
        url: https://api.github.com/repos/Rangi42/tilemap-studio/tarball/v4.0.1
        sha256: 4ae47cc7e55209ebd36538e438fee635f373665e3270b33e698908b4766df5f3
        x-checker-data:
            type: json
            url: https://api.github.com/repos/Rangi42/tilemap-studio/releases/latest
            version-query: .tag_name
            url-query: .tarball_url
            is-main-source: true
      - type: file
        path: io.github.Rangi42.tilemap-studio.png
      - type: file
        path: io.github.Rangi42.tilemap-studio.metainfo.xml
    cleanup:
      - /share/pixmaps

io.github.Rangi42.tilemap-studio.metainfo.xml

<?xml version='1.0' encoding='utf-8'?>
<component type="desktop">
  <!--Created with jdAppdataEdit 5.1-->
  <id>io.github.Rangi42.tilemap-studio</id>
  <name>Tilemap Studio</name>
  <summary>A tilemap editor for Game Boy, Color, Advance, DS, and SNES projects</summary>
  <developer_name>Rangi42</developer_name>
  <launchable type="desktop-id">io.github.Rangi42.tilemap-studio.desktop</launchable>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>LGPL-3.0</project_license>
  <description>
    <p>A tilemap editor for Game Boy, GBC, GBA, NDS, SNES, Genesis, or TG16 projects. Specifically meant to support the pret disassemblies like pokered, pokecrystal, and pokeemerald; as well as hacks including Polished Crystal, Red++, Orange, Prism, and many more.</p>
    <p>Inspired by tools like Tilemap Creator, NTME, GSC Town Map Editor and Karteneditor, but implemented with C++ and FLTK, and with support for multi-platform tilemaps as well as Pokémon-specific formats.</p>
  </description>
  <screenshots>
    <screenshot type="default">
      <caption>The Main Window</caption>
      <image type="source">https://github.com/Rangi42/tilemap-studio/blob/v4.0.1/screenshot.png?raw=true</image>
    </screenshot>
    <screenshot>
      <caption>Image to Tiles Window</caption>
      <image type="source">https://github.com/Rangi42/tilemap-studio/blob/v4.0.1/screenshot2.png?raw=true</image>
    </screenshot>
  </screenshots>
  <releases>
    <release version="v4.0.1" date="2021-11-01" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v4.0.1</url>
      <description>
        <ul>
          <li>Import and export .asm tilemaps</li>
          <li>Confirm before closing a modified tilemap to open one from Image to Tiles</li>
          <li>Support 1bpp and 2bpp .NCGR graphics files</li>
          <li>Support Animator Pro .COL palette files</li>
          <li>Improve compatibility with international characters in filenames</li>
        </ul>
      </description>
    </release>
    <release version="v4.0.0" date="2021-08-29" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v4.0.0</url>
    </release>
    <release version="v3.3.0" date="2021-06-02" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v3.3.0</url>
    </release>
    <release version="v3.2.2" date="2020-11-13" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v3.2.2</url>
    </release>
    <release version="v3.2.1" date="2020-08-24" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v3.2.1</url>
    </release>
    <release version="v3.2.0" date="2020-06-02" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v3.2.0</url>
    </release>
    <release version="v3.1.0" date="2019-11-24" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v3.1.0</url>
    </release>
    <release version="v3.0.0" date="2019-11-17" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v3.0.0</url>
    </release>
    <release version="v2.1.1" date="2019-10-31" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v2.1.1</url>
    </release>
    <release version="v2.1.0" date="2019-10-20" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v2.1.0</url>
    </release>
    <release version="v2.0.0" date="2019-10-06" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v2.0.0</url>
    </release>
    <release version="v1.1.1" date="2019-09-08" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v1.1.1</url>
    </release>
    <release version="v1.1.0" date="2019-09-07" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v1.1.0</url>
    </release>
    <release version="v1.0.1" date="2019-09-02" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v1.0.1</url>
    </release>
    <release version="v1.0.0" date="2019-09-02" type="stable">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v1.0.0</url>
    </release>
    <release version="v0.4.0" date="2019-08-11" type="development">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v0.4.0</url>
    </release>
    <release version="v0.3.0" date="2019-08-04" type="development">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v0.3.0</url>
    </release>
    <release version="v0.2.0" date="2019-08-03" type="development">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v0.2.0</url>
    </release>
    <release version="v0.1.0" date="2019-08-02" type="development">
      <url>https://github.com/Rangi42/tilemap-studio/releases/tag/v0.1.0</url>
    </release>
  </releases>
  <url type="homepage">https://github.com/Rangi42/tilemap-studio</url>
  <url type="bugtracker">https://github.com/Rangi42/tilemap-studio/issues</url>
  <categories>
    <category>Game</category>
  </categories>
  <recommends>
    <control>pointing</control>
    <control>keyboard</control>
  </recommends>
  <content_rating type="oars-1.1"/>
  <provides>
    <binary> tilemapstudio</binary>
  </provides>
  <keywords>
    <keyword>Nintendo</keyword>
    <keyword>GameBoy</keyword>
    <keyword>GBA</keyword>
    <keyword>Hack</keyword>
  </keywords>
</component>

xdg-dir.patch

diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index 90b7820fd..8e301c99c 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -1038,7 +1038,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
   const char *e;
   switch (root) {
     case USER:
-      if ((e = fl_getenv("HOME")) != NULL) {
+      if ((e = fl_getenv("XDG_CONFIG_HOME")) != NULL) {
    strlcpy(filename, e, sizeof(filename));

    if (filename[strlen(filename)-1] != '/') {

io.github.Rangi42.tilemap-studio.png io github Rangi42 tilemap-studio

Rangi42 commented 1 year ago

Interesting, thanks! Not sure if I'll add these files in the repo itself.

FLTK made that XDG_CONFIG_HOME change in https://github.com/fltk/fltk/commit/7308bcdb74e34626c6459699cb57371afd7b343b. They're "planning to release 1.3.9 (soon, maybe parallel to 1.4.0)", so maybe that will have it.

mid-kid commented 1 year ago

It's a good idea to maintain the metainfo.xml upstream (and install it in /usr/share/metainfo/ as appropriate), as it's not flatpak-specific, and will get shown in any software store/package repository the program is distributed in. https://wiki.debian.org/AppStream/Guidelines#Component_naming https://www.freedesktop.org/software/appstream/docs/

Also, that patch kind of stinks. XDG_CONFIG_HOME is not guaranteed to be set, and needs to fall back to HOME/.config, and changing it like this results in a configuration root of ~/.config/.fltk/. It's awkward to have hidden files in .config.

JakobDev commented 1 year ago

Tilemap Studio is now on Flathub

Interesting, thanks! Not sure if I'll add these files in the repo itself.

You should do (except the Patch). These are normal Linux Metadata.

FLTK made that XDG_CONFIG_HOME change in https://github.com/fltk/fltk/commit/7308bcdb74e34626c6459699cb57371afd7b343b. They're "planning to release 1.3.9 (soon, maybe parallel to 1.4.0)", so maybe that will have it.

Nice to hear!

Also, that patch kind of stinks. XDG_CONFIG_HOME is not guaranteed to be set, and needs to fall back to HOME/.config, and changing it like this results in a configuration root of ~/.config/.fltk/. It's awkward to have hidden files in .config.

It does not. The only thing this Patch should do, is to make FLTK put it's files in the correct directory (Flatpak uses ~/.var/<appid>). Nothing more. XDG_CONFIG_HOME is guaranteed to be set inside a Flatpak.

mid-kid commented 1 year ago

I guess it works if it's only going to be used in flatpak, though it'll be awkward when fltk 1.4.0 eventually releases and uses $XDG_CONFIG_HOME/fltk rather than $XDG_CONFIG_HOME/.fltk. Just don't submit or apply this patch anywhere else.