Skip to content

Commit

Permalink
Allow openssl to be disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio committed Jun 20, 2023
1 parent e01b262 commit 660a446
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
8 changes: 7 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -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')
28 changes: 15 additions & 13 deletions subprojects/packagefiles/yara/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
1 change: 1 addition & 0 deletions subprojects/packagefiles/yara/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('enable_openssl', type: 'boolean', value: true, description: 'enables openssl support')

0 comments on commit 660a446

Please sign in to comment.