[gnome-calculator/60-split-out-a-backend-library: 2/39] gcalc: create a new directory



commit 869884340efdc20173d48e1e2e0a92bf138afeed
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 5 14:48:28 2018 -0600

    gcalc: create a new directory
    
    gcalc needs to port clean (no gtk dependant) classes

 {lib => gcalc}/gcalc-result.vala      |  0
 {lib => gcalc}/gcalc-solver.vala      |  0
 {lib => gcalc}/gcalc.deps.in          |  0
 {lib => gcalc}/gcalc.pc.in            |  0
 gcalc/meson.build                     | 94 ++++++++++++++++++++++++++++++++++
 {lib => gcalc}/namespace-info.vala.in |  0
 lib/meson.build                       | 95 -----------------------------------
 meson.build                           | 11 ++--
 meson_options.txt                     |  1 +
 9 files changed, 102 insertions(+), 99 deletions(-)
---
diff --git a/lib/gcalc-result.vala b/gcalc/gcalc-result.vala
similarity index 100%
rename from lib/gcalc-result.vala
rename to gcalc/gcalc-result.vala
diff --git a/lib/gcalc-solver.vala b/gcalc/gcalc-solver.vala
similarity index 100%
rename from lib/gcalc-solver.vala
rename to gcalc/gcalc-solver.vala
diff --git a/lib/gcalc.deps.in b/gcalc/gcalc.deps.in
similarity index 100%
rename from lib/gcalc.deps.in
rename to gcalc/gcalc.deps.in
diff --git a/lib/gcalc.pc.in b/gcalc/gcalc.pc.in
similarity index 100%
rename from lib/gcalc.pc.in
rename to gcalc/gcalc.pc.in
diff --git a/gcalc/meson.build b/gcalc/meson.build
new file mode 100644
index 00000000..02708877
--- /dev/null
+++ b/gcalc/meson.build
@@ -0,0 +1,94 @@
+PROJECT_NAME='gcalc'
+API_VERSION='1'
+VERSIONED_PROJECT_NAME=PROJECT_NAME+'-'+API_VERSION
+CAMEL_CASE_NAME='GCalc'
+VERSIONED_CAMEL_CASE_NAME=CAMEL_CASE_NAME+'-'+API_VERSION
+vapidir = join_paths (get_option('datadir'),'vala','vapi')
+GIR_NAME= VERSIONED_CAMEL_CASE_NAME+'.gir'
+TYPELIB_NAME= VERSIONED_CAMEL_CASE_NAME+'.typelib'
+VAPI_NAME = VERSIONED_PROJECT_NAME+'.vapi'
+
+conf = configuration_data()
+conf.set('prefix', get_option('prefix'))
+conf.set('libdir', '${exec_prefix}/'+get_option ('libdir'))
+conf.set('PROJECT_NAME', PROJECT_NAME)
+conf.set('PROJECT_VERSION', meson.project_version ())
+conf.set('API_VERSION', API_VERSION)
+
+configure_file(input : 'gcalc.pc.in',
+       output : 'gcalc-@0@.pc'.format(API_VERSION),
+       configuration : conf,
+       install : true,
+       install_dir : join_paths(get_option('libdir'), 'pkgconfig'))
+
+configure_file(input : 'gcalc.deps.in',
+       output : 'gcalc-@0@.deps'.format(API_VERSION),
+       configuration : conf,
+       install : true,
+       install_dir : vapidir)
+
+nsinfo = configure_file(input : 'namespace-info.vala.in',
+       output : 'namespace-info.vala',
+       configuration : conf)
+namespaceinfo_dep = declare_dependency (sources : nsinfo)
+
+confh = configuration_data ()
+confh.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
+confh.set_quoted('GETTEXT_PACKAGE', 'GCalc')
+configure_file(output : 'config.h',
+       configuration : confh)
+
+sources = files([
+       'gcalc-solver.vala',
+       'gcalc-result.vala'
+  ])
+
+inc_libh = include_directories ('.')
+inc_libh_dep = declare_dependency (include_directories : inc_libh)
+
+# LT_VERSION for ABI related changes
+# From: https://autotools.io/libtool/version.html
+# This rules applies to Meson 0.43
+# Increase the current value whenever an interface has been added, removed or changed.
+# Always increase revision value whenever an interface has been added, removed or changed.
+# Increase the age value only if the changes made to the ABI are backward compatible.
+# Set version to the value of subtract age from current
+# Reset current and version to 1 and, age and version to 0 if library's name is changed
+LT_CURRENT='0'
+LT_REVISION='0'
+LT_AGE='0'
+LT_VERSION='0'
+lib = library(VERSIONED_PROJECT_NAME,
+       sources,
+       version : LT_VERSION,
+       soversion : LT_VERSION+'.'+LT_AGE+'.'+LT_REVISION,
+       vala_header : PROJECT_NAME+'.h',
+       vala_vapi : VAPI_NAME,
+       vala_gir : GIR_NAME,
+       dependencies : [ gio, namespaceinfo_dep, inc_libh_dep, inc_rooth_dep ],
+       c_args : [
+               '-include',
+               meson.current_build_dir() + '/config.h'
+       ],
+       install : true,
+       install_dir : [
+               true,
+               join_paths (get_option('includedir'), 'gcalc-@0@'.format (API_VERSION), 'gcalc'),
+               vapidir,
+               true
+       ])
+
+g_ir_compiler = find_program('g-ir-compiler', required: false)
+if g_ir_compiler.found()
+custom_target('typelib',
+       command: [
+               g_ir_compiler,
+               '--shared-library', 'lib'+PROJECT_NAME+'-@0@.so'.format (API_VERSION),
+               '--output', '@OUTPUT@',
+               join_paths(meson.current_build_dir(), GIR_NAME)
+       ],
+       output: TYPELIB_NAME,
+       depends: lib,
+       install: true,
+       install_dir: join_paths(get_option('libdir'), 'girepository-1.0'))
+endif
\ No newline at end of file
diff --git a/lib/namespace-info.vala.in b/gcalc/namespace-info.vala.in
similarity index 100%
rename from lib/namespace-info.vala.in
rename to gcalc/namespace-info.vala.in
diff --git a/lib/meson.build b/lib/meson.build
index 2516b631..bc1b9792 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -42,98 +42,3 @@ libcalculator = static_library('calculator', libcalculator_sources,
   include_directories: config_h_dir,
   install: false,
 )
