From c0eafd05d46d573362768d94e12078243fd591a9 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval R Date: Fri, 18 Feb 2022 14:58:35 +0100 Subject: [PATCH 1/5] Use proper license --- data/com.belmoussaoui.Obfuscate.metainfo.xml.in.in | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/com.belmoussaoui.Obfuscate.metainfo.xml.in.in b/data/com.belmoussaoui.Obfuscate.metainfo.xml.in.in index e403444..6c0f506 100644 --- a/data/com.belmoussaoui.Obfuscate.metainfo.xml.in.in +++ b/data/com.belmoussaoui.Obfuscate.metainfo.xml.in.in @@ -3,7 +3,7 @@ @app-id@ CC0 - GPL-3.0+ + GPL-3.0-or-later Obfuscate Censor private information diff --git a/meson.build b/meson.build index 78bb7db..47f1b3d 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('obfuscate', 'rust', version: '0.0.4', - license: 'GPL3') + license: 'GPL-3.0-or-later') i18n = import('i18n') gnome = import('gnome') -- GitLab From f8fc18adb666e34d923db819c78a1c526814dc9f Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval R Date: Fri, 18 Feb 2022 14:59:32 +0100 Subject: [PATCH 2/5] meson: Update to 0.59 --- meson.build | 7 ++++--- src/meson.build | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 47f1b3d..7d1276e 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,7 @@ project('obfuscate', 'rust', version: '0.0.4', + meson_version: '>= 0.59', license: 'GPL-3.0-or-later') i18n = import('i18n') @@ -33,7 +34,7 @@ localedir = prefix / get_option('localedir') datadir = prefix / get_option('datadir') pkgdatadir = datadir / meson.project_name() iconsdir = datadir / 'icons' -podir = meson.source_root () / 'po' +podir = meson.project_source_root () / 'po' gettext_package = meson.project_name() @@ -57,8 +58,8 @@ subdir('src') meson.add_dist_script( 'build-aux/dist-vendor.sh', - meson.build_root() / 'meson-dist' / meson.project_name() + '-' + version, - meson.source_root() + meson.project_build_root() / 'meson-dist' / meson.project_name() + '-' + version, + meson.project_source_root() ) if get_option('profile') == 'development' diff --git a/src/meson.build b/src/meson.build index 5f2e844..697d666 100644 --- a/src/meson.build +++ b/src/meson.build @@ -13,8 +13,8 @@ config = configure_file( # Copy the config.rs output to the source directory. run_command( 'cp', - join_paths(meson.build_root(), 'src', 'config.rs'), - join_paths(meson.source_root(), 'src', 'config.rs'), + join_paths(meson.project_build_root(), 'src', 'config.rs'), + join_paths(meson.project_source_root(), 'src', 'config.rs'), check: true ) @@ -37,8 +37,8 @@ cargo_release = custom_target( install_dir: bindir, command: [ cargo_script, - meson.build_root(), - meson.source_root(), + meson.project_build_root(), + meson.project_source_root(), '@OUTPUT@', get_option('profile'), meson.project_name(), -- GitLab From 828eacfaa18f9835bd60f0264992268908c4e1fd Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval R Date: Fri, 18 Feb 2022 15:00:02 +0100 Subject: [PATCH 3/5] meson: Use gnome.post_install --- build-aux/meson_post_install.py | 14 -------------- meson.build | 8 +++++--- 2 files changed, 5 insertions(+), 17 deletions(-) delete mode 100755 build-aux/meson_post_install.py diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py deleted file mode 100755 index 9028aec..0000000 --- a/build-aux/meson_post_install.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -from os import environ, path -from subprocess import call - -if not environ.get('DESTDIR', ''): - PREFIX = environ.get('MESON_INSTALL_PREFIX', '/usr/local') - DATA_DIR = path.join(PREFIX, 'share') - print('Updating icon cache...') - call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')]) - print("Compiling new schemas...") - call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0/schemas')]) - print("Updating desktop database...") - call(["update-desktop-database", path.join(DATA_DIR, 'applications')]) diff --git a/meson.build b/meson.build index 7d1276e..9f70e22 100644 --- a/meson.build +++ b/meson.build @@ -68,6 +68,8 @@ if get_option('profile') == 'development' run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit') endif - -meson.add_install_script('build-aux/meson_post_install.py') - +gnome.post_install( + gtk_update_icon_cache: true, + glib_compile_schemas: true, + update_desktop_database: true, +) -- GitLab From 2a3383af40f527032baccf5f65f63851c58c9abd Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval R Date: Fri, 18 Feb 2022 15:02:04 +0100 Subject: [PATCH 4/5] meson: Drop custom cargo.sh --- build-aux/cargo.sh | 18 ------------------ meson.build | 3 +-- src/meson.build | 35 ++++++++++++++++++++--------------- 3 files changed, 21 insertions(+), 35 deletions(-) delete mode 100644 build-aux/cargo.sh diff --git a/build-aux/cargo.sh b/build-aux/cargo.sh deleted file mode 100644 index b4ecc2a..0000000 --- a/build-aux/cargo.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/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 - -if [[ $4 = "development" ]]; then - echo "DEBUG MODE" - cargo build --manifest-path \ - "$MESON_SOURCE_ROOT"/Cargo.toml && - cp "$CARGO_TARGET_DIR"/debug/$5 $3 -else - echo "RELEASE MODE" - cargo build --manifest-path \ - "$MESON_SOURCE_ROOT"/Cargo.toml --release && - cp "$CARGO_TARGET_DIR"/release/$5 $3 -fi diff --git a/meson.build b/meson.build index 9f70e22..4287fe2 100644 --- a/meson.build +++ b/meson.build @@ -13,13 +13,12 @@ dependency('gdk-pixbuf-2.0') dependency('gtk4', version: '>= 4.0.0') dependency('libadwaita-1', version: '>= 1.0.0') -find_program('cargo') +cargo = find_program('cargo') 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) -cargo_script = find_program('build-aux/cargo.sh') version = meson.project_version() version_array = version.split('.') diff --git a/src/meson.build b/src/meson.build index 697d666..3e374e3 100644 --- a/src/meson.build +++ b/src/meson.build @@ -18,30 +18,35 @@ run_command( check: true ) -sources = files( - 'widgets/drawing_area.rs', - 'widgets/mod.rs', - 'widgets/window.rs', - 'application.rs', - 'config.rs', - 'main.rs', -) +cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ] +cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ] + +if get_option('profile') == 'default' + cargo_options += [ '--release' ] + rust_target = 'release' + message('Building in release mode') +else + rust_target = 'debug' + message('Building in debug mode') +endif + +cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ] cargo_release = custom_target( 'cargo-build', build_by_default: true, - input: sources, + build_always_stale: true, output: meson.project_name(), console: true, install: true, install_dir: bindir, command: [ - cargo_script, - meson.project_build_root(), - meson.project_source_root(), - '@OUTPUT@', - get_option('profile'), - meson.project_name(), + 'env', + cargo_env, + cargo, 'build', + cargo_options, + '&&', + 'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@', ] ) -- GitLab From e62b9ab7662b23d1b79c7e1befcf1985655ce205 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval R Date: Fri, 18 Feb 2022 15:04:05 +0100 Subject: [PATCH 5/5] flatpak: Drop a11y hole --- build-aux/com.belmoussaoui.ObfuscateDevel.json | 1 - 1 file changed, 1 deletion(-) diff --git a/build-aux/com.belmoussaoui.ObfuscateDevel.json b/build-aux/com.belmoussaoui.ObfuscateDevel.json index 11b2853..3b1209b 100644 --- a/build-aux/com.belmoussaoui.ObfuscateDevel.json +++ b/build-aux/com.belmoussaoui.ObfuscateDevel.json @@ -15,7 +15,6 @@ "--socket=fallback-x11", "--socket=wayland", "--device=dri", - "--talk-name=org.a11y.Bus", "--env=RUST_LOG=obfuscate=debug", "--env=RUST_BACKTRACE=1", "--env=G_MESSAGES_DEBUG=none" -- GitLab