[dia: 18/105] #19: ABI change: dia_get_lib_directory: remove subdir argument.



commit 098d00e396e5013dd83c0e96e098658eac9ae7ae
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Thu Dec 20 00:41:23 2018 +0000

    #19: ABI change: dia_get_lib_directory: remove subdir argument.
    
      - The subdir argument was not really used.
      - Previously get_lib_directory was called with either "dia"
        or "locale" as subdir:
          - the subdir=="locale" call was removed by rewriting
            dia_get_locale_directory.
          - next, the subdir argument was removed and instead of
            appending "dia" to LIBDIR, we just use DIALIBDIR.
      - Define DIALIBDIR as simply $(libdir)/dia,
        without having to define LIBDIR as well.

 app/app_procs.c |  2 +-
 app/meson.build |  2 +-
 lib/Makefile.am |  2 +-
 lib/dia_dirs.c  | 26 +++++++++++---------------
 lib/dia_dirs.h  |  2 +-
 lib/meson.build |  4 ++--
 lib/plug-ins.c  |  2 +-
 meson.build     |  6 +++++-
 8 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index dfd84e9c..aab2a590 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -836,7 +836,7 @@ app_init (int argc, char **argv)
     message_error(_("Couldn't find standard objects when looking for "
                  "object-libs; exiting...\n"));
     g_critical( _("Couldn't find standard objects when looking for "
-           "object-libs in '%s'; exiting...\n"), dia_get_lib_directory("dia"));
+           "object-libs in '%s'; exiting...\n"), dia_get_lib_directory());
     exit(1);
   }
 
diff --git a/app/meson.build b/app/meson.build
index cccc67e6..c053ab0e 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -70,5 +70,5 @@ dia = executable('dia',
     include_directories : [configuration_inc, libdia_inc],
     gui_app : true,
     install : true,
-    install_rpath : join_paths(get_option('prefix'), get_option('libdir'))
+    install_rpath : dialibdir
 )
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ecab9b8c..a01f7fb7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -235,7 +235,7 @@ libdia_la_LIBADD = $(GTK_LIBS)
 AM_CPPFLAGS = \
        $(LIBART_CFLAGS) \
        -DLIBDIA_COMPILATION \
-       -DLIBDIR=\"$(libdir)\" \
+       -DDIALIBDIR=\"$(libdir)/dia\" \
        -DPKGDATADIR=\"$(pkgdatadir)\" \
        -DLOCALEDIR=\"$(localedir)\" \
        -DPREFIX=\"$(prefix)\"
diff --git a/lib/dia_dirs.c b/lib/dia_dirs.c
index c721f497..fdddc286 100644
--- a/lib/dia_dirs.c
+++ b/lib/dia_dirs.c
@@ -117,24 +117,20 @@ dia_get_data_directory(const gchar* subdir)
  *          freed after use.
  */
 gchar*
-dia_get_lib_directory(const gchar* subdir)
+dia_get_lib_directory(void)
 {
 #ifdef G_OS_WIN32
   gchar *sLoc = _dia_get_module_directory ();
   gchar *returnPath = NULL;
-#  if defined(PREFIX) && defined(LIBDIR)
-  {
-    gchar *tmpPath = replace_prefix(sLoc, LIBDIR);
-    returnPath = g_build_path(G_DIR_SEPARATOR_S, tmpPath, subdir, NULL);
-    g_free(tmpPath);
-  }
+#  if defined(PREFIX) && defined(DIALIBDIR)
+    returnPath = replace_prefix(sLoc, DIALIBDIR);
 #  else
-  returnPath = g_strconcat (sLoc , subdir, NULL);
+  returnPath = g_strconcat (sLoc , "dia", NULL);
 #  endif
   g_free (sLoc);
   return returnPath;
 #else
-  return g_strconcat (LIBDIR, G_DIR_SEPARATOR_S, subdir, NULL);
+  return g_strconcat (DIALIBDIR, G_DIR_SEPARATOR_S, "", NULL);
 #endif
 }
 
@@ -142,15 +138,15 @@ gchar*
 dia_get_locale_directory(void)
 {
 #ifdef G_OS_WIN32
-#  if defined(PREFIX) && defined(LOCALEDIR)
-  gchar *ret;
   gchar *sLoc = _dia_get_module_directory ();
-  ret = replace_prefix(sLoc, LOCALEDIR);
-  g_free (sLoc);
-  return  ret;
+  gchar *returnPath = NULL;
+#  if defined(PREFIX) && defined(LOCALEDIR)
+    returnPath = replace_prefix(sLoc, LOCALEDIR);
 #  else
-  return dia_get_lib_directory ("locale");
+  returnPath = g_strconcat (sLoc, "locale", NULL);
 #  endif
+  g_free (sLoc);
+  return returnPath;
 #else
   return g_strconcat (LOCALEDIR, G_DIR_SEPARATOR_S, "", NULL);
 #endif
diff --git a/lib/dia_dirs.h b/lib/dia_dirs.h
index de911e54..80d67879 100644
--- a/lib/dia_dirs.h
+++ b/lib/dia_dirs.h
@@ -22,7 +22,7 @@
 #include <glib.h>
 
 gchar *dia_get_data_directory (const gchar* subdir);
-gchar *dia_get_lib_directory  (const gchar* subdir);
+gchar *dia_get_lib_directory  (void);
 gchar *dia_get_locale_directory (void);
 gchar *dia_config_filename    (const gchar* file);
 gboolean dia_config_ensure_dir  (const gchar* filename);
diff --git a/lib/meson.build b/lib/meson.build
index c0b459fe..aea6a548 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -131,11 +131,11 @@ libdia_deps = [
 
 libdia_inc = include_directories('.')
 
-libdia = shared_library('dia',
+libdia = library('dia',
     libdia_sources + [diamarshal_c, diamarshal_h, dia_lib_icons_h],
     dependencies : libdia_deps,
     include_directories : configuration_inc,
     c_args : ['-Wall'],
     install : true,
-    install_rpath : get_option('prefix')
+    install_dir   : dialibdir
 )
diff --git a/lib/plug-ins.c b/lib/plug-ins.c
index 250ef472..744d8554 100644
--- a/lib/plug-ins.c
+++ b/lib/plug-ins.c
@@ -390,7 +390,7 @@ dia_register_plugins(void)
     }
     g_strfreev(paths);
   } else {
-    library_path = dia_get_lib_directory("dia");
+    library_path = dia_get_lib_directory();
 
     dia_register_plugins_in_dir(library_path);
     g_free((char *)library_path);
diff --git a/meson.build b/meson.build
index e561d350..31f5e03f 100644
--- a/meson.build
+++ b/meson.build
@@ -39,11 +39,15 @@ datadir = join_paths(get_option('prefix'),
 
 pkgdatadir = join_paths(datadir, 'dia')
 
+dialibdir = join_paths(get_option('prefix'),
+                       get_option('libdir'),
+                       'dia')
+
 conf.set_quoted('VERSION', meson.project_version())
 conf.set_quoted('GETTEXT_PACKAGE', 'dia')
 conf.set_quoted('DATADIR', datadir)
 conf.set_quoted('PKGDATADIR', pkgdatadir)
-conf.set_quoted('LIBDIR',  join_paths(get_option('prefix'), get_option('libdir')))
+conf.set_quoted('DIALIBDIR',  dialibdir)
 conf.set_quoted('LOCALEDIR', get_option('localedir'))
 conf.set('ENABLE_NLS', 1)
 


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