[dia: 49/105] #19: Remove -lc link argument and instead use libc_dep.



commit ba6af0ff99f7d05e1bea36f5ae549d7483ede4b3
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Tue Jan 1 21:38:01 2019 +0000

    #19: Remove -lc link argument and instead use libc_dep.
    
      - This fixes build issue where 'fwrite' from wmf plugin was not defined.
      - Remove code duplication when defining objects.
      - Define ENABLE_NLS instead of setting it to '1'.

 lib/meson.build                  |  3 ++-
 meson.build                      |  8 +-------
 objects/AADL/meson.build         | 12 ++----------
 objects/Database/meson.build     | 12 ++----------
 objects/ER/meson.build           | 12 ++----------
 objects/FS/meson.build           | 12 ++----------
 objects/GRAFCET/meson.build      | 12 ++----------
 objects/Istar/meson.build        | 12 ++----------
 objects/Jackson/meson.build      | 12 ++----------
 objects/KAOS/meson.build         | 12 ++----------
 objects/Misc/meson.build         | 12 ++----------
 objects/SADT/meson.build         | 12 ++----------
 objects/Sozi/meson.build         | 15 ++++-----------
 objects/UML/meson.build          | 12 ++----------
 objects/chronogram/meson.build   | 12 ++----------
 objects/custom/meson.build       | 12 ++----------
 objects/custom_lines/meson.build | 12 ++----------
 objects/flowchart/meson.build    | 12 ++----------
 objects/meson.build              | 13 +++++++++++++
 objects/network/meson.build      | 12 ++----------
 objects/standard/meson.build     | 12 ++----------
 plug-ins/drs/meson.build         |  2 +-
 plug-ins/layout/meson.build      |  2 +-
 plug-ins/meson.build             |  2 +-
 plug-ins/python/meson.build      |  2 +-
 plug-ins/stress/meson.build      |  2 +-
 plug-ins/wmf/meson.build         |  2 +-
 27 files changed, 60 insertions(+), 195 deletions(-)
