]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
meson: support differn't legacy levels. 960/head
authorShawn Landden <slandden@gmail.com>
Thu, 21 Dec 2017 23:41:58 +0000 (15:41 -0800)
committerShawn Landden <slandden@gmail.com>
Thu, 21 Dec 2017 23:47:38 +0000 (15:47 -0800)
Default to v0.4.0+

contrib/meson/meson.build
contrib/meson/meson_options.txt

index 5ff370fa7163336e70c687bf85fb94ecba693291..ce3fb83e3323bdbdc1d83e1e691c35a4252ad8cf 100644 (file)
@@ -38,21 +38,35 @@ libzstd_srcs = [
 
 libzstd_includes = [include_directories(common_dir, dictbuilder_dir, compress_dir, lib_dir)]
 
-if get_option('legacy_support')
-    message('Enabling legacy support')
-    libzstd_cflags = ['-DZSTD_LEGACY_SUPPORT=4']
+legacy = get_option('legacy_support')
+if legacy != 'false'
+    message('Enabling legacy support back to version 0.' + legacy)
+    legacy_int = legacy.to_int()
+    libzstd_cflags = ['-DZSTD_LEGACY_SUPPORT=' + legacy]
 
     legacy_dir = join_paths(lib_dir, 'legacy')
     libzstd_includes += [include_directories(legacy_dir)]
-    libzstd_srcs += [
-        join_paths(legacy_dir, 'zstd_v01.c'),
-        join_paths(legacy_dir, 'zstd_v02.c'),
-        join_paths(legacy_dir, 'zstd_v03.c'),
-        join_paths(legacy_dir, 'zstd_v04.c'),
-        join_paths(legacy_dir, 'zstd_v05.c'),
-        join_paths(legacy_dir, 'zstd_v06.c'),
-        join_paths(legacy_dir, 'zstd_v07.c')
-    ]
+    if legacy_int <= 1
+        libzstd_srcs += join_paths(legacy_dir, 'zstd_v01.c')
+    endif
+    if legacy_int <= 2
+        libzstd_srcs += join_paths(legacy_dir, 'zstd_v02.c')
+    endif
+    if legacy_int <= 3
+        libzstd_srcs += join_paths(legacy_dir, 'zstd_v03.c')
+    endif
+    if legacy_int <= 4
+        libzstd_srcs += join_paths(legacy_dir, 'zstd_v04.c')
+    endif
+    if legacy_int <= 5
+        libzstd_srcs += join_paths(legacy_dir, 'zstd_v05.c')
+    endif
+    if legacy_int <= 6
+        libzstd_srcs += join_paths(legacy_dir, 'zstd_v06.c')
+    endif
+    if legacy_int <= 7
+        libzstd_srcs += join_paths(legacy_dir, 'zstd_v07.c')
+    endif
 else
     libzstd_cflags = []
 endif
index 0a12f43e1967b050ebd2e1eb74f70e037630575e..de9fea073cf2db89464bfcf7759d7aac40bb69fb 100644 (file)
@@ -1,2 +1,2 @@
 option('multithread', type: 'boolean', value: false)
-option('legacy_support', type: 'boolean', value: false)
+option('legacy_support', type: 'string', value: '4')