From: Jonathan Dieter Date: Sun, 9 Jan 2022 20:12:14 +0000 (+0000) Subject: Make libcurl optional X-Git-Tag: archive/raspbian/1.2.1+ds1-1+rpi1^2~7^2~1^2~5^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bf84566ccc1a0d4e3d3c2975c87bcd5742c17c9c;p=zchunk.git Make libcurl optional Signed-off-by: Jonathan Dieter --- diff --git a/meson.build b/meson.build index 453e5fb..53a201c 100644 --- a/meson.build +++ b/meson.build @@ -18,7 +18,7 @@ if build_machine.system() == 'freebsd' add_project_arguments('-DFREEBSD', language : 'c') endif - +# zstd dependency if build_machine.system() == 'windows' zstd_dep = dependency('zstd', modules: 'zstd::libzstd_shared', required : get_option('with-zstd'), fallback: 'zstd') else @@ -32,13 +32,17 @@ if zstd_dep.found() endif endif +# curl dependency if build_machine.system() == 'windows' - curl_dep = dependency('curl', modules: 'CURL::libcurl') + curl_dep = dependency('curl', modules: 'CURL::libcurl', required : get_option('with-curl')) else - curl_dep = dependency('libcurl') + curl_dep = dependency('libcurl', required : get_option('with-curl')) +endif +if not curl_dep.found() + curl_dep = disabler() endif - +# openssl dependency if build_machine.system() == 'windows' openssl_dep = dependency('openssl', modules : ['OpenSSL::SSL', 'OpenSSL::Crypto'], required : get_option('with-openssl')) else @@ -48,12 +52,14 @@ if openssl_dep.found() add_project_arguments('-DZCHUNK_OPENSSL', language : 'c') endif +# includes inc = [] inc += include_directories('include') if host_machine.system() == 'windows' inc += include_directories('src/lib/win32') endif +# argp-standalone dependency (if required) if build_machine.system() == 'windows' or build_machine.system() == 'darwin' or build_machine.system() == 'freebsd' or not cc.links('#include \nstatic error_t parse_opt (int key, char *arg, struct argp_state *state) { argp_usage(state); return 0; }; void main() {}') if fs.is_dir(join_paths([get_option('prefix'), 'include'])) inc += include_directories(join_paths([get_option('prefix'), 'include'])) diff --git a/meson_options.txt b/meson_options.txt index bb7dd6c..ef08266 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ option('with-zstd', type : 'feature', value : 'auto') option('with-openssl', type : 'feature', value : 'auto') +option('with-curl', type : 'feature', value : 'auto') option('coverity', type : 'boolean', value : false) diff --git a/src/lib/dl/dl.c b/src/lib/dl/dl.c index b27960f..635fc02 100644 --- a/src/lib/dl/dl.c +++ b/src/lib/dl/dl.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/src/meson.build b/src/meson.build index bea4ea4..928fe3f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -22,14 +22,6 @@ unzck = executable( link_with: zcklib, install: true ) -zckdl = executable( - 'zckdl', - ['zck_dl.c', 'util_common.c'] + extra_win_src, - include_directories: inc, - dependencies: [argplib, curl_dep], - link_with: zcklib, - install: true -) zck_gen_zdict = executable( 'zck_gen_zdict', ['zck_gen_zdict.c', 'util_common.c'] + extra_win_src, @@ -54,3 +46,13 @@ zck_delta_size = executable( link_with: zcklib, install: true ) +if curl_dep.found() + zckdl = executable( + 'zckdl', + ['zck_dl.c', 'util_common.c'] + extra_win_src, + include_directories: inc, + dependencies: [argplib, curl_dep], + link_with: zcklib, + install: true + ) +endif diff --git a/test/meson.build b/test/meson.build index 7c05b53..76f2701 100644 --- a/test/meson.build +++ b/test/meson.build @@ -77,13 +77,15 @@ test( '-V' ] ) -test( - 'check version info in zckdl', - zckdl, - args: [ - '-V' - ] -) +if curl_dep.found() + test( + 'check version info in zckdl', + zckdl, + args: [ + '-V' + ] + ) +endif test( 'check version info in zck_read_header', zck_read_header, @@ -149,15 +151,17 @@ test( ], is_parallel: false ) -test( - 'check verbosity in zckdl', - zckdl, - args: [ - '-vvvvv', - 'file:///empty' - ], - should_fail: true -) +if curl_dep.found() + test( + 'check verbosity in zckdl', + zckdl, + args: [ + '-vvvvv', + 'file:///empty' + ], + should_fail: true + ) +endif test( 'check verbosity in zck_read_header', zck_read_header,