Add support for building with meson and add flatpak template
This commit is contained in:
parent
7a293458b9
commit
bfa01c8609
|
@ -1,2 +1,3 @@
|
|||
/target
|
||||
/.cargo
|
||||
/.cargo
|
||||
/_build
|
|
@ -62,6 +62,13 @@ sudo docker cp $(CONTAINER_ID):/root/lemoa/target/release/lemoa .
|
|||
|
||||
Once the build is done, there will be an executable `lemoa` binary file in your current directory, executing it starts Lemoa :tada:.
|
||||
|
||||
# Building with meson
|
||||
```
|
||||
meson _build
|
||||
ninja -C _build
|
||||
sudo ninja -C _build install
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
Lemoa is licensed under the [**GNU General Public License**](https://www.gnu.org/licenses/gpl.html): You can use, study and share it as you want.
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"id": "com.lemmy-gtk.lemoa",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "42",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"sdk-extensions": [
|
||||
"org.freedesktop.Sdk.Extension.rust-stable",
|
||||
"org.freedesktop.Sdk.Extension.llvm14"
|
||||
],
|
||||
"command": "lemoa",
|
||||
"finish-args": [
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--device=dri",
|
||||
"--env=RUST_LOG=gtk_rust_template=debug",
|
||||
"--env=G_MESSAGES_DEBUG=none",
|
||||
"--env=RUST_BACKTRACE=1"
|
||||
],
|
||||
"build-options": {
|
||||
"append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm14/bin",
|
||||
"build-args": [
|
||||
"--share=network"
|
||||
],
|
||||
"env": {
|
||||
"CARGO_REGISTRIES_CRATES_IO_PROTOCOL": "sparse",
|
||||
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER": "clang",
|
||||
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold",
|
||||
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER": "clang",
|
||||
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold"
|
||||
},
|
||||
"test-args": [
|
||||
"--socket=x11",
|
||||
"--share=network"
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "lemoa",
|
||||
"buildsystem": "meson",
|
||||
"run-tests": true,
|
||||
"config-opts": [
|
||||
"-Dprofile=development"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "../"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
export DIST="$1"
|
||||
export SOURCE_ROOT="$2"
|
||||
|
||||
cd "$SOURCE_ROOT"
|
||||
mkdir "$DIST"/.cargo
|
||||
cargo vendor | sed 's/^directory = ".*"/directory = "vendor"/g' > $DIST/.cargo/config
|
||||
# Move vendor into dist tarball directory
|
||||
mv vendor "$DIST"
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
project(
|
||||
'lemoa',
|
||||
'rust',
|
||||
version: '0.1.0',
|
||||
meson_version: '>= 0.59',
|
||||
license: 'GPL-3.0',
|
||||
)
|
||||
|
||||
gnome = import('gnome')
|
||||
|
||||
application_id = 'com.lemmy-gtk.lemoa'
|
||||
|
||||
dependency('glib-2.0', version: '>= 2.66')
|
||||
dependency('gio-2.0', version: '>= 2.66')
|
||||
dependency('gtk4', version: '>= 4.0.0')
|
||||
|
||||
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)
|
||||
cargo = find_program('cargo', required: true)
|
||||
|
||||
version = meson.project_version()
|
||||
|
||||
prefix = get_option('prefix')
|
||||
bindir = prefix / get_option('bindir')
|
||||
|
||||
datadir = prefix / get_option('datadir')
|
||||
pkgdatadir = datadir / meson.project_name()
|
||||
|
||||
meson.add_dist_script(
|
||||
'build-aux/dist-vendor.sh',
|
||||
meson.project_build_root() / 'meson-dist' / meson.project_name() + '-' + version,
|
||||
meson.project_source_root()
|
||||
)
|
||||
|
||||
subdir('src')
|
||||
|
||||
gnome.post_install(
|
||||
gtk_update_icon_cache: true,
|
||||
glib_compile_schemas: true,
|
||||
update_desktop_database: true,
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
pub const APP_ID: &str = "com.lemmy-gtk.lemoa";
|
||||
pub const GETTEXT_PACKAGE: &str = ;
|
||||
pub const LOCALEDIR: &str = ;
|
||||
pub const PKGDATADIR: &str = "/usr/local/share/lemoa";
|
||||
pub const PROFILE: &str = ;
|
||||
pub const RESOURCES_FILE: &str = concat!("/usr/local/share/lemoa", "/resources.gresource");
|
||||
pub const VERSION: &str = "0.1.0";
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
pub const APP_ID: &str = @APP_ID@;
|
||||
pub const GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@;
|
||||
pub const LOCALEDIR: &str = @LOCALEDIR@;
|
||||
pub const PKGDATADIR: &str = @PKGDATADIR@;
|
||||
pub const PROFILE: &str = @PROFILE@;
|
||||
pub const RESOURCES_FILE: &str = concat!(@PKGDATADIR@, "/resources.gresource");
|
||||
pub const VERSION: &str = @VERSION@;
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# Configuration file
|
||||
conf = configuration_data()
|
||||
conf.set_quoted('APP_ID', application_id)
|
||||
conf.set_quoted('PKGDATADIR', pkgdatadir)
|
||||
conf.set_quoted('VERSION', version)
|
||||
|
||||
configure_file(
|
||||
input: 'config.rs.in',
|
||||
output: 'config.rs',
|
||||
configuration: conf
|
||||
)
|
||||
|
||||
run_command(
|
||||
'cp',
|
||||
join_paths(meson.project_build_root(), 'src', 'config.rs'),
|
||||
join_paths(meson.project_source_root(), 'src', 'config.rs'),
|
||||
check: true
|
||||
)
|
||||
|
||||
# Setup cargo
|
||||
cargo = find_program('cargo')
|
||||
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
|
||||
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
|
||||
cargo_options += [ '--target-dir', meson.project_build_root() / 'target' ]
|
||||
cargo_options += [ '--release' ]
|
||||
|
||||
cargo_release = custom_target(
|
||||
'cargo-build',
|
||||
build_by_default: true,
|
||||
build_always_stale: true,
|
||||
output: meson.project_name(),
|
||||
console: true,
|
||||
install: true,
|
||||
install_dir: bindir,
|
||||
command: [
|
||||
'env',
|
||||
cargo_env,
|
||||
cargo, 'build',
|
||||
cargo_options,
|
||||
'&&',
|
||||
'cp', 'target' / 'release' / meson.project_name(), '@OUTPUT@',
|
||||
]
|
||||
)
|
||||
|
Loading…
Reference in New Issue