add meson build system
This commit is contained in:
parent
93bd919f57
commit
5407e06683
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/build
|
||||
/yggtk
|
@ -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
|
||||
```
|
||||
|
25
main.vala
25
main.vala
@ -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
18
meson.build
Normal 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'),
|
||||
]
|
||||
)
|
Loading…
Reference in New Issue
Block a user