321 Commits

Author SHA1 Message Date
William Ahern
60fcc36af6 escape glob pattern special characters in subject string before generating search patterns in combine.sh list_has_item 2022-08-10 20:58:55 -07:00
William Ahern
cca3544708 restore combine.sh bash performance while still sticking to POSIX 2022-08-10 16:51:17 -07:00
Taylor Braun-Jones
cd9d0a7e6e Fix ZSTD_BUILD_TESTS=ON build with MSVC
Fixes:

    Command line error D8021 : invalid numeric argument '/Wno-deprecated-declarations'
2022-06-30 13:20:42 -04:00
Yann Collet
15f3605135 removed gnu99 statement from meson recipe 2022-06-20 18:18:40 -07:00
Yann Collet
eceecc5b2c removed explicit compilation standard from cmake script
it's not expected to be useful
and can actually lead to subtle side effects
such as #3163.
2022-06-19 14:52:32 -07:00
Eli Schwartz
6548ec7440
meson: for internal linkage, link to both libzstd and a static copy of it
Partial, Meson-only implementation of #2976 for non-MSVC builds.

Due to the prevalence of private symbol reuse, linking to a shared
library is simply utterly unreliable, but we still want to defer to the
shared library for installable applications. By linking to both, we can
share symbols where possible, and statically link where needed.

This means we no longer need to manually track every file that needs to
be extracted and reused.

The flip side is that MSVC completely does not support this, so for MSVC
builds we just link to a full static copy even where
-Ddefault_library=shared.

As a side benefit, by using library inclusion rather than including
extra explicit object files, the zstd program shrinks in size slightly
(~4kb).
2022-04-28 21:57:02 -04:00
Eli Schwartz
8d522b8a9d
meson: avoid rebuilding some libzstd sources in the programs
These need to be explicitly included as we use their private symbols,
but we don't need to recompile them when we can reuse the existing
objects.

Minus 7 compile steps.
2022-04-28 21:56:36 -04:00
Eli Schwartz
df6eefb3bb
meson: avoid rebuilding some libzstd files in the test programs
The poolTests program already linked to libzstd, and later to
libtestcommon with included libzstd objects. So this was redundant.

Minus 4 compile steps.
2022-04-28 21:56:36 -04:00
Yann Collet
66633f9386
Merge pull request #3039 from eli-schwartz/meson
Meson fixups for Windows
2022-04-19 15:51:19 -07:00
Dominique Pelle
b772f53952 Typo and grammar fixes 2022-03-12 08:58:04 +01:00
Yann Collet
db104f6e83
Merge pull request #3079 from niamster/cmake-compat-5
build:cmake: enable ZSTD legacy support by default
2022-03-08 00:21:23 -08:00
Dimitris Apostolou
cf1894b324
Fix typos 2022-03-05 23:47:25 +02:00
Dmytro Milinevskyi
03bba1b0bf build:cmake: enable ZSTD legacy support by default 2022-03-01 18:29:47 +01:00
Alexander Shadchin
317bd108fe
Select legacy level for cmake 2022-02-04 14:24:58 +03:00
Eli Schwartz
ef78b9af30
meson: valgrind wrapper should return correct errors
While trying to raise an exception on failures, it instead raised an
exception for misusing the exception. CalledProcessError is only
supposed to be used when given a return code and a command, and it
prints:

Command '{cmd}' returned non-zero exit status {ret}

Passing an error message string instead, just errored out with:

TypeError: __init__() missing 1 required positional argument

Instead use the subprocess module's base error which does accept string
messages. Everything that used to error out, still errors out, but now
they do so with a slightly prettier console message.
2022-01-30 21:50:42 -05:00
Eli Schwartz
84c05453db
meson: never require a libm
libm is not guaranteed to exist. POSIX requires the math functions to
exist, but doesn't require to have it be a standalone library.

On platforms where libm exists as a standalone library, it will always
be found by meson -- it is shipped with libc.

If it is not found, then we can safely assume the linker will make the
math functions available by default.

See https://mesonbuild.com/howtox.html#add-math-library-lm-portably

Fixes building with bin_tests=true on Windows.
2022-01-30 21:50:42 -05:00
Eli Schwartz
5b2c6c776a
meson: fix resource file compilation on Windows
It needs to know about the correct include directories on its own.
2022-01-30 21:50:42 -05:00
Yonatan Komornik
70df5de1b2
AsyncIO compression part 1 - refactor of existing asyncio code (#3021)
* Refactored fileio.c:
- Extracted asyncio code to fileio_asyncio.c/.h
- Moved type definitions to fileio_types.h
- Moved common macro definitions needed by both fileio.c and fileio_asyncio.c to fileio_common.h

* Bugfix - rename fileio_asycio to fileio_asyncio

* Added copyrights & license to new files

* CR fixes
2022-01-24 14:43:02 -08:00
Yann Collet
b27356fd27
Merge pull request #3005 from cwoffenden/faster-amalgamate
Use faster Python script to amalgamate
2022-01-21 16:12:22 -08:00
Yonatan Komornik
1598e6c634
Async write for decompression (#2975)
* Async IO decompression:
- Added --[no-]asyncio flag for CLI decompression.
- Replaced dstBuffer in decompression with a pool of write jobs.
- Added an ability to execute write jobs in a separate thread.
- Added an ability to wait (join) on all jobs in a thread pool (queued and running).
2022-01-21 13:55:41 -08:00
Carl Woffenden
3f181b6192 More descriptive exclusion error; updated docs and copyright 2022-01-20 14:50:31 +01:00
Carl Woffenden
dc983e7d68 Typo (and missing commit) 2022-01-19 18:05:35 +01:00
Carl Woffenden
786263ea85 Suggestion from code review 2022-01-19 17:48:10 +01:00
Carl Woffenden
566ebce347
Python style change
Co-authored-by: Alexandre Bury <alexandre.bury@gmail.com>
2022-01-19 17:33:20 +01:00
Carl Woffenden
5fd6ddaf8b Fixed bugs found in other projects
When testing amalgamating other projects it was found: invalid Unicode errors were tripping Python's text IO, and the header search order appears differs from the shell version.
2022-01-19 16:56:03 +01:00
Carl Woffenden
dd7d29a19c Updated README 2022-01-19 15:57:33 +01:00
Carl Woffenden
7d90f0b520 Test and tidy
Made the Python more Python-like. Added notes and general tidy. Tested exclusions and building with various options. Tested all scripts.
2022-01-19 11:32:53 +01:00
Carl Woffenden
8f1e51f99f Feature parity with original shell script; needs further testing 2022-01-18 19:07:18 +01:00
Carl Woffenden
829ac2e9ce Work-in-progress; annotated types, added docs, parsed and resolved excluded files 2022-01-18 11:43:01 +01:00
Carl Woffenden
7e50d1e8c1 Using faster Python script to amalgamate 2022-01-17 18:59:54 +01:00
Felix Handte
4dfaf0003f
Merge pull request #2957 from hmaarrfk/fix_cmake_msvc
Fixup MSVC source file inclusion for cmake builds
2022-01-11 13:25:16 -05:00
Mark Harfouche
df5ad5a0f1 Add a compile option to explicitely disable assembly 2022-01-05 20:38:00 -05:00
Nick Terrell
c4f5116e95 [meson] Explicitly disable assembly for non clang/gcc copmilers
After merging #2951 I realized that we will want to explicitly disable
assembly when we aren't including the assembly source file. Otherwise,
if some non clang/gcc compiler does support assembly, it would fail to
build.
2022-01-04 16:05:59 -08:00
Mark Harfouche
148ff15774 Fixup MSVC source file inclusion for cmake builds 2021-12-27 02:21:21 -05:00
Eli Schwartz
29e44bc554
meson: fix MSVC support
Regression from commit a5f2c45528032ed20c33e0f8cd2c163a800a0017. It is
not possible to unconditionally add the asm sources, since not all
compilers understand the .s file extension.

Specifically for meson, only compilers inheriting from the GNU mixin
will allow a .s file at configure time.

zstd doesn't support asm for MSVC for the same basic reason; if/when
Windows asm support is added, it would involve preprocessing with nasm,
most likely.
2021-12-22 20:20:30 -05:00
مهدي شينون (Mehdi Chinoune)
14a0eaf73b Fix zstd-static output name with MINGW/Clang 2021-12-22 10:16:41 +01:00
Nick Terrell
486472c453
Merge pull request #2893 from terrelln/issue-2789
[asm] Share portability macros and restrict ASM further
2021-12-03 14:07:30 -05:00
Nick Terrell
c284569457 [asm] Share portability macros and restrict ASM further
Move portability macros to `lib/common/portability_macros.h`. This file
only contains platform/feature detection (e.g. 0/1 macros). This file is
shared between C and ASM code, so it cannot include any C code.

Rename `HUF_` ASM macros to be `ZSTD_` prefixed, and move to the new
header.

Restrict `ZSTD_ASM_SUPPORTED` to `__GNUC__`, because we need the GAS
assembler.

Finally, only include the ASM code if we are actually going to use it.
This disables it on all Windows platforms, which should resolve the
problem brought up in Issue #2789.
2021-12-02 16:58:04 -08:00
W. Felix Handte
4a82bc9d00 Disable Multithreading in CMake Builds for Android 2021-12-02 17:23:42 -05:00
Jann Köker
0a36c104ca
Update CMakeLists.txt
Prevents multiple rules error when building with ninja and clang under windows
2021-11-24 11:35:36 +01:00
Dimitris Apostolou
ebbd675998
Fix typos 2021-11-13 10:04:04 +02:00
Denis Rouzaud
abc1a91fe2 add missing BUNDLE DESTINATION
fixes build on iOS
2021-09-29 08:27:12 +02:00
Nick Terrell
a5f2c45528 Huffman ASM 2021-09-20 14:46:43 -07:00
Ma Lin
4eef208889 add msvc2019 to build.generic.cmd 2021-09-19 10:28:16 +08:00
Nick Terrell
8bf699aa59 [build] Add support for ASM files in Make + CMake
* Extract out common portion of `lib/Makefile` into `lib/libzstd.mk`.
  Most relevantly, the way we find library files.
* Use `lib/libzstd.mk` in the other Makefiles instead of repeating the
  same code.
* Add a test `tests/test-variants.sh` that checks that the builds of
  `make -C programs allVariants` are correct, and run it in Actions.
* Adds support for ASM files in the CMake build.

The Meson build is not updated because it lists every file in zstd,
and supports ASM off the bat, so the Huffman ASM commit will just add
the ASM file to the list.

The Visual Studios build is not updated because I'm not adding ASM
support to Visual Studios yet.
2021-09-17 14:13:53 -07:00
Eli Schwartz
193aa49673
meson: fix type error for integer option
meson forgave using the wrong type, but this isn't guaranteed. muon
simply failed.
2021-09-09 23:40:58 -04:00
Eli Schwartz
9748608aeb
meson: set the symbol visibility of the shared library to hidden
This matches the Makefile build. Due to one private xxhash symbol in use
by the program, it recompiles a private copy of xxhash.

Due to the test binaries making extensive (?) use of private symbols, it
doesn't even attempt to link to shared libzstd, and instead, all of the
original object files are added to libtestcommon itself for private
linkage. This, too, matches the Makefile build.

Ref. #2261
2021-08-09 22:03:17 -04:00
Eli Schwartz
d95a3f5097
meson: fix warnings in build files
meson prefers that project-level options for Wall/Wextra/pedantic be
used, rather than hardcoding raw flags in add_project_arguments. If you
do the latter anyway, it raises a meson warning.

Set the default options for the project to use all this.

Also move the -Werror comment to the project default options with
appropriate format, but leave it commented out since it does not work.
2021-08-09 20:17:00 -04:00
Eli Schwartz
ee3355df30
meson: link tests with a convenience library of sources used by multiple binaries
This saves repeatedly compiling them, resulting in 16 fewer compile
steps, in exchange for one `ar` step.
2021-08-09 20:15:44 -04:00
Jonathan Ringer
e1f85dbca3
pzstd: fix linking for static builds 2021-07-09 13:21:15 -07:00