feat(meson): devel option (#55)

* Add new development flatpak manifest

* feat(ci): use devel manifest

* feat(meson): check if git is available

* feat(meson): pass 'check' to run_command

there was a warning

* chore: install.sh should build devel

* fix(meson_options): profile => devel

Co-authored-by: Evangelos Paterakis <evan@geopjr.dev>
This commit is contained in:
Bleak Grey 2023-01-12 22:20:11 +03:00 committed by GitHub
parent 94688429bd
commit 15b8f4a0c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 7 deletions

View File

@ -12,7 +12,7 @@ jobs:
options: --privileged
steps:
- uses: actions/checkout@v3
- uses: flatpak/flatpak-github-actions/flatpak-builder@master
- uses: flatpak/flatpak-github-actions/flatpak-builder@v5
with:
bundle: "dev.geopjr.tooth.flatpak"
manifest-path: "dev.geopjr.tooth.json"
bundle: "dev.geopjr.tooth.Devel.flatpak"
manifest-path: "dev.geopjr.tooth.Devel.json"

View File

@ -2,8 +2,13 @@ icons_dir = join_paths(get_option('datadir'), 'icons', 'hicolor')
scalable_dir = join_paths(icons_dir, 'scalable', 'apps')
symbolic_dir = join_paths(icons_dir, 'symbolic', 'apps')
icon = 'color.svg'
if get_option('devel')
icon = 'color-nightly.svg'
endif
install_data(
join_paths('icons', 'color.svg'),
join_paths('icons', icon),
install_dir: scalable_dir,
rename: meson.project_name() + '.svg',
)

View File

@ -0,0 +1,50 @@
{
"app-id": "dev.geopjr.tooth",
"runtime": "org.gnome.Platform",
"runtime-version": "43",
"sdk": "org.gnome.Sdk",
"sdk-extensions" : ["org.freedesktop.Sdk.Extension.vala"],
"build-options" : {
"prepend-path" : "/usr/lib/sdk/vala/bin/",
"prepend-ld-library-path" : "/usr/lib/sdk/vala/lib"
},
"command": "dev.geopjr.tooth",
"finish-args": [
"--device=dri",
"--share=ipc",
"--share=network",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs",
"--talk-name=org.gtk.vfs.*",
"--filesystem=xdg-run/gvfsd"
],
"cleanup": [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"/share/vala",
"*.la",
"*.a"
],
"modules": [
{
"name": "tooth",
"builddir": true,
"buildsystem": "meson",
"config-opts" : [
"-Ddevel=true"
],
"sources": [
{
"type": "dir",
"path": "."
}
]
}
]
}

View File

@ -2,6 +2,7 @@
set -e
meson setup build --prefix=/usr
meson configure build -Ddevel=true
cd build
ninja
sudo ninja install

View File

@ -16,20 +16,32 @@ add_global_arguments(
language: 'c',
)
devel = get_option('devel')
config = configuration_data()
config.set('EXEC_NAME', meson.project_name())
config.set('GETTEXT_PACKAGE', meson.project_name())
config.set('RESOURCES', '/' + '/'.join(meson.project_name().split('.')) + '/')
config.set('VERSION', meson.project_version())
config.set('PREFIX', get_option('prefix'))
config.set('PROFILE', devel ? 'development' : 'production')
config.set('NAME', 'Tooth')
config.set('WEBSITE', 'https://github.com/GeopJr/tooth')
config.set('SUPPORT_WEBSITE', 'https://github.com/GeopJr/tooth/issues')
config.set(
'COPYRIGHT',
'© 2018-2021 bleak_grey\n© 2022 Evangelos \"GeopJr\" Paterakis',
'© 2022 bleak_grey\n© 2022 Evangelos \"GeopJr\" Paterakis',
)
if devel
git = find_program('git')
if git.found()
branch = run_command('git', 'branch', '--show-current', check: true).stdout().strip()
revision = run_command('git', 'rev-parse', '--short', 'HEAD', check: true).stdout().strip()
version = '@0@-@1@'.format(branch, revision)
config.set('VERSION', version)
endif
endif
gnome = import('gnome')
i18n = import('i18n')

1
meson_options.txt Normal file
View File

@ -0,0 +1 @@
option('devel', type: 'boolean', value: false)

View File

@ -200,9 +200,9 @@ namespace Tooth {
refresh ();
}
string troubleshooting = "flatpak: %s\nversion: %s\ngtk: %u.%u.%u (%d.%d.%d)\nlibadwaita: %u.%u.%u (%d.%d.%d)\nlibsoup: %u.%u.%u (%d.%d.%d)\n".printf(
string troubleshooting = "flatpak: %s\nversion: %s (%s)\ngtk: %u.%u.%u (%d.%d.%d)\nlibadwaita: %u.%u.%u (%d.%d.%d)\nlibsoup: %u.%u.%u (%d.%d.%d)\n".printf(
(GLib.Environment.get_variable("FLATPAK_ID") != null || GLib.File.new_for_path("/.flatpak-info").query_exists()).to_string(),
Build.VERSION,
Build.VERSION, Build.PROFILE,
Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version(),
Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION, Gtk.MICRO_VERSION,
Adw.get_major_version(), Adw.get_minor_version(), Adw.get_micro_version(),

View File

@ -8,6 +8,7 @@ public class Build {
public const string SUPPORT_WEBSITE = "@SUPPORT_WEBSITE@";
public const string COPYRIGHT = "@COPYRIGHT@";
public const string PREFIX = "@PREFIX@";
public const string PROFILE = "@PROFILE@";
public static string SYSTEM_INFO;
@ -23,6 +24,7 @@ public class Build {
SYSTEM_INFO = @"$NAME $VERSION";
SYSTEM_INFO += @"\nRunning on: $os_name $os_ver";
SYSTEM_INFO += @"\nBuild prefix: \"$PREFIX\"";
SYSTEM_INFO += @"\nBuild profile: \"$PROFILE\"";
var lines = SYSTEM_INFO.split ("\n");
foreach (unowned string line in lines) {

View File

@ -32,6 +32,10 @@ public class Tooth.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable {
);
sidebar.set_sidebar_selected_item(0);
open_view (new Views.Main ());
if (Build.PROFILE == "development") {
this.add_css_class ("devel");
}
}
public Views.Base open_view (Views.Base view) {