-
-# Public Library gcalc
-
-PROJECT_NAME='gcalc'
-API_VERSION='1'
-VERSIONED_PROJECT_NAME=PROJECT_NAME+'-'+API_VERSION
-CAMEL_CASE_NAME='GClac'
-VERSIONED_CAMEL_CASE_NAME=CAMEL_CASE_NAME+'-'+API_VERSION
-vapidir = join_paths (get_option('datadir'),'vala','vapi')
-GIR_NAME= VERSIONED_CAMEL_CASE_NAME+'.gir'
-TYPELIB_NAME= VERSIONED_CAMEL_CASE_NAME+'.typelib'
-VAPI_NAME = VERSIONED_PROJECT_NAME+'.vapi'
-
-conf = configuration_data()
-conf.set('prefix', get_option('prefix'))
-conf.set('libdir', '${exec_prefix}/'+get_option ('libdir'))
-conf.set('PROJECT_NAME', PROJECT_NAME)
-conf.set('PROJECT_VERSION', meson.project_version ())
-conf.set('API_VERSION', API_VERSION)
-
-configure_file(input : 'gcalc.pc.in',
-       output : 'gcalc-@0@.pc'.format(API_VERSION),
-       configuration : conf,
-       install : true,
-       install_dir : join_paths(get_option('libdir'), 'pkgconfig'))
-
-configure_file(input : 'gcalc.deps.in',
-       output : 'gcalc-@0@.deps'.format(API_VERSION),
-       configuration : conf,
-       install : true,
-       install_dir : vapidir)
-
-nsinfo = configure_file(input : 'namespace-info.vala.in',
-       output : 'namespace-info.vala',
-       configuration : conf)
-namespaceinfo_dep = declare_dependency (sources : nsinfo)
-
-confh = configuration_data ()
-confh.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
-confh.set_quoted('GETTEXT_PACKAGE', 'GCalc')
-configure_file(output : 'config.h',
-       configuration : confh)
-
-sources = files([
-  ])
-
-inc_libh = include_directories ('.')
-inc_libh_dep = declare_dependency (include_directories : inc_libh)
-
-# LT_VERSION for ABI related changes
-# From: https://autotools.io/libtool/version.html
-# This rules applies to Meson 0.43
-# Increase the current value whenever an interface has been added, removed or changed.
-# Always increase revision value whenever an interface has been added, removed or changed.
-# Increase the age value only if the changes made to the ABI are backward compatible.
-# Set version to the value of subtract age from current
-# Reset current and version to 1 and, age and version to 0 if library's name is changed
-LT_CURRENT='0'
-LT_REVISION='0'
-LT_AGE='0'
-LT_VERSION='0'
-lib = library(VERSIONED_PROJECT_NAME,
-       sources,
-       version : LT_VERSION,
-       soversion : LT_VERSION+'.'+LT_AGE+'.'+LT_REVISION,
-       vala_header : PROJECT_NAME+'.h',
-       vala_vapi : VAPI_NAME,
-       vala_gir : GIR_NAME,
-       dependencies : [ gio, namespaceinfo_dep, inc_libh_dep, inc_rooth_dep ],
-       c_args : [
-               '-include',
-               meson.current_build_dir() + '/config.h'
-       ],
-       install : true,
-       install_dir : [
-               true,
-               join_paths (get_option('includedir'), 'gcalc-@0@'.format (API_VERSION), 'gcalc'),
-               vapidir,
-               true
-       ])
-
-g_ir_compiler = find_program('g-ir-compiler', required: false)
-if g_ir_compiler.found()
-custom_target('typelib',
-       command: [
-               g_ir_compiler,
-               '--shared-library', 'lib'+PROJECT_NAME+'-@0@.so'.format (API_VERSION),
-               '--output', '@OUTPUT@',
-               join_paths(meson.current_build_dir(), GIR_NAME)
-       ],
-       output: TYPELIB_NAME,
-       depends: lib,
-       install: true,
-       install_dir: join_paths(get_option('libdir'), 'girepository-1.0'))
-endif
diff --git a/meson.build b/meson.build
index c28a2f06..ca1559df 100644
--- a/meson.build
+++ b/meson.build
@@ -28,10 +28,6 @@ gio = dependency('gio-2.0', version: '>= ' + glib_min_version)
 glib = dependency('glib-2.0', version: '>= ' + glib_min_version)
 gmodule_export = dependency('gmodule-export-2.0')
 gobject = dependency('gobject-2.0', version: '>= ' + glib_min_version)
-gtk = dependency('gtk+-3.0', version: '>= 3.19.3')
-gtksourceview = dependency('gtksourceview-4', version: '>= 4.0.2')
-libsoup = dependency('libsoup-2.4', version: '>= 2.42')
-libxml = dependency('libxml-2.0')
 
 # Libraries
 cc = meson.get_compiler('c')
@@ -66,6 +62,12 @@ config_h_dir = include_directories('.')
 meson.add_install_script('meson_post_install.py')
 
 # Subdirs
+subdir('gcalc')
+if not get_option ('disable-ui')
+gtk = dependency('gtk+-3.0', version: '>= 3.19.3')
+libsoup = dependency('libsoup-2.4', version: '>= 2.42')
+libxml = dependency('libxml-2.0')
+gtksourceview = dependency('gtksourceview-4', version: '>= 4.0.2')
 subdir('data')
 subdir('lib')
 subdir('src')
@@ -73,3 +75,4 @@ subdir('search-provider')
 subdir('tests')
 subdir('help')
 subdir('po')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..579bba62
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('disable-ui', type : 'boolean', value : false, description : 'Disable GTK+ program')
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]