From 51e2f8b26926e159fa970bc8e77dc75b0954669f Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 4 Jan 2022 23:45:20 -0500 Subject: [PATCH] meson: add subproject fallback for zstd installed via the command: ``` meson wrap install zstd ``` This file does nothing, unless a dependency cannot be found; in that case, instead of failing, meson will download a private copy of the dependency and build + link to that instead. (This is especially common on Windows, where managing dependencies without a package manager can be difficult.) Alternatively, users interested in specifically building a statically linked / portable executable can configure meson with `--wrap-mode=forcefallback` to prefer the private copy. --- meson.build | 3 ++- subprojects/zstd.wrap | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 subprojects/zstd.wrap diff --git a/meson.build b/meson.build index 7e7db31..31dc079 100644 --- a/meson.build +++ b/meson.build @@ -20,7 +20,8 @@ endif if get_option('with-zstd') == 'disabled' zstd_dep = dependency('', required : false) else - zstd_dep = dependency('libzstd', required : get_option('with-zstd') == 'enabled') + zstd_dep = dependency('libzstd', required : get_option('with-zstd') == 'enabled', + default_options: ['bin_programs=false', 'zlib=disabled', 'lzma=disabled', 'lz4=disabled']) if zstd_dep.found() add_project_arguments('-DZCHUNK_ZSTD', language : 'c') if zstd_dep.version().version_compare('<=1.4.9') diff --git a/subprojects/zstd.wrap b/subprojects/zstd.wrap new file mode 100644 index 0000000..b736b50 --- /dev/null +++ b/subprojects/zstd.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = zstd-1.4.5 +source_url = https://github.com/facebook/zstd/releases/download/v1.4.5/zstd-1.4.5.tar.gz +source_filename = zstd-1.4.5.tar.gz +source_hash = 98e91c7c6bf162bf90e4e70fdbc41a8188b9fa8de5ad840c401198014406ce9e +patch_url = https://wrapdb.mesonbuild.com/v2/zstd_1.4.5-1/get_patch +patch_filename = zstd-1.4.5-1-wrap.zip +patch_hash = fd9cb7b9c8f7092ef1597ff68f170beef65fcf33e575a621955cf405a41db1cc + +[provide] +libzstd = libzstd_dep + -- 2.30.2