head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC6:1.1.1.1
	netbsd-11-0-RC5:1.1.1.1
	netbsd-11-0-RC4:1.1.1.1
	zstd-1-5-7:1.1.1.2
	netbsd-11-0-RC3:1.1.1.1
	netbsd-11-0-RC2:1.1.1.1
	netbsd-11-0-RC1:1.1.1.1
	perseant-exfatfs-base-20250801:1.1.1.1
	netbsd-11:1.1.1.1.0.2
	netbsd-11-base:1.1.1.1
	zstd-1-5-6:1.1.1.1
	META:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2024.10.27.22.44.09;	author christos;	state Exp;
branches
	1.1.1.1;
next	;
commitid	IUZDrqSXcnIYVlvF;

1.1.1.1
date	2024.10.27.22.44.09;	author christos;	state Exp;
branches;
next	1.1.1.2;
commitid	IUZDrqSXcnIYVlvF;

1.1.1.2
date	2026.05.01.14.27.17;	author christos;	state Exp;
branches;
next	;
commitid	LjoDikzDsAzrt7EG;


desc
@@


1.1
log
@Initial revision
@
text
@# #############################################################################
# Copyright (c) 2018-present     Dima Krasner <dima@@dimakrasner.com>
#                                lzutao <taolzu(at)gmail.com>
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# in the COPYING file in the root directory of this source tree).
# #############################################################################

project('zstd',
  ['c', 'cpp'],
  license: ['BSD', 'GPLv2'],
  default_options : [
    # There shouldn't be any need to force a C standard convention for zstd
    # but in case one would want that anyway, this can be done here.
    # 'c_std=gnu99',
    # c++11 standard is useful for pzstd
    'cpp_std=c++11',
    'buildtype=release',
    'warning_level=3',
    # -Wdocumentation does not actually pass, nor do the test binaries,
    # so this isn't safe
    #'werror=true'
  ],
  version: run_command(
    find_program('GetZstdLibraryVersion.py'), '../../lib/zstd.h',
    check: true).stdout().strip(),
  meson_version: '>=0.50.0')

cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')
pkgconfig = import('pkgconfig')
windows_mod = import('windows')

host_machine_os = host_machine.system()
os_windows = 'windows'
os_linux = 'linux'
os_darwin = 'darwin'
os_freebsd = 'freebsd'
os_sun = 'sunos'

cc_id = cc.get_id()
compiler_gcc = 'gcc'
compiler_clang = 'clang'
compiler_msvc = 'msvc'

zstd_version = meson.project_version()

zstd_libversion = zstd_version

# =============================================================================
# Installation directories
# =============================================================================

zstd_prefix = get_option('prefix')
zstd_bindir = get_option('bindir')
zstd_datadir = get_option('datadir')
zstd_mandir = get_option('mandir')
zstd_docdir = join_paths(zstd_datadir, 'doc', meson.project_name())

# =============================================================================
# Project options
# =============================================================================

# Built-in options
use_debug = get_option('debug')
buildtype = get_option('buildtype')
default_library_type = get_option('default_library')

# Custom options
debug_level = get_option('debug_level')
legacy_level = get_option('legacy_level')
use_backtrace = get_option('backtrace')
use_static_runtime = get_option('static_runtime')

bin_programs = get_option('bin_programs')
bin_contrib = get_option('bin_contrib')
bin_tests = get_option('bin_tests')

feature_multi_thread = get_option('multi_thread')
feature_zlib = get_option('zlib')
feature_lzma = get_option('lzma')
feature_lz4 = get_option('lz4')

# =============================================================================
# Dependencies
# =============================================================================

libm_dep = cc.find_library('m', required: false)
thread_dep = dependency('threads', required: feature_multi_thread)
use_multi_thread = thread_dep.found()
# Arguments in dependency should be equivalent to those passed to pkg-config
zlib_dep = dependency('zlib', required: feature_zlib)
use_zlib = zlib_dep.found()
lzma_dep = dependency('liblzma', required: feature_lzma)
use_lzma = lzma_dep.found()
lz4_dep = dependency('liblz4', required: feature_lz4)
use_lz4 = lz4_dep.found()

# =============================================================================
# Compiler flags
# =============================================================================

