From 660a446881e4d9b2f0224b502f784472e44b4ce9 Mon Sep 17 00:00:00 2001 From: wargio Date: Tue, 20 Jun 2023 15:14:27 +0800 Subject: [PATCH] Allow openssl to be disabled. --- meson.build | 8 +++++- meson_options.txt | 3 +- subprojects/packagefiles/yara/meson.build | 28 ++++++++++--------- .../packagefiles/yara/meson_options.txt | 1 + 4 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 subprojects/packagefiles/yara/meson_options.txt diff --git a/meson.build b/meson.build index 24b207a..ad0b910 100644 --- a/meson.build +++ b/meson.build @@ -22,7 +22,13 @@ if sys_yara_opt.enabled() or sys_yara_opt.auto() endif endif if (sys_yara_opt.auto() and not yara_dep.found()) or sys_yara_opt.disabled() - yara_proj = subproject('yara', default_options: ['default_library=static']) + yara_options = ['default_library=static'] + if get_option('enable_openssl') + yara_options += 'enable_openssl=true' + else + yara_options += 'enable_openssl=false' + endif + yara_proj = subproject('yara', default_options: yara_options) yara_dep = yara_proj.get_variable('yara_dep') endif diff --git a/meson_options.txt b/meson_options.txt index 15e4030..1d9656f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,3 @@ option('rizin_plugdir', type: 'string', value: '', description: 'rizin plugin install directory') -option('use_sys_yara', type: 'feature', value: 'disabled') +option('use_sys_yara', type: 'feature', value: 'disabled', description: 'uses the system library instead of the embedded one') +option('enable_openssl', type: 'boolean', value: true, description: 'enables openssl support') diff --git a/subprojects/packagefiles/yara/meson.build b/subprojects/packagefiles/yara/meson.build index c58f321..e0c21d4 100644 --- a/subprojects/packagefiles/yara/meson.build +++ b/subprojects/packagefiles/yara/meson.build @@ -82,19 +82,21 @@ else yara_c_args += '-DUSE_NO_PROC' endif -openssl = dependency('openssl', required: false) -if openssl.found() - yara_deps += openssl - yara_c_args += '-DHASH_MODULE=1' - yara_c_args += '-DHAVE_LIBCRYPTO=1' - yara_c_args += '-DHAVE_OPENSSL_ASN1_H=1' - yara_c_args += '-DHAVE_OPENSSL_BIO_H=1' - yara_c_args += '-DHAVE_OPENSSL_CRYPTO_H=1' - yara_c_args += '-DHAVE_OPENSSL_MD5_H=1' - yara_c_args += '-DHAVE_OPENSSL_PKCS7_H=1' - yara_c_args += '-DHAVE_OPENSSL_SHA_H=1' - yara_c_args += '-DHAVE_OPENSSL_X509_H=1' - yara_src += 'libyara/modules/hash/hash.c' +if get_option('enable_openssl') + openssl = dependency('openssl', required: false) + if openssl.found() + yara_deps += openssl + yara_c_args += '-DHASH_MODULE=1' + yara_c_args += '-DHAVE_LIBCRYPTO=1' + yara_c_args += '-DHAVE_OPENSSL_ASN1_H=1' + yara_c_args += '-DHAVE_OPENSSL_BIO_H=1' + yara_c_args += '-DHAVE_OPENSSL_CRYPTO_H=1' + yara_c_args += '-DHAVE_OPENSSL_MD5_H=1' + yara_c_args += '-DHAVE_OPENSSL_PKCS7_H=1' + yara_c_args += '-DHAVE_OPENSSL_SHA_H=1' + yara_c_args += '-DHAVE_OPENSSL_X509_H=1' + yara_src += 'libyara/modules/hash/hash.c' + endif endif yara_incs = [ diff --git a/subprojects/packagefiles/yara/meson_options.txt b/subprojects/packagefiles/yara/meson_options.txt new file mode 100644 index 0000000..0325e57 --- /dev/null +++ b/subprojects/packagefiles/yara/meson_options.txt @@ -0,0 +1 @@ +option('enable_openssl', type: 'boolean', value: true, description: 'enables openssl support')