diff --git a/.gitignore b/.gitignore index 67c5111..5335456 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,15 @@ /target /libs *.AppImage +target/ +build/ +_build/ +builddir/ +build-aux/app +build-aux/.flatpak-builder/ +src/config.rs +*.ui.in~ +*.ui~ +.flatpak/ +vendor + diff --git a/build-aux/cargo.sh b/build-aux/cargo.sh new file mode 100644 index 0000000..3c37396 --- /dev/null +++ b/build-aux/cargo.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +export MESON_BUILD_ROOT="$1" +export MESON_SOURCE_ROOT="$2" +export CARGO_TARGET_DIR="$MESON_BUILD_ROOT"/target +export CARGO_HOME="$MESON_BUILD_ROOT"/cargo-home +export OUTPUT="$3" +export BUILDTYPE="$4" +export APP_BIN="$5" + + +if [ $BUILDTYPE = "release" ] +then + echo "RELEASE MODE" + cargo build --manifest-path \ + "$MESON_SOURCE_ROOT"/Cargo.toml --release && \ + cp "$CARGO_TARGET_DIR"/release/"$APP_BIN" "$OUTPUT" +else + echo "DEBUG MODE" + cargo build --manifest-path \ + "$MESON_SOURCE_ROOT"/Cargo.toml && \ + cp "$CARGO_TARGET_DIR"/debug/"$APP_BIN" "$OUTPUT" +fi + diff --git a/data/icons/hicolor/scalable/apps/org.kuchelmeister.toolbxtuner.svg b/data/icons/hicolor/scalable/apps/org.kuchelmeister.toolbxtuner.svg new file mode 100644 index 0000000..a74c4df --- /dev/null +++ b/data/icons/hicolor/scalable/apps/org.kuchelmeister.toolbxtuner.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + application-x-executable + + + + + + + + + + + + + + + + diff --git a/data/icons/hicolor/symbolic/apps/org.kuchelmeister.toolbxtuner-symbolic.svg b/data/icons/hicolor/symbolic/apps/org.kuchelmeister.toolbxtuner-symbolic.svg new file mode 100644 index 0000000..0444828 --- /dev/null +++ b/data/icons/hicolor/symbolic/apps/org.kuchelmeister.toolbxtuner-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 0000000..f65f4a5 --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,13 @@ +application_id = 'org.kuchelmeister.toolbxtuner' + +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) +) diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..3d4dcce --- /dev/null +++ b/data/meson.build @@ -0,0 +1,43 @@ +desktop_file = i18n.merge_file( + input: 'org.kuchelmeister.toolbxtuner.desktop.in', + output: 'org.kuchelmeister.toolbxtuner.desktop', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +desktop_utils = find_program('desktop-file-validate', required: false) +if desktop_utils.found() + test('Validate desktop file', desktop_utils, + args: [desktop_file] + ) +endif + +appstream_file = i18n.merge_file( + input: 'org.kuchelmeister.toolbxtuner.appdata.xml.in', + output: 'org.kuchelmeister.toolbxtuner.appdata.xml', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'appdata') +) + +appstream_util = find_program('appstream-util', required: false) +if appstream_util.found() + test('Validate appstream file', appstream_util, + args: ['validate', appstream_file] + ) +endif + +install_data('org.kuchelmeister.toolbxtuner.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') +) + +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') diff --git a/data/org.kuchelmeister.toolbxtuner.appdata.xml.in b/data/org.kuchelmeister.toolbxtuner.appdata.xml.in new file mode 100644 index 0000000..462b8ff --- /dev/null +++ b/data/org.kuchelmeister.toolbxtuner.appdata.xml.in @@ -0,0 +1,9 @@ + + + org.kuchelmeister.toolbxtuner.desktop + CC0-1.0 + GPL-3.0-or-later + +

No description

