From 85c70bca5e6cd097c362ec9ddc25c262e1bda0a1 Mon Sep 17 00:00:00 2001 From: a-Sansara Date: Tue, 28 Aug 2018 23:59:35 +0200 Subject: [PATCH] update build --- .berel.yml | 6 +--- meson.build | 56 ++++++++++++----------------- src/Pluie/Berel.App.vala | 6 ++-- src/Pluie/Berel.HeaderDef.vala | 2 +- install.vala.in => src/install.vala | 0 main.vala => src/main.vala | 0 src/meson.build | 38 ++++++++++++++++++++ 7 files changed, 64 insertions(+), 44 deletions(-) rename install.vala.in => src/install.vala (100%) rename main.vala => src/main.vala (100%) create mode 100644 src/meson.build diff --git a/.berel.yml b/.berel.yml index 306b5ed..7f5ecd3 100644 --- a/.berel.yml +++ b/.berel.yml @@ -26,7 +26,7 @@ - meson : file : - meson.build - startline : 1 + - src/meson.build sepline : motif : "# " repeat : 40 @@ -39,10 +39,6 @@ - src extension : - .vala - file : - - install.vala.in - - main.vala - startline : 1 sepline : motif : " *" repeat : 40 diff --git a/meson.build b/meson.build index a20290e..cf12e64 100644 --- a/meson.build +++ b/meson.build @@ -27,47 +27,35 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^# -project('berel', 'vala', 'c', version:'0.21') +project('berel', ['vala', 'c'], version:'0.21') -cc = meson.get_compiler('c') -dep_glib = dependency('glib-2.0') -dep_gobject = dependency('gobject-2.0') -dep_gmodule = dependency('gmodule-2.0') -dep_gio = dependency('gio-2.0') -dep_gee = dependency('gee-0.8') -dep_echo = dependency('pluie-echo-0.2') -dep_yaml = dependency('pluie-yaml-0.5') -dep_m = cc.find_library('m', required : false) -# dep_yaml = cc.find_library('yaml', required : true) - -version = meson.project_version() -bindir = join_paths(get_option('prefix'), get_option('bindir')) -datadir = join_paths(get_option('prefix'), get_option('datadir'), 'pluie/berel') -libdir = join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig') -incdir = join_paths(get_option('prefix'), get_option('includedir'), 'pluie') - -conf = configuration_data() -conf.set('VERSION' , version) -conf.set('INSTALL_PATH', bindir) -conf.set('DATA_PATH' , datadir) +conf = configuration_data() +conf.set('VERSION' , meson.project_version()) +conf.set('INSTALL_PATH', join_paths(get_option('prefix'), get_option('bindir'))) +conf.set('DATA_PATH' , join_paths(get_option('prefix'), get_option('datadir'), 'pluie/berel')) configure_file( - input: 'install.vala.in', + input : 'src/install.vala', output: 'install.vala', configuration: conf ) -sources = [ - 'build/install.vala', - 'src/Pluie/Berel.App.vala', - 'src/Pluie/Berel.Comment.vala', - 'src/Pluie/Berel.HeaderDef.vala', - 'src/Pluie/Berel.Key.vala', - 'src/Pluie/Berel.Meta.vala', - 'src/Pluie/Berel.Sepline.vala', - 'main.vala', -] +subdir('src') -executable('berel', sources, install : true, dependencies : [dep_glib, dep_gobject, dep_gmodule, dep_gio, dep_gee, dep_echo, dep_yaml, dep_m]) +executable( + meson.project_name(), + src_files + [ 'build/install.vala' ], + install : true, + dependencies : [ + dependency('glib-2.0'), + dependency('gobject-2.0'), + dependency('gmodule-2.0'), + dependency('gio-2.0'), + dependency('gee-0.8'), + dependency('pluie-echo-0.2'), + dependency('pluie-yaml-0.5'), + meson.get_compiler('c').find_library('m', required : false) + ] +) diff --git a/src/Pluie/Berel.App.vala b/src/Pluie/Berel.App.vala index 99f4c3e..00e006d 100644 --- a/src/Pluie/Berel.App.vala +++ b/src/Pluie/Berel.App.vala @@ -98,7 +98,7 @@ public class Pluie.Berel.App foreach (var name in header.file) { path = Path.build_filename(this.pwd, name); data = this.get_write_content(path, header); - if (this.write_file (path, data)) { + if (data.length > 0 && this.write_file (path, data)) { if (header.yaml_name == "sh") { FileUtils.chmod (path, 0775); } @@ -115,7 +115,6 @@ public class Pluie.Berel.App */ private void write_dir (string path, HeaderDef header) { - of.echo (" > reading directory %s".printf (path)); string? dname = null; string? data = null; try { @@ -126,14 +125,13 @@ public class Pluie.Berel.App this.write_dir (p, header); else { data = this.get_write_content(p, header, true); - this.write_file (p, data); + if (data.length > 00) this.write_file (p, data); } } } catch(GLib.FileError e) { of.error (e.message); } - of.echo (" < directory %s".printf (path)); } /** diff --git a/src/Pluie/Berel.HeaderDef.vala b/src/Pluie/Berel.HeaderDef.vala index 25ed5dd..5b22d24 100644 --- a/src/Pluie/Berel.HeaderDef.vala +++ b/src/Pluie/Berel.HeaderDef.vala @@ -34,7 +34,7 @@ public class Pluie.Berel.HeaderDef : Yaml.Object { public Gee.ArrayList file { get; set; } public Gee.ArrayList dir { get; set; } - public int startline { get; set; } + public int startline { get; set; default = 1; } public Berel.Sepline sepline { get; set; } public Gee.ArrayList extension { get; set; } public Berel.Comment comment { get; set; } diff --git a/install.vala.in b/src/install.vala similarity index 100% rename from install.vala.in rename to src/install.vala diff --git a/main.vala b/src/main.vala similarity index 100% rename from main.vala rename to src/main.vala diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..5d5b5b0 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,38 @@ +#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# @software : berel +# @version : 0.21 +# @type : program +# @date : 2018 +# @license : GPLv3.0 +# @author : a-Sansara <[dev]at[pluie]dot[org]> +# @copyright : pluie.org +# +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# This file is part of berel. +# +# berel is free software (free as in speech) : you can redistribute it +# and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. +# +# berel is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License +# along with berel. If not, see . +# +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^# + +src_files = [ + 'src/Pluie/Berel.App.vala', + 'src/Pluie/Berel.Comment.vala', + 'src/Pluie/Berel.HeaderDef.vala', + 'src/Pluie/Berel.Key.vala', + 'src/Pluie/Berel.Meta.vala', + 'src/Pluie/Berel.Sepline.vala', + 'src/main.vala' +]