add meson build system

This commit is contained in:
Nikolay Brovko 2020-01-24 12:16:34 +03:00
parent 93bd919f57
commit 5407e06683
No known key found for this signature in database
GPG Key ID: 32258A3DEC9B6F07
4 changed files with 44 additions and 10 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/build
/yggtk

View File

@ -5,9 +5,8 @@ Now support Arch and Debian based Linux (OpenRC and SystemD).
### Build and run
```
git clone https://git.macaw.me/plant_1312/Yggtk.git
valac Yggtk/main.vala --pkg gtk+-3.0 --pkg json-glib-1.0
cp Yggtk/main.ui .
rm -R Yggtk
./main
git clone https://git.macaw.me/plant_1312/Yggtk.git && cd Yggtk
meson build
ninja -C build
./build/yggtk
```

View File

@ -110,16 +110,31 @@ int download () {
}
string mktempdir () throws Error {
string temp_dir = null;
Process.spawn_command_line_sync("mktemp -d", out temp_dir);
return temp_dir.strip ();
}
int update () {
try {
Process.spawn_command_line_sync ("git clone https://git.macaw.me/plant_1312/Yggtk.git");
Process.spawn_command_line_sync ("valac Yggtk/main.vala --pkg gtk+-3.0 --pkg json-glib-1.0");
Process.spawn_command_line_sync ("cp Yggtk/main.ui .");
Process.spawn_command_line_sync ("rm -R Yggtk");
unowned string repo_url = Environment.get_variable ("YGG_UPDATE_REPO");
string temp_dir = mktempdir ();
string command = null;
if (repo_url == null) {
repo_url = "https://git.macaw.me/plant_1312/Yggtk.git";
}
Process.spawn_command_line_sync (@"git clone $repo_url $temp_dir");
Process.spawn_command_line_sync (@"meson $temp_dir/build $temp_dir");
Process.spawn_command_line_sync (@"ninja -C $temp_dir/build");
Process.spawn_command_line_sync (@"cp $temp_dir/build/yggtk .");
Process.spawn_command_line_sync (@"rm -rf $temp_dir");
Process.spawn_command_line_sync ("./yggtk");
Process.spawn_command_line_async ("./main");
Gtk.main_quit ();
} catch (Error e) {

18
meson.build Normal file
View File

@ -0,0 +1,18 @@
project(
'yggtk',
['vala', 'c'],
license: 'GPL3',
)
pkg = import('pkgconfig')
yggtk = executable(
meson.project_name(),
[
'main.vala',
],
dependencies: [
dependency('gtk+-3.0'),
dependency('json-glib-1.0'),
]
)