meson: Remove custom build scripts

This commit is contained in:
Tom A. Wagner
2022-01-28 13:01:35 +01:00
parent 872ef7890d
commit 96c61e43d2
4 changed files with 29 additions and 64 deletions

View File

@@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
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

View File

@@ -1,12 +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(['gtk4-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')])
print("Updating desktop database...")
call(["update-desktop-database", path.join(DATA_DIR, 'applications')])

View File

@@ -3,9 +3,11 @@ project(
'rust',
version: '0.3.2',
license: 'GPL-3.0',
meson_version: '>=0.50.0'
meson_version: '>=0.59.0'
)
gnome = import('gnome')
base_id = 'org.pipewire.Helvum'
dependency('glib-2.0', version: '>= 2.66')
@@ -15,7 +17,6 @@ dependency('libpipewire-0.3')
desktop_file_validate = find_program('desktop-file-validate', required: false)
appstream_util = find_program('appstream-util', required: false)
cargo = find_program('cargo', required: true)
cargo_script = find_program('build-aux/cargo.sh')
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
@@ -24,16 +25,14 @@ iconsdir = datadir / 'icons'
meson.add_dist_script(
'build-aux/dist-vendor.sh',
meson.build_root() / 'meson-dist' / meson.project_name() + '-' + meson.project_version(),
meson.source_root()
)
cargo_sources = files(
'Cargo.toml',
'Cargo.lock',
meson.project_build_root() / 'meson-dist' / meson.project_name() + '-' + meson.project_version(),
meson.project_source_root()
)
subdir('src')
subdir('data')
meson.add_install_script('build-aux/meson_post_install.py')
gnome.post_install(
gtk_update_icon_cache: true,
update_desktop_database: true,
)

View File

@@ -1,32 +1,31 @@
rust_sources = files(
'application.rs',
'main.rs',
'pipewire_connection.rs',
'pipewire_connection/state.rs',
'style.css',
'view/graph_view.rs',
'view/mod.rs',
'view/node.rs',
'view/port.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' ]
custom_target(
'cargo-build',
build_by_default: true,
input: [
cargo_sources,
rust_sources
],
build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: bindir,
command: [
cargo_script,
meson.build_root(),
meson.source_root(),
'@OUTPUT@',
get_option('profile'),
meson.project_name(),
'env',
cargo_env,
cargo, 'build',
cargo_options,
'&&',
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT',
],
)