update build system

This commit is contained in:
Chris Cromer 2019-01-05 00:28:18 -03:00
parent c37c341784
commit ed580cfe2a
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
34 changed files with 164 additions and 64 deletions

View File

@ -1,2 +1,9 @@
gnome = import('gnome')
gschemas = files(
'cl.cromer.ubb.sernatur.db.gschema.xml',
'cl.cromer.ubb.sernatur.window.gschema.xml')
gnome.compile_schemas(build_by_default: true,
depend_files: gschemas
)
install_data('cl.cromer.ubb.sernatur.db.gschema.xml', install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas')) install_data('cl.cromer.ubb.sernatur.db.gschema.xml', install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas'))
install_data('cl.cromer.ubb.sernatur.window.gschema.xml', install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas')) install_data('cl.cromer.ubb.sernatur.window.gschema.xml', install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas'))

View File

@ -1,5 +1,7 @@
gnome = import('gnome') gnome = import('gnome')
sernatur_gresource_c = gnome.compile_resources('sernatur-resources', gresource = gnome.compile_resources(meson.project_name() + '_gresource_main',
'sernatur.gresource.xml', 'sernatur.gresource.xml',
source_dir : '.', source_dir: '.',
c_name : 'sernatur') c_name: meson.project_name() + '_resource_main',
export: true,
install_header: true)

View File

