[devhelp] meson: generate pkg-config file



commit 493b52fee1257f3d4d4d6ae23155dce8cfd01a8c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Mar 11 18:14:33 2018 +0100

    meson: generate pkg-config file

 devhelp/meson.build    |   19 +++++++++++++++----
 meson.build            |   28 +++++++++++++++++++++++-----
 unit-tests/meson.build |    2 +-
 3 files changed, 39 insertions(+), 10 deletions(-)
---
diff --git a/devhelp/meson.build b/devhelp/meson.build
index ac4872c..1a92619 100644
--- a/devhelp/meson.build
+++ b/devhelp/meson.build
@@ -39,7 +39,8 @@ libdevhelp_private_c_files = [
         'dh-util-lib.c'
 ]
 
-install_headers_subdir = 'devhelp-@0@/devhelp'.format(DEVHELP_API_VERSION)
+install_headers_first_subdir = 'devhelp-@0@'.format(DEVHELP_API_VERSION)
+install_headers_subdir = join_paths(install_headers_first_subdir, 'devhelp')
 install_headers_fulldir = join_paths(
         get_option('prefix'),
         get_option('includedir'),
@@ -60,7 +61,7 @@ libdevhelp_static = static_library(
          libdevhelp_private_c_files,
          libdevhelp_enums],
         include_directories : [CONFIG_H_INCLUDE_DIR, ROOT_INCLUDE_DIR],
-        dependencies : DEVHELP_DEPS
+        dependencies : LIBDEVHELP_DEPS
 )
 
 # For unit tests, to be able to test private functions.
@@ -68,7 +69,7 @@ LIBDEVHELP_STATIC_DEP = declare_dependency(
         sources : libdevhelp_enum_header,
         link_with : libdevhelp_static,
         include_directories : [ROOT_INCLUDE_DIR],
-        dependencies : DEVHELP_DEPS
+        dependencies : LIBDEVHELP_DEPS
 )
 
 symbol_map = join_paths(meson.current_source_dir(), 'symbol.map')
@@ -81,7 +82,7 @@ if c_compiler.has_argument(ldflag)
         ldflags += '@0@,@1@'.format(ldflag, symbol_map)
 endif
 
-shared_library(
+libdevhelp = shared_library(
         'devhelp-@0@'.format(DEVHELP_API_VERSION),
         link_whole : libdevhelp_static,
         link_args : ldflags,
@@ -94,3 +95,13 @@ install_headers(
         libdevhelp_public_headers,
         subdir : install_headers_subdir
 )
+
+PKG_CONFIG.generate(
+        filebase : 'libdevhelp-@0@'.format(DEVHELP_API_VERSION_FULL),
+        name : meson.project_name(),
+        description : meson.project_name(),
+        version : meson.project_version(),
+        libraries : libdevhelp,
+        subdirs : install_headers_first_subdir,
+        requires : LIBDEVHELP_DEPS_STR
+)
diff --git a/meson.build b/meson.build
index 8fabee1..1e71a15 100644
--- a/meson.build
+++ b/meson.build
@@ -10,10 +10,15 @@ project(
 )
 
 GNOME = import('gnome')
+PKG_CONFIG = import('pkgconfig')
 
 # API version, used for parallel installability.
 DEVHELP_API_VERSION = '3'
 
+# It would be nice to get rid of this variant, to use only the short version
+# everywhere.
+DEVHELP_API_VERSION_FULL = '3.0'
+
 # Libtool version numbers, remember to change them just *before* a release.
 # A good time to update it is for the GNOME x.y.90 version, at API freeze,
 # so that packagers have the time to update the package.
@@ -25,13 +30,26 @@ lt_revision=0
 lt_age=0
 LIBDEVHELP_LT_VERSION='@0@.@1@.@2@'.format(lt_current, lt_revision, lt_age)
 
-DEVHELP_DEPS = [
-        dependency('gio-2.0', version : '>= 2.40'),
-        dependency('gtk+-3.0', version : '>= 3.22'),
-        dependency('webkit2gtk-4.0', version : '>= 2.19.2'),
-        dependency('gsettings-desktop-schemas')
+libdevhelp_deps_array = [
+        ['gio-2.0', '>= 2.40'],
+        ['gtk+-3.0', '>= 3.22'],
+        ['webkit2gtk-4.0', '>= 2.19.2']
 ]
 
+LIBDEVHELP_DEPS_STR = []
+LIBDEVHELP_DEPS = []
+foreach dep : libdevhelp_deps_array
+        dep_name = dep[0]
+        dep_version = dep[1]
+        LIBDEVHELP_DEPS_STR += '@0@ @1@'.format(dep_name, dep_version)
+        LIBDEVHELP_DEPS += dependency(dep_name, version : dep_version)
+endforeach
+
+#DEVHELP_APP_DEPS = [
+#        LIBDEVHELP_DEPS,
+#        dependency('gsettings-desktop-schemas')
+#]
+
 # config.h
 
 config_data = configuration_data()
diff --git a/unit-tests/meson.build b/unit-tests/meson.build
index 130e51e..20e24e2 100644
--- a/unit-tests/meson.build
+++ b/unit-tests/meson.build
@@ -10,7 +10,7 @@ foreach unit_test : unit_tests
                 unit_test,
                 unit_test + '.c',
                 include_directories : ROOT_INCLUDE_DIR,
-                dependencies : [DEVHELP_DEPS, LIBDEVHELP_STATIC_DEP]
+                dependencies : [LIBDEVHELP_DEPS, LIBDEVHELP_STATIC_DEP]
         )
 
         test(unit_test, exe)


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