Skip to content
frank-1 edited this page Mar 15, 2023 · 17 revisions

Building a flatpak package without compiling

I went a different way and built my own runtime. I built the packages without the flatpak-builder.

Building fh.frank.myBaseSdk on Ubuntu 20.04

  • mkdir -p myflatpakbuilddir-u20/myBaseSdk/usr
  • cd myflatpakbuilddir-u20
  • flatpak build-init myBaseSdk fh.frank.myBaseSdk org.kde.Sdk/x86_64/5.12 org.kde.Sdk/x86_64/5.12
  • fakechroot fakeroot debootstrap --variant=minbase --arch=amd64 focal myBaseSdk/usr http://de.archive.ubuntu.com/ubuntu/
  • fakeroot fakechroot chroot myBaseSdk/usr apt install nano
  • fakeroot fakechroot chroot myBaseSdk/usr apt install locales
  • nano myBaseSdk/usr/etc/locale.gen and I removed the appropriate comment marks
  • fakechroot chroot myBaseSdk/usr locale-gen
  • fakechroot chroot myBaseSdk/usr apt-get clean
  • ln -s -f ../../lib/x86_64-linux-gnu/ld-2.31.so myBaseSdk/usr/usr/lib64/ld-linux-x86-64.so.2
  • I changed in myBaseSdk/metadata [Application] in [Runtime]
  • flatpak build-finish myBaseSdk
  • flatpak build-export -r ../ffdiarepo myBaseSdk
  • flatpak --user remote-add --no-gpg-verify ../ffdiarepo ffdiarepo
  • flatpak install ffdiarepo fh.frank.myBaseSdk
  • Runtime test:
  • flatpak run --command=bash fh.frank.myBaseSdk
  • exit

Building ffdiaruntime:

  • mkdir -p ffdiaruntime/usr
  • flatpak build-init -w ffdiaruntime fh.frank.ffdiaruntime fh.frank.myBaseSdk fh.frank.myBaseSdk
  • flatpak build ffdiaruntime ln -s /usr/usr/share /usr/share
  • flatpak build ffdiaruntime ln -s /usr/usr/include /usr/include
  • flatpak build ffdiaruntime ln -s /usr/usr/local /usr/local
  • flatpak build ffdiaruntime ln -s /usr/var/lib /var/lib
  • flatpak build ffdiaruntime ln -s /usr/usr/lib/apt /usr/lib/apt
  • flatpak build ffdiaruntime ln -s /usr/usr/lib/x86_64-linux-gnu/coreutils /usr/lib/x86_64-linux-gnu/coreutils
  • fakeroot fakechroot chroot ffdiaruntime/usr/
  • nano /etc/apt/sources.list
  • changed in deb http://de.archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
  • apt update
  • apt upgrade
  • apt install ffdiaporama
  • apt install libqt5concurrent5
  • ln -s /usr/usr/lib/locale /usr/lib/locale
  • ln -s /usr/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0 /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0
  • exit

Patching ffdiaporama_2.1+dfsg-1build2_amd64.deb because of ‘Unable to find codec h264’: (Patching can be skipped)

  • apt-get source ffdiaporama
  • cd ffdiaporama-2.1+dfsg
  • nano src/ffDiaporama/engine/_EncodeVideo.cpp:
t349c349,351
<     *codec=avcodec_find_encoder_by_name(CodecName);
---
>     if (strcmp(CodecName,"h264") == 0) *codec=avcodec_find_encoder_by_name("libx264");
>         else *codec=avcodec_find_encoder_by_name(CodecName);
>
  • sudo apt-get -y build-dep ffdiaporama
  • dpkg-source --commit
  • debuild
  • cd ../
  • cp ffdiaporama_2.1+dfsg-1build2_amd64.deb ffdiaruntime/usr/home/
  • fakeroot fakechroot chroot ffdiaruntime/usr/
  • apt remove ffdiaporama
  • dpkg -i /home/ffdiaporama_2.1+dfsg-1build2_amd64.deb
  • exit

Finishing runtime:

  • nano ffdiaruntime/metadata (changed [Application] in [Runtime])
  • flatpak build-finish ffdiaruntime
  • flatpak build-export -r ../ffdiarepo ffdiaruntime
  • flatpak install --user ffdiarepo fh.frank.ffdiaruntime

Test:

  • flatpak run --share=network --share=ipc --socket=x11 --socket=pulseaudio --persist=.ffDiaporama --filesystem=xdg-documents --filesystem=xdg-download --filesystem=xdg-pictures --filesystem=xdg-music --filesystem=xdg-videos --command=bash fh.frank.ffdiaruntime
  • ffDiaporama
  • exit

Dummy app:

  • flatpak build-init ffdiaapp fh.frank.u20.ffdiaporama fh.frank.ffdiaruntime fh.frank.ffdiaruntime
  • flatpak build-finish ffdiaapp --share=network --share=ipc --socket=x11 --socket=pulseaudio --persist=.ffDiaporama --filesystem=xdg-documents --filesystem=xdg-download --filesystem=xdg-pictures --filesystem=xdg-music --filesystem=xdg-videos --command=ffDiaporama
  • flatpak build-export ../ffdiarepo ffdiaapp
  • flatpak install --user ffdiarepo fh.frank.u20.ffdiaporama
  • flatpak run fh.frank.u20.ffdiaporama

This website (point 4) helped me: Flatpak - ArchWiki 1 And also Installation mit debootstrap › Wiki › ubuntuusers.de

Clone this wiki locally