[libgepub] Updated meson build system port



commit 1e9d9afd691c6ea81a6531094b9f98457177deca
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Jun 13 12:43:31 2017 +0200

    Updated meson build system port
    
    A few changes have been made which are as follows:
    - The variable holding config.h data has been renamed to config_h.
    - libexecdir has been added which is used on the pkgconfig file.
    - test-gepub is not considered an unattended test anymore and the
      build file has been simplified.
    - meson required version has been raised to 0.41.0.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783735

 libgepub/meson.build |   68 +++++++++++++++++++++----------------------------
 meson.build          |   51 +++++++++++++++++++------------------
 tests/meson.build    |   29 +++++++--------------
 3 files changed, 65 insertions(+), 83 deletions(-)
---
diff --git a/libgepub/meson.build b/libgepub/meson.build
index 7b74292..d5e014e 100644
--- a/libgepub/meson.build
+++ b/libgepub/meson.build
@@ -1,27 +1,27 @@
-headers = [
-  'gepub-widget.h',
+headers = files(
   'gepub-archive.h',
-  'gepub-text-chunk.h',
   'gepub-doc.h',
+  'gepub-text-chunk.h',
+  'gepub-widget.h',
   'gepub.h'
-]
+)
 
 install_headers(
   headers,
   subdir: gepub_pkgincludedir
 )
 
-private_headers = [
+private_headers = files(
   'gepub-utils.h'
-]
+)
 
-sources = [
-  'gepub-widget.c',
+sources = files(
   'gepub-archive.c',
-  'gepub-text-chunk.c',
   'gepub-doc.c',
-  'gepub-utils.c'
-]
+  'gepub-text-chunk.c',
+  'gepub-utils.c',
+  'gepub-widget.c'
+)
 
 ldflags = [
   '-no-undefined',
@@ -38,36 +38,22 @@ if host_machine.system().contains('linux')
   endforeach
 endif
 
-libtype = get_option('default_library')
-
-if libtype == 'static'
-  libgepub = static_library(
-    'gepub',
-    sources: sources + headers + private_headers,
-    include_directories: top_inc,
-    dependencies: gepub_dep,
-    link_args: gepub_ldflags,
-    install: true,
-    install_dir: gepub_libdir
-  )
-else
-  libgepub = shared_library(
-    'gepub',
-    sources: sources + headers + private_headers,
-    version: libversion,
-    soversion: soversion,
-    include_directories: top_inc,
-    dependencies: gepub_dep,
-    link_args: gepub_ldflags,
-    install: true,
-    install_dir: gepub_libdir
-  )
-endif
+libgepub = library(
+  'gepub',
+  sources: sources,
+  version: libversion,
+  soversion: soversion,
+  include_directories: top_inc,
+  dependencies: gepub_deps,
+  link_args: gepub_ldflags,
+  install: true,
+  install_dir: gepub_libdir
+)
 
 libgepub_dep = declare_dependency(
   link_with: libgepub,
   include_directories: include_directories('.'),
-  dependencies: gepub_dep
+  dependencies: gepub_deps
 )
 
 pkg.generate(
@@ -81,10 +67,14 @@ pkg.generate(
   requires_private: [
     'libxml-2.0',
     'libarchive'
-  ]
+  ],
+  variables: [
+    'exec_prefix=' + gepub_libexecdir
+  ],
+  install_dir: join_paths(gepub_libdir, 'pkgconfig')
 )
 
-if get_option('enable-introspection') and libtype == 'shared'
+if get_option('enable-introspection') and get_option('default_library') == 'shared'
   gir_inc = [
     'GObject-2.0',
     'libxml2-2.0',
diff --git a/meson.build b/meson.build
index eff8b50..ec9e361 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project(
     'c_std=gnu99',
     'warning_level=1'
   ],
-  meson_version: '>= 0.38.1'
+  meson_version: '>= 0.41.0'
 )
 
 gepub_version = meson.project_version()
@@ -21,6 +21,7 @@ gepub_gir_version = '1.0'
 gepub_prefix = get_option('prefix')
 gepub_datadir = join_paths(gepub_prefix, get_option('datadir'))
 gepub_libdir = join_paths(gepub_prefix, get_option('libdir'))
+gepub_libexecdir = join_paths(gepub_prefix, get_option('libexecdir'))
 gepub_includedir = join_paths(gepub_prefix, get_option('includedir'))
 
 gepub_pkgincludedir = join_paths(gepub_includedir, meson.project_name())
@@ -32,30 +33,30 @@ libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
 
 cc = meson.get_compiler('c')
 
-conf = configuration_data()
+config_h = configuration_data()
 
 # package
-conf.set_quoted('PACKAGE', meson.project_name())
-conf.set_quoted('PACKAGE_BUGREPORT', 'danigm wadobo com')
-conf.set_quoted('PACKAGE_NAME', meson.project_name())
-conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), gepub_version))
-conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
-conf.set_quoted('PACKAGE_URL', '')
-conf.set_quoted('PACKAGE_VERSION', gepub_version)
-conf.set_quoted('PACKAGE_API_VERSION', gepub_version)
-conf.set_quoted('VERSION', gepub_version)
+config_h.set_quoted('PACKAGE', meson.project_name())
+config_h.set_quoted('PACKAGE_BUGREPORT', 'danigm wadobo com')
+config_h.set_quoted('PACKAGE_NAME', meson.project_name())
+config_h.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), gepub_version))
+config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
+config_h.set_quoted('PACKAGE_URL', '')
+config_h.set_quoted('PACKAGE_VERSION', gepub_version)
+config_h.set_quoted('PACKAGE_API_VERSION', gepub_version)
+config_h.set_quoted('VERSION', gepub_version)
 
 # headers
-conf.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h'))
-conf.set('HAVE_INTTYPES_H', cc.has_header('inttypes.h'))
-conf.set('HAVE_MEMORY_H', cc.has_header('memory.h'))
-conf.set('HAVE_STDINT_H', cc.has_header('stdint.h'))
-conf.set('HAVE_STDLIB_H', cc.has_header('stdlib.h'))
-conf.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
-conf.set('HAVE_STRING_H', cc.has_header('string.h'))
-conf.set('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h'))
-conf.set('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h'))
-conf.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
+config_h.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h'))
+config_h.set('HAVE_INTTYPES_H', cc.has_header('inttypes.h'))
+config_h.set('HAVE_MEMORY_H', cc.has_header('memory.h'))
+config_h.set('HAVE_STDINT_H', cc.has_header('stdint.h'))
+config_h.set('HAVE_STDLIB_H', cc.has_header('stdlib.h'))
+config_h.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
+config_h.set('HAVE_STRING_H', cc.has_header('string.h'))
+config_h.set('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h'))
+config_h.set('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h'))
+config_h.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
 
 # Compiler flags
 test_cflags = [
@@ -107,9 +108,9 @@ foreach cflag: test_cflags
   endif
 endforeach
 
-add_global_arguments(common_flags, language: 'c')
+add_project_arguments(common_flags, language: 'c')
 
-gepub_dep = [
+gepub_deps = [
   dependency('webkit2gtk-4.0'),
   dependency('libsoup-2.4'),
   dependency('glib-2.0'),
@@ -120,8 +121,8 @@ gepub_dep = [
 ]
 
 configure_file(
-  output : 'config.h',
-  configuration : conf
+  output: 'config.h',
+  configuration: config_h
 )
 
 gnome = import('gnome')
diff --git a/tests/meson.build b/tests/meson.build
index b6bdd14..b59322f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,20 +1,11 @@
-gepub_tests = [
-  'test-gepub'
-]
+test_gepub = 'test-gepub'
 
-gepub_test_dep = [
-  gepub_dep,
-  libgepub_dep,
-  dependency('gtk+-3.0')
-]
-
-foreach gepub_test: gepub_tests
-  exe = executable(
-    gepub_test,
-    '@0@.c'.format(gepub_test),
-    include_directories: top_inc,
-    dependencies: gepub_test_dep
-  )
-
-  test(gepub_test, exe)
-endforeach
+executable(
+  test_gepub,
+  test_gepub + '.c',
+  include_directories: top_inc,
+  dependencies: [
+    libgepub_dep,
+    dependency('gtk+-3.0')
+  ]
+)


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