Flatpakin valmistaminen

Vastaava kuin Snap. Flatpak-versio Jamista, jaetaan Flathub.

Mikä on Flatpak ja miten se toimii?

Lue ensin johdanto Introduction to Flatpak ja Basic Concepts jotta saat perusymmärryksen Flatpakeista.

Tärkeä

Ennen kuin jatkat, asenna flatpak paketti.

Lähdekoodi

Flatpak lähdekoodi on täsmälleen sama kuin työpöytäversion. Riippuvuudet ja Flatpak-kohtaiset korjaustiedostot sijaitsevat kuitenkin virallisessa GitHub-arkistossa (Flathub vaatimusten mukaisesti) ja löytyy täältä.

Edellytykset

Asenna flatpak-builder:

flatpak install flathub org.flatpak.Builder

Lisää sitten Flathub-repo kaikille käyttäjille:

flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo

Flatpakin valmistaminen paikallisesti

Kloonaa GitHub-arkisto

git clone git@github.com:flathub/net.jami.Jami.git

Jamin rakentaminen

flatpak-builder --force-clean --user --install-deps-from=flathub --repo=DIR builddir net.jami.Jami.yml

”DIR” – arkiston nimi. Oletuksena arkiston nimen pitäisi olla ”repo”. Jos arkiston nimi on jokin muu, nimeä on käytettävä [Jamin asennuksessa] (#install-jami), [Flatpak virheentarkistuksessa] (#debugging) ja [päivitysten lähettämisessä Flathubiin] (#submitting-updates-to-flathub).

Asenna Jami

flatpak install DIR -y net.jami.Jami

Suorita Jami

flatpak run net.jami.Jami

Muista

Jos Jamista on useita Flatpak-asennuksia, --branch=BRANCH-vipu tulee määrittää run-komennon jälkeen, juuri käännetyn Flatpakin suorittamiseksi.

Flatpak-asennukset ja vastaavat haarat voidaan tarkistaa komennolla ”flatpak list”. Suorita juuri käännetty ja asennettu Flatpak, asettamalla ”BRANCH”-kohtaan haara, joka vastaa ”Origin”-haaraa, joka on ”repo”.

Virheentarkistus

Flatpak virheentarkistus hiekkalaatikossa on mahdollista paikallisella tietokoneella.

Varoitus

Due to the way Jami is built for Flatpak, debugging can be time-consuming since jami-core is built as a shared library. This means that each time the debugger is restarted, it is required to wait for the symbols to load. Unless it is certain that the issue being debugged is specific to the Flatpak version of Jami, it is usually faster to build and debug the desktop client locally. For instructions, see here.

Downloading the debug version

The instructions to build the Jami Flatpak as described in the previous section must be complete prior to proceeding. Once done, install the debug version:

flatpak install --include-sdk --include-debug repo -y net.jami.Jami

Starting the debugging environment

The following command will run a shell within the sandbox:

flatpak run --command=sh --devel --filesystem=$(pwd) net.jami.Jami

Once run, the shell should appear similar to the following:

[📦 net.jami.Jami net.jami.Jami]$

There are now two methods for debugging. Regardless of which is chosen, commands described in either section should be run within the sandbox shell.

Debug with the GNU Project Debugger (GDB)

gdb --args /app/bin/jami --debug

Debugging can now be done as usual.

Debug with Visual Studio Code (VS Code)

  1. Start gdbserver.

    gdbserver :1234 /app/bin/jami --debug
    

    Muista

    The port number can be changed if required. Make sure the port number for miDebuggerServerAddress in .vscode/launch.json reflects the new port number.

  2. Launch VS Code at the root of the project.

  3. Enter the Run and Debug section (Ctrl+Shift+D).

  4. Select Attach to Remote GDB.

  5. Run Jami (F5).

Setting breakpoints

Source files are located in builddir/files/lib/debug/source at the root of the project and are where breakpoints should be set.

Submitting updates to Flathub

If not done already, install flatpak-builder and add the Flathub repo user-wide as described in the Prerequisites section.

Build the manifest

flatpak run --command=flathub-build org.flatpak.Builder --install net.jami.Jami.yml

Run and test Jami

flatpak run net.jami.Jami

Run the linter

The following commands must be run when changes are made to the YAML files. If there are errors, they must be resolved before opening a pull request. Otherwise, the Flathub test builds will fail as well.

flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest net.jami.Jami.yml
flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo repo

The list of linter errors can be found here.

Push changes and open a pull request

If the build was successful and passed the linter checks, changes can be pushed to the GitHub repo and a pull request can be opened. Once the pull request is opened, the Flathub automatic build system will create test builds for the x86_64 and aarch64 architectures. If the test builds are successful, the pull request will be able to be merged into master, triggering the official builds.

Muista

Any changes to finish-args in net.jami.Jami.yml as well as changes to net.jami.Jami.metainfo.xml will require approval by the Flathub maintainers. Depending on the changes, the build may be rejected or require an explanation or justification. For the latter, an issue will be opened on the GitHub repository to explain or justify the changes.

To see the status of approval, sign in to Flathub and navigate to Developer Portal → Jami.