I have a Gnome GJS app and would like to package it with Meson.
The app source (in ./src) has subfolders lib, object, and ui.
Each subfolder has a meson.build file that looks like this (for the ./src/lib folder):
app_resource = gnome.compile_resources(app_id + 'src.lib',
app_id + '.lib.gresource.xml',
source_dir: '.',
gresource_bundle: true,
install: true,
install_dir : pkgdatadir)
and a gresource xml file that looks like this (also for the ./src/lib folder):
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/domain/app/js">
<file>aes.js</file>
<file>file.js</file>
<file>settings.js</file>
<file>table.js</file>
<file>template.js</file>
</gresource>
</gresources>
In the ./src foder I have a com.domain.app.in file like this:
#!@GJS@
imports.package.init({ name: "com.domain.app",
version: "@PACKAGE_VERSION@",
prefix: "@prefix@",
libdir: "@libdir@" });
imports.package.run(imports.main);
a meson.build file like this:
app_resource = gnome.compile_resources(app_id + '.src',
app_id + '.src.gresource.xml',
source_dir: '.',
gresource_bundle: true,
install: true,
install_dir : pkgdatadir)
app_launcher = configure_file(
output : app_id,
input : app_id + '.in',
configuration: app_configuration)
install_data(app_launcher,
install_dir: get_option('bindir'),
install_mode: 'rwxr-xr-x'
)
and a gresource xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/domain/app/src">
<file>main.js</file>
</gresource>
</gresources>
The main meson.build file in the project root looks like this:
project('app', 'c',
version: '0.1.0',
meson_version: '>= 0.50.0',
)
app_command = 'app'
app_id = 'com.domain.app'
gnome = import('gnome')
intl = import('i18n')
config_h = configuration_data()
GETTEXT_PACKAGE = app_id
config_h.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE)
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
configure_file(
output: 'config.h',
configuration: config_h,
)
add_global_arguments([
'-DHAVE_CONFIG_H',
'-I' + meson.build_root(),
], language: 'c')
app_configuration = configuration_data()
app_configuration.set('GJS', find_program('gjs').path())
app_configuration.set('PACKAGE_NAME', app_id)
app_configuration.set('PACKAGE_VERSION', meson.project_version())
app_configuration.set('prefix', get_option('prefix'))
pkgdatadir = join_paths(get_option('datadir'), app_id)
app_configuration.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
app_configuration.set('pkgdatadir', pkgdatadir)
subdir('src')
subdir('src/lib')
subdir('src/ui')
subdir('src/object')
subdir('data')
subdir('po')
meson.add_install_script('meson/meson_post_install.py')
So...
When I run meson builddir
meson seems happy and gives no errors. It does populate the builddir, but not with anything visibly useful.
Then I cd into builddir and run ninja, ninja seems to not do much and I still don't have any executable file of any sort.
Thanks to Andy's comment, I ran meson install
(with a bunch of test parameters for local folders) and did get some files including an executable.
BUT, when I try to run the executable from the terminal, I get the following error:
(com.domain.app:6420): Gjs-WARNING **: 21:27:05.765: JS ERROR: ImportError: No JS module 'main' found in search path
@./com.domain.app:6:1
main.js is a file in the src folder of the app. It is referenced in the gresource xml file in that same folder.
What am I doing wrong or missing?
Any pointers would be greatly appreciated.