From 7aa67b142b0f5b0062e9766eb8bf881023af5e8b Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Fri, 30 Aug 2019 20:58:28 +0200 Subject: [PATCH] Add a new meson option : -Dstatic-dependency=yes to use static dependencies --- meson.build | 19 +++++++++++++------ meson_options.txt | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 3386737a..63f6c125 100644 --- a/meson.build +++ b/meson.build @@ -41,7 +41,10 @@ with_perl_lib = get_option('with-perl-lib') require_otr = get_option('with-otr') == 'yes' want_otr = get_option('with-otr') != 'no' -want_glib_internal = get_option('install-glib') == 'yes' +want_glib_internal = get_option('install-glib') != 'no' +require_glib_internal = get_option('install-glib') == 'force' + +want_static_dependency = get_option('static-dependency') == 'yes' chat_modules = ['irc'] @@ -149,7 +152,11 @@ message('*** to download and build it automatically') message('*** Or alternatively install your distribution\'s package') message('*** On Debian: sudo apt-get install libglib2.0-dev') message('*** On Redhat: dnf install glib2-devel') -glib_dep = dependency('glib-2.0', version : '>=2.28', required : not want_glib_internal) +if not require_glib_internal + glib_dep = dependency('glib-2.0', version : '>=2.28', required : not want_glib_internal, static : want_static_dependency) +else + glib_dep = dependency('', required : false) +endif if not glib_dep.found() glib_internal = true meson_cmd = find_program('meson') @@ -200,12 +207,12 @@ if not glib_dep.found() link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gmodule' / 'libgmodule-2.0.a' ], ) else - gmodule_dep = dependency('gmodule-2.0') + gmodule_dep = dependency('gmodule-2.0', static : want_static_dependency) endif dep += glib_dep dep += gmodule_dep -openssl_dep = dependency('openssl') +openssl_dep = dependency('openssl', static : want_static_dependency) dep += openssl_dep ############ @@ -365,8 +372,8 @@ endif have_otr = false if want_otr - libgcrypt = dependency('libgcrypt', version : '>=1.2.0', required : require_otr) - libotr = dependency('libotr', version : '>=4.1.0', required : require_otr) + libgcrypt = dependency('libgcrypt', version : '>=1.2.0', required : require_otr, static : want_static_dependency) + libotr = dependency('libotr', version : '>=4.1.0', required : require_otr, static : want_static_dependency) if libgcrypt.found() and libotr.found() dep += libgcrypt dep += libotr diff --git a/meson_options.txt b/meson_options.txt index 579b9cda..141e3fba 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -10,5 +10,6 @@ option('enable-true-color', type : 'combo', description : 'Build with true colo option('disable-gregex', type : 'combo', description : 'Build without GRegex (fall back to regex.h)', choices : ['no', 'yes']) option('disable-utf8proc', type : 'combo', description : 'Build without Julia\'s utf8proc', choices : ['auto', 'yes', 'no']) option('with-capsicum', type : 'combo', description : 'Build with Capsicum support', choices : ['auto', 'yes', 'no']) -option('install-glib', type : 'combo', description : 'Download and install GLib for you', choices : ['no', 'yes']) +option('static-dependency', type : 'combo', description : 'Request static dependencies', choices : ['no', 'yes']) +option('install-glib', type : 'combo', description : 'Download and install GLib for you', choices : ['no', 'yes', 'force']) option('docdir', type : 'string', description : 'Documentation directory')