---
diff --git a/lib/meson.build b/lib/meson.build
index aea6a548..9d61b7c3 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -121,12 +121,13 @@ diamarshal_h = custom_target(
 subdir('pixmaps')
 
 libdia_deps = [
+    libc_dep,
     libgtk_dep,
     libglib_dep,
     libxml_dep,
     libm_dep,
     libzlib_dep,
-    gmodule_dep
+    gmodule_dep,
 ]
 
 libdia_inc = include_directories('.')
diff --git a/meson.build b/meson.build
index 631d2ca1..7dbacee8 100644
--- a/meson.build
+++ b/meson.build
@@ -6,9 +6,6 @@ project('dia',
         default_options : []
 )
 
-#TODO: use libc_dep defined below.
-add_global_link_arguments('-lc', language: 'c')
-
 cc = meson.get_compiler('c')
 conf = configuration_data()
 
@@ -35,8 +32,6 @@ conf.set('HAVE_LIBEMF', libemf_dep.found())
 libogdf_dep = cc.find_library('ogdf', required: false)
 conf.set('HAVE_OGDF', libogdf_dep.found())
 
-
-
 # Used in pixmap csource generation.
 gdk_pixbuf_csource = find_program('gdk-pixbuf-csource')
 
@@ -56,8 +51,7 @@ conf.set_quoted('DATADIR', datadir)
 conf.set_quoted('PKGDATADIR', pkgdatadir)
 conf.set_quoted('DIALIBDIR',  dialibdir)
 conf.set_quoted('LOCALEDIR', get_option('localedir'))
-conf.set('ENABLE_NLS', 1)
-
+conf.set('ENABLE_NLS', true)
 
 foreach h : ['stddef.h', 'fcntl.h', 'unistd.h', 'utime.h']
     conf.set10('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
diff --git a/objects/AADL/meson.build b/objects/AADL/meson.build
index d4e6c630..b3cdad5e 100644
--- a/objects/AADL/meson.build
+++ b/objects/AADL/meson.build
@@ -1,4 +1,4 @@
-object_sources = [
+sources = files(
     'aadl.c',
     'aadlbox.c',
     'aadldata.c',
@@ -15,14 +15,6 @@ object_sources = [
     'aadlthreadgroup.c',
     'aadlpackage.c',
     'edit_port_declaration.c',
-]
-
-library('aadl_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['aadl_objects', sources, []]]
diff --git a/objects/Database/meson.build b/objects/Database/meson.build
index c4472a8c..0c51df1d 100644
--- a/objects/Database/meson.build
+++ b/objects/Database/meson.build
@@ -1,16 +1,8 @@
-object_sources = [
+sources = files(
     'database.c',
     'table.c',
     'reference.c',
     'compound.c'
-]
-
-library('db_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['db_objects', sources, []]]
diff --git a/objects/ER/meson.build b/objects/ER/meson.build
index b32e2166..6e838467 100644
--- a/objects/ER/meson.build
+++ b/objects/ER/meson.build
@@ -1,17 +1,9 @@
-object_sources = [
+sources = files(
     'entity.c',
     'relationship.c',
     'attribute.c',
     'participation.c',
     'er.c'
-]
-
-library('er_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['er_objects', sources, []]]
diff --git a/objects/FS/meson.build b/objects/FS/meson.build
index f1781439..0243f01c 100644
--- a/objects/FS/meson.build
+++ b/objects/FS/meson.build
@@ -1,16 +1,8 @@
-object_sources = [
+sources = files(
     'fs.c',
     'flow.c',
     'flow-ortho.c',
     'function.c'
-]
-
-library('fs_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['fs_objects', sources, []]]
diff --git a/objects/GRAFCET/meson.build b/objects/GRAFCET/meson.build
index c031b724..cf7be49e 100644
--- a/objects/GRAFCET/meson.build
+++ b/objects/GRAFCET/meson.build
@@ -1,4 +1,4 @@
-object_sources = [
+sources = files(
     'grafcet.c',
     'step.c',
     'action.c',
@@ -8,14 +8,6 @@ object_sources = [
     'condition.c',
     'vergent.c',
     'vector.c'
-]
-
-library('grafcet_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['grafcet_objects', sources, []]]
diff --git a/objects/Istar/meson.build b/objects/Istar/meson.build
index 2309b9a3..3902c384 100644
--- a/objects/Istar/meson.build
+++ b/objects/Istar/meson.build
@@ -1,17 +1,9 @@
-object_sources = [
+sources = files(
     'istar.c',
     'actor.c',
     'goal.c',
     'other.c',
     'link.c'
-]
-
-library('istar_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['istar_objects', sources, []]]
diff --git a/objects/Jackson/meson.build b/objects/Jackson/meson.build
index 2c6346f8..7966e1d7 100644
--- a/objects/Jackson/meson.build
+++ b/objects/Jackson/meson.build
@@ -1,16 +1,8 @@
-object_sources = [
+sources = files(
     'jackson.c',
     'domain.c',
     'requirement.c',
     'phenomenon.c'
-]
-
-library('jackson_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['jackson_objects', sources, []]]
diff --git a/objects/KAOS/meson.build b/objects/KAOS/meson.build
index 70e277e3..b10de215 100644
--- a/objects/KAOS/meson.build
+++ b/objects/KAOS/meson.build
@@ -1,17 +1,9 @@
-object_sources = [
+sources = files(
     'kaos.c',
     'goal.c',
     'other.c',
     'metabinrel.c',
     'metaandorrel.c'
-]
-
-library('kaos_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['kaos_objects', sources, []]]
diff --git a/objects/Misc/meson.build b/objects/Misc/meson.build
index 463cc16d..0bd24c0d 100644
--- a/objects/Misc/meson.build
+++ b/objects/Misc/meson.build
@@ -1,4 +1,4 @@
-object_sources = [
+sources = files(
     'libmisc.c',
     'analog_clock.c',
     'diagram_as_object.c',
@@ -6,14 +6,6 @@ object_sources = [
     'measure.c',
     'n_gon.c',
     'tree.c'
-]
-
-library('misc_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['misc_objects', sources, []]]
diff --git a/objects/SADT/meson.build b/objects/SADT/meson.build
index 6683eaec..3c7dc5f3 100644
--- a/objects/SADT/meson.build
+++ b/objects/SADT/meson.build
@@ -1,16 +1,8 @@
-object_sources = [
+sources = files(
     'sadt.c',
     'arrow.c',
     'box.c',
     'annotation.c'
-]
-
-library('sadt_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['sadt_objects', sources, []]]
diff --git a/objects/Sozi/meson.build b/objects/Sozi/meson.build
index 6b212b1d..12968404 100644
--- a/objects/Sozi/meson.build
+++ b/objects/Sozi/meson.build
@@ -1,18 +1,11 @@
-# This depends on WITH_SOZI compilation option.
+# TODO: This depends on WITH_SOZI compilation option.
 if false
-    object_sources = [
+    sources = files(
         'sozi.c',
         'sozi-object.c',
         'sozi-frame.c',
         'sozi-media.c'
-    ]
-
-    library('sozi_objects',
-        object_sources,
-        dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-        link_with : libdia,
-        include_directories : [configuration_inc, libdia_inc],
-        install : true,
-        install_dir : dialibdir
     )
+
+    dia_object_desc += [['sozi_objects', sources, []]]
 endif
diff --git a/objects/UML/meson.build b/objects/UML/meson.build
index db7ff469..84ef28a8 100644
--- a/objects/UML/meson.build
+++ b/objects/UML/meson.build
@@ -1,4 +1,4 @@
-object_sources = [
+sources = files(
     'uml.c',
     'class.c',
     'class_dialog.c',
@@ -34,14 +34,6 @@ object_sources = [
     'umloperation.c',
     'umlparameter.c',
     'umlformalparameter.c'
-]
-
-library('uml_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['uml_objects', sources, []]]
diff --git a/objects/chronogram/meson.build b/objects/chronogram/meson.build
index 08530ee3..09abdda1 100644
--- a/objects/chronogram/meson.build
+++ b/objects/chronogram/meson.build
@@ -1,16 +1,8 @@
-object_sources = [
+sources = files(
     'chronogram.c',
     'chronoref.c',
     'chronoline.c',
     'chronoline_event.c'
-]
-
-library('chronogram_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['chronogram_objects', sources, []]]
diff --git a/objects/custom/meson.build b/objects/custom/meson.build
index 3fc69ad8..ab73c0f7 100644
--- a/objects/custom/meson.build
+++ b/objects/custom/meson.build
@@ -1,17 +1,9 @@
-object_sources = [
+sources = files(
     'shape_info.c',
     'shape_typeinfo.c',
     'custom_object.c',
     'custom_util.c',
     'custom.c'
-]
-
-library('custom_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['custom_objects', sources, []]]
diff --git a/objects/custom_lines/meson.build b/objects/custom_lines/meson.build
index 5e8110f8..875cd9c1 100644
--- a/objects/custom_lines/meson.build
+++ b/objects/custom_lines/meson.build
@@ -1,15 +1,7 @@
-object_sources = [
+sources = files(
     'custom_lines.c',
     'custom_linetypes.c',
     'line_info.c'
-]
-
-library('custom_lines_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['custom_lines_objects', sources, []]]
diff --git a/objects/flowchart/meson.build b/objects/flowchart/meson.build
index 424bd1e8..408369fe 100644
--- a/objects/flowchart/meson.build
+++ b/objects/flowchart/meson.build
@@ -1,17 +1,9 @@
-object_sources = [
+sources = files(
     'box.c',
     'parallelogram.c',
     'diamond.c',
     'ellipse.c',
     'flowchart.c'
-]
-
-library('flowchart_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['flowchart_objects', sources, []]]
diff --git a/objects/meson.build b/objects/meson.build
index 9566d777..485872c6 100644
--- a/objects/meson.build
+++ b/objects/meson.build
@@ -1,3 +1,5 @@
+dia_object_desc = []
+
 subdir('AADL')
 subdir('chronogram')
 subdir('custom')
@@ -16,3 +18,14 @@ subdir('SADT')
 subdir('Sozi')
 subdir('standard')
 subdir('UML')
+
+foreach o : dia_object_desc
+    library(o[0],
+        o[1],
+        dependencies : [libc_dep, libgtk_dep, libxml_dep, libm_dep] + o[2],
+        link_with : libdia,
+        include_directories : [configuration_inc, libdia_inc],
+        install : true,
+        install_dir : dialibdir
+    )
+endforeach
diff --git a/objects/network/meson.build b/objects/network/meson.build
index 4153ac85..5bfe48a4 100644
--- a/objects/network/meson.build
+++ b/objects/network/meson.build
@@ -1,17 +1,9 @@
-object_sources = [
+sources = files(
     'network.c',
     'bus.c',
     'radiocell.c',
     'basestation.c',
     'wanlink.c'
-]
-
-library('network_objects',
-    object_sources,
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['network_objects', sources, []]]
diff --git a/objects/standard/meson.build b/objects/standard/meson.build
index e7fc7282..39775d63 100644
--- a/objects/standard/meson.build
+++ b/objects/standard/meson.build
@@ -1,6 +1,6 @@
 subdir('pixmaps')
 
-object_sources = [
+sources = files(
     'arc.c',
     'box.c',
     'ellipse.c',
@@ -14,14 +14,6 @@ object_sources = [
     'outline.c',
     'polygon.c',
     'beziergon.c'
-]
-
-library('standard_objects',
-    object_sources + [tool_icons_h],
-    dependencies : [libgtk_dep, libglib_dep, libxml_dep, libm_dep],
-    link_with : libdia,
-    include_directories : [configuration_inc, libdia_inc],
-    install : true,
-    install_dir : dialibdir
 )
 
+dia_object_desc += [['standard_objects', sources + [tool_icons_h], []]]
diff --git a/plug-ins/drs/meson.build b/plug-ins/drs/meson.build
index 481e0010..5e8b7350 100644
--- a/plug-ins/drs/meson.build
+++ b/plug-ins/drs/meson.build
@@ -9,7 +9,7 @@ sources = files(
 shared_library(
     'drs_filter',
     sources,
-    dependencies: [libgtk_dep, libm_dep, libxml_dep],
+    dependencies: [libc_dep, libgtk_dep, libm_dep, libxml_dep],
     include_directories: [libdia_inc, configuration_inc],
     link_with: [libdia],
     install: false,
diff --git a/plug-ins/layout/meson.build b/plug-ins/layout/meson.build
index 2ea38d3b..81cec58a 100644
--- a/plug-ins/layout/meson.build
+++ b/plug-ins/layout/meson.build
@@ -3,7 +3,7 @@ sources = files(
     'layout.cpp',
 )
 
-deps = [libgtk_dep, libm_dep, libxml_dep]
+deps = [libc_dep, libgtk_dep, libm_dep, libxml_dep]
 
 #TODO: this needs to be tested.
 if libogdf_dep.found() == true
diff --git a/plug-ins/meson.build b/plug-ins/meson.build
index 654cd5cd..d2c8ee41 100644
--- a/plug-ins/meson.build
+++ b/plug-ins/meson.build
@@ -36,7 +36,7 @@ foreach p : install_plugins_desc
     library(
         p[0],
         p[1],
-        dependencies: [libgtk_dep, libm_dep, libxml_dep] + [p[2]],
+        dependencies: [libc_dep, libgtk_dep, libm_dep, libxml_dep] + [p[2]],
         include_directories: [libdia_inc, configuration_inc],
         link_with: [libdia],
         install: true,
diff --git a/plug-ins/python/meson.build b/plug-ins/python/meson.build
index 25b4477a..e2dc0fa3 100644
--- a/plug-ins/python/meson.build
+++ b/plug-ins/python/meson.build
@@ -48,7 +48,7 @@ if py_dep.found()
     shared_module(
         'python_plugin',
         sources,
-        dependencies: [libxml_dep, libgtk_dep, py_dep],
+        dependencies: [libc_dep, libxml_dep, libgtk_dep, py_dep],
         include_directories: [libdia_inc, configuration_inc, diaapp_inc],
         link_with: [libdia],
         install: true,
diff --git a/plug-ins/stress/meson.build b/plug-ins/stress/meson.build
index ec877164..cb700f02 100644
--- a/plug-ins/stress/meson.build
+++ b/plug-ins/stress/meson.build
@@ -11,7 +11,7 @@ if host_machine.system() != 'windows'
     library(
         'stress_filter',
         sources,
-        dependencies: [libgtk_dep, libm_dep],
+        dependencies: [libc_dep, libgtk_dep, libm_dep],
         include_directories: [libdia_inc, configuration_inc],
         link_with: [libdia],
         install: false,
diff --git a/plug-ins/wmf/meson.build b/plug-ins/wmf/meson.build
index 2f6e5d2d..fa0e1a0d 100644
--- a/plug-ins/wmf/meson.build
+++ b/plug-ins/wmf/meson.build
@@ -15,7 +15,7 @@ endif
 library(
     'wmf_filter',
     sources,
-    dependencies: [libgtk_dep, libm_dep, libxml_dep] + deps,
+    dependencies: [libc_dep, libgtk_dep, libm_dep, libxml_dep] + deps,
     include_directories: [libdia_inc, configuration_inc],
     link_with: [libdia],
     install: libemf_dep.found(),


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