@ -2,6 +2,7 @@ docs_enabled = get_option('valadocs')
valadoc = find_program('valadoc', required: docs_enabled) valadoc = find_program('valadoc', required: docs_enabled)
vala_doc_sources = vala_sources vala_doc_sources = vala_sources
vala_doc_sources += lib_sources vala_doc_sources += lib_sources
vala_doc_sources += config_data_file
if docs_enabled if docs_enabled
valadocs_deps = get_option('valadocs_deps') valadocs_deps = get_option('valadocs_deps')
docs_deps = ['--pkg=gtk+-3.0'] docs_deps = ['--pkg=gtk+-3.0']
@ -20,7 +21,7 @@ if docs_enabled
'--force', '--force',
'--package-name=@0@'.format(meson.project_name()), '--package-name=@0@'.format(meson.project_name()),
'--package-version=@0@'.format(meson.project_version()), '--package-version=@0@'.format(meson.project_version()),
'--vapidir=@0@'.format(join_paths(meson.source_root(), 'src/vapi')), '--vapidir=@0@'.format(join_paths(meson.source_root(), 'vapi')),
'--directory=@OUTDIR@/valadoc', '--directory=@OUTDIR@/valadoc',
vala_doc_sources, vala_doc_sources,
], ],

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace DB { namespace DB {
using Postgres; using Postgres;
using Wrapper; using Wrapper;

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
/** /**
* This is the database namespace for Sernatur * This is the database namespace for Sernatur
*/ */

View File

@ -26,19 +26,22 @@ lib_sources = files(
'db/turista.vala', 'db/turista.vala',
'db/vehiculo.vala') 'db/vehiculo.vala')
vala_args = ['--vapidir='+join_paths(meson.source_root(),'vapi')] vala_args = ['--vapidir=' + join_paths(meson.source_root(), 'vapi')]
sernatur_lib = library('sernatur', lib = library(meson.project_name(),
lib_sources, lib_sources,
vala_header: 'sernatur.h', vala_header: 'lib' + meson.project_name() + '.h',
vala_vapi: 'sernatur-1.0.0.vapi', vala_vapi: 'lib' + meson.project_name() + '.vapi',
# vala_gir: 'Sernatur-1.0.0.gir', # vala_gir: 'LibSernatur-1.0.0.gir',
vala_args: vala_args, vala_args: vala_args,
dependencies: [glib_dep, gobject_dep, pq_dep], dependencies: [glib_dep, gobject_dep, pq_dep],
version: '1.0.0', version: '1.0.0',
soversion: '1', soversion: '0',
install: true, install: true,
install_dir: [true, true, true]) install_dir: [true, true, true])
pkg_mod = import('pkgconfig') pkg_mod = import('pkgconfig')
pkg_mod.generate(sernatur_lib) pkg_mod.generate(lib)
lib_dep = declare_dependency(
link_with: lib)

View File

@ -1,4 +1,4 @@
namespace Sernatur { namespace LibSernatur {
namespace Person { namespace Person {
public errordomain InvalidRut { public errordomain InvalidRut {

View File

@ -9,12 +9,12 @@ project('sernatur',
'b_ndebug=if-release' 'b_ndebug=if-release'
] ]
) )
add_global_arguments('-DGETTEXT_PACKAGE="sernatur"', language: 'c') add_project_arguments('-DGETTEXT_PACKAGE="' + meson.project_name() + '"', language: 'c')
debugging = get_option('debugging') debugging = get_option('debugging')
if debugging if debugging
add_global_arguments('-DDEBUG', language : 'c') add_project_arguments('-DDEBUG', language : 'c')
add_global_arguments('-D', 'DEBUG', language : 'vala') add_project_arguments('-D', 'DEBUG', language : 'vala')
endif endif
add_project_arguments(['--vapidir', add_project_arguments(['--vapidir',

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sernatur\n" "Project-Id-Version: sernatur\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-03 20:50-0300\n" "POT-Creation-Date: 2019-01-05 00:27-0300\n"
"PO-Revision-Date: 2019-01-03 20:49-0300\n" "PO-Revision-Date: 2019-01-04 19:59-0300\n"
"Last-Translator: Chris Cromer <chris@cromer.cl>\n" "Last-Translator: Chris Cromer <chris@cromer.cl>\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: es\n" "Language: es\n"
@ -38,11 +38,27 @@ msgstr "El RUT %s es demasiado grande!"
msgid "The verifier %C is invalid!" msgid "The verifier %C is invalid!"
msgstr "El verificador %C es invalido!" msgstr "El verificador %C es invalido!"
#: src/sernatur-window.vala:128 #: src/sernatur.vala:96
#, c-format
msgid "Error: %s\n"
msgstr "Error %s\n"
#: src/sernatur.vala:97
#, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
"Correr '%s --help' para ver una lista completa de las opciones de la "
"consola.\n"
#: src/sernatur.vala:102
msgid "SERNATUR version: "
msgstr "Versión de SERNATUR:"
#: src/sernatur-window.vala:129
msgid "Error" msgid "Error"
msgstr "Error" msgstr "Error"
#: src/sernatur-window.vala:133 #: src/sernatur-window.vala:134
msgid "Postgresql server version:" msgid "Postgresql server version:"
msgstr "Versión del servidor Postgresql:" msgstr "Versión del servidor Postgresql:"

View File

@ -1,7 +1,12 @@
install_translations = get_option('install_translations') install_translations = get_option('install_translations')
i18n = import('i18n')
if install_translations if install_translations
i18n = import('i18n')
i18n.gettext(meson.project_name(), i18n.gettext(meson.project_name(),
args: '--directory=' + meson.source_root() args: '--directory=' + meson.source_root()
) )
else
i18n.gettext(meson.project_name(),
args: '--directory=' + meson.source_root(),
install: false
)
endif endif

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sernatur\n" "Project-Id-Version: sernatur\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-03 20:50-0300\n" "POT-Creation-Date: 2019-01-05 00:27-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -37,11 +37,25 @@ msgstr ""
msgid "The verifier %C is invalid!" msgid "The verifier %C is invalid!"
msgstr "" msgstr ""
#: src/sernatur-window.vala:128 #: src/sernatur.vala:96
#, c-format
msgid "Error: %s\n"
msgstr ""
#: src/sernatur.vala:97
#, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
#: src/sernatur.vala:102
msgid "SERNATUR version: "
msgstr ""
#: src/sernatur-window.vala:129
msgid "Error" msgid "Error"
msgstr "" msgstr ""
#: src/sernatur-window.vala:133 #: src/sernatur-window.vala:134
msgid "Postgresql server version:" msgid "Postgresql server version:"
msgstr "" msgstr ""

6
src/config.vala.in Normal file
View File

@ -0,0 +1,6 @@
namespace Sernatur {
namespace Constants {
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string VERSION = "@VERSION@";
}
}

View File

@ -5,23 +5,31 @@ gtk_dep = dependency('gtk+-3.0', version: '>=3.0.0')
gmodule_dep = dependency('gmodule-2.0', version: '>=2.0') gmodule_dep = dependency('gmodule-2.0', version: '>=2.0')
pq_dep = dependency('libpq', version: '>=9.0') pq_dep = dependency('libpq', version: '>=9.0')
config_data = configuration_data()
config_data.set('VERSION', meson.project_version())
config_data.set('GETTEXT_PACKAGE', meson.project_name())
config_data_file = configure_file(input: 'config.vala.in',
output: 'config.vala',
configuration: config_data)
vala_sources = files( vala_sources = files(
'sernatur.vala', 'sernatur.vala',
'sernatur-window.vala') 'sernatur-window.vala')
sources = vala_sources sources = vala_sources
c_sources = [sernatur_gresource_c] sources += gresource
sources += config_data_file
sources = vala_sources vala_args = ['--vapidir=' + join_paths(meson.source_root(), 'vapi')]
sources += c_sources vala_args += ['--gresources=' + join_paths(meson.source_root(), 'data/ui/sernatur.gresource.xml')]
vala_args = ['--vapidir='+join_paths(meson.source_root(),'vapi')] inc = include_directories('../lib', './')
vala_args += ['--gresources='+join_paths(meson.source_root(),'data/ui/sernatur.gresource.xml')]
sernatur_dep = declare_dependency(link_with: sernatur_lib, include_directories: include_directories('../lib')) exe = executable(meson.project_name(),
exe = executable('sernatur',
sources, sources,
vala_args: vala_args, vala_args: vala_args,
dependencies: [glib_dep, gobject_dep, gtk_dep, gmodule_dep, pq_dep, sernatur_dep], include_directories : inc,
gui_app: true,
dependencies: [glib_dep, gobject_dep, gtk_dep, gmodule_dep, pq_dep, lib_dep],
install: true) install: true)

View File

@ -16,14 +16,15 @@
* The main Sernatur namespace * The main Sernatur namespace
*/ */
namespace Sernatur { namespace Sernatur {
using DB; using LibSernatur.Person;
using LibSernatur.DB;
/** /**
* The MainWindow class * The MainWindow class
*/ */
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/sernatur.window.ui")] [GtkTemplate (ui = "/cl/cromer/ubb/sernatur/sernatur.window.ui")]
public class MainWindow : Gtk.ApplicationWindow { public class MainWindow : Gtk.ApplicationWindow {
Gtk.Grid content; private Gtk.Grid content;
[GtkChild] [GtkChild]
private Gtk.Box mainbox; private Gtk.Box mainbox;
@ -132,7 +133,7 @@ namespace Sernatur {
} }
print (dgettext (null, "Postgresql server version:") + " %d\n", conn.get_server_version ()); print (dgettext (null, "Postgresql server version:") + " %d\n", conn.get_server_version ());
/*var tour = Tour.get_all_tours (conn); var tour = Tour.get_all_tours (conn);
print (tour[0].ciudad.region.nombre_region + "\n"); print (tour[0].ciudad.region.nombre_region + "\n");
var tiene_enfermedad = TieneEnfermedad.get_all_tiene_enfermedades (conn); var tiene_enfermedad = TieneEnfermedad.get_all_tiene_enfermedades (conn);
print (tiene_enfermedad[0].turista.contacto_emergencia.nombre_emergencia + "\n"); print (tiene_enfermedad[0].turista.contacto_emergencia.nombre_emergencia + "\n");
@ -150,18 +151,18 @@ namespace Sernatur {
var requerir_auto = RequerirAuto.get_all_requerir_autos (conn); var requerir_auto = RequerirAuto.get_all_requerir_autos (conn);
print (requerir_auto[0].vehiculo.marca + "\n"); print (requerir_auto[0].vehiculo.marca + "\n");
try { try {
var rut = new Person.Rut ("23.660.457-8"); var rut = new Rut ("23.660.457-8");
print (rut.get_rut () + "\n"); print (rut.get_rut () + "\n");
if (rut.type () == Person.Rut.Type.RUN) { if (rut.type () == Rut.Type.RUN) {
print ("person\n"); print ("person\n");
} }
else { else {
print ("company\n"); print ("company\n");
} }
} }
catch (Person.InvalidRut e) { catch (InvalidRut e) {
print ("Rut is invalid"); print ("Rut is invalid");
}*/ }
} }
} }
} }

View File

@ -16,8 +16,23 @@
* The main Sernatur namespace * The main Sernatur namespace
*/ */
namespace Sernatur { namespace Sernatur {
using Constants;
using Gtk; using Gtk;
private static bool version = false;
private const GLib.OptionEntry[] options = {
// --version
{ "version", 'v', 0, OptionArg.NONE, ref version, "Display version number", null },
// list terminator
{ null }
};
public unowned string MyTranslateFunc (string str) {
return dgettext (null, str);
}
/** /**
* The application class * The application class
*/ */
@ -55,8 +70,6 @@ namespace Sernatur {
* Run when the application starts * Run when the application starts
*/ */
public override void startup () { public override void startup () {
Intl.textdomain ("sernatur");
Intl.setlocale (LocaleCategory.ALL, "");
base.startup (); base.startup ();
} }
} }
@ -67,7 +80,31 @@ namespace Sernatur {
* @return success of the application * @return success of the application
*/ */
public static int main (string[] args) { public static int main (string[] args) {
var application = new Application (); Intl.setlocale (LocaleCategory.ALL, "");
return application.run (args); Intl.bindtextdomain (GETTEXT_PACKAGE, "/usr/share/locale");
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
Intl.textdomain (GETTEXT_PACKAGE);
try {
var opt_context = new OptionContext ("");
opt_context.set_translation_domain (GETTEXT_PACKAGE);
opt_context.set_translate_func (MyTranslateFunc, null);
opt_context.set_help_enabled (true);
opt_context.add_main_entries (options, null);
opt_context.parse (ref args);
}
catch (OptionError e) {
print (dgettext (null, "Error: %s\n"), e.message);
print (dgettext (null, "Run '%s --help' to see a full list of available command line options.\n"), args[0]);
return 1;
}
if (version) {
print (dgettext (null, "SERNATUR version: ") + VERSION + "\n");
return 0;
}
else {
var application = new Application ();
return application.run (args);
}
} }
} }