add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c'])

pzstd_warning_flags = []
if [compiler_gcc, compiler_clang].contains(cc_id)
  common_warning_flags = [ '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ]
  pzstd_warning_flags = ['-Wno-shadow', '-Wno-deprecated-declarations']
  if cc_id == compiler_clang
    common_warning_flags += ['-Wconversion', '-Wno-sign-conversion', '-Wdocumentation']
  endif
  cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes'])
  cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags)
  add_project_arguments(cc_compile_flags, language : 'c')
  add_project_arguments(cxx_compile_flags, language : 'cpp')
elif cc_id == compiler_msvc
  msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ]
  if use_multi_thread
    msvc_compile_flags += '/MP'
  endif
  if use_static_runtime
    msvc_compile_flags += '/MT'
  endif
  add_project_arguments(msvc_compile_flags, language: ['c', 'cpp'])
endif

# =============================================================================
# Subdirs
# =============================================================================

subdir('lib')

if bin_programs or bin_tests
  subdir('programs')
endif

if bin_tests
  subdir('tests')
endif

if bin_contrib
  subdir('contrib')
endif
@


1.1.1.1
log
@Import zstd-1.5.6 from:
    https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz
@
text
@@


1.1.1.2
log
@Import zstd-1.5.7 (previous was 1.5.6)

V1.5.7 (Feb 2025)
fix: compression bug in 32-bit mode associated with long-lasting sessions
api: new method `ZSTD_compressSequencesAndLiterals()` (#4217, #4232)
api: `ZSTD_getFrameHeader()` works on skippable frames (#4228)
perf: substantial compression speed improvements (up to +30%) on small data, by @@TocarIP (#4144) and @@cyan4973 (#4165)
perf: improved compression speed (~+5%) for dictionary compression at low levels (#4170)
perf: much faster speed for `--patch-from` at high compression levels (#4276)
perf: higher `--patch-from` compression ratios, notably at high levels (#4288)
perf: better speed for binaries on Windows (@@pps83) and when compiled with Visual Studio (@@MessyHack)
perf: slight compression ratio improvement thanks to better block boundaries (#4136, #4176, #4178)
perf: slight compression ratio improvement for `dfast`, aka levels 3 and 4 (#4171)
perf: runtime bmi2 detection enabled on x86 32-bit mode (#4251)
cli: multi-threading as default CLI setting, by @@daniellerozenblit
cli: new `--max` command (#4290)
build: improve `msbuild` version autodetection, support VS2022, by @@ManuelBlanc
build: fix `meson` build by @@artem and @@Victor-C-Zhang, and on Windows by @@bgilbert
build: compatibility with Apple Framework, by @@Treata11
build: improve icc/icx compatibility, by @@josepho0918 and @@luau-project
build: improve compatibility with Android NDK, by Adenilson Cavalcanti
portability: linux kernel branch, with improved support for Sequence producers (@@embg, @@gcabiddu, @@cyan4973)
portability: improved qnx compatibility, suggested by @@rainbowball
portability: improved install script for FreeBSD, by @@sunpoet
portability: fixed test suite compatibility with gnu hurd, by @@diegonc
doc: clarify specification, by @@elasota
misc: improved tests/decodecorpus validation tool (#4102), by antmicro
@
text
@d91 2
a92 7
if host_machine_os == os_windows
  thread_dep = dependency('', required: false)
  use_multi_thread = not feature_multi_thread.disabled()
else
  thread_dep = dependency('threads', required: feature_multi_thread)
  use_multi_thread = thread_dep.found()
endif
d114 2
a115 4
  noexecstack_flags = ['-Wa,--noexecstack' ]
  noexecstack_link_flags = ['-Wl,-z,noexecstack']
  cc_compile_flags = cc.get_supported_arguments(common_warning_flags + noexecstack_flags + ['-Wstrict-prototypes'])
  cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags + noexecstack_flags)
a117 4
  cc_link_flags = cc.get_supported_link_arguments(noexecstack_link_flags)
  cxx_link_flags = cxx.get_supported_link_arguments(noexecstack_link_flags)
  add_project_link_arguments(cc_link_flags, language: 'c')
  add_project_link_arguments(cxx_link_flags, language: 'cpp')
@

