[libgnome-volume-control/wip/inigomartinez/meson: 5/8] build: Use meson's library function



commit 9c56c9b3da3964a2bbf8abe6dc061476a8e7ea02
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Sat Jan 27 09:12:47 2018 +0100

    build: Use meson's library function
    
    meson features a `library` function which based on the
    `default_library`, already used, builds a shared or a static
    library.
    
    This patch takes advantage of this function, there is no need to
    conditionally split the library creation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792948

 meson.build |   39 +++++++++++++--------------------------
 1 files changed, 13 insertions(+), 26 deletions(-)
---
diff --git a/meson.build b/meson.build
index 2649a1f..a9b223a 100644
--- a/meson.build
+++ b/meson.build
@@ -68,6 +68,10 @@ cdata.set('HAVE_ALSA', enable_alsa)
 static = get_option('default_library') == 'static'
 enable_introspection = get_option('introspection')
 
+if not static and pkglibdir == ''
+  error('Installing shared library, but pkglibdir is unset!')
+endif
+
 if static and enable_introspection
   error('Currently meson requires a shared library for building girs.')
 endif
@@ -78,32 +82,15 @@ if enable_introspection
   c_args += '-DWITH_INTROSPECTION'
 endif
 
-if static
-  libgvc_static = static_library('gvc',
-    sources: libgvc_gir_sources + libgvc_no_gir_sources,
-    include_directories: libgvc_inc,
-    dependencies: libgvc_deps,
-    c_args: c_args
-  )
-
-  libgvc = libgvc_static
-else
-  if pkglibdir == ''
-    error('Installing shared library, but pkglibdir is unset!')
-  endif
-
-  libgvc_shared = shared_library('gvc',
-    sources: libgvc_gir_sources + libgvc_no_gir_sources,
-    include_directories: libgvc_inc,
-    dependencies: libgvc_deps,
-    c_args: c_args,
-    install_rpath: pkgdatadir,
-    install_dir: pkglibdir,
-    install: true
-  )
-
-  libgvc = libgvc_shared
-endif
+libgvc = library('gvc',
+  sources: libgvc_gir_sources + libgvc_no_gir_sources,
+  include_directories: libgvc_inc,
+  dependencies: libgvc_deps,
+  c_args: c_args,
+  install_rpath: pkgdatadir,
+  install_dir: pkglibdir,
+  install: not static
+)
 
 if enable_introspection
   if pkgdatadir == ''


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