Overhaul Meson / Flatpak Building
This commit is contained in:
parent
1b98054024
commit
6cde50daf3
21 changed files with 802 additions and 550 deletions
1042
burrow-gtk/Cargo.lock
generated
1042
burrow-gtk/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -10,7 +10,7 @@ anyhow = "1.0"
|
|||
relm4 = { features = ["libadwaita", "gnome_45"], git = "https://github.com/Relm4/Relm4" }
|
||||
burrow = { version = "*", path = "../burrow/" }
|
||||
tokio = { version = "1.35.0", features = ["time", "sync"] }
|
||||
gettext-rs = "0.7.0"
|
||||
gettext-rs = { version = "0.7.0", features = ["gettext-system"] }
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = "1.0"
|
||||
|
|
|
|||
|
|
@ -24,12 +24,24 @@
|
|||
"RUST_LOG" : "burrow-gtk=debug"
|
||||
}
|
||||
},
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/man",
|
||||
"/share/doc",
|
||||
"/share/gtk-doc",
|
||||
"/share/man",
|
||||
"/share/pkgconfig",
|
||||
"*.la",
|
||||
"*.a"
|
||||
],
|
||||
"modules" : [
|
||||
{
|
||||
"name" : "burrow-gtk",
|
||||
"builddir" : true,
|
||||
"subdir" : "burrow-gtk",
|
||||
"buildsystem" : "meson",
|
||||
"config-opts": ["--buildtype=debug"],
|
||||
"sources" : [
|
||||
{
|
||||
"type": "dir",
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
"builddir" : true,
|
||||
"subdir" : "burrow-gtk",
|
||||
"buildsystem" : "meson",
|
||||
"config-opts": ["--buildtype=release"],
|
||||
"sources" : [
|
||||
{
|
||||
"type": "dir",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Name=Burrow
|
||||
Exec=burrow-gtk
|
||||
Icon=com.hackclub.burrow
|
||||
Name=@APP_NAME_CAPITALIZED@
|
||||
Exec=@APP_NAME@
|
||||
Icon=@APP_ID@
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=GTK;Network
|
||||
5
burrow-gtk/data/app.gschema.xml.in
Normal file
5
burrow-gtk/data/app.gschema.xml.in
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist gettext-domain="@APP_NAME@">
|
||||
<schema id="@APP_ID" path="@APP_IDPATH@">
|
||||
</schema>
|
||||
</schemalist>
|
||||
16
burrow-gtk/data/app.metainfo.xml.in
Normal file
16
burrow-gtk/data/app.metainfo.xml.in
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>@APP_ID@</id>
|
||||
<metadata_license>CC0</metadata_license>
|
||||
<project_license>GPL-3.0-or-later</project_license>
|
||||
<name translatable="no">@APP_NAME_CAPITALIZED@</name>
|
||||
<launchable type="desktop-id">@APP_ID@.desktop</launchable>
|
||||
|
||||
<description>
|
||||
<p>No description</p>
|
||||
</description>
|
||||
|
||||
<summary>
|
||||
<p>No Summary</p>
|
||||
</summary>
|
||||
</component>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>com.hackclub.burrow.desktop</id>
|
||||
<project_license>GPL-3.0-or-later</project_license>
|
||||
<description>
|
||||
<p>No description</p>
|
||||
</description>
|
||||
</component>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist gettext-domain="burrow-gtk">
|
||||
<schema id="com.hackclub.burrow" path="/com/hackclub/burrow/">
|
||||
</schema>
|
||||
</schemalist>
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
|
|
@ -1,13 +0,0 @@
|
|||
application_id = 'com.hackclub.burrow'
|
||||
|
||||
scalable_dir = join_paths('hicolor', 'scalable', 'apps')
|
||||
install_data(
|
||||
join_paths(scalable_dir, ('@0@.svg').format(application_id)),
|
||||
install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir)
|
||||
)
|
||||
|
||||
symbolic_dir = join_paths('hicolor', 'symbolic', 'apps')
|
||||
install_data(
|
||||
join_paths(symbolic_dir, ('@0@-symbolic.svg').format(application_id)),
|
||||
install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir)
|
||||
)
|
||||
|
|
@ -1,39 +1,90 @@
|
|||
# app.desktop.in.in
|
||||
desktop_conf = configuration_data()
|
||||
desktop_conf.set('APP_ID', app_id)
|
||||
desktop_conf.set('APP_NAME', app_name)
|
||||
desktop_conf.set('APP_NAME_CAPITALIZED', app_name_capitalized)
|
||||
|
||||
desktop_file_in = configure_file(
|
||||
input: 'app.desktop.in.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: desktop_conf,
|
||||
)
|
||||
|
||||
desktop_file = i18n.merge_file(
|
||||
input: 'com.hackclub.burrow.desktop.in',
|
||||
output: 'com.hackclub.burrow.desktop',
|
||||
type: 'desktop',
|
||||
po_dir: '../po',
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('datadir'), 'applications')
|
||||
input: desktop_file_in,
|
||||
output: app_id + '.desktop',
|
||||
type: 'desktop',
|
||||
po_dir: '../po',
|
||||
install: true,
|
||||
install_dir: datadir / 'applications',
|
||||
)
|
||||
|
||||
desktop_utils = find_program('desktop-file-validate', required: false)
|
||||
if desktop_utils.found()
|
||||
test('Validate desktop file', desktop_utils, args: [desktop_file])
|
||||
if desktop_file_validate.found()
|
||||
test(
|
||||
'validate-desktop',
|
||||
desktop_file_validate,
|
||||
args: [desktop_file],
|
||||
)
|
||||
endif
|
||||
|
||||
appstream_file = i18n.merge_file(
|
||||
input: 'com.hackclub.burrow.appdata.xml.in',
|
||||
output: 'com.hackclub.burrow.appdata.xml',
|
||||
po_dir: '../po',
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('datadir'), 'appdata')
|
||||
# app.gschema.xml.in
|
||||
gschema_conf = configuration_data()
|
||||
gschema_conf.set('APP_ID', app_id)
|
||||
gschema_conf.set('APP_NAME', app_name)
|
||||
gschema_conf.set('APP_IDPATH', app_idpath)
|
||||
gschema_file = configure_file(
|
||||
input: 'app.gschema.xml.in',
|
||||
output: app_id + '.gschema.xml',
|
||||
configuration: gschema_conf,
|
||||
install: true,
|
||||
install_dir: datadir / 'glib-2.0' / 'schemas',
|
||||
)
|
||||
|
||||
if glib_compile_schemas.found()
|
||||
test(
|
||||
'validate-gschema',
|
||||
glib_compile_schemas,
|
||||
args: [
|
||||
'--dry-run',
|
||||
datadir / 'glib-2.0' / 'schemas',
|
||||
],
|
||||
)
|
||||
endif
|
||||
|
||||
# app.metainfo.xml.in
|
||||
appdata_conf = configuration_data()
|
||||
appdata_conf.set('APP_ID', app_id)
|
||||
appdata_conf.set('APP_NAME', app_name)
|
||||
appdata_conf.set('APP_NAME_CAPITALIZED', app_name_capitalized)
|
||||
appdata_file_in = configure_file(
|
||||
input: 'app.metainfo.xml.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: appdata_conf,
|
||||
)
|
||||
appdata_file = i18n.merge_file(
|
||||
input: appdata_file_in,
|
||||
output: app_id + '.metainfo.xml',
|
||||
po_dir: '../po',
|
||||
install: true,
|
||||
install_dir: datadir / 'metainfo',
|
||||
)
|
||||
|
||||
appstream_util = find_program('appstream-util', required: false)
|
||||
if appstream_util.found()
|
||||
test('Validate appstream file', appstream_util, args: ['validate', appstream_file])
|
||||
test(
|
||||
'validate-appdata',
|
||||
appstream_util,
|
||||
args: ['validate', '--nonet', appdata_file],
|
||||
)
|
||||
endif
|
||||
|
||||
install_data('com.hackclub.burrow.gschema.xml',
|
||||
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
|
||||
install_data(
|
||||
'icons/hicolor/scalable/apps/' + app_name + '.svg',
|
||||
install_dir: datadir / 'icons' / 'hicolor' / 'scalable' / 'apps',
|
||||
rename: app_id + '.svg',
|
||||
)
|
||||
|
||||
compile_schemas = find_program('glib-compile-schemas', required: false)
|
||||
if compile_schemas.found()
|
||||
test('Validate schema file',
|
||||
compile_schemas,
|
||||
args: ['--strict', '--dry-run', meson.current_source_dir()])
|
||||
endif
|
||||
|
||||
subdir('icons')
|
||||
install_data(
|
||||
'icons/hicolor/symbolic/apps/' + app_name + '-symbolic.svg',
|
||||
install_dir: datadir / 'icons' / 'hicolor' / 'symbolic' / 'apps',
|
||||
rename: app_id + '-symbolic.svg',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,4 +3,3 @@
|
|||
<gresource prefix="/com/hackclub/burrow">
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,56 @@
|
|||
project('burrow-gtk', 'rust',
|
||||
version: '0.1.0',
|
||||
meson_version: '>= 0.62.0',
|
||||
default_options: [ 'warning_level=2', 'werror=false', ],
|
||||
project(
|
||||
'burrow-gtk',
|
||||
['rust'],
|
||||
version: '0.0.1',
|
||||
meson_version: '>= 1.0',
|
||||
)
|
||||
|
||||
# Find Cargo
|
||||
cargo_bin = find_program('cargo')
|
||||
cargo_env = ['CARGO_HOME=' + meson.project_build_root()]
|
||||
cargo_opt = ['--manifest-path', meson.project_source_root() / 'Cargo.toml']
|
||||
cargo_opt += ['--target-dir', meson.project_build_root() / 'target']
|
||||
|
||||
# Config
|
||||
prefix = get_option('prefix')
|
||||
datadir = prefix / get_option('datadir')
|
||||
localedir = prefix / get_option('localedir')
|
||||
|
||||
app_name = 'burrow-gtk'
|
||||
app_name_capitalized = 'Burrow'
|
||||
base_id = 'com.hackclub.burrow'
|
||||
app_idpath = '/com/hackclub/' + app_name + '/'
|
||||
if get_option('buildtype') == 'release'
|
||||
cargo_opt += ['--release']
|
||||
rust_target = 'release'
|
||||
app_id = base_id
|
||||
else
|
||||
rust_target = 'debug'
|
||||
app_id = base_id + '-' + 'devel'
|
||||
endif
|
||||
|
||||
# Imports
|
||||
i18n = import('i18n')
|
||||
gnome = import('gnome')
|
||||
|
||||
# External Dependencies
|
||||
dependency('gtk4', version: '>= 4.12')
|
||||
dependency('libadwaita-1', version: '>= 1.4')
|
||||
|
||||
glib_compile_resources = find_program('glib-compile-resources', required: true)
|
||||
glib_compile_schemas = find_program('glib-compile-schemas', required: true)
|
||||
desktop_file_validate = find_program('desktop-file-validate', required: false)
|
||||
appstream_util = find_program('appstream-util', required: false)
|
||||
fc_cache = find_program('fc-cache', required: false)
|
||||
update_mime_database = find_program('update-mime-database', required: false)
|
||||
|
||||
dependency('gtk4', version: '>= 4.12')
|
||||
dependency('libadwaita-1', version: '>= 1.4')
|
||||
|
||||
# Our Sources
|
||||
subdir('po')
|
||||
subdir('data')
|
||||
subdir('src')
|
||||
|
||||
# Gnome Post Install
|
||||
gnome.post_install(
|
||||
glib_compile_schemas: true,
|
||||
gtk_update_icon_cache: true,
|
||||
update_desktop_database: true,
|
||||
glib_compile_schemas: true,
|
||||
gtk_update_icon_cache: true,
|
||||
update_desktop_database: true,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
data/com.hackclub.Burrow.desktop.in
|
||||
data/com.hackclub.Burrow.appdata.xml.in
|
||||
data/com.hackclub.Burrow.gschema.xml
|
||||
data/app.desktop.in.in
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
i18n.gettext('burrow-gtk', preset: 'glib')
|
||||
i18n.gettext(app_name, preset: 'glib')
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ pub enum AppMsg {
|
|||
|
||||
impl App {
|
||||
pub fn run() {
|
||||
let app = RelmApp::new("com.hackclub.burrow");
|
||||
let app = RelmApp::new(config::ID);
|
||||
Self::setup_gresources().unwrap();
|
||||
Self::setup_i18n().unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ impl SimpleComponent for SettingsScreen {
|
|||
|
||||
fn init(
|
||||
init: Self::Init,
|
||||
root: &Self::Root,
|
||||
root: Self::Root,
|
||||
sender: ComponentSender<Self>,
|
||||
) -> ComponentParts<Self> {
|
||||
let diag_group = settings::DiagGroup::builder()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
pub static VERSION: &str = @VERSION@;
|
||||
pub static GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@;
|
||||
pub static LOCALEDIR: &str = @LOCALEDIR@;
|
||||
pub static PKGDATADIR: &str = @PKGDATADIR@;
|
||||
#[allow(unused)]
|
||||
pub const ID: &str = @ID@;
|
||||
#[allow(unused)]
|
||||
pub const VERSION: &str = @VERSION@;
|
||||
#[allow(unused)]
|
||||
pub const LOCALEDIR: &str = @LOCALEDIR@;
|
||||
#[allow(unused)]
|
||||
pub const GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@;
|
||||
|
|
|
|||
|
|
@ -1,46 +1,34 @@
|
|||
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
|
||||
|
||||
# config.rs.in
|
||||
global_conf = configuration_data()
|
||||
global_conf.set_quoted('ID', app_id)
|
||||
global_conf.set_quoted('VERSION', meson.project_version())
|
||||
global_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
||||
global_conf.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
|
||||
global_conf.set_quoted('PKGDATADIR', pkgdatadir)
|
||||
global_conf.set_quoted('LOCALEDIR', localedir)
|
||||
global_conf.set_quoted('GETTEXT_PACKAGE', app_name)
|
||||
config = configure_file(
|
||||
input: 'config.rs.in',
|
||||
output: 'config.rs',
|
||||
configuration: global_conf
|
||||
input: 'config.rs.in',
|
||||
output: 'config.rs',
|
||||
configuration: global_conf,
|
||||
)
|
||||
|
||||
run_command(
|
||||
'cp',
|
||||
meson.project_build_root() / 'src' / 'config.rs',
|
||||
meson.project_source_root() / 'src' / 'config.rs',
|
||||
check: true
|
||||
'cp',
|
||||
meson.project_build_root() / 'src' / 'config.rs',
|
||||
meson.project_source_root() / 'src',
|
||||
check: true,
|
||||
)
|
||||
|
||||
cargo_bin = find_program('cargo')
|
||||
cargo_opt = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
|
||||
cargo_opt += [ '--target-dir', meson.project_build_root() / 'src' ]
|
||||
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
|
||||
|
||||
if get_option('buildtype') == 'release'
|
||||
cargo_options += [ '--release' ]
|
||||
rust_target = 'release'
|
||||
else
|
||||
rust_target = 'debug'
|
||||
endif
|
||||
|
||||
# Cargo Build
|
||||
cargo_build = custom_target(
|
||||
'cargo-build',
|
||||
build_by_default: true,
|
||||
build_always_stale: true,
|
||||
output: meson.project_name(),
|
||||
console: true,
|
||||
install: true,
|
||||
install_dir: get_option('bindir'),
|
||||
command: [
|
||||
'env', cargo_env,
|
||||
cargo_bin, 'build',
|
||||
cargo_opt, '&&', 'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
|
||||
]
|
||||
)
|
||||
'cargo-build',
|
||||
build_by_default: true,
|
||||
build_always_stale: true,
|
||||
output: meson.project_name(),
|
||||
console: true,
|
||||
install: true,
|
||||
install_dir: get_option('bindir'),
|
||||
command: [
|
||||
'env', cargo_env,
|
||||
cargo_bin, 'build',
|
||||
cargo_opt, '&&', 'cp', 'target' / rust_target / meson.project_name(), '@OUTPUT@',
|
||||
]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue