From: Igor Gnatenko Date: Mon, 30 Jul 2018 11:17:05 +0000 (+0200) Subject: build: use 'feature' option type X-Git-Tag: archive/raspbian/1.1.9+ds1-1+rpi1~1^2~154^2^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8b5845002fbfd6f0cc95f172fd794eda157b5f41;p=zchunk.git build: use 'feature' option type Signed-off-by: Igor Gnatenko --- diff --git a/meson.build b/meson.build index 1f786f8..1c49956 100644 --- a/meson.build +++ b/meson.build @@ -1,41 +1,19 @@ -project('zck', 'c', version: '0.9.1') +project('zck', 'c', + version : '0.9.1', + meson_version : '>=0.47.0') so_version = '1' -use_zstd = get_option('with-zstd') -zstd_dep = [] -if use_zstd == 'yes' - zstd_required = true -else - zstd_required = false -endif -if use_zstd == 'auto' or use_zstd == 'yes' - zstd_dep = dependency('libzstd', required:zstd_required) - if zstd_dep.found() - add_project_arguments('-DZCHUNK_ZSTD', language : 'c') - use_zstd = 'yes' - else - use_zstd = 'no' - endif +zstd_dep = dependency('libzstd', required : get_option('with-zstd')) +if zstd_dep.found() + add_project_arguments('-DZCHUNK_ZSTD', language : 'c') endif -curl_dep = dependency('libcurl', required:true) +curl_dep = dependency('libcurl') -use_openssl = get_option('with-openssl') -openssl_dep = [] -if use_openssl == 'yes' - openssl_required = true -else - openssl_required = false -endif -if use_openssl == 'auto' or use_openssl == 'yes' - openssl_dep = dependency('openssl', required:openssl_required) - if openssl_dep.found() - add_project_arguments('-DZCHUNK_OPENSSL', language : 'c') - use_openssl = 'yes' - else - use_openssl = 'no' - endif +openssl_dep = dependency('openssl', required : get_option('with-openssl')) +if openssl_dep.found() + add_project_arguments('-DZCHUNK_OPENSSL', language : 'c') endif inc = include_directories('include') diff --git a/meson_options.txt b/meson_options.txt index 67cdd4f..bfb4128 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,2 @@ -option('with-zstd', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto') -option('with-openssl', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto') +option('with-zstd', type : 'feature', value : 'auto') +option('with-openssl', type : 'feature', value : 'auto') diff --git a/src/lib/comp/meson.build b/src/lib/comp/meson.build index a6edc00..b66482b 100644 --- a/src/lib/comp/meson.build +++ b/src/lib/comp/meson.build @@ -1,5 +1,5 @@ lib_sources += files('comp.c') -if use_zstd == 'yes' - subdir('zstd') +if zstd_dep.found() + subdir('zstd') endif subdir('nocomp') diff --git a/src/lib/hash/meson.build b/src/lib/hash/meson.build index 999d85d..9edc4da 100644 --- a/src/lib/hash/meson.build +++ b/src/lib/hash/meson.build @@ -1,5 +1,5 @@ lib_sources += files('hash.c') -if use_openssl == 'no' +if not openssl_dep.found() subdir('sha1') subdir('sha2') endif