+
+
diff --git a/data/org.kuchelmeister.toolbxtuner.desktop.in b/data/org.kuchelmeister.toolbxtuner.desktop.in new file mode 100644 index 0000000..9cdbfd9 --- /dev/null +++ b/data/org.kuchelmeister.toolbxtuner.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=toolbx-tuner +Exec=toolbx-tuner +Icon=org.kuchelmeister.toolbxtuner +Terminal=false +Type=Application +Categories=GTK; +StartupNotify=true diff --git a/data/org.kuchelmeister.toolbxtuner.gschema.xml b/data/org.kuchelmeister.toolbxtuner.gschema.xml new file mode 100644 index 0000000..5c76897 --- /dev/null +++ b/data/org.kuchelmeister.toolbxtuner.gschema.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..b0d32ef --- /dev/null +++ b/meson.build @@ -0,0 +1,26 @@ +project('toolbx-tuner', 'rust', + version: '0.1.0', + meson_version: '>= 0.59.0', + default_options: [ 'warning_level=2', + 'werror=false', + ], +) + +i18n = import('i18n') + +gnome = import('gnome') + + +cargo_sources = files( + 'Cargo.toml', + 'Cargo.lock', +) + +subdir('data') +subdir('src') + +gnome.post_install( + glib_compile_schemas: true, + gtk_update_icon_cache: true, + update_desktop_database: true, +) diff --git a/org.kuchelmeister.toolbxtuner.json b/org.kuchelmeister.toolbxtuner.json new file mode 100644 index 0000000..0bc8e20 --- /dev/null +++ b/org.kuchelmeister.toolbxtuner.json @@ -0,0 +1,51 @@ +{ + "app-id" : "org.kuchelmeister.toolbxtuner", + "runtime" : "org.gnome.Platform", + "runtime-version" : "42", + "sdk" : "org.gnome.Sdk", + "sdk-extensions" : [ + "org.freedesktop.Sdk.Extension.rust-stable" + ], + "command" : "toolbx-tuner", + "finish-args" : [ + "--share=network", + "--share=ipc", + "--socket=fallback-x11", + "--device=dri", + "--socket=wayland" + ], + "build-options" : { + "append-path" : "/usr/lib/sdk/rust-stable/bin", + "build-args" : [ + "--share=network" + ], + "env" : { + "RUST_BACKTRACE" : "1", + "RUST_LOG" : "toolbx-tuner=debug" + } + }, + "cleanup" : [ + "/include", + "/lib/pkgconfig", + "/man", + "/share/doc", + "/share/gtk-doc", + "/share/man", + "/share/pkgconfig", + "*.la", + "*.a" + ], + "modules" : [ + { + "name" : "toolbx-tuner", + "builddir" : true, + "buildsystem" : "meson", + "sources" : [ + { + "type" : "git", + "url" : "file:///var/home/hannes/Projects/toolbx-tuner" + } + ] + } + ] +} diff --git a/src/config.rs.in b/src/config.rs.in new file mode 100644 index 0000000..1a24858 --- /dev/null +++ b/src/config.rs.in @@ -0,0 +1,4 @@ +pub static VERSION: &str = @VERSION@; +pub static GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@; +pub static LOCALEDIR: &str = @LOCALEDIR@; +pub static PKGDATADIR: &str = @PKGDATADIR@; diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..7eb2a77 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,76 @@ +pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) +gnome = import('gnome') + +gnome.compile_resources('toolbx-tuner', + 'toolbx_tuner.gresource.xml', + gresource_bundle: true, + install: true, + install_dir: pkgdatadir, +) + +conf = configuration_data() +conf.set_quoted('VERSION', meson.project_version()) +conf.set_quoted('GETTEXT_PACKAGE', 'toolbx-tuner') +conf.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) +conf.set_quoted('PKGDATADIR', pkgdatadir) + +configure_file( + input: 'config.rs.in', + output: 'config.rs', + configuration: conf +) + +# Copy the config.rs output to the source directory. +run_command( + 'cp', + join_paths(meson.project_build_root(), 'src', 'config.rs'), + join_paths(meson.project_source_root(), 'src', 'config.rs'), + check: true +) + +rust_sources = files( + 'main.rs', + 'toolbx/mod.rs', + 'ui/mod.rs', + 'ui/ui_strings.rs', + 'ui/app/mod.rs', + 'ui/app/model.rs', + 'ui/app/widgets.rs', + 'ui/app/workers.rs', + 'ui/app/messages.rs', + 'ui/app/toolbox_list.rs', + 'ui/app/update.rs', + 'ui/components/mod.rs', + 'ui/components/toolbox_apps/factory.rs', + 'ui/components/toolbox_apps/messages.rs', + 'ui/components/toolbox_apps/mod.rs', + 'ui/components/toolbox_apps/model.rs', + 'ui/components/toolbox_apps/update.rs', + 'ui/components/toolbox_apps/widgets.rs', + 'ui/components/toolbox_settings/messages.rs', + 'ui/components/toolbox_settings/mod.rs', + 'ui/components/toolbox_settings/model.rs', + 'ui/components/toolbox_settings/update.rs', + 'ui/components/toolbox_settings/widgets.rs', +) + +sources = [cargo_sources, rust_sources] + +cargo_script = find_program(join_paths(meson.project_source_root(), 'build-aux/cargo.sh')) +cargo_release = custom_target( + 'cargo-build', + build_by_default: true, + input: sources, + output: meson.project_name(), + console: true, + install: true, + install_dir: get_option('bindir'), + command: [ + cargo_script, + meson.project_build_root(), + meson.project_source_root(), + '@OUTPUT@', + get_option('buildtype'), + meson.project_name(), + ] +) diff --git a/src/toolbx_tuner.gresource.xml b/src/toolbx_tuner.gresource.xml new file mode 100644 index 0000000..99e9cbe --- /dev/null +++ b/src/toolbx_tuner.gresource.xml @@ -0,0 +1,5 @@ + + + + +