This is more like the actual code. My Meson.build is similar to the first bit of code below. ChatGPT suggests using the code below that in the manifest instead. That looks simpler and avoids the use of a second technology.
Will this work, in particular does it use the official Flatpak directories properly? I’m not expecting anyone to write the code for me, just to confirm that I haven’t missed something subtle that Meson does that I haven’t understood.
Current manifest
blah
blah
- name: myapp
buildsystem: meson
sources:
- type: git
tag: main
url: https://github.com/mysoftware/myapp
meson.build
project(
‘myapp’,
version: ‘0.0.0’,
meson_version: ‘>= 0.46.0’
)
bindir = get_option(‘bindir’)
datadir = get_option(‘datadir’)
pkgdatadir = join_paths(get_option(‘prefix’), get_option(‘datadir’), ‘myapp’)
conf = configuration_data()
conf.set(‘pkgdatadir’, pkgdatadir)
configure_file(
input: ‘myapp.py’,
output: ‘myapp’,
configuration: conf,
install_dir: bindir
)
data_files = [
‘com.github.mysoftware.myapp.png’,
‘dummy.png’
]
foreach file : data_files
install_data(file, install_dir: pkgdatadir)
endforeach
install_data(
‘com.github.mysoftware.myapp.appdata.xml’,
install_dir: join_paths(datadir, ‘metainfo’)
)
install_data(
‘com.github.mysoftware.myapp.desktop’,
install_dir: join_paths(datadir, ‘applications’)
)
install_data(
‘com.github.mysoftware.myapp.png’,
install_dir: join_paths(datadir, ‘icons’, ‘hicolor’, ‘128x128’, ‘apps’)
)
install_data(
‘com.github.mysoftware.myapp64x64.png’, rename : ‘com.github.mysoftware.myapp.png’,
install_dir: join_paths(datadir, ‘icons’, ‘hicolor’, ‘64x64’, ‘apps’)
)
install_data(
‘myapp_nl_NL.mo’, rename : ‘myapp.mo’,
install_dir: join_paths(get_option(‘prefix’), get_option(‘localedir’), ‘nl_NL’, ‘LC_MESSAGES’)
)
install_data(
‘myapp_de_DE.mo’, rename : ‘myapp.mo’,
install_dir: join_paths(get_option(‘prefix’), get_option(‘localedir’), ‘de_DE’, ‘LC_MESSAGES’)
)
New manifest
blah
blah
- name: myapp
buildsystem: simple
build-commands:
# Ensure the target directories exist
- mkdir -p /app/bin
- mkdir -p /app/share/myapp
- mkdir -p /app/share/metainfo
- mkdir -p /app/share/applications
- mkdir -p /app/share/icons/hicolor/128x128/apps
- mkdir -p /app/share/icons/hicolor/64x64/apps
- mkdir -p /app/share/locale/nl_NL/LC_MESSAGES
- mkdir -p /app/share/locale/de_DE/LC_MESSAGES
# Install the main script
- install -m 755 popout3d.py /app/bin/popout3d
# Install data files
- install -m 644 com.github.mysoftware.myapp.png dummy.png /app/share/myapp
# Install app metadata
- install -m 644 com.github.mysoftware.myapp.appdata.xml /app/share/metainfo
- install -m 644 com.github.mysoftware.myapp.desktop /app/share/applications
# Install icons
- install -m 644 com.github.mysoftware.myapp.png /app/share/icons/hicolor/128x128/apps
- install -m 644 com.github.mysoftware.myapp64x64.png /app/share/icons/hicolor/64x64/apps/com.github.mysoftware.myapp.png
# Install translations
- install -m 644 myapp_nl_NL.mo /app/share/locale/nl_NL/LC_MESSAGES/myapp.mo
- install -m 644 myapp_de_DE.mo /app/share/locale/de_DE/LC_MESSAGES/myapp.mo
sources:
- type: git
tag: main
url: https://github.com/mysoftware/myapp