I'm trying to build a Vala program with flatpak. I need to connect to a mysql-server and thats why i need to bundle libmysqlclient
with my flatpak.
Thats why I added mysql_config
to my meson.build file.
project('zeiterfassunggtk', ['c', 'vala'], version: '0.1.0',
meson_version: '>= 0.40.0',
)
i18n = import('i18n')
mysql_config = find_program('mysql_config')
mysql_vapi = meson.get_compiler('vala').find_library('mysql')
mysql_dep = declare_dependency(c_args: run_command([mysql_config, '--cflags']).stdout().split(),
link_args: run_command([mysql_config, '--libs']).stdout().split(),
dependencies: [mysql_vapi])
subdir('data')
subdir('src')
subdir('po')
meson.add_install_script('build-aux/meson/postinstall.py')
The problem now ist that mysql_config is not available in the flatpak runtime. So I need to bundle it with my flatpak.
The Flatpak documentation however was not very helpful for me.
Modules
The module list specifies each of the modules that are to be built as part of the build process. One of these modules is the application itself, and other modules are dependencies and libraries that are bundled as part of the Flatpak. While simple applications may only specify one or two modules, and therefore have short modules sections, some applications can bundle numerous modules and therefore have lengthy modules sections.
GNOME Dictionary’s modules section is short, since it just contains the application itself, and looks like:
"modules": [ { "name": "gnome-dictionary", "sources": [ { "type": "archive", "url": "https://download.gnome.org/sources/gnome-dictionary/3.26/gnome-dictionary-3.26.0.tar.xz", "sha256": "387ff8fbb8091448453fd26dcf0b10053601c662e59581097bc0b54ced52e9ef" } ] } ]
As can be seen, each listed module has a name (which can be freely assigned) and a list of sources. Each source has a type, and available types include:
archive - .tar or .zip archive files git - Git repositories bzr - Bazaar repositories file - local file (these are copied into the source directory) dir - local directory (these are copied into the source directory) script - an array of shell commands (these are put in a shellscript file) shell - an array of shell commands that are run during source extraction patch - a patch (are applied to the source directory) extra-data - data that can be downloaded at install time; this can include archive or package files
Different properties are available for each source type, which are listed in the Flatpak Builder Command Reference.
Can someone tell me how to add libmysqlclient
to my flatpak and how to use mysql_config
to set the correct compiler flags for my flatpak.
This is my manifest (the gnome-builder default):
{
"app-id" : "org.gnome.Zeiterfassunggtk",
"runtime" : "org.gnome.Platform",
"runtime-version" : "3.28",
"sdk" : "org.gnome.Sdk",
"command" : "zeiterfassunggtk",
"finish-args" : [
"--share=network",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"build-options" : {
"cflags" : "-O2 -g",
"cxxflags" : "-O2 -g",
"env" : {
"V" : "1"
}
},
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"/share/vala",
"*.la",
"*.a"
],
"modules" : [
{
"name" : "zeiterfassunggtk",
"buildsystem" : "meson",
"config-opts" : [
"--libdir=lib"
],
"builddir" : true,
"sources" : [
{
"type" : "git",
"url" : "file:///home/g.zehetner/Projekte/ZeiterfassungGtk"
}
]
}
]
}