Compare commits

..

309 Commits
master ... v5.4

Author SHA1 Message Date
Jia Tan 6e8732c5a3 Bump version and soname for 5.4.6. 2024-01-26 19:41:20 +08:00
Jia Tan 6532f55caa Add NEWS for 5.4.6. 2024-01-26 18:54:24 +08:00
Jia Tan 8b1a2798ad Docs: Update .xz file format specification to 1.2.0.
The new RISC-V filter was added to the specification, in addition to
updating the specification URL.
2024-01-24 21:13:55 +08:00
Jia Tan 55285900b3 xz: Update website URLs in the man pages. 2024-01-24 21:13:52 +08:00
Jia Tan a670f69521 liblzma: Update website URL. 2024-01-24 21:13:49 +08:00
Jia Tan 05aeda9612 Docs: Update website URLs. 2024-01-24 21:13:43 +08:00
Jia Tan 3cc54f1c0b Build: Update website URL. 2024-01-24 21:13:10 +08:00
Jia Tan 82f5515de6 Translations: Update the French translation. 2023-12-22 20:02:06 +08:00
Jia Tan 9e96ca8c48 xz: Add a comment to Capsicum sandbox setup.
This comment is repeated in xzdec.c to help remind us why all the
capabilities are removed from stdin in certain situations.
2023-12-22 20:02:06 +08:00
Jia Tan 8191720eac liblzma: Set all values in lzma_lz_encoder to NULL after allocation.
The first member of lzma_lz_encoder doesn't necessarily need to be set
to NULL since it will always be set before anything tries to use it.
However the function pointer members must be set to NULL since other
functions rely on this NULL value to determine if this behavior is
supported or not.

This fixes a somewhat serious bug, where the options_update() and
set_out_limit() function pointers are not set to NULL. This seems to
have been forgotten since these function pointers were added many years
after the original two (code() and end()).

The problem is that by not setting this to NULL we are relying on the
memory allocation to zero things out if lzma_filters_update() is called
on a LZMA1 encoder. The function pointer for set_out_limit() is less
serious because there is not an API function that could call this in an
incorrect way. set_out_limit() is only called by the MicroLZMA encoder,
which must use LZMA1 where set_out_limit() is always set. Its currently
not possible to call set_out_limit() on an LZMA2 encoder at this time.

So calling lzma_filters_update() on an LZMA1 encoder had undefined
behavior since its possible that memory could be manipulated so the
options_update member pointed to a different instruction sequence.

This is unlikely to be a bug in an existing application since it relies
on calling lzma_filters_update() on an LZMA1 encoder in the first place.
For instance, it does not affect xz because lzma_filters_update() can
only be used when encoding to the .xz format.
2023-12-22 20:02:06 +08:00
Jia Tan 0ba5dd7ba1 liblzma: Tweak a comment. 2023-12-22 20:02:06 +08:00
Jia Tan 27ab54af84 liblzma: Make parameter names in function definition match declaration.
lzma_raw_encoder() and lzma_raw_encoder_init() used "options" as the
parameter name instead of "filters" (used by the declaration). "filters"
is more clear since the parameter represents the list of filters passed
to the raw encoder, each of which contains filter options.
2023-12-22 20:02:06 +08:00
Jia Tan 019afd72e0 liblzma: Improve lzma encoder init function consistency.
lzma_encoder_init() did not check for NULL options, but
lzma2_encoder_init() did. This is more of a code style improvement than
anything else to help make lzma_encoder_init() and lzma2_encoder_init()
more similar.
2023-12-22 20:02:06 +08:00
Jia Tan 6af9a4cbe5 Docs: Update repository URL in Changelog. 2023-12-22 20:02:06 +08:00
Jia Tan 3f51a4415a Tests: Silence -Wsign-conversion warning on GCC version < 10.
Since GCC version 10, GCC no longer complains about simple implicit
integer conversions with Arithmetic operators.

For instance:

    uint8_t a = 5;
    uint32_t b = a + 5;

Give a warning on GCC 9 and earlier but this:

    uint8_t a = 5;
    uint32_t b = (a + 5) * 2;

Gives a warning with GCC 10+.
2023-12-22 20:02:06 +08:00
Jia Tan 932f02990c Update THANKS. 2023-12-22 20:02:06 +08:00
Kian-Meng Ang b26d5d547f Tests: Fix typos 2023-12-22 20:02:06 +08:00
Jia Tan 7dc466d621 xz: Use is_tty() in message.c. 2023-12-22 20:02:06 +08:00
Jia Tan 0ecfaa6df9 xz: Create separate is_tty() function.
The new is_tty() will report if a file descriptor is a terminal or not.
On POSIX systems, it is a wrapper around isatty(). However, the native
Windows implementation of isatty() will return true for all character
devices, not just terminals. So is_tty() has a special case for Windows
so it can use alternative Windows API functions to determine if a file
descriptor is a terminal.

This fixes a bug with MSVC and MinGW-w64 builds that refused to read from
or write to non-terminal character devices because xz thought it was a
terminal. For instance:

    xz foo -c > /dev/null

would fail because /dev/null was assumed to be a terminal.
2023-12-22 20:02:06 +08:00
Jia Tan 9a300c9068 tuklib_integer: Fix typo discovered by codespell.
Based on internet dictionary searches, 'choise' is an outdated spelling
of 'choice'.
2023-12-22 20:02:06 +08:00
Jia Tan 9b469da8f3 Tests: Fix typo in a comment. 2023-12-22 20:02:06 +08:00
Jia Tan afcb30fcad Tests: Create test_suffix.sh.
This tests some complicated interactions with the --suffix= option.
The suffix option must be used with --format=raw, but can optionally
be used to override the default .xz suffix.

This test also verifies some recent bugs have been correctly solved
and to hopefully avoid further regressions in the future.
2023-12-22 20:02:06 +08:00
Jia Tan 87c956d4c4 xz: Fix suffix check.
The suffix refactor done in 99575947a5
had a small regression where raw format compression to standard out
failed if a suffix was not set. In this case, setting the suffix did
not make sense since a file is not created.

Now, xz should only fail when a suffix is not provided when it is
actually needed.

For instance:

    echo "foo" | xz --format=raw --lzma2 | wc -c

does not need a suffix check since it creates no files. But:

    xz --format=raw --lzma2 --suffix=.bar foo

Needs the suffix to be set since it must create foo.bar.
2023-12-22 20:02:06 +08:00
Jia Tan 84196e8c09 liblzma: Add missing comments to lz_encoder.h. 2023-12-22 20:02:03 +08:00
Jia Tan 49053c0a64 Bump version and soname for 5.4.5. 2023-11-01 20:26:15 +08:00
Jia Tan 84c0cfc556 Add NEWS for 5.4.5. 2023-11-01 20:26:12 +08:00
Lasse Collin d90ed84db9 liblzma: Fix compilation of fastpos_tablegen.c.
The macro lzma_attr_visibility_hidden has to be defined to make
fastpos.h usable. The visibility attribute is irrelevant to
fastpos_tablegen.c so simply #define the macro to an empty value.

fastpos_tablegen.c is never built by the included build systems
and so the problem wasn't noticed earlier. It's just a standalone
program for generating fastpos_table.c.

Fixes: https://github.com/tukaani-project/xz/pull/69
Thanks to GitHub user Jamaika1.
2023-11-01 20:22:15 +08:00
Jia Tan 9b1268538b Build: Fix text wrapping in an output message. 2023-10-31 21:55:21 +08:00
Lasse Collin 068ee436f4 liblzma: Use lzma_always_inline in memcmplen.h. 2023-10-31 18:44:59 +08:00
Lasse Collin 6cdf0a7b79 liblzma: #define lzma_always_inline in common.h. 2023-10-31 18:44:59 +08:00
Lasse Collin 33daad3961 liblzma: Use lzma_attr_visibility_hidden on private extern declarations.
These variables are internal to liblzma and not exposed in the API.
2023-10-31 18:44:59 +08:00
Lasse Collin 6961a5ac7d liblzma: #define lzma_attr_visibility_hidden in common.h.
In ELF shared libs:

-fvisibility=hidden affects definitions of symbols but not
declarations.[*] This doesn't affect direct calls to functions
inside liblzma as a linker can replace a call to lzma_foo@plt
with a call directly to lzma_foo when -fvisibility=hidden is used.

[*] It has to be like this because otherwise every installed
    header file would need to explictly set the symbol visibility
    to default.

When accessing extern variables that aren't defined in the
same translation unit, compiler assumes that the variable has
the default visibility and thus indirection is needed. Unlike
function calls, linker cannot optimize this.

Using __attribute__((__visibility__("hidden"))) with the extern
variable declarations tells the compiler that indirection isn't
needed because the definition is in the same shared library.

About 15+ years ago, someone told me that it would be good if
the CRC tables would be defined in the same translation unit
as the C code of the CRC functions. While I understood that it
could help a tiny amount, I didn't want to change the code because
a separate translation unit for the CRC tables was needed for the
x86 assembly code anyway. But when visibility attributes are
supported, simply marking the extern declaration with the
hidden attribute will get identical result. When there are only
a few affected variables, this is trivial to do. I wish I had
understood this back then already.
2023-10-31 18:44:59 +08:00
Lasse Collin 5b9e167649 liblzma: Refer to MinGW-w64 instead of MinGW in the API headers.
MinGW (formely a MinGW.org Project, later the MinGW.OSDN Project
at <https://osdn.net/projects/mingw/>) has GCC 9.2.0 as the
most recent GCC package (released 2021-02-02). The project might
still be alive but majority of people have switched to MinGW-w64.
Thus it seems clearer to refer to MinGW-w64 in our API headers too.
Building with MinGW is likely to still work but I haven't tested it
in the recent years.
2023-10-31 18:44:59 +08:00
Lasse Collin 36fabdbe67 CMake: Use -D_FILE_OFFSET_BITS=64 if (and only if) needed.
A CMake option LARGE_FILE_SUPPORT is created if and only if
-D_FILE_OFFSET_BITS=64 affects sizeof(off_t).

This is needed on many 32-bit platforms and even with 64-bit builds
with MinGW-w64 to get support for files larger than 2 GiB.
2023-10-31 18:44:59 +08:00
Lasse Collin 989c8c354c CMake: Generate and install liblzma.pc if not using MSVC.
Autotools based build uses -pthread and thus adds it to Libs.private
in liblzma.pc. CMake doesn't use -pthread at all if pthread functions
are available in libc so Libs.private doesn't get -pthread either.
2023-10-31 18:44:59 +08:00
Lasse Collin 983f3b458d CMake: Rearrange the PACKAGE_ variables.
The windres workaround now replaces spaces with \x20 so
the package name isn't repeated.

These changes will help with creation of liblzma.pc.
2023-10-31 18:44:59 +08:00
Lasse Collin 4083c8e950 liblzma: Add Cflags.private to liblzma.pc.in for MSYS2.
It properly adds -DLZMA_API_STATIC when compiling code that
will be linked against static liblzma. Having it there on
systems other than Windows does no harm.

See: https://www.msys2.org/docs/pkgconfig/
2023-10-31 18:44:59 +08:00
Lasse Collin 661549ecb7 CMake: Create liblzma.def when building liblzma.dll with MinGW-w64. 2023-10-31 18:44:59 +08:00
Lasse Collin 0e546eb4da CMake: Change one CMAKE_CURRENT_SOURCE_DIR to CMAKE_CURRENT_LIST_DIR.
In this case they have identical values.
2023-10-31 18:44:59 +08:00
Lasse Collin da4d04e4d6 CMake/Windows: Fix the import library filename.
Both PREFIX and IMPORT_PERFIX have to be set to "" to get
liblzma.dll and liblzma.dll.a.
2023-10-31 18:44:59 +08:00
Lasse Collin 007558a358 CMake: Don't shadow the cache entry ENABLE_THREADS with a normal variable.
Using set(ENABLE_THREADS "posix") is confusing because it sets
a new normal variable and leaves the cache entry with the same
name unchanged. The intent wasn't to change the cache entry so
this switches to a different variable name.
2023-10-31 18:44:59 +08:00
Lasse Collin 7d01de67ee CMake: Edit threading related messages.
It's mostly to change from "thread method" to "threading method".
2023-10-31 18:44:59 +08:00
Lasse Collin f8edcf3da6 CMake: Use FATAL_ERROR if user-supplied options aren't understood.
This way typos are caught quickly and compounding error messages
are avoided (a single typo could cause more than one error).

This keeps using SEND_ERROR when the system is lacking a feature
(like threading library or sandboxing method). This way the whole
configuration log will be generated in case someone wishes to
report a problem upstream.
2023-10-31 18:44:59 +08:00
Jia Tan 1695021e4a CMake: Add ALLOW_CLMUL_CRC option to enable/disable CLMUL.
The option is enabled by default, but will only be visible to a user
listing cache variables or using a CMake GUI application if the
immintrin.h header file is found.

This mirrors our Autotools build --disable-clmul-crc functionality.
2023-10-31 18:44:59 +08:00
Lasse Collin 5056bc5107 tuklib_integer: Revise unaligned reads and writes on strict-align archs.
In XZ Utils context this doesn't matter much because
unaligned reads and writes aren't used in hot code
when TUKLIB_FAST_UNALIGNED_ACCESS isn't #defined.
2023-10-31 18:44:59 +08:00
Lasse Collin 9e14743ee5 tuklib_integer: Add missing write64be and write64le fallback functions. 2023-10-31 18:44:59 +08:00
Jia Tan 4cc91ceb39 Build: Update visibility.m4 from Gnulib.
Updating from version 6 -> 8 from upstream. Declarations for variables
and function bodies were added to avoid unnecessary failures with
-Werror.
2023-10-31 18:44:59 +08:00
Lasse Collin 1824a6007c Update THANKS. 2023-10-31 18:44:59 +08:00
Jia Tan 8fdc71a27d CMake: Rename xz and man page symlink custom targets.
The Ninja Generator for CMake cannot have a custom target and its
BYPRODUCTS have the same name. This has prevented Ninja builds on
Unix-like systems since the xz symlinks were introduced in
80a1a8bb83.
2023-10-31 18:44:59 +08:00
Lasse Collin 38171492de CMake: Fix Windows build with Clang/LLVM 17.
llvm-windres 17.0.0 has more accurate emulation of GNU windres, so
the hack for GNU windres must now be used with llvm-windres too.

LLVM 16.0.6 has the old behavior and there likely won't be more
16.x releases. So we can simply check for >= 17.0.0.

The workaround must not be used with Clang that is acting in
MSVC mode. This checks for the known environments that need
the workaround instead of using "NOT MSVC".

See also:
2bcc0fdc58
2023-10-31 18:44:59 +08:00
Jia Tan 1bce6fe483 liblzma: Avoid compiler warning without creating extra symbol.
When the generic fast crc64 method is used, then we omit
lzma_crc64_table[][].

The C standards don't allow an empty translation unit which can be
avoided by declaring something, without exporting any symbols.
2023-10-31 18:44:59 +08:00
Lasse Collin dce95a593e Build: Update the comment about -Werror usage in checks. 2023-10-31 18:44:59 +08:00
Lasse Collin f3c32762ae Build: Fix underquoted AC_LANG_SOURCE.
It made no practical difference in this case.
2023-10-31 18:44:59 +08:00
Lasse Collin 7dd57f2f2c Build: Silence Autoconf warning.
There was a use of AC_COMPILE_IFELSE that didn't use
AC_LANG_SOURCE and Autoconf warned about this. The omission
had been intentional but it turned out that this didn't do
what I thought it would.

Autoconf 2.71 manual gives an impression that AC_LANG_SOURCE
inserts all #defines that have been made with AC_DEFINE so
far (confdefs.h). The idea was that omitting AC_LANG_SOURCE
would mean that only the exact code included in the
AC_COMPILE_IFELSE call would be compiled.

With C programs this is not true: the #defines get added without
AC_LANG_SOURCE too. There seems to be no neat way to avoid this.
Thus, with the C language at least, adding AC_LANG_SOURCE makes
no other difference than silencing a warning from Autoconf. The
generated "configure" remains identical. (Docs of AC_LANG_CONFTEST
say that the #defines have been inserted since Autoconf 2.63b and
that AC_COMPILE_IFELSE uses AC_LANG_CONFTEST. So the behavior is
documented if one also reads the docs of macros that one isn't
calling directly.)

Any extra code, including #defines, can cause problems for
these two tests because these tests must use -Werror.
CC=clang CFLAGS=-Weverything is the most extreme example.
It enables -Wreserved-macro-identifier which warns about
It's possible to write a test file that passes -Weverything but
it becomes impossible when Autoconf inserts confdefs.h.

So this commit adds AC_LANG_SOURCE to silence Autoconf warnings.
A different solution is needed for -Werror tests.
2023-10-31 18:44:59 +08:00
Jia Tan edec253e41 Build: Remove Gnulib dependency from tests.
The tests do not use any Gnulib replacements so they do not need to link
libgnu.a or have /lib in the include path.
2023-10-31 18:44:59 +08:00
Jia Tan 46cb133ce7 CMake: Remove /lib from tests include path.
The tests never included anything from /lib, so this was not needed.
2023-10-31 18:44:59 +08:00
Lasse Collin 4ae13cfe0d sysdefs.h: Update the comment about __USE_MINGW_ANSI_STDIO. 2023-10-31 18:44:59 +08:00
Lasse Collin 660c8c29e5 xz: Windows: Don't (de)compress to special files like "con" or "nul".
Before this commit, the following writes "foo" to the
console and deletes the input file:

    echo foo | xz > con_xz
    xz --suffix=_xz --decompress con_xz

It cannot happen without --suffix because names like con.xz
are also special and so attempting to decompress con.xz
(or compress con to con.xz) will already fail when opening
the input file.

Similar thing is possible when compressing. The following
writes to "nul" and the input file "n" is deleted.

    echo foo | xz > n
    xz --suffix=ul n

Now xz checks if the destination is a special file before
continuing. DOS/DJGPP version had a check for this but
Windows (and OS/2) didn't.
2023-10-31 18:44:59 +08:00
Lasse Collin b7ce6e8078 CMake: Wrap two overlong lines that are possible to wrap. 2023-10-31 18:44:59 +08:00
Lasse Collin 1595f454d5 CMake: Add a comment about threads on Cygwin. 2023-10-31 18:44:59 +08:00
Lasse Collin 5be6275f19 CMake: Bump maximum policy version to 3.27.
There are several new policies. CMP0149 may affect the Windows SDK
version that CMake will choose by default. The new behavior is more
predictable, always choosing the latest SDK version by default.

The other new policies shouldn't affect this package.
2023-10-31 18:44:58 +08:00
Lasse Collin e515643d75 Doxygen: Add more C macro names to PREDEFINED. 2023-10-31 01:03:25 +08:00
Lasse Collin e3478ae4f3 liblzma: Move a few __attribute__ uses in function declarations.
The API headers have many attributes but these were left
as is for now.
2023-10-31 01:03:25 +08:00
Lasse Collin b71b8922ef xz, xzdec, lzmainfo: Use tuklib_attr_noreturn.
For compatibility with C23's [[noreturn]], tuklib_attr_noreturn
must be at the beginning of declaration (before "extern" or
"static", and even before any GNU C's __attribute__).

This commit also moves all other function attributes to
the beginning of function declarations. "extern" is kept
at the beginning of a line so the attributes are listed on
separate lines before "extern" or "static".
2023-10-31 01:03:25 +08:00
Lasse Collin 359e5c6cb1 Remove incorrect uses of __attribute__((__malloc__)).
xrealloc() is obviously incorrect, modern GCC docs even
mention realloc() as an example where this attribute
cannot be used.

liblzma's lzma_alloc() and lzma_alloc_zero() would be
correct uses most of the time but custom allocators
may use a memory pool or otherwise hold the pointer
so aliasing issues could happen in theory.

The xstrdup() case likely was correct but I removed it anyway.
Now there are no __malloc__ attributes left in the code.
The allocations aren't in hot paths so this should make
no practical difference.
2023-10-31 01:03:25 +08:00
Lasse Collin 589b4cba22 Update THANKS. 2023-10-31 01:03:25 +08:00
Lasse Collin 43728ed226 Update THANKS. 2023-10-31 01:03:25 +08:00
Lasse Collin caf00e0988 liblzma: Mark crc64_clmul() with __attribute__((__no_sanitize_address__)).
Thanks to Agostino Sarubbo.
Fixes: https://github.com/tukaani-project/xz/issues/62
2023-10-31 01:03:25 +08:00
Jia Tan a70e96d2da CMake: Fix time.h checks not running on second CMake run.
If CMake was configured more than once, HAVE_CLOCK_GETTIME and
HAVE_CLOCK_MONOTONIC would not be set as compile definitions. The check
for librt being needed to provide HAVE_CLOCK_GETTIME was also
simplified.
2023-10-31 01:03:25 +08:00
Jia Tan d5275d83bd CMake: Fix unconditionally defining HAVE_CLOCK_MONOTONIC.
If HAVE_CLOCK_GETTIME was defined, then HAVE_CLOCK_MONOTONIC was always
added as a compile definition even if the check for it failed.
2023-10-31 01:03:25 +08:00
Lasse Collin 1f6e7c68fb xz: Refactor thousand separator detection and disable it on MSVC.
Now the two variations of the format strings are created with
a macro, and the whole detection code can be easily disabled
on platforms where thousand separator formatting is known to
not work (MSVC has no support, and on DJGPP 2.05 it can have
problems in some cases).
2023-10-31 01:03:25 +08:00
Lasse Collin ef71f83973 xz: Fix a too relaxed assertion and remove uses of SSIZE_MAX.
SSIZE_MAX isn't readily available on MSVC. Removing it means
that there is one thing less to worry when porting to MSVC.
2023-10-31 01:03:25 +08:00
Jia Tan cf8ba7c3a8 Tests: Improve invalid unpadded size check in test_lzma_index_append().
This check was extended to test the code added to fix a failing assert
in 68bda971bb.
2023-10-31 01:02:59 +08:00
Jia Tan 4a4180ce74 Tests: Improve comments in test_index.c. 2023-10-26 06:22:24 +08:00
Jia Tan 4b23b84b89 Update THANKS. 2023-10-26 06:22:24 +08:00
Jia Tan 773f1e8622 liblzma: Update assert in vli_ceil4().
The argument to vli_ceil4() should always guarantee the return value
is also a valid lzma_vli. Thus the highest three valid lzma_vli values
are invalid arguments. All uses of the function ensure this so the
assert is updated to match this.
2023-10-26 06:22:24 +08:00
Jia Tan 68bda971bb liblzma: Add overflow check for Unpadded size in lzma_index_append().
This was not a security bug since there was no path to overflow
UINT64_MAX in lzma_index_append() or when it calls index_file_size().
The bug was discovered by a failing assert() in vli_ceil4() when called
from index_file_size() when unpadded_sum (the sum of the compressed size
of current Stream and the unpadded_size parameter) exceeds LZMA_VLI_MAX.

Previously, the unpadded_size parameter was checked to be not greater
than UNPADDED_SIZE_MAX, but no check was done once compressed_base was
added.

This could not have caused an integer overflow in index_file_size() when
called by lzma_index_append(). The calculation for file_size breaks down
into the sum of:

- Compressed base from all previous Streams
- 2 * LZMA_STREAM_HEADER_SIZE (size of the current Streams header and
  footer)
- stream_padding (can be set by lzma_index_stream_padding())
- Compressed base from the current Stream
- Unpadded size (parameter to lzma_index_append())

The sum of everything except for Unpadded size must be less than
LZMA_VLI_MAX. This is guarenteed by overflow checks in the functions
that can set these values including lzma_index_stream_padding(),
lzma_index_append(), and lzma_index_cat(). The maximum value for
Unpadded size is enforced by lzma_index_append() to be less than or
equal UNPADDED_SIZE_MAX. Thus, the sum cannot exceed UINT64_MAX since
LZMA_VLI_MAX is half of UINT64_MAX.

Thanks to Joona Kannisto for reporting this.
2023-10-26 06:22:24 +08:00
Jia Tan b41bb79c60 Translations: Update the Esperanto translation. 2023-10-26 06:22:24 +08:00
Jia Tan 6614e6d4bf Docs: Update INSTALL for --enable-threads method win95.
The Autotools build allows win95 threads and --enable-small together now
if the compiler supports __attribute__((__constructor__)).
2023-10-26 06:22:24 +08:00
Jia Tan bfb623ad96 CMake: Conditionally allow win95 threads and --enable-small. 2023-10-26 06:22:24 +08:00
Jia Tan e919ebb29a Build: Conditionally allow win95 threads and --enable-small.
When the compiler supports __attribute__((__constructor__))
mythread_once() is never used, even with --enable-small. A configuration
with win95 threads and --enable-small will compile and be thread safe so
it can be allowed.

This isn't a very common configuration since MSVC does not support
__attribute__((__constructor__)), but MINGW32 and CLANG32 environments
for MSYS2 can use win95 threads and have
__attribute__((__constructor__)) support.
2023-10-26 06:22:24 +08:00
Jamaika1 c0c0cd4a48 mythread.h: Fix typo error in Vista threads mythread_once().
The "once_" variable was accidentally referred to as just "once". This
prevented building with Vista threads when
HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR was not defined.
2023-10-26 06:22:24 +08:00
Jia Tan d93fbefcc4 Tests: Style fixes to test_lzip_decoder.c. 2023-10-26 06:22:24 +08:00
Jia Tan 65981d8e45 Translations: Update the Chinese (simplified) translation. 2023-10-26 06:22:22 +08:00
Lasse Collin a108ed5891 xz: Omit an empty paragraph on the man page. 2023-08-02 17:39:50 +03:00
Jia Tan 03c51c5c08 Bump version and soname for 5.4.4. 2023-08-02 20:32:20 +08:00
Jia Tan d7fa3f1b58 Add NEWS for 5.4.4. 2023-08-02 20:30:54 +08:00
Lasse Collin 6a1093c000 build-aux/manconv.sh: Fix US-ASCII and UTF-8 output.
groff defaults to SGR escapes. Using -P-c passes -c to grotty
which restores the old behavior. Perhaps there is a better way to
get pure plain text output but this works for now.
2023-08-02 15:20:31 +03:00
Lasse Collin f6f9f5651a Update THANKS. 2023-08-01 19:10:58 +03:00
Lasse Collin 0dd83ba876 Update THANKS. 2023-08-01 18:44:02 +03:00
ChanTsune 4170a80785 mythread.h: Disable signal functions in builds targeting Wasm + WASI.
signal.h in WASI SDK doesn't currently provide sigprocmask()
or sigset_t. liblzma doesn't need them so this change makes
liblzma and xzdec build against WASI SDK. xz doesn't build yet
and the tests don't either as tuktest needs setjmp() which
isn't (yet?) implemented in WASI SDK.

Closes: https://github.com/tukaani-project/xz/pull/57
See also: https://github.com/tukaani-project/xz/pull/56

(The original commit was edited a little by Lasse Collin.)
2023-08-01 18:44:02 +03:00
Dimitri Papadopoulos Orfanos 0db6fbe0be Docs: Fix typos found by codespell 2023-08-01 18:44:02 +03:00
Jia Tan 84a3a1f4e4 Update .gitignore. 2023-08-01 18:42:23 +03:00
Jia Tan 962b3d41e0 CMake: Conditionally allow the creation of broken symlinks.
The CMake build will try to create broken symlinks on Unix and Unix-like
platforms. Cygwin and MSYS2 are Unix-like, but may not be able to create
broken symlinks. The value of the CYGWIN or MSYS environment variables
determine if broken symlinks are valid.

The default for MSYS2 does not allow for broken symlinks, so the CMake
build has been broken for MSYS2 since commit
80a1a8bb83.
2023-08-01 18:41:42 +03:00
Jia Tan 19899340cf liblzma: Prevent an empty translation unit in Windows builds.
To workaround Automake lacking Windows resource compiler support, an
empty source file is compiled to overwrite the resource files for static
library builds. Translation units without an external declaration are
not allowed by the C standard and result in a warning when used with
-Wempty-translation-unit (Clang) or -pedantic (GCC).
2023-08-01 18:41:42 +03:00
Jia Tan ef7fbe8393 Tests: Skip .lz files in test_files.sh if not configured.
Previously if the lzip decoder was not configured then test_files.sh
would pass the lzip tests instead of skipping them.
2023-08-01 18:41:42 +03:00
Jia Tan e49815ba7a Tests: Add ARM64 filter test to test_compress.sh. 2023-08-01 18:41:23 +03:00
Jia Tan db5b57b827 Translations: Update the Vietnamese translation. 2023-07-31 21:26:52 +08:00
Jia Tan e6ba501408 Translations: Update the Croatian translation. 2023-07-31 21:25:46 +08:00
Jia Tan 82657a1f10 Translations: Update the Korean man page translations. 2023-07-31 21:25:41 +08:00
Jia Tan fab35907d1 Translations: Update the Korean translation. 2023-07-31 21:25:36 +08:00
Jia Tan f530fe1964 Translations: Update the Polish translation. 2023-07-31 21:25:33 +08:00
Jia Tan 10b3500cc2 Translations: Update the German man page translations. 2023-07-31 21:25:30 +08:00
Jia Tan 3d14e8a34d Translations: Update the German translation. 2023-07-31 21:25:27 +08:00
Jia Tan bdcc180a2d Translations: Update the Chinese (simplified) translation. 2023-07-31 21:25:23 +08:00
Jia Tan 844240350d Translations: Update the Swedish translation. 2023-07-31 21:25:20 +08:00
Jia Tan bdc7952bcf Translations: Update the Ukrainian man page translations. 2023-07-31 21:25:16 +08:00
Jia Tan 143396e070 Translations: Update the Ukrainian translation. 2023-07-31 21:25:13 +08:00
Jia Tan 1b8146d64e Translations: Update the Spanish translation. 2023-07-31 21:25:09 +08:00
Jia Tan f947ce09d7 Translations: Update the Romanian translation. 2023-07-31 21:25:05 +08:00
Jia Tan f681301a36 Translations: Update the Romanian man page translations. 2023-07-31 21:24:58 +08:00
Jia Tan 8bc3146c6b xz: Update man page Authors and date. 2023-07-18 23:24:02 +08:00
Jia Tan c2905540ef xz: Slight reword in xz man page for consistency.
Changed will print => prints in xz --robot --version description to
match --robot --info-memory description.
2023-07-18 23:24:02 +08:00
Jia Tan 2600d33524 liblzma: Improve comment in string_conversion.c.
The comment used "flag" when referring to decoder options. Just
referring to them as options is more clear and consistent.
2023-07-18 23:24:02 +08:00
Jia Tan 98fc14541e liblzma: Reword lzma_str_list_filters() documentation.
Reword "options required" to "options read". The previous wording
may have suggested that the options listed were all required when
the filters are used for encoding or decoding. Now it should be
more clear that the options listed are the ones relevant for
encoding or decoding.
2023-07-18 23:21:23 +08:00
Lasse Collin 1ac79b4cba xz: Translate the second "%s: " in message.c since French needs "%s : ".
This string is used to print a filename when using "xz -v" and
stderr isn't a terminal.
2023-07-18 17:41:55 +03:00
Lasse Collin 97851be2c6 xz: Make "%s: %s" translatable because French needs "%s : %s". 2023-07-18 14:37:07 +03:00
Lasse Collin b406828a6d liblzma: Tweak #if condition in memcmplen.h.
Maybe ICC always #defines _MSC_VER on Windows but now
it's very clear which code will get used.
2023-07-18 14:03:08 +03:00
Lasse Collin ef4a07ad94 liblzma: Omit unnecessary parenthesis in a preprocessor directive. 2023-07-18 14:03:08 +03:00
Jia Tan 64ee0caaea liblzma: Prevent warning for MSYS2 Windows build.
In lzma_memcmplen(), the <intrin.h> header file is only included if
_MSC_VER and _M_X64 are both defined but _BitScanForward64() was
previously used if _M_X64 was defined. GCC for MSYS2 defines _M_X64 but
not _MSC_VER so _BitScanForward64() was used without including
<intrin.h>.

Now, lzma_memcmplen() will use __builtin_ctzll() for MSYS2 GCC builds as
expected.
2023-07-18 14:03:08 +03:00
Jia Tan ba17705764 Docs: Add a new section to INSTALL for Tests.
The new Tests section describes basic information about the tests, how
to run them, and important details when cross compiling. We have had a
few questions about how to compile the tests without running them, so
hopefully this information will help others with the same question in the
future.

Fixes: https://github.com/tukaani-project/xz/issues/54
2023-07-18 13:28:51 +03:00
Jia Tan 0745b900fa Docs: Update README.
This adds an entry to "Other implementations of the .xz format" for
XZ for Java.
2023-07-18 13:28:51 +03:00
Jia Tan c972d44103 xz: Fix typo in man page.
The Memory limit information section described three output
columns when it actually has six. This was reworded to
"multiple" to make it more future proof.
2023-07-18 13:27:46 +03:00
Jia Tan 6e21f1b4e2 Tests: Improve feature testing for skipping.
Fixed a bug where test_compress_* would all fail if arm64 or armthumb
filters were enabled for compression but arm was disabled. Since the
grep tests only checked for "define HAVE_ENCODER_ARM", this would match
on HAVE_ENCODER_ARM64 or HAVE_ENCODER_ARMTHUMB.

Now the config.h feature test requires " 1" at the end to prevent the
prefix problem. have_feature() was also updated for this even though
there were known current bugs affecting it. This is just in case future
features have a similar prefix problem.
2023-07-18 13:26:48 +03:00
Jia Tan 26c37d290c Translations: Update the Chinese (traditional) translation. 2023-07-18 13:26:48 +03:00
Jia Tan 2ec65181e2 Translations: Update the Vietnamese translation. 2023-07-18 13:26:48 +03:00
Jia Tan c44c7e7590 Tests: Fix memory leaks in test_index.
Several tests were missing calls to lzma_index_end() to clean up the
lzma_index structs. The memory leaks were discovered by using
-fsanitize=address with GCC.
2023-07-18 13:26:48 +03:00
Jia Tan b9499c94fc Tests: Fix memory leaks in test_block_header.
test_block_header was not properly freeing the filter options between
calls to lzma_block_header_decode(). The memory leaks were discovered by
using -fsanitize=address with GCC.
2023-07-18 13:26:48 +03:00
Jia Tan 1155471651 liblzma: Prevent uninitialzed warning in mt stream encoder.
This change only impacts the compiler warning since it was impossible
for the wait_abs struct in stream_encode_mt() to be used before it was
initialized since mythread_condtime_set() will always be called before
mythread_cond_timedwait().

Since the mythread.h code is different between the POSIX and
Windows versions, this warning was only present on Windows builds.

Thanks to Arthur S for reporting the warning and providing an initial
patch.
2023-07-18 13:20:16 +03:00
Jia Tan 62dd1c9bf0 Update THANKS. 2023-07-18 13:03:12 +03:00
Benjamin Buch d04eb78ab3 CMake: Protects against double find_package
Boost iostream uses `find_package` in quiet mode and then again uses
`find_package` with required. This second call triggers a
`add_library cannot create imported target "LibLZMA::LibLZMA"
because another target with the same name already exists.`

This can simply be fixed by skipping the alias part on secondary
`find_package` runs.
2023-07-18 13:02:02 +03:00
Jia Tan 12ea1fb297 Translations: Update the Esperanto translation. 2023-07-18 12:59:10 +03:00
Jia Tan a4d45c07c1 Translations: Update the Croatian translation. 2023-07-18 12:59:10 +03:00
Jia Tan f51b7bcea6 Translations: Update the Chinese (simplified) translation. 2023-07-18 12:59:10 +03:00
Jia Tan d5b81c19a7 Translations: Update German translation of man pages. 2023-07-18 12:59:10 +03:00
Jia Tan 36860a3e30 Translations: Update the German translation. 2023-07-18 12:59:10 +03:00
Jia Tan f05641ef0d Translations: Update the Croatian translation. 2023-07-18 12:59:10 +03:00
Jia Tan b852f6f11d Translations: Update Korean translation of man pages. 2023-07-18 12:59:10 +03:00
Jia Tan fdcb78fb6f Translations: Update the Korean translation. 2023-07-18 12:59:10 +03:00
Jia Tan 9e39cebe3c Translations: Update the Spanish translation. 2023-07-18 12:59:10 +03:00
Jia Tan 7a578d1d82 Translations: Update the Romanian translation. 2023-07-18 12:59:10 +03:00
Jia Tan 362320fea5 Translations: Update Romanian translation of man pages. 2023-07-18 12:59:10 +03:00
Jia Tan 29c5a870be Translations: Update Ukrainian translation of man pages. 2023-07-18 12:59:10 +03:00
Jia Tan 5ee5757277 Translations: Update the Ukrainian translation. 2023-07-18 12:59:10 +03:00
Jia Tan dfc257bdb2 Translations: Update the Polish translation. 2023-07-18 12:59:10 +03:00
Jia Tan f6df4c4ab7 Translations: Update the Swedish translation. 2023-07-18 12:59:10 +03:00
Jia Tan 25da22e052 Translations: Update the Esperanto translation. 2023-07-18 12:59:09 +03:00
Jia Tan 4f57a9c991 liblzma: Adds lzma_nothrow to MicroLZMA API functions.
None of the liblzma functions may throw an exception, so this
attribute should be applied to all liblzma API functions.
2023-07-18 12:48:53 +03:00
Jia Tan 238b4e5458 Translations: Update the Croatian translation. 2023-05-04 22:23:01 +08:00
Jia Tan 0cee63c3c6 Bump version and soname for 5.4.3. 2023-05-04 22:02:29 +08:00
Jia Tan 01f937ea9a Add NEWS for 5.4.3. 2023-05-04 22:02:29 +08:00
Lasse Collin e9b9ea9531 tuklib_integer.h: Fix a recent copypaste error in Clang detection.
Wrong line was changed in 7062348bf3.
Also, this has >= instead of == since ints larger than 32 bits would
work too even if not relevant in practice.
2023-05-03 22:55:54 +03:00
Jia Tan be6e39a862 Update THANKS. 2023-04-25 20:19:37 +08:00
Jia Tan 9e343a46cf Windows: Include <intrin.h> when needed.
Legacy Windows did not need to #include <intrin.h> to use the MSVC
intrinsics. Newer versions likely just issue a warning, but the MSVC
documentation says to include the header file for the intrinsics we use.

GCC and Clang can "pretend" to be MSVC on Windows, so extra checks are
needed in tuklib_integer.h to only include <intrin.h> when it will is
actually needed.
2023-04-25 20:19:32 +08:00
Jia Tan 12321a9390 tuklib_integer: Use __builtin_clz() with Clang.
Clang has support for __builtin_clz(), but previously Clang would
fallback to either the MSVC intrinsic or the regular C code. This was
discovered due to a bug where a new version of Clang required the
<intrin.h> header file in order to use the MSVC intrinsics.

Thanks to Anton Kochkov for notifying us about the bug.
2023-04-25 20:19:28 +08:00
Lasse Collin d1f0e01c39 liblzma: Update project maintainers in lzma.h.
AUTHORS was updated earlier, lzma.h was simply forgotten.
2023-04-25 20:19:21 +08:00
Jia Tan 8204c5d130 liblzma: Cleans up old commented out code. 2023-04-25 20:19:10 +08:00
Jia Tan 32980d1562 CMake: Update liblzma-config.cmake generation.
Now that the threading is configurable, the liblzma CMake package only
needs the threading library when using POSIX threads.
2023-04-25 20:18:55 +08:00
Jia Tan 023907faa9 CMake: Allows setting thread method.
The thread method is now configurable for the CMake build. It matches
the Autotools build by allowing ON (pick the best threading method),
OFF (no threading), posix, win95, and vista. If both Windows and
posix threading are both available, then ON will choose Windows
threading. Windows threading will also not use:

target_link_libraries(liblzma Threads::Threads)

since on systems like MinGW-w64 it would link the posix threads
without purpose.
2023-04-25 20:18:45 +08:00
Jia Tan ba176d77cb CMake: Only build xzdec if decoders are enabled. 2023-04-25 20:18:31 +08:00
Jia Tan c99d697df8 Build: Removes redundant check for LZMA1 filter support. 2023-04-25 20:18:18 +08:00
Lasse Collin 54a2fd8c85 CMake: Bump maximum policy version to 3.26.
It adds only one new policy related to FOLDERS which we don't use.
This makes it clear that the code is compatible with the policies
up to 3.26.
2023-04-25 20:18:08 +08:00
Jia Tan 622d0fdc02 CMake: Conditionally build xz list.* files if decoders are enabled. 2023-04-25 20:18:00 +08:00
Jia Tan 3e2dc523c5 CMake: Allow configuring features as cache variables.
This allows users to change the features they build either in
CMakeCache.txt or by using a CMake GUI. The sources built for
liblzma are affected by this too, so only the necessary files
will be compiled.
2023-04-25 20:17:49 +08:00
Lasse Collin 0c053f9733 Build: Add a comment that AC_PROG_CC_C99 is needed for Autoconf 2.69.
It's obsolete in Autoconf >= 2.70 and just an alias for AC_PROG_CC
but Autoconf 2.69 requires AC_PROG_CC_C99 to get a C99 compiler.
2023-03-21 14:14:35 +02:00
Lasse Collin 915d4f6058 Build: configure.ac: Use AS_IF and AS_CASE where required.
This makes no functional difference in the generated configure
(at least with the Autotools versions I have installed) but this
change might prevent future bugs like the one that was just
fixed in the commit 5a5bd7f871.
2023-03-21 14:14:35 +02:00
Lasse Collin b848c03958 Update THANKS. 2023-03-21 14:14:35 +02:00
Lasse Collin c775ba1602 Build: Fix --disable-threads breaking the building of shared libs.
This is broken in the releases 5.2.6 to 5.4.2. A workaround
for these releases is to pass EGREP='grep -E' as an argument
to configure in addition to --disable-threads.

The problem appeared when m4/ax_pthread.m4 was updated in
the commit 6629ed929c which
introduced the use of AC_EGREP_CPP. AC_EGREP_CPP calls
AC_REQUIRE([AC_PROG_EGREP]) to set the shell variable EGREP
but this was only executed if POSIX threads were enabled.
Libtool code also has AC_REQUIRE([AC_PROG_EGREP]) but Autoconf
omits it as AC_PROG_EGREP has already been required earlier.
Thus, if not using POSIX threads, the shell variable EGREP
would be undefined in the Libtool code in configure.

ax_pthread.m4 is fine. The bug was in configure.ac which called
AX_PTHREAD conditionally in an incorrect way. Using AS_CASE
ensures that all AC_REQUIREs get always run.

Thanks to Frank Busse for reporting the bug.
Fixes: https://github.com/tukaani-project/xz/issues/45
2023-03-21 14:14:35 +02:00
Lasse Collin 0673c9ec98 liblzma: Silence -Wsign-conversion in SSE2 code in memcmplen.h.
Thanks to Christian Hesse for reporting the issue.
Fixes: https://github.com/tukaani-project/xz/issues/44
2023-03-19 22:46:26 +02:00
Jia Tan 6ca8046ecb Bump version and soname for 5.4.2. 2023-03-18 23:22:06 +08:00
Jia Tan ce4f246600 Add NEWS for 5.4.2. 2023-03-18 22:24:08 +08:00
Lasse Collin 3634fe3307 Update the copy of GNU GPLv3 from gnu.org to COPYING.GPLv3. 2023-03-18 22:02:45 +08:00
Lasse Collin 97679d25ce Change a few HTTP URLs to HTTPS.
The xz man page timestamp was intentionally left unchanged.
2023-03-18 22:02:40 +08:00
Jia Tan 01a67e89a5 CMake: Fix typo in a comment. 2023-03-18 00:41:09 +08:00
Lasse Collin 5dca3f5cba Windows: build.bash: Copy liblzma API docs to the output package. 2023-03-18 00:39:32 +08:00
Lasse Collin ae252862b3 Windows: Add microlzma_*.c to the VS project files.
These should have been included in 5.3.2alpha already.
2023-03-17 20:19:38 +08:00
Lasse Collin 147d282cc3 CMake: Add microlzma_*.c to the build.
These should have been included in 5.3.2alpha already.
2023-03-17 20:19:34 +08:00
Lasse Collin 4523a5ee29 Build: Update comments about unaligned access to mention 64-bit. 2023-03-17 20:19:29 +08:00
Lasse Collin 82aacb4036 Tests: Update .gitignore. 2023-03-17 20:19:24 +08:00
Lasse Collin 5d022c2492 po4a/update-po: Display the script name consistently in error messages. 2023-03-17 20:19:20 +08:00
Jia Tan 8962951173 Doc: Rename Doxygen HTML doc directory name liblzma => api.
When the docs are installed, calling the directory "liblzma" is
confusing since multiple other files in the doc directory are for
liblzma. This should also make it more natural for distros when they
package the documentation.
2023-03-17 20:19:16 +08:00
Jia Tan 94097157fa liblzma: Remove note from lzma_options_bcj about the ARM64 exception.
This was left in by mistake since an early version of the ARM64 filter
used a different struct for its options.
2023-03-17 20:19:10 +08:00
Lasse Collin da16d0b73b COPYING: Add a note about the included Doxygen-generated HTML. 2023-03-17 20:19:02 +08:00
Jia Tan e57c74f9ef Doc: Update PACKAGERS with details about liblzma API docs install. 2023-03-17 20:18:57 +08:00
Jia Tan 7e2fa48bb7 liblzma: Add set lzma.h as the main page for Doxygen documentation.
The \mainpage command is used in the first block of comments in lzma.h.
This changes the previously nearly empty index.html to use the first
comment block in lzma.h for its contents.

lzma.h is no longer documented separately, but this is for the better
since lzma.h only defined a few macros that users do not need to use.
The individual API header files all have a disclaimer that they should
not be #included directly, so there should be no confusion on the fact
that lzma.h should be the only header used by applications.

Additionally, the note "See ../lzma.h for information about liblzma as
a whole." was removed since lzma.h is now the main page of the
generated HTML and does not have its own page anymore. So it would be
confusing in the HTML version and was only a "nice to have" when
browsing the source files.
2023-03-17 20:18:52 +08:00
Jia Tan d42977c7ac Build: Generate doxygen documentation in autogen.sh.
Another command line option (--no-doxygen) was added to disable
creating the doxygen documenation in cases where it not wanted or
if the doxygen tool is not installed.
2023-03-17 20:18:46 +08:00
Jia Tan 8fc712fcf4 Build: Create doxygen/update-doxygen script.
This is a helper script to generate the Doxygen documentation. It can be
run in 'liblzma' or 'internal' mode by setting the first argument. It
will default to 'liblzma' mode and only generate documentation for the
liblzma API header files.

The helper script will be run during the custom mydist hook when we
create releases. This hook already alters the source directory, so its
fine to do it here too. This way, we can include the Doxygen generated
files in the distrubtion and when installing.

In 'liblzma' mode, the JavaScript is stripped from the .html files and
the .js files are removed. This avoids license hassle from jQuery and
other libraries that Doxygen 1.9.6 puts into jquery.js in minified form.
2023-03-17 20:18:41 +08:00
Jia Tan 77d2c025d1 Build: Install Doxygen docs and include in distribution if generated.
Added a install-data-local target to install the Doxygen documentation
only when it has been generated. In order to correctly remove the docs,
a corresponding uninstall-local target was added.

If the doxygen docs exist in the source tree, they will also be included
in the distribution now too.
2023-03-17 20:18:36 +08:00
Jia Tan 9af8f6f947 Doxygen: Refactor Doxyfile.in to doxygen/Doxyfile.
Instead of having Doxyfile.in configured by Autoconf, the Doxyfile
can have the tags that need to be configured piped into the doxygen
command through stdin with the overrides after Doxyfile's contents.

Going forward, the documentation should be generated in two different
modes: liblzma or internal.

liblzma is useful for most users. It is the documentation for just
the liblzma API header files. This is the default.

internal is for people who want to understand how xz and liblzma work.
It might be useful for people who want to contribute to the project.
2023-03-17 20:17:27 +08:00
Jia Tan 1c558a2692 Tests: Remove unused macros and functions. 2023-03-13 20:53:26 +08:00
Jia Tan 7479a69a45 Tests: Refactors existing lzma_index tests.
Converts the existing lzma_index tests into tuktests and covers every
API function from index.h except for lzma_file_info_decoder, which can
be tested in the future.
2023-03-13 20:53:12 +08:00
Lasse Collin fd56d53533 xz: Make Capsicum sandbox more strict with stdin and stdout. 2023-03-11 19:34:39 +02:00
Lasse Collin d1bdaaebc6 xz: Don't fail if Capsicum is enabled but kernel doesn't support it.
(This commit combines related commits from the master branch.)

If Capsicum support is missing from the kernel or xz is being run
in an emulator that lacks Capsicum suport, the syscalls will fail
and set errno to ENOSYS. Previously xz would display and error and
exit, making xz unusable. Now it will check for ENOSYS and run
without sandbox support. Other tools like ssh behave similarly.

Displaying a warning for missing Capsicum support was considered
but such extra output would quickly become annoying. It would also
break test_scripts.sh in "make check".

Also move cap_enter() to be the first step instead of the last one.
This matches the example in the cap_rights_limit(2) man page. With
the current code it shouldn't make any practical difference though.

Thanks to Xin Li for the bug report, suggesting a fix, and testing:
https://github.com/tukaani-project/xz/pull/43

Thanks to Jia Tan for most of the original commits.
2023-03-11 19:31:40 +02:00
Jia Tan 5d351c69c1 Build: Adjust CMake version search regex.
Now, the LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, and LZMA_VERSION_PATCH
macros do not need to be on consecutive lines in version.h. They can be
separated by more whitespace, comments, or even other content, as long
as they appear in the proper order (major, minor, patch).
2023-03-07 23:57:39 +08:00
Jia Tan b82d4831e3 liblzma: Improve documentation for version.h.
Specified parameter and return values for API functions and documented
a few more of the macros.
2023-03-07 23:57:39 +08:00
Jia Tan 2caba3efe3 liblzma: Clarify lzma_lzma_preset() documentation in lzma12.h.
lzma_lzma_preset() does not guarentee that the lzma_options_lzma are
usable in an encoder even if it returns false (success). If liblzma
is built with default configurations, then the options will always be
usable. However if the match finders hc3, hc4, or bt4 are disabled, then
the options may not be usable depending on the preset level requested.

The documentation was updated to reflect this complexity, since this
behavior was unclear before.
2023-03-07 23:25:17 +08:00
Lasse Collin 594f904673 CMake: Require that the C compiler supports C99 or a newer standard.
Thanks to autoantwort for reporting the issue and suggesting
a different patch:
https://github.com/tukaani-project/xz/pull/42
2023-03-07 23:25:12 +08:00
Jia Tan 88101143cb Tests: Small tweak to test-vli.c.
The static global variables can be disabled if encoders and decoders
are not built. If they are not disabled and -Werror is used, it will
cause an usused warning as an error.
2023-03-07 23:24:56 +08:00
Jia Tan 4042dbf03a liblzma: Replace '\n' -> newline in filter.h documentation.
The '\n' renders as a newline when the comments are converted to html
by Doxygen.
2023-03-07 23:24:46 +08:00
Jia Tan 3971f5c502 liblzma: Shorten return description for two functions in filter.h.
Shorten the description for lzma_raw_encoder_memusage() and
lzma_raw_decoder_memusage().
2023-03-07 23:24:42 +08:00
Jia Tan 5e61b39432 liblzma: Reword a few lines in filter.h 2023-03-07 23:24:38 +08:00
Jia Tan 8a53533869 liblzma: Improve documentation in filter.h.
All functions now explicitly specify parameter and return values.
The notes and code annotations were moved before the parameter and
return value descriptions for consistency.

Also, the description above lzma_filter_encoder_is_supported() about
not being able to list available filters was removed since
lzma_str_list_filters() will do this.
2023-03-07 23:24:32 +08:00
Lasse Collin 6d05b08b17 Update THANKS. 2023-03-07 23:24:27 +08:00
Lasse Collin dfc9a54082 liblzma: Avoid null pointer + 0 (undefined behavior in C).
In the C99 and C17 standards, section 6.5.6 paragraph 8 means that
adding 0 to a null pointer is undefined behavior. As of writing,
"clang -fsanitize=undefined" (Clang 15) diagnoses this. However,
I'm not aware of any compiler that would take advantage of this
when optimizing (Clang 15 included). It's good to avoid this anyway
since compilers might some day infer that pointer arithmetic implies
that the pointer is not NULL. That is, the following foo() would then
unconditionally return 0, even for foo(NULL, 0):

    void bar(char *a, char *b);

    int foo(char *a, size_t n)
    {
        bar(a, a + n);
        return a == NULL;
    }

In contrast to C, C++ explicitly allows null pointer + 0. So if
the above is compiled as C++ then there is no undefined behavior
in the foo(NULL, 0) call.

To me it seems that changing the C standard would be the sane
thing to do (just add one sentence) as it would ensure that a huge
amount of old code won't break in the future. Based on web searches
it seems that a large number of codebases (where null pointer + 0
occurs) are being fixed instead to be future-proof in case compilers
will some day optimize based on it (like making the above foo(NULL, 0)
return 0) which in the worst case will cause security bugs.

Some projects don't plan to change it. For example, gnulib and thus
many GNU tools currently require that null pointer + 0 is defined:

    https://lists.gnu.org/archive/html/bug-gnulib/2021-11/msg00000.html

    https://www.gnu.org/software/gnulib/manual/html_node/Other-portability-assumptions.html

In XZ Utils null pointer + 0 issue should be fixed after this
commit. This adds a few if-statements and thus branches to avoid
null pointer + 0. These check for size > 0 instead of ptr != NULL
because this way bugs where size > 0 && ptr == NULL will likely
get caught quickly. None of them are in hot spots so it shouldn't
matter for performance.

A little less readable version would be replacing

    ptr + offset

with

    offset != 0 ? ptr + offset : ptr

or creating a macro for it:

    #define my_ptr_add(ptr, offset) \
            ((offset) != 0 ? ((ptr) + (offset)) : (ptr))

Checking for offset != 0 instead of ptr != NULL allows GCC >= 8.1,
Clang >= 7, and Clang-based ICX to optimize it to the very same code
as ptr + offset. That is, it won't create a branch. So for hot code
this could be a good solution to avoid null pointer + 0. Unfortunately
other compilers like ICC 2021 or MSVC 19.33 (VS2022) will create a
branch from my_ptr_add().

Thanks to Marcin Kowalczyk for reporting the problem:
https://github.com/tukaani-project/xz/issues/36
2023-03-07 23:24:15 +08:00
Jia Tan f6dce49cb6 liblzma: Adjust container.h for consistency with filter.h. 2023-03-07 23:24:09 +08:00
Jia Tan 173d240bb4 liblzma: Fix small typos and reword a few things in filter.h. 2023-03-07 23:24:05 +08:00
Jia Tan 17797bacde liblzma: Convert list of flags in lzma_mt to bulleted list. 2023-03-07 23:24:00 +08:00
Jia Tan 37da0e7271 liblzma: Fix typo in documentation in container.h
lzma_microlzma_decoder -> lzma_microlzma_encoder
2023-03-07 23:23:55 +08:00
Jia Tan b8331077c6 liblzma: Improve documentation for container.h
Standardizing each function to always specify parameters and return
values. Also moved the parameters and return values to the end of each
function description.
2023-03-07 23:23:51 +08:00
Jia Tan b9a3511bb6 CMake: Add LZIP decoder test to list of tests. 2023-03-07 23:23:41 +08:00
Lasse Collin cd82ef2fb4 Update THANKS. 2023-03-07 23:23:34 +08:00
Lasse Collin 076e911ba2 Build: Use only the generic symbol versioning on MicroBlaze.
On MicroBlaze, GCC 12 is broken in sense that
__has_attribute(__symver__) returns true but it still doesn't
support the __symver__ attribute even though the platform is ELF
and symbol versioning is supported if using the traditional
__asm__(".symver ...") method. Avoiding the traditional method is
good because it breaks LTO (-flto) builds with GCC.

See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

For now the only extra symbols in liblzma_linux.map are the
compatibility symbols with the patch that spread from RHEL/CentOS 7.
These require the use of __symver__ attribute or __asm__(".symver ...")
in the C code. Compatibility with the patch from CentOS 7 doesn't
seem valuable on MicroBlaze so use liblzma_generic.map on MicroBlaze
instead. It doesn't require anything special in the C code and thus
no LTO issues either.

An alternative would be to detect support for __symver__
attribute in configure.ac and CMakeLists.txt and fall back
to __asm__(".symver ...") but then LTO would be silently broken
on MicroBlaze. It sounds likely that MicroBlaze is a special
case so let's treat it as a such because that is simpler. If
a similar issue exists on some other platform too then hopefully
someone will report it and this can be reconsidered.

(This doesn't do the same fix in CMakeLists.txt. Perhaps it should
but perhaps CMake build of liblzma doesn't matter much on MicroBlaze.
The problem breaks the build so it's easy to notice and can be fixed
later.)

Thanks to Vincent Fazio for reporting the problem and proposing
a patch (in the end that solution wasn't used):
https://github.com/tukaani-project/xz/pull/32
2023-03-07 23:23:29 +08:00
Lasse Collin bc34e5ac99 liblzma: Very minor API doc tweaks.
Use "member" to refer to struct members as that's the term used
by the C standard.

Use lzma_options_delta.dist and such in docs so that in Doxygen's
HTML output they will link to the doc of the struct member.

Clean up a few trailing white spaces too.
2023-03-07 23:23:19 +08:00
Jia Tan d31fbd28be liblzma: Adjust spacing in doc headers in bcj.h. 2023-03-07 23:23:04 +08:00
Jia Tan 701e9be6be liblzma: Adjust documentation in bcj.h for consistent style. 2023-03-07 23:22:57 +08:00
Jia Tan 762c4d0b62 liblzma: Rename field => member in documentation.
Also adjusted preset value => preset level.
2023-03-07 23:22:46 +08:00
Lasse Collin 0ce1db0223 liblzma: Silence a warning from MSVC.
It gives C4146 here since unary minus with unsigned integer
is still unsigned (which is the intention here). Doing it
with substraction makes it clearer and avoids the warning.

Thanks to Nathan Moinvaziri for reporting this.
2023-03-07 23:22:21 +08:00
Jia Tan d83da006b3 liblzma: Improve documentation for stream_flags.h
Standardizing each function to always specify parameters and return
values. Also moved the parameters and return values to the end of each
function description.

A few small things were reworded and long sentences broken up.
2023-03-07 23:21:47 +08:00
Jia Tan 2796bb4736 liblzma: Improve documentation in lzma12.h.
All functions now explicitly specify parameter and return values.
2023-02-15 22:48:21 +08:00
Jia Tan ebebaa8d93 liblzma: Improve documentation in check.h.
All functions now explicitly specify parameter and return values.
Also moved the note about SHA-256 functions not being exported to the
top of the file.
2023-02-15 22:48:07 +08:00
Jia Tan 765fa2865a liblzma: Improve documentation in index.h
All functions now explicitly specify parameter and return values.
2023-02-15 22:47:59 +08:00
Jia Tan 918e208af5 liblzma: Reword a comment in index.h. 2023-02-15 22:47:55 +08:00
Jia Tan 1f157d214b liblzma: Omit lzma_index_iter's internal field from Doxygen docs.
Add \private above this field and its sub-fields since it is not meant
to be modified by users.
2023-02-15 22:47:36 +08:00
Jia Tan 28757fa46d liblzma: Fix documentation for LZMA_MEMLIMIT_ERROR.
LZMA_MEMLIMIT_ERROR was missing the "<" character needed to put
documentation after a member.
2023-02-15 22:47:29 +08:00
Jia Tan 135d5a1a65 liblzma: Improve documentation for base.h.
Standardizing each function to always specify params and return values.
Also fixed a small grammar mistake.
2023-02-15 22:46:41 +08:00
Jia Tan 2287d56683 liblzma: Minor improvements to vli.h.
Added [out] annotations to parameters that are pointers and can have
their value changed. Also added a clarification to lzma_vli_is_valid.
2023-02-15 22:46:25 +08:00
Jia Tan 7124b8a16a liblzma: Add comments for macros in delta.h.
Document LZMA_DELTA_DIST_MIN and LZMA_DELTA_DIST_MAX for completeness
and to avoid Doxygen warnings.
2023-02-15 22:45:57 +08:00
Jia Tan 59c7bb8931 liblzma: Improve documentation in index_hash.h.
All functions now explicitly specify parameter and return values.
Also reworded the description of lzma_index_hash_init() for readability.
2023-02-15 22:45:51 +08:00
Jia Tan e970c28ac3 liblzma: Fix bug in lzma_str_from_filters() not checking filters[] length.
The bug is only a problem in applications that do not properly terminate
the filters[] array with LZMA_VLI_UNKNOWN or have more than
LZMA_FILTERS_MAX filters. This bug does not affect xz.
2023-02-03 21:43:01 +08:00
Jia Tan 85e01266a9 Tests: Create test_filter_str.c.
Tests lzma_str_to_filters(), lzma_str_from_filters(), and
lzma_str_list_filters() API functions.
2023-02-03 21:42:48 +08:00
Jia Tan 3fa0f3ba12 liblzma: Fix typos in comments in string_conversion.c. 2023-02-03 21:42:40 +08:00
Jia Tan 32dbe045d7 liblzma: Clarify block encoder and decoder documentation.
Added a few sentences to the description for lzma_block_encoder() and
lzma_block_decoder() to highlight that the Block Header must be coded
before calling these functions.
2023-02-03 21:42:35 +08:00
Jia Tan ccf12acbfa Update lzma_block documentation for lzma_block_uncomp_encode(). 2023-02-03 21:42:30 +08:00
Jia Tan 6a0b168dd9 liblzma: Minor edits to lzma_block header_size documentation. 2023-02-03 21:42:27 +08:00
Jia Tan 84ce36f90e liblzma: Enumerate functions that read version in lzma_block. 2023-02-03 21:42:24 +08:00
Jia Tan d662077468 liblzma: Clarify comment in block.h. 2023-02-03 21:42:19 +08:00
Jia Tan 880adb5aa2 liblzma: Improve documentation for block.h.
Standardizing each function to always specify params and return values.
Output pointer parameters are also marked with doxygen style [out] to
make it clear. Any note sections were also moved above the parameter and
return sections for consistency.
2023-02-03 21:42:14 +08:00
Jia Tan b5b1b1f061 liblzma: Clarify a comment about LZMA_STR_NO_VALIDATION.
The flag description for LZMA_STR_NO_VALIDATION was previously confusing
about the treatment for filters than cannot be used with .xz format
(lzma1) without using LZMA_STR_ALL_FILTERS. Now, it is clear that
LZMA_STR_NO_VALIDATION is not a super set of LZMA_STR_ALL_FILTERS.
2023-02-03 21:42:07 +08:00
Jia Tan e904e778b8 Translations: Add Brazilian Portuguese translation of man pages.
Thanks to Rafael Fontenelle.
2023-02-03 21:39:59 +08:00
Jia Tan e9c47e79c9 liblzma: Fix documentation in filter.h for lzma_str_to_filters()
The previous documentation for lzma_str_to_filters() was technically
correct, but misleading. lzma_str_to_filters() returns NULL on success,
which is in practice always defined to 0. This is the same value as
LZMA_OK, but lzma_str_to_filters() does not return lzma_ret so we should
be more clear.
2023-02-03 21:38:26 +08:00
Jia Tan 99575947a5 xz: Refactor duplicated check for custom suffix when using --format=raw 2023-02-03 21:38:26 +08:00
Jia Tan 76dec92fcc liblzma: Set documentation on all reserved fields to private.
This prevents the reserved fields from being part of the generated
Doxygen documentation.
2023-02-03 21:38:26 +08:00
Jia Tan bd213d06eb liblzma: Highlight liblzma API headers should not be included directly.
This improves the generated Doxygen HTML files to better highlight
how to properly use the liblzma API header files.
2023-02-03 21:38:26 +08:00
Jia Tan 257dbff0ba tuklib_physmem: Silence warning from -Wcast-function-type on MinGW-w64.
tuklib_physmem depends on GetProcAddress() for both MSVC and MinGW-w64
to retrieve a function address. The proper way to do this is to cast the
return value to the type of function pointer retrieved. Unfortunately,
this causes a cast-function-type warning, so the best solution is to
simply ignore the warning.
2023-02-03 21:38:13 +08:00
Jia Tan 720ad4a442 xz: Add missing comment for coder_set_compression_settings() 2023-02-03 21:11:32 +08:00
Jia Tan 88dc191634 xz: Do not set compression settings with raw format in list mode.
Calling coder_set_compression_settings() in list mode with verbose mode
on caused the filter chain and memory requirements to print. This was
unnecessary since the command results in an error and not consistent
with other formats like lzma and alone.
2023-02-03 21:11:11 +08:00
Jia Tan 039e0ab13e Translations: Update the Brazilian Portuguese translation. 2023-02-03 21:10:57 +08:00
Lasse Collin 718f7a60e7 Build: Omit -Wmissing-noreturn from the default warnings.
It's not that important. It can be annoying in builds that
disable many features since in those cases the tests programs
will correctly trigger this warning with Clang.
2023-02-03 21:10:47 +08:00
Lasse Collin 3ccedb0972 xz: Use ssize_t for the to-be-ignored return value from write(fd, ptr, 1).
It makes no difference here as the return value fits into an int
too and it then gets ignored but this looks better.
2023-02-03 21:10:42 +08:00
Lasse Collin 09fbd2f052 xz: Silence warnings from -Wsign-conversion in a 32-bit build. 2023-02-03 21:10:38 +08:00
Lasse Collin 683d3f178e liblzma: Silence another warning from -Wsign-conversion in a 32-bit build.
It doesn't warn on a 64-bit system because truncating
a ptrdiff_t (signed long) to uint32_t is diagnosed under
-Wconversion by GCC and -Wshorten-64-to-32 by Clang.
2023-02-03 21:10:30 +08:00
Lasse Collin 2b8062ef94 liblzma: Silence a warning from -Wsign-conversion in a 32-bit build. 2023-02-03 21:10:25 +08:00
Lasse Collin b16b9c0d22 Build: Make configure add more warning flags for GCC and Clang.
-Wstrict-aliasing was removed from the list since it is enabled
by -Wall already.

A normal build is clean with these on GNU/Linux x86-64 with
GCC 12.2.0 and Clang 14.0.6.
2023-02-03 21:10:19 +08:00
Lasse Collin c47ecd6d39 Tests: Fix warnings from clang --Wassign-enum.
Explicitly casting the integer to lzma_check silences the warning.
Since such an invalid value is needed in multiple tests, a constant
INVALID_LZMA_CHECK_ID was added to tests.h.

The use of 0x1000 for lzma_block.check wasn't optimal as if
the underlying type is a char then 0x1000 will be truncated to 0.
However, in these test cases the value is ignored, thus even with
such truncation the test would have passed.
2023-02-03 21:10:06 +08:00
Lasse Collin 34e13ce015 Tests: Silence warnings from -Wsign-conversion.
Note that assigning an unsigned int to lzma_check doesn't warn
on GNU/Linux x86-64 since the enum type is unsigned on that
platform. The enum can be signed on some other platform though
so it's best to use enumeration type lzma_check in these situations.
2023-02-03 21:10:01 +08:00
Lasse Collin 6671d0fe46 liblzma: Silence warnings from clang -Wconditional-uninitialized.
This is similar to 2ce4f36f17.
The actual initialization of the variables is done inside
mythread_sync() macro. Clang doesn't seem to see that
the initialization code inside the macro is always executed.
2023-02-03 21:09:42 +08:00
Lasse Collin d3e833ca1d Fix warnings from clang -Wdocumentation. 2023-02-03 21:09:35 +08:00
Lasse Collin 977dd2e26b Tests: test_lzip_decoder: Remove trailing white-space. 2023-02-03 21:09:12 +08:00
Lasse Collin c55157ed74 Tests: test_lzip_decoder: Silence warnings from -Wsign-conversion. 2023-02-03 21:07:57 +08:00
Lasse Collin 18b845e697 Bump version and soname for 5.4.1. 2023-01-11 18:52:54 +02:00
Jia Tan 4080bbb844 Add NEWS for 5.4.1. 2023-01-11 18:52:23 +02:00
Lasse Collin 674c89fdb8 sysdefs.h: Don't include strings.h anymore.
On some platforms src/xz/suffix.c may need <strings.h> for
strcasecmp() but suffix.c includes the header when it needs it.

Unless there is an old system that otherwise supports enough C99
to build XZ Utils but doesn't have C89/C90-compatible <string.h>,
there should be no need to include <strings.h> in sysdefs.h.
2023-01-11 17:49:59 +02:00
Lasse Collin 2a6b938084 xz: Include <strings.h> in suffix.c if needed for strcasecmp().
SUSv2 and POSIX.1‐2017 declare only a few functions in <strings.h>.
Of these, strcasecmp() is used on some platforms in suffix.c.
Nothing else in the project needs <strings.h> (at least if
building on a modern system).

sysdefs.h currently includes <strings.h> if HAVE_STRINGS_H is
defined and suffix.c relied on this.

Note that dos/config.h doesn't #define HAVE_STRINGS_H even though
DJGPP does have strings.h. It isn't needed with DJGPP as strcasecmp()
is also in <string.h> in DJGPP.
2023-01-11 17:49:59 +02:00
Jia Tan aea639e81b xz: Fix warning -Wformat-nonliteral on clang in message.c.
clang and gcc differ in how they handle -Wformat-nonliteral. gcc will
allow a non-literal format string as long as the function takes its
format arguments as a va_list.
2023-01-11 17:31:54 +02:00
Jia Tan e3b42bfcb0 Tests: Fix test_filter_flags copy/paste error. 2023-01-11 17:31:54 +02:00
Jia Tan 21625b7e11 Tests: Fix type-limits warning in test_filter_flags.
This only occurs in test_filter_flags when the BCJ filters are not
configured and built. In this case, ARRAY_SIZE() returns 0 and causes a
type-limits warning with the loop variable since an unsigned number will
always be >= 0.
2023-01-11 17:31:54 +02:00
Lasse Collin c337983e92 liblzma: CLMUL CRC64: Work around a bug in MSVC, second attempt.
This affects only 32-bit x86 builds. x86-64 is OK as is.

I still cannot easily test this myself. The reporter has tested
this and it passes the tests included in the CMake build and
performance is good: raw CRC64 is 2-3 times faster than the
C version of the slice-by-four method. (Note that liblzma doesn't
include a MSVC-compatible version of the 32-bit x86 assembly code
for the slice-by-four method.)

Thanks to Iouri Kharon for figuring out a fix, testing, and
benchmarking.
2023-01-11 17:31:54 +02:00
Jia Tan b7fb438ea0 Tests: Fix unused function warning in test_block_header.
One of the global arrays of filters was only used in a test that
required both encoders and decoders to be configured in the build.
2023-01-11 17:31:54 +02:00
Jia Tan 68e9ef036d Tests: Fix unused function warning in test_index_hash.
test_index_hash does not use fill_index_hash() unless both encoders
and decoders are configured in the build.
2023-01-11 17:31:54 +02:00
Lasse Collin a387707cd8 Windows: Update INSTALL-MSVC.txt to recommend CMake over project files. 2023-01-11 17:30:30 +02:00
Lasse Collin 52902ad695 Revert "liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022)."
This reverts commit 36edc65ab4.

It was reported that it wasn't a good enough fix and MSVC
still produced (different kind of) bad code when building
for 32-bit x86 if optimizations are enabled.

Thanks to Iouri Kharon.
2023-01-10 12:51:19 +02:00
Lasse Collin e81b9fc48c sysdefs.h: Fix a comment. 2023-01-10 10:26:59 +02:00
Lasse Collin 6e89ab58b0 sysdefs.h: Don't include memory.h anymore even if it were available.
It quite probably was never needed, that is, any system where memory.h
was required likely couldn't compile XZ Utils for other reasons anyway.

XZ Utils 5.2.6 and later source packages were generated using
Autoconf 2.71 which no longer defines HAVE_MEMORY_H. So the code
being removed is no longer used anyway.
2023-01-10 10:26:59 +02:00
Lasse Collin 65c59ad429 CMake/Windows: Add a workaround for windres from GNU binutils.
This is combined from the following commits in the master branch:
443dfebced
6b117d3b1f
5e34774c31

Thanks to Iouri Kharon for the bug report, the original patch,
and testing.
2023-01-10 08:50:26 +02:00
Lasse Collin 43521e77ac Tests: test_filter_flags: Clean up minor issues.
Here are the list of the most significant issues addressed:
- Avoid using internal common.h header. It's not good to copy the
constants like this but common.h cannot be included for use outside
of liblzma. This is the quickest thing to do that could be fixed later.

- Omit the INIT_FILTER macro. Initialization should be done with just
regular designated initializers.

- Use start_offset = 257 for BCJ tests. It demonstrates that Filter
Flags encoder and decoder don't validate the options thoroughly.
257 is valid only for the x86 filter. This is a bit silly but
not a significant problem in practice because the encoder and
decoder initialization functions will catch bad alignment still.
Perhaps this should be fixed but it's not urgent and doesn't need
to be in 5.4.x.

- Various tweaks to comments such as filter id -> Filter ID
2023-01-09 16:58:27 +02:00
Jia Tan 6b44cead95 Tests: Refactors existing filter flags tests.
Converts the existing filter flags tests into tuktests.
2023-01-09 16:58:27 +02:00
Lasse Collin 1bbefa9659 Tests: tuktest.h: Support tuktest_malloc(0).
It's not needed in XZ Utils at least for now. It's good to support
it still because if such use is needed later, it wouldn't be
caught on GNU/Linux since malloc(0) from glibc returns non-NULL.
2023-01-09 16:58:27 +02:00
Lasse Collin ce3a3fbc7c CMake: Update cmake_minimum_required from 3.13...3.16 to 3.13...3.25.
The changes listed on cmake-policies(7) for versions 3.17 to 3.25
shouldn't affect this project.
2023-01-09 16:58:27 +02:00
Lasse Collin 99fcd57f2e Update THANKS. 2023-01-09 16:58:27 +02:00
Lasse Collin c0c13d9d82 Update THANKS. 2023-01-09 16:58:27 +02:00
Lasse Collin 3d45987451 CMake: Fix a copypaste error in xzdec Windows resource file handling.
It was my mistake. Thanks to Iouri Kharon for the bug report.
2023-01-09 16:58:27 +02:00
Lasse Collin 706bce5018 CMake/Windows: Add resource files to xz.exe and xzdec.exe.
The command line tools cannot be built with MSVC for now but
they can be built with MinGW-w64.

Thanks to Iouri Kharon for the bug report and the original patch.
2023-01-09 16:58:27 +02:00
Lasse Collin e96dee55df liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022).
I haven't tested with MSVC myself and there doesn't seem to be
information about the problem online, so I'm relying on the bug report.

Thanks to Iouri Kharon for the bug report and the patch.
2023-01-09 16:58:27 +02:00
Lasse Collin 52bc1ee34d Build: Require that _mm_set_epi64x() is usable to enable CLMUL support.
VS2013 doesn't have _mm_set_epi64x() so this way CLMUL gets
disabled with VS2013.

Thanks to Iouri Kharon for the bug report.
2023-01-09 16:58:27 +02:00
Jia Tan bad44cfe19 Tests: Creates test_index_hash.c
Tests all API functions exported from index_hash.h. Does not have a
dedicated test for lzma_index_hash_end.

[Minor edits were made by Lasse Collin.]
2023-01-09 16:56:07 +02:00
Jia Tan 692ccdf551 liblzma: Remove common.h include from common/index.h.
common/index.h is needed by liblzma internally and tests. common.h will
include and define many things that are not needed by the tests.

Also, this prevents include order problems because both common.h and
lzma.h define LZMA_API. On most platforms it results only in a warning
but on Windows it would break the build as the definition in common.h
must be used only for building liblzma itself.
2023-01-09 16:37:19 +02:00
Jia Tan 2ac7bafc8f liblzma: Add NULL check to lzma_index_hash_append.
This is for consistency with lzma_index_append.
2023-01-09 16:34:32 +02:00
Jia Tan db714d30e0 liblzma: Replaced hardcoded 0x0 index indicator byte with macro 2023-01-09 16:34:32 +02:00
Jia Tan 39d2585dcd Style: Change #if !defined() to #ifndef in mythread.h. 2023-01-09 16:33:53 +02:00
Jia Tan 3f0130aa28 Build: Add missing stream_decoder_mt.c to .vcxproj files.
The line in the .vcxproj files for building with was missing in 5.4.0.
Thank to Hajin Jang for reporting the issue.
2023-01-09 16:33:53 +02:00
Lasse Collin f204d1050a Update THANKS. 2023-01-04 23:17:09 +02:00
Lasse Collin 34a9c2d650 Tests: Adjust style in test_compress.sh. 2023-01-04 23:17:09 +02:00
Jia Tan 761c208d58 Tests: Replace non portable shell parameter expansion
The shell parameter expansion using # and ## is not supported in
Solaris 10 Bourne shell (/bin/sh). Even though this is POSIX, it is not fully
portable, so we should avoid it.
2023-01-05 00:30:22 +08:00
Jia Tan 8a7cbc0745 Translations: Add Korean translation of man pages.
Thanks to Seong-ho Cho
2023-01-05 00:30:14 +08:00
Jia Tan ca2af49bb8 Translations: Update the Esperanto translation. 2023-01-05 00:30:05 +08:00
Lasse Collin bfba3394ae Build: Fix config.h comments. 2023-01-05 00:29:52 +08:00
Jia Tan 507648ad11 Build: Only define HAVE_PROGRAM_INVOCATION_NAME if it is set to 1.
HAVE_DECL_PROGRAM_INVOCATION_NAME is renamed to
HAVE_PROGRAM_INVOCATION_NAME. Previously,
HAVE_DECL_PROGRAM_INVOCATION_NAME was always set when
building with autotools. CMake would only set this when it was 1, and the
dos/config.h did not define it. The new macro definition is consistent
across build systems.
2023-01-05 00:29:39 +08:00
Lasse Collin ab5229d32a Tests: test_check: Test corner cases of CLMUL CRC64. 2023-01-05 00:28:09 +08:00
Lasse Collin 8791826f31 Tests: Clarify a comment in test_lzip_decoder.c. 2023-01-05 00:28:01 +08:00
Jia Tan c410d812ea xz: Includes <time.h> and <sys/time.h> conditionally in mytime.c.
Previously, mytime.c depended on mythread.h for <time.h> to be included.
2023-01-05 00:27:51 +08:00
Jia Tan 501c6013d4 liblzma: Includes sys/time.h conditionally in mythread
Previously, <sys/time.h> was always included, even if mythread only used
clock_gettime. <time.h> is still needed even if clock_gettime is not used
though because struct timespec is needed for mythread_condtime.
2023-01-05 00:26:45 +08:00
Jia Tan 9e3cb514b5 Build: No longer require HAVE_DECL_CLOCK_MONOTONIC to always be set.
Previously, if threading was enabled HAVE_DECL_CLOCK_MONOTONIC would always
be set to 0 or 1. However, this macro was needed in xz so if xz was not
built with threading and HAVE_DECL_CLOCK_MONOTONIC was not defined but
HAVE_CLOCK_GETTIME was, it caused a warning during build. Now,
HAVE_DECL_CLOCK_MONOTONIC has been renamed to HAVE_CLOCK_MONOTONIC and
will only be set if it is 1.
2023-01-05 00:26:35 +08:00
Jia Tan 6fc3e54679 Translations: Add Ukrainian translations of man pages.
Thanks to Yuri Chornoivan
2022-12-28 01:20:44 +08:00
Jia Tan e84f2ab7f8 liblzma: Update documentation for lzma_filter_encoder. 2022-12-28 01:20:27 +08:00
Jia Tan b14b8dbba9 Tests: Adds lzip decoder tests 2022-12-28 01:20:16 +08:00
Jia Cheong Tan 09a114805e Doxygen: Update .gitignore for generating docs for in source build.
In source builds are not recommended, but we should still ignore
the generated artifacts.
2022-12-20 22:23:59 +08:00
Jia Tan d3e6fe4419 liblzma: Fix lzma_microlzma_encoder() return value.
Using return_if_error on lzma_lzma_lclppb_encode was improper because
return_if_error is expecting an lzma_ret value, but
lzma_lzma_lclppb_encode returns a boolean. This could result in
lzma_microlzma_encoder, which would be misleading for applications.
2022-12-20 22:23:59 +08:00
Lasse Collin b55a27b46f liblzma: Update authors list in arm64.c. 2022-12-20 22:23:59 +08:00
Jia Tan 2fd28d2b7c CMake: Update .gitignore for CMake artifacts from in source build.
In source builds are not recommended, but we can make it easier
by ignoring the generated artifacts from CMake.
2022-12-16 20:58:55 +08:00
404 changed files with 18382 additions and 28233 deletions

View File

@ -1,24 +0,0 @@
[codespell]
# Skip all translation files and a few other autogenerated files.
# The autotool files should have their typos fixed in the upstream, but
# until then we will blacklist them here.
skip = *.po,*.pot,./po4a/man,./doc/api,./configure,./autom4te.cache,./m4/libtool.m4,./build-aux/depcomp,./build-aux/ltmain.sh,./build-aux/config.guess,./build-aux/config.rpath,./m4/po.m4,./build-aux/config.sub
# Ignore false positive matching words. Ideally codespell would allow
# ignoring words for specific files, but that does not appear to be
# supported. Instead we need to hope we do not make these typos.
# Additionally, the ignored words must be specified lower-case even though
# some of the false positives only occurred upper-case.
# ANS - used as a variable name in xzmore.in.
# bu - groff syntax for creating a bullet list item, used in xz.1.
# te - groff syntax, used in xz.1.
# caf - command line options for tar example, used in xz.1.
ignore-words-list = ans,bu,te,caf
# Add extra dictionaries to help improvement comments, docs, etc.
builtin = clear,rare,informal,usage,names
# Always default to highest interactive level to avoid accidentally
# changing a false positive or picking the wrong replacement.
interactive = 3

23
.github/SECURITY.md vendored
View File

@ -1,23 +0,0 @@
# Security Policy
## Supported Versions
We provide security updates to the development branch and the stable
branches. Security patches for old releases are available on the
[project website](https://xz.tukaani.org/xz-utils/).
## Reporting a Vulnerability
If you discover a security vulnerability in this project, please
report it privately. **Do not disclose it as a public issue.** This gives
us time to work with you to fix the issue before public exposure, reducing
the chance that the exploit will be used before a patch is released.
You may submit a report by emailing us at
[xz@tukaani.org](mailto:xz@tukaani.org), or through
[Security Advisories](https://github.com/tukaani-project/xz/security/advisories/new).
While both options are available, we prefer email.
This project is maintained by a team of volunteers on a reasonable-effort
basis. As such, please give us 90 days to work on a fix before
public exposure.

View File

@ -1,160 +0,0 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
#
# Author: Jia Tan
#
#############################################################################
name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows running workflow manually
workflow_dispatch:
jobs:
POSIX:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_system: [autotools, cmake]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 #v4.1.0
########################
# Install Dependencies #
########################
# Install Autotools on Linux
- name: Install Dependencies
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential po4a autopoint gcc-multilib doxygen musl-tools
# Install Autotools on Mac
- name: Install Dependencies
if: ${{ matrix.os == 'macos-latest' && matrix.build_system == 'autotools' }}
run: brew install autoconf automake libtool po4a doxygen
# Install CMake on Linux
- name: Install Dependencies
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'cmake' }}
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake musl-tools
# Install CMake on Mac
- name: Install Dependencies
if: ${{ matrix.os == 'macos-latest' && matrix.build_system == 'cmake' }}
run: brew install cmake
##################
# Build and Test #
##################
# -b specifies the build system to use.
# -p specifies the phase (build or test) to help narrow down an error
# if one occurs.
#
# The first two builds/tests are only run on Autotools Linux and
# affect the CFLAGS. Resetting the CFLAGS requires clearing the
# config cache between runs, so the tests that require CFLAGS are
# done first.
- name: Build 32-bit
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.sh -b autotools -p build -f "-m32"
- name: Test 32-bit
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
./build-aux/ci_build.sh -b autotools -p test -f "-m32" -n 32_bit
cd ../xz_build && make distclean
# ifunc must be disabled for this test because __attribute__ ifunc is
# incompatible with -fsanitize=address.
#
# The sandbox must also be disabled because it will prevent access to
# the /proc/ filesystem on Linux, which is used by the sanitizer's
# instrumentation.
- name: Build with -fsanitize=address,undefined
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.sh -b autotools -p build -f "-fsanitize=address,undefined" -d ifunc,sandbox
- name: Test with -fsanitize=address,undefined
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
./build-aux/ci_build.sh -b autotools -p test -f "-fsanitize=address,undefined" -d ifunc,sandbox
cd ../xz_build && make distclean
# musl libc has some slight differences compared to glibc, including
# the lack of ifunc support. This tests if the ifunc detection
# functions properly since musl-gcc can compile with ifunc support,
# but will fail at runtime.
- name: Build with musl libc
if: ${{ matrix.os == 'ubuntu-latest'}}
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p build -m "/usr/bin/musl-gcc"
- name: Test with musl libc
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p test -m "/usr/bin/musl-gcc"
- name: Clean up musl libc run
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: cd ../xz_build && make distclean
- name: Build with full features
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p build
- name: Test with full features
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p test -n full_features
- name: Build without encoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d encoders,shared -p build
- name: Test without encoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
- name: Build without decoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d decoders,shared -p build
- name: Test without decoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
- name: Build without threads
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d threads,shared -p build
- name: Test without threads
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
- name: Build without BCJ filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d bcj,shared,nls -p build
- name: Test without BCJ filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d bcj,shared,nls -p test -n no_bcj
- name: Build without Delta filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d delta,shared,nls -p build
- name: Test without Delta filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d delta,shared,nls -p test -n no_delta
- name: Build without sha256 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p build
- name: Test without sha256 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p test -n no_sha256
- name: Build without crc64 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p build
- name: Test without crc64 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p test -n no_crc64
- name: Build small
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d small -p build
- name: Test small
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d small -p test -n small
# Attempt to upload the test logs as artifacts if any step has failed
- uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0
if: ${{ failure() }}
with:
name: ${{ matrix.os }} ${{ matrix.build_system }} Test Logs
path: build-aux/artifacts

View File

@ -1,124 +0,0 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
#
# Author: Jia Tan
#
#############################################################################
name: Windows-CI
# Only run the Windows CI manually since it takes much longer than the others.
on: workflow_dispatch
jobs:
POSIX:
strategy:
matrix:
# Test different environments since the code may change between
# them and we want to ensure that we support all potential users.
# clang64 builds are currently broken when building static libraries
# due to a bug in ldd search path:
# https://github.com/llvm/llvm-project/issues/67779
# TODO - re-enable clang64 when this is resolved.
msys2_env: [mingw64, mingw32, ucrt64, msys]
build_system: [autotools, cmake]
# Set the shell to be msys2 as a default to avoid setting it for
# every individual run command.
defaults:
run:
shell: msys2 {0}
runs-on: windows-latest
steps:
#####################
# Setup Environment #
#####################
# Rely on the msys2 GitHub Action to set up the msys2 environment.
- name: Setup MSYS2
uses: msys2/setup-msys2@27b3aa77f672cb6b3054121cfd80c3d22ceebb1d #v2.20.1
with:
msystem: ${{ matrix.msys2_env }}
update: true
install: pactoys make
- name: Checkout code
# Need to explicitly set the shell here since we set the default
# shell as msys2 earlier. This avoids an extra msys2 dependency on
# git.
shell: powershell
# Avoid Windows line endings. Otherwise test_scripts.sh will fail
# because the expected output is stored in the test framework as a
# text file and will not match the output from xzgrep.
run: git config --global core.autocrlf false
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 #v4.1.0
########################
# Install Dependencies #
########################
# The pacman repository has a different naming scheme for default
# msys packages than the others. The pacboy tool allows installing
# the packages possible in matrix setup without a burdensome amount
# of ifs.
- name: Install Dependencies
if: ${{ matrix.msys2_env == 'msys' && matrix.build_system == 'autotools' }}
run: pacman --noconfirm -S --needed autotools base-devel doxygen gettext-devel gcc
- name: Install Dependencies
if: ${{ matrix.msys2_env != 'msys' && matrix.build_system == 'autotools' }}
run: pacboy --noconfirm -S --needed autotools:p toolchain:p doxygen:p
- name: Install Dependencies
if: ${{ matrix.msys2_env == 'msys' && matrix.build_system == 'cmake' }}
run: pacman --noconfirm -S --needed cmake base-devel gcc
- name: Install Dependencies
if: ${{ matrix.msys2_env != 'msys' && matrix.build_system == 'cmake' }}
run: pacboy --noconfirm -S --needed cmake:p toolchain:p
##################
# Build and Test #
##################
- name: Build with full features
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -p build
- name: Test with full features
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -p test -n full_features
- name: Build without threads
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p build
- name: Test without threads
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
- name: Build without encoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p build
- name: Test without encoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
- name: Build without decoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p build
- name: Test without decoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
- name: Build with only crc32 check
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p build
- name: Test with only crc32 check
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p test -n crc32_only
###############
# Upload Logs #
###############
# Upload the test logs as artifacts if any step has failed.
- uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0
if: ${{ failure() }}
with:
name: ${{ matrix.msys2_env }} ${{ matrix.build_system }} Test Logs
path: build-aux/artifacts

2
.gitignore vendored
View File

@ -25,7 +25,6 @@ Makefile.in
/libtool /libtool
/stamp-h1 /stamp-h1
build-aux/artifacts
build-aux/compile build-aux/compile
build-aux/config.guess build-aux/config.guess
build-aux/config.rpath build-aux/config.rpath
@ -67,7 +66,6 @@ coverage
/tests/test_index /tests/test_index
/tests/test_index_hash /tests/test_index_hash
/tests/test_lzip_decoder /tests/test_lzip_decoder
/tests/test_microlzma
/tests/test_memlimit /tests/test_memlimit
/tests/test_stream_flags /tests/test_stream_flags
/tests/test_vli /tests/test_vli

40
AUTHORS
View File

@ -9,13 +9,15 @@ Authors of XZ Utils
specifically the LZMA SDK <https://7-zip.org/sdk.html>. Without specifically the LZMA SDK <https://7-zip.org/sdk.html>. Without
this code, XZ Utils wouldn't exist. this code, XZ Utils wouldn't exist.
The SHA-256 implementation in liblzma is based on code written by The SHA-256 implementation in liblzma is based on the code found from
Wei Dai in Crypto++ Library <https://www.cryptopp.com/>. 7-Zip <https://7-zip.org/>, which has a modified version of the SHA-256
code found from Crypto++ <https://www.cryptopp.com/>. The SHA-256 code
in Crypto++ was written by Kevin Springle and Wei Dai.
A few scripts have been adapted from GNU gzip. The original Some scripts have been adapted from gzip. The original versions
versions were written by Jean-loup Gailly, Charles Levert, and were written by Jean-loup Gailly, Charles Levert, and Paul Eggert.
Paul Eggert. Andrew Dudman helped adapting the scripts and their Andrew Dudman helped adapting the scripts and their man pages for
man pages for XZ Utils. XZ Utils.
The initial version of the threaded .xz decompressor was written The initial version of the threaded .xz decompressor was written
by Sebastian Andrzej Siewior. by Sebastian Andrzej Siewior.
@ -23,31 +25,15 @@ Authors of XZ Utils
The initial version of the .lz (lzip) decoder was written The initial version of the .lz (lzip) decoder was written
by Michał Górny. by Michał Górny.
Architecture-specific CRC optimizations were contributed by CLMUL-accelerated CRC code was contributed by Ilya Kurdyukov.
Ilya Kurdyukov, Hans Jansen, and Chenxi Mao.
Other authors: Other authors:
- Jonathan Nieder - Jonathan Nieder
- Joachim Henke - Joachim Henke
Many people have contributed improvements or reported bugs. The GNU Autotools-based build system contains files from many authors,
Most of these people are mentioned in the file THANKS. which I'm not trying to list here.
The translations of the command line tools and man pages have been Several people have contributed fixes or reported bugs. Most of them
contributed by many people via the Translation Project: are mentioned in the file THANKS.
- https://translationproject.org/domain/xz.html
- https://translationproject.org/domain/xz-man.html
The authors of the translated man pages are in the header comments
of the man page files. In the source package, the authors of the
translations are in po/*.po and po4a/*.po files.
Third-party code whose authors aren't listed here:
- GNU getopt_long() in the 'lib' directory is included for
platforms that don't have a usable getopt_long().
- The build system files from GNU Autoconf, GNU Automake,
GNU Libtool, GNU Gettext, Autoconf Archive, and related files.

File diff suppressed because it is too large Load Diff

107
COPYING
View File

@ -6,95 +6,72 @@ XZ Utils Licensing
is a rough summary of which licenses apply to which parts of this is a rough summary of which licenses apply to which parts of this
package (but check the individual files to be sure!): package (but check the individual files to be sure!):
- liblzma is under the BSD Zero Clause License (0BSD). - liblzma is in the public domain.
- The command line tools xz, xzdec, lzmadec, and lzmainfo are - xz, xzdec, and lzmadec command line tools are in the public
under 0BSD except that, on systems that don't have a usable domain unless GNU getopt_long had to be compiled and linked
getopt_long, GNU getopt_long is compiled and linked in from the in from the lib directory. The getopt_long code is under
'lib' directory. The getopt_long code is under GNU LGPLv2.1+. GNU LGPLv2.1+.
- The scripts to grep, diff, and view compressed files have been - The scripts to grep, diff, and view compressed files have been
adapted from GNU gzip. These scripts (xzgrep, xzdiff, xzless, adapted from gzip. These scripts and their documentation are
and xzmore) are under GNU GPLv2+. The man pages of the scripts under GNU GPLv2+.
are under 0BSD; they aren't based on the man pages of GNU gzip.
- Most of the XZ Utils specific documentation that is in - All the documentation in the doc directory and most of the
plain text files (like README, INSTALL, PACKAGERS, NEWS, XZ Utils specific documentation files in other directories
and ChangeLog) are under 0BSD unless stated otherwise in are in the public domain.
the file itself. The files xz-file-format.txt and
lzma-file-format.xt are in the public domain but may
be distributed under the terms of 0BSD too.
- Doxygen-generated HTML version of the liblzma API documentation:
While Doxygen is under the GNU GPLv2, the license information
in Doxygen includes the following exception:
Documents produced by doxygen are derivative works
derived from the input used in their production;
they are not affected by this license.
Note: The JavaScript files (under the MIT license) have Note: The JavaScript files (under the MIT license) have
been removed from the Doxygen output. been removed from the Doxygen-generated HTML version of the
liblzma API documentation. Doxygen itself is under the GNU GPL
but the remaining files generated by Doxygen are not affected
by the licenses used in Doxygen because Doxygen licensing has
the following exception:
- The XZ logo (xz-logo.png) included in the Doxygen-generated "Documents produced by doxygen are derivative works
documentation is under the Creative Commons BY-SA 4.0 license. derived from the input used in their production;
they are not affected by this license."
- Translated messages and man pages are under 0BSD except that - Translated messages are in the public domain.
some old translations are in the public domain.
- Test files and test code in the 'tests' directory, and - The build system contains public domain files, and files that
debugging utilities in the 'debug' directory are under are under GNU GPLv2+ or GNU GPLv3+. None of these files end up
the BSD Zero Clause License (0BSD). in the binaries being built.
- The GNU Autotools based build system contains files that are - Test files and test code in the tests directory, and debugging
under GNU GPLv2+, GNU GPLv3+, and a few permissive licenses. utilities in the debug directory are in the public domain.
These files don't affect the licensing of the binaries being
built.
- The extra directory contain files that are under various - The extra directory may contain public domain files, and files
free software licenses. that are under various free software licenses.
For the files under the BSD Zero Clause License (0BSD), if You can do whatever you want with the files that have been put into
a copyright notice is needed, the following is sufficient: the public domain. If you find public domain legally problematic,
take the previous sentence as a license grant. If you still find
the lack of copyright legally problematic, you have too many
lawyers.
Copyright (C) The XZ Utils authors and contributors As usual, this software is provided "as is", without any warranty.
If you copy significant amounts of 0BSD-licensed code from XZ Utils If you copy significant amounts of public domain code from XZ Utils
into your project, acknowledging this somewhere in your software is into your project, acknowledging this somewhere in your software is
polite (especially if it is proprietary, non-free software), but polite (especially if it is proprietary, non-free software), but
it is not legally required by the license terms. Here is an example naturally it is not legally required. Here is an example of a good
of a good notice to put into "about box" or into documentation: notice to put into "about box" or into documentation:
This software includes code from XZ Utils This software includes code from XZ Utils
<https://xz.tukaani.org/xz-utils/>. <https://xz.tukaani.org/xz-utils/>.
The following license texts are included in the following files: The following license texts are included in the following files:
- COPYING.0BSD: BSD Zero Clause License
- COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1 - COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
- COPYING.GPLv2: GNU General Public License version 2 - COPYING.GPLv2: GNU General Public License version 2
- COPYING.GPLv3: GNU General Public License version 3 - COPYING.GPLv3: GNU General Public License version 3
- COPYING.CC-BY-SA-4.0: Creative Commons Attribution-ShareAlike 4.0
International Public License
A note about old XZ Utils releases: Note that the toolchain (compiler, linker etc.) may add some code
pieces that are copyrighted. Thus, it is possible that e.g. liblzma
binary wouldn't actually be in the public domain in its entirety
even though it contains no copyrighted code from the XZ Utils source
package.
XZ Utils releases 5.4.6 and older and 5.5.1alpha have a If you have questions, don't hesitate to ask the author(s) for more
significant amount of code put into the public domain and information.
that obviously remains so. The switch from public domain to
0BSD for newer releases was made in Febrary 2024 because
public domain has (real or perceived) legal ambiguities in
some jurisdictions.
There is very little *practical* difference between public
domain and 0BSD. The main difference likely is that one
shouldn't claim that 0BSD-licensed code is in the public
domain; 0BSD-licensed code is copyrighted but available under
an extremely permissive license. Neither 0BSD nor public domain
require retaining or reproducing author, copyright holder, or
license notices when distributing the software. (Compare to,
for example, BSD 2-Clause "Simplified" License which does have
such requirements.)
If you have questions, don't hesitate to ask for more information.
The contact information is in the README file.

View File

@ -1,11 +0,0 @@
Permission to use, copy, modify, and/or distribute this
software for any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -1,427 +0,0 @@
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.

200
INSTALL
View File

@ -143,37 +143,43 @@ XZ Utils Installation
1.2.7. Windows 1.2.7. Windows
The "windows" directory contains instructions for a few types If it is enough to build liblzma (no command line tools):
of builds:
- INSTALL-MinGW-w64_with_CMake.txt - There is CMake support. It should be good enough to build
Simple instructions how to build XZ Utils natively on static liblzma or liblzma.dll with Visual Studio. The CMake
Windows using only CMake and a prebuilt toolchain support may work with MinGW or MinGW-w64. Read the comment
(GCC + MinGW-w64 or Clang/LLVM + MinGW-w64). in the beginning of CMakeLists.txt before running CMake!
- INSTALL-MinGW-w64_with_Autotools.txt - There are Visual Studio project files under the "windows"
Native build under MSYS2 or cross-compilation from directory. See windows/INSTALL-MSVC.txt. In the future the
GNU/Linux using a bash script that creates a .zip project files will be removed when CMake support is good
and .7z archives of the binaries and documentation. enough. Thus, please test the CMake version and help fix
The related file README-Windows.txt is for the possible issues.
resulting binary package.
- INSTALL-MSVC.txt To build also the command line tools:
Building with MSVC / Visual Studio and CMake.
- liblzma-crt-mixing.txt - MinGW-w64 + MSYS (32-bit and 64-bit x86): This is used
Documentation what to take into account as a programmer for building the official binary packages for Windows.
if liblzma.dll and the application don't use the same There is windows/build.bash to ease packaging XZ Utils with
CRT (MSVCRT or UCRT). MinGW(-w64) + MSYS into a redistributable .zip or .7z file.
See windows/INSTALL-MinGW.txt for more information.
Other choices: - MinGW + MSYS (32-bit x86): I haven't recently tested this.
- Cygwin: https://cygwin.com/ - Cygwin 1.7.35 and later: NOTE that using XZ Utils >= 5.2.0
Building on Cygwin can be done like on many POSIX operating under Cygwin older than 1.7.35 can lead to DATA LOSS! If
systems. XZ Utils >= 5.2.0 isn't compatible with Cygwin older you must use an old Cygwin version, stick to XZ Utils 5.0.x
than 1.7.35 (data loss!). 1.7.35 was released on 2015-03-04. which is safe under older Cygwin versions. You can check
the Cygwin version with the command "cygcheck -V".
- MSYS2: https://www.msys2.org/ It may be possible to build liblzma with other toolchains too, but
that will probably require writing a separate makefile. Building
the command line tools with non-GNU toolchains will be harder than
building only liblzma.
Even if liblzma is built with MinGW(-w64), the resulting DLL can
be used by other compilers and linkers, including MSVC. See
windows/README-Windows.txt for details.
1.2.8. DOS 1.2.8. DOS
@ -353,20 +359,20 @@ XZ Utils Installation
with --docdir=DIR. with --docdir=DIR.
--disable-assembler --disable-assembler
This disables CRC32 and CRC64 assembly code on liblzma includes some assembler optimizations. Currently
32-bit x86. This option currently does nothing there is only assembler code for CRC32 and CRC64 for
on other architectures (not even on x86-64). 32-bit x86.
The 32-bit x86 assembly is position-independent code All the assembler code in liblzma is position-independent
which is suitable for use in shared libraries and code, which is suitable for use in shared libraries and
position-independent executables. It uses only i386 position-independent executables. So far only i386
instructions but the code is optimized for i686 class instructions are used, but the code is optimized for i686
CPUs. If you are compiling liblzma exclusively for class CPUs. If you are compiling liblzma exclusively for
pre-i686 systems, you may want to disable the assembler pre-i686 systems, you may want to disable the assembler
code. code.
--disable-clmul-crc --disable-clmul-crc
Disable the use of carryless multiplication for CRC Disable the use carryless multiplication for CRC
calculation even if compiler support for it is detected. calculation even if compiler support for it is detected.
The code uses runtime detection of SSSE3, SSE4.1, and The code uses runtime detection of SSSE3, SSE4.1, and
CLMUL instructions on x86. On 32-bit x86 this currently CLMUL instructions on x86. On 32-bit x86 this currently
@ -377,16 +383,6 @@ XZ Utils Installation
required extensions (-msse4.1 -mpclmul) then runtime required extensions (-msse4.1 -mpclmul) then runtime
detection isn't used and the generic code is omitted. detection isn't used and the generic code is omitted.
--disable-arm64-crc32
Disable the use of the ARM64 CRC32 instruction extension
even if compiler support for it is detected. The code will
detect support for the instruction at runtime.
If using compiler options that unconditionally allow the
required extensions (-march=armv8-a+crc or -march=armv8.1-a
and later) then runtime detection isn't used and the
generic code is omitted.
--enable-unaligned-access --enable-unaligned-access
Allow liblzma to use unaligned memory access for 16-bit, Allow liblzma to use unaligned memory access for 16-bit,
32-bit, and 64-bit loads and stores. This should be 32-bit, and 64-bit loads and stores. This should be
@ -396,43 +392,8 @@ XZ Utils Installation
slow. This option shouldn't be used on systems that slow. This option shouldn't be used on systems that
rely on such emulation. rely on such emulation.
Unaligned access is enabled by default on these: Unaligned access is enabled by default on x86, x86-64,
- 32-bit x86 big endian PowerPC, some ARM, and some ARM64 systems.
- 64-bit x86-64
- 32-bit big endian PowerPC
- 64-bit big endian PowerPC
- 64-bit little endian PowerPC
- some RISC-V [1]
- some 32-bit ARM [2]
- some 64-bit ARM64 [2] (NOTE: Autodetection bug
if using GCC -mstrict-align, see below.)
[1] Unaligned access is enabled by default if
configure sees that the C compiler
#defines __riscv_misaligned_fast.
[2] Unaligned access is enabled by default if
configure sees that the C compiler
#defines __ARM_FEATURE_UNALIGNED:
- ARMv7 + GCC or Clang: It works. The options
-munaligned-access and -mno-unaligned-access
affect this macro correctly.
- ARM64 + Clang: It works. The options
-munaligned-access, -mno-unaligned-access,
and -mstrict-align affect this macro correctly.
Clang >= 17 supports -mno-strict-align too.
- ARM64 + GCC: It partially works. The macro
is always #defined by GCC versions at least
up to 13.2, even when using -mstrict-align.
If building for strict-align ARM64, the
configure option --disable-unaligned-access
should be used if using a GCC version that has
this issue because otherwise the performance
may be degraded. It likely won't crash due to
how unaligned access is done in the C code.
--enable-unsafe-type-punning --enable-unsafe-type-punning
This enables use of code like This enables use of code like
@ -499,14 +460,14 @@ XZ Utils Installation
too. This is the default for 32-bit x86 too. This is the default for 32-bit x86
Windows builds. Unless the compiler Windows builds. Unless the compiler
supports __attribute__((__constructor__)), supports __attribute__((__constructor__)),
the 'win95' threading is incompatible with the `win95' threading is incompatible with
--enable-small. --enable-small.
vista Use Windows Vista compatible threads. The vista Use Windows Vista compatible threads. The
resulting binaries won't run on Windows XP resulting binaries won't run on Windows XP
or older. This is the default for Windows or older. This is the default for Windows
excluding 32-bit x86 builds (that is, on excluding 32-bit x86 builds (that is, on
x86-64 the default is 'vista'). x86-64 the default is `vista').
no Disable threading support. This is the no Disable threading support. This is the
same as using --disable-threads. same as using --disable-threads.
@ -518,25 +479,14 @@ XZ Utils Installation
calls any liblzma functions from more than calls any liblzma functions from more than
one thread, something bad may happen. one thread, something bad may happen.
--enable-ifunc
Use __attribute__((__ifunc__())) in liblzma. This is
enabled by default on GNU/Linux and FreeBSD.
The ifunc attribute is incompatible with
-fsanitize=address. --disable-ifunc must be used
if any -fsanitize= option is specified in CFLAGS.
--enable-sandbox=METHOD --enable-sandbox=METHOD
There is limited sandboxing support in the xz and xzdec There is limited sandboxing support in the xz tool. If
tools. If built with sandbox support, xz uses it built with sandbox support, it's used automatically when
automatically when (de)compressing exactly one file to (de)compressing exactly one file to standard output and
standard output when the options --files or --files0 aren't the options --files or --files0 weren't used. This is a
used. This is a common use case, for example, common use case, for example, (de)compressing .tar.xz
(de)compressing .tar.xz files via GNU tar. The sandbox is files via GNU tar. The sandbox is also used for
also used for single-file 'xz --test' or 'xz --list'. single-file `xz --test' or `xz --list'.
xzdec always uses the sandbox, except when more than one
file are decompressed. In this case it will enable the
sandbox for the last file that is decompressed.
Supported METHODs: Supported METHODs:
@ -548,7 +498,7 @@ XZ Utils Installation
no Disable sandboxing support. no Disable sandboxing support.
capsicum capsicum
Use Capsicum (FreeBSD >= 10.2) for Use Capsicum (FreeBSD >= 10) for
sandboxing. If no Capsicum support sandboxing. If no Capsicum support
is found, configure will give an error. is found, configure will give an error.
@ -556,50 +506,10 @@ XZ Utils Installation
sandboxing. If pledge(2) isn't found, sandboxing. If pledge(2) isn't found,
configure will give an error. configure will give an error.
landlock --enable-symbol-versions
Use Landlock (Linux >= 5.13) for Use symbol versioning for liblzma. This is enabled by
sandboxing. If no Landlock support default on GNU/Linux, other GNU-based systems, and
is found, configure will give an error. FreeBSD.
--enable-symbol-versions[=VARIANT]
Use symbol versioning for liblzma shared library.
This is enabled by default on GNU/Linux (glibc only),
other GNU-based systems, and FreeBSD.
Symbol versioning is never used for static liblzma. This
option is ignored when not building a shared library.
Supported VARIANTs:
no Disable symbol versioning. This is the
same as using --disable-symbol-versions.
auto Autodetect between "no", "linux",
and "generic".
yes Autodetect between "linux" and
"generic". This forces symbol
versioning to be used when
building a shared library.
generic Generic version is the default for
FreeBSD and GNU/Linux on MicroBlaze.
This is also used on GNU/Linux when
building with NVIDIA HPC Compiler
because the compiler doesn't support
the features required for the "linux"
variant below.
linux Special version for GNU/Linux (glibc
only). This adds a few extra symbol
versions for compatibility with binaries
that have been linked against a liblzma
version that has been patched with
"xz-5.2.2-compat-libs.patch" from
RHEL/CentOS 7. That patch was used
by some build tools outside of
RHEL/CentOS 7 too.
--enable-debug --enable-debug
This enables the assert() macro and possibly some other This enables the assert() macro and possibly some other

View File

@ -1,5 +1,9 @@
## SPDX-License-Identifier: 0BSD ##
## Author: Lasse Collin ## Author: Lasse Collin
##
## This file has been put into the public domain.
## You can do whatever you want with this file.
##
# Use -n to prevent gzip from adding a timestamp to the .gz headers. # Use -n to prevent gzip from adding a timestamp to the .gz headers.
GZIP_ENV = -9n GZIP_ENV = -9n
@ -17,11 +21,11 @@ if COND_DOC
dist_doc_DATA = \ dist_doc_DATA = \
AUTHORS \ AUTHORS \
COPYING \ COPYING \
COPYING.0BSD \
COPYING.GPLv2 \ COPYING.GPLv2 \
NEWS \ NEWS \
README \ README \
THANKS \ THANKS \
TODO \
doc/faq.txt \ doc/faq.txt \
doc/history.txt \ doc/history.txt \
doc/xz-file-format.txt \ doc/xz-file-format.txt \
@ -34,9 +38,13 @@ dist_examples_DATA = \
doc/examples/02_decompress.c \ doc/examples/02_decompress.c \
doc/examples/03_compress_custom.c \ doc/examples/03_compress_custom.c \
doc/examples/04_compress_easy_mt.c \ doc/examples/04_compress_easy_mt.c \
doc/examples/11_file_info.c \
doc/examples/Makefile doc/examples/Makefile
examplesolddir = $(docdir)/examples_old
dist_examplesold_DATA = \
doc/examples_old/xz_pipe_comp.c \
doc/examples_old/xz_pipe_decomp.c
# Install the Doxygen generated documentation if they were built. # Install the Doxygen generated documentation if they were built.
install-data-local: install-data-local:
if test -d "$(srcdir)/doc/api" ; then \ if test -d "$(srcdir)/doc/api" ; then \
@ -51,25 +59,22 @@ uninstall-local:
endif endif
EXTRA_DIST = \ EXTRA_DIST = \
cmake \ po4a \
extra \
dos \ dos \
doxygen \ doxygen \
extra \
po4a \
windows \ windows \
macosx \
cmake \
CMakeLists.txt \ CMakeLists.txt \
COPYING.CC-BY-SA-4.0 \ autogen.sh \
COPYING.GPLv2 \ COPYING.GPLv2 \
COPYING.GPLv3 \ COPYING.GPLv3 \
COPYING.LGPLv2.1 \ COPYING.LGPLv2.1 \
INSTALL.generic \ INSTALL.generic \
PACKAGERS \ PACKAGERS \
TODO \
autogen.sh \
build-aux/manconv.sh \ build-aux/manconv.sh \
build-aux/version.sh \ build-aux/version.sh
doc/xz-logo.png \
po/xz.pot-header
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
@ -88,7 +93,7 @@ manfiles = \
dist-hook: dist-hook:
if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \ if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \
( cd "$(srcdir)" && git log --date=iso --stat \ ( cd "$(srcdir)" && git log --date=iso --stat \
b69da6d4bb6bb11fc0cf066920791990d2b22a06^..HEAD ) \ 6060f7dc76fd6c2a8a1f8e85d0e4d86bb78273e6^..HEAD ) \
> "$(distdir)/ChangeLog"; \ > "$(distdir)/ChangeLog"; \
fi fi
if type groff > /dev/null 2>&1 && type ps2pdf > /dev/null 2>&1; then \ if type groff > /dev/null 2>&1 && type ps2pdf > /dev/null 2>&1; then \

356
NEWS
View File

@ -2,319 +2,6 @@
XZ Utils Release Notes XZ Utils Release Notes
====================== ======================
5.6.1 (2024-03-09)
* liblzma: Fixed two bugs relating to GNU indirect function (IFUNC)
with GCC. The more serious bug caused a program linked with
liblzma to crash on start up if the flag -fprofile-generate was
used to build liblzma. The second bug caused liblzma to falsely
report an invalid write to Valgrind when loading liblzma.
* xz: Changed the messages for thread reduction due to memory
constraints to only appear under the highest verbosity level.
* Build:
- Fixed a build issue when the header file <linux/landlock.h>
was present on the system but the Landlock system calls were
not defined in <sys/syscall.h>.
- The CMake build now warns and disables NLS if both gettext
tools and pre-created .gmo files are missing. Previously,
this caused the CMake build to fail.
* Minor improvements to man pages.
* Minor improvements to tests.
5.6.0 (2024-02-24)
This bumps the minor version of liblzma because new features were
added. The API and ABI are still backward compatible with liblzma
5.4.x and 5.2.x and 5.0.x.
NOTE: As described in the NEWS for 5.5.2beta, the core components
are now under the BSD Zero Clause License (0BSD).
Since 5.5.2beta:
* liblzma:
- Disabled the branchless C variant in the LZMA decoder based
on the benchmark results from the community.
- Disabled x86-64 inline assembly on x32 to fix the build.
* Sandboxing support in xz:
- Landlock is now used even when xz needs to create files.
In this case the sandbox has to be more permissive than
when no files need to be created. A similar thing was
already in use with pledge(2) since 5.3.4alpha.
- Landlock and pledge(2) are now stricter when reading from
more than one input file and only writing to standard output.
- Added support for Landlock ABI version 4.
* CMake:
- Default to -O2 instead of -O3 with CMAKE_BUILD_TYPE=Release.
-O3 is not useful for speed and makes the code larger.
- Now builds lzmainfo and lzmadec.
- xzdiff, xzgrep, xzless, xzmore, and their symlinks are now
installed. The scripts are also tested during "make test".
- Added translation support for xz, lzmainfo, and the
man pages.
- Applied the symbol versioning workaround for MicroBlaze that
is used in the Autotools build.
- The general XZ Utils and liblzma API documentation is now
installed.
- The CMake component names were changed a little and several
were added. liblzma_Runtime and liblzma_Development are
unchanged.
- Minimum required CMake version is now 3.14. However,
translation support is disabled with CMake versions
older than 3.20.
- The CMake-based build is now close to feature parity with the
Autotools-based build. Most importantly a few tests aren't
run yet. Testing the CMake-based build on different operating
systems would be welcome now. See the comment at the top of
CMakeLists.txt.
* Fixed a bug in the Autotools feature test for ARM64 CRC32
instruction support for old versions of Clang. This did not
affect the CMake build.
* Windows:
- The build instructions in INSTALL and windows/INSTALL*.txt
were revised completely.
- windows/build-with-cmake.bat along with the instructions
in windows/INSTALL-MinGW-w64_with_CMake.txt should make
it very easy to build liblzma.dll and xz.exe on Windows
using CMake and MinGW-w64 with either GCC or Clang/LLVM.
- windows/build.bash was updated. It now works on MSYS2 and
on GNU/Linux (cross-compiling) to create a .zip and .7z
package for 32-bit and 64-bit x86 using GCC + MinGW-w64.
* The TODO file is no longer installed as part of the
documentation. The file is out of date and does not reflect
the actual tasks that will be completed in the future.
* Translations:
- Translated lzmainfo man pages are now installed. These
had been forgotten in earlier versions.
- Updated Croatian, Esperanto, German, Hungarian, Korean,
Polish, Romanian, Spanish, Swedish, Vietnamese, and Ukrainian
translations.
- Updated German, Korean, Romanian, and Ukrainian man page
translations.
* Added a few tests.
Summary of new features added in the 5.5.x development releases:
* liblzma:
- LZMA decoder: Speed optimizations to the C code and
added GCC & Clang compatible inline assembly for x86-64.
- Added lzma_mt_block_size() to recommend a Block size for
multithreaded encoding.
- Added CLMUL-based CRC32 on x86-64 and E2K with runtime
processor detection. Similar to CRC64, on 32-bit x86 it
isn't available unless --disable-assembler is used.
- Optimized the CRC32 calculation on ARM64 platforms using the
CRC32 instructions. Runtime detection for the instruction is
used on GNU/Linux, FreeBSD, Windows, and macOS. If the
compiler flags indicate unconditional CRC32 instruction
support (+crc) then the generic version is not built.
- Added definitions of mask values like
LZMA_INDEX_CHECK_MASK_CRC32 to <lzma/index.h>.
* xz:
- Multithreaded mode is now the default. This improves
compression speed and creates .xz files that can be
decompressed in multithreaded mode. The downsides are
increased memory usage and slightly worse compression ratio.
- Added a new command line option --filters to set the filter
chain using the liblzma filter string syntax.
- Added new command line options --filters1 ... --filters9 to
set additional filter chains using the liblzma filter string
syntax. The --block-list option now allows specifying filter
chains that were set using these new options.
- Ported the command line tools to Windows MSVC.
Visual Studio 2015 or later is required.
* Added lz4 support to xzdiff/xzcmp and xzgrep.
5.5.2beta (2024-02-14)
* Licensing change: The core components are now under the
BSD Zero Clause License (0BSD). In XZ Utils 5.4.6 and older
and 5.5.1alpha these components are in the public domain and
obviously remain so; the change affects the new releases only.
0BSD is an extremely permissive license which doesn't require
retaining or reproducing copyright or license notices when
distributing the code, thus in practice there is extremely
little difference to public domain.
* liblzma
- Significant speed optimizations to the LZMA decoder were
made. There are now three variants that can be chosen at
build time:
* Basic C version: This is a few percent faster than
5.4.x due to some new optimizations.
* Branchless C: This is currently the default on platforms
for which there is no assembly code. This should be a few
percent faster than the basic C version.
* x86-64 inline assembly. This works with GCC and Clang.
The default choice can currently be overridden by setting
LZMA_RANGE_DECODER_CONFIG in CPPFLAGS: 0 means the basic
version and 3 means that branchless C version.
- Optimized the CRC32 calculation on ARM64 platforms using the
CRC32 instructions. The instructions are optional in ARMv8.0
and are required in ARMv8.1 and later. Runtime detection for
the instruction is used on GNU/Linux, FreeBSD, Windows, and
macOS. If the compiler flags indicate unconditional CRC32
instruction support (+crc) then the generic version is not
built.
* Added lz4 support to xzdiff/xzcmp and xzgrep.
* Man pages of xzdiff/xzcmp, xzgrep, and xzmore were rewritten
to simplify licensing of the man page translations.
* Translations:
- Updated Chinese (simplified), German, Korean, Polish,
Romanian, Spanish, Swedish, and Ukrainian translations.
- Updated German, Korean, Romanian, and Ukrainian man page
translations.
* Small improvements to the tests.
* Added doc/examples/11_file_info.c. It was added to the Git
repository in 2017 but forgotten to be added into distribution
tarballs.
* Removed doc/examples_old. These were from 2012.
* Removed the macos/build.sh script. It had not been updated
since 2013.
5.5.1alpha (2024-01-26)
* Added a new filter for RISC-V binaries. The filter can be used
for 32-bit and 64-bit binaries with either little or big
endianness. In liblzma, the Filter ID is LZMA_FILTER_RISCV (0x0B)
and the xz option is --riscv. liblzma filter string syntax
recognizes this filter as "riscv".
* liblzma:
- Added lzma_mt_block_size() to recommend a Block size for
multithreaded encoding
- Added CLMUL-based CRC32 on x86-64 and E2K with runtime
processor detection. Similar to CRC64, on 32-bit x86 it
isn't available unless --disable-assembler is used.
- Implemented GNU indirect function (IFUNC) as a runtime
function dispatching method for CRC32 and CRC64 fast
implementations on x86. Only GNU/Linux (glibc) and FreeBSD
builds will use IFUNC, unless --enable-ifunc is specified to
configure.
- Added definitions of mask values like
LZMA_INDEX_CHECK_MASK_CRC32 to <lzma/index.h>.
- The XZ logo is now included in the Doxygen generated
documentation. It is licensed under Creative Commons
Attribution-ShareAlike 4.0.
* xz:
- Multithreaded mode is now the default. This improves
compression speed and creates .xz files that can be
decompressed multithreaded at the cost of increased memory
usage and slightly worse compression ratio.
- Added new command line option --filters to set the filter
chain using liblzma filter string syntax.
- Added new command line options --filters1 ... --filters9 to
set additional filter chains using liblzma filter string
syntax. The --block-list option now allows specifying filter
chains that were set using these new options.
- Added support for Linux Landlock as a sandboxing method.
- xzdec now supports pledge(2), Capsicum, and Linux Landlock as
sandboxing methods.
- Progress indicator time stats remain accurate after pausing
xz with SIGTSTP.
- Ported xz and xzdec to Windows MSVC. Visual Studio 2015 or
later is required.
* CMake Build:
- Supports pledge(2), Capsicum, and Linux Landlock sandboxing
methods.
- Replacement functions for getopt_long() are used on platforms
that do not have it.
* Enabled unaligned access by default on PowerPC64LE and on RISC-V
targets that define __riscv_misaligned_fast.
* Tests:
- Added two new fuzz targets to OSS-Fuzz.
- Implemented Continuous Integration (CI) testing using
GitHub Actions.
* Changed quoting style from `...' to '...' in all messages,
scripts, and documentation.
* Added basic Codespell support to help catch typo errors.
5.4.6 (2024-01-26) 5.4.6 (2024-01-26)
* Fixed a bug involving internal function pointers in liblzma not * Fixed a bug involving internal function pointers in liblzma not
@ -337,7 +24,7 @@ XZ Utils Release Notes
* Added a new test. * Added a new test.
5.4.5 (2023-11-31) 5.4.5 (2023-11-01)
* liblzma: * liblzma:
@ -1139,47 +826,6 @@ XZ Utils Release Notes
(FreeBSD >= 10). (FreeBSD >= 10).
5.2.12 (2023-05-04)
* Fixed a build system bug that prevented building liblzma as a
shared library when configured with --disable-threads. This bug
affected releases 5.2.6 to 5.2.11 and 5.4.0 to 5.4.2.
* Include <intrin.h> for Windows intrinsic functions where they are
needed. This fixed a bug that prevented building liblzma using
clang-cl on Windows.
* Minor update to the Croatian translation. The small change
applies to a string in both 5.2 and 5.4 branches.
5.2.11 (2023-03-18)
* Removed all possible cases of null pointer + 0. It is undefined
behavior in C99 and C17. This was detected by a sanitizer and had
not caused any known issues.
* Build systems:
- Added a workaround for building with GCC on MicroBlaze Linux.
GCC 12 on MicroBlaze doesn't support the __symver__ attribute
even though __has_attribute(__symver__) returns true. The
build is now done without the extra RHEL/CentOS 7 symbols
that were added in XZ Utils 5.2.7. The workaround only
applies to the Autotools build (not CMake).
- CMake: Ensure that the C compiler language is set to C99 or
a newer standard.
- CMake changes from XZ Utils 5.4.1:
* Added a workaround for a build failure with
windres from GNU binutils.
* Included the Windows resource files in the xz
and xzdec build rules.
5.2.10 (2022-12-13) 5.2.10 (2022-12-13)
* xz: Don't modify argv[] when parsing the --memlimit* and * xz: Don't modify argv[] when parsing the --memlimit* and

View File

@ -124,15 +124,14 @@ Information to packagers of XZ Utils
If the package manager supports a license field, you probably should If the package manager supports a license field, you probably should
put GPLv2+ there (GNU GPL v2 or later). The interesting parts of put GPLv2+ there (GNU GPL v2 or later). The interesting parts of
XZ Utils are under the BSD Zero Clause License (0BSD), but some less XZ Utils are in the public domain, but some less important files
important files ending up into the binary package are under GPLv2+. ending up into the binary package are under GPLv2+. So it is simplest
So it is simplest to just say GPLv2+ if you cannot specify to just say GPLv2+ if you cannot specify "public domain and GPLv2+".
"BSD0 and GPLv2+".
If you split XZ Utils into multiple packages as described earlier If you split XZ Utils into multiple packages as described earlier
in this file, liblzma and liblzma-dev packages will contain only in this file, liblzma and liblzma-dev packages will contain only
0BSD-licensed code from XZ Utils (compiler or linker may add some public domain code (from XZ Utils at least; compiler or linker may
third-party code which may have other licenses). add some third-party code, which may be copyrighted).
4. configure options 4. configure options

7
README
View File

@ -69,18 +69,15 @@ XZ Utils
README This file README This file
INSTALL.generic Generic install instructions for those not INSTALL.generic Generic install instructions for those not familiar
familiar with packages using GNU Autotools with packages using GNU Autotools
INSTALL Installation instructions specific to XZ Utils INSTALL Installation instructions specific to XZ Utils
PACKAGERS Information to packagers of XZ Utils PACKAGERS Information to packagers of XZ Utils
COPYING XZ Utils copyright and license information COPYING XZ Utils copyright and license information
COPYING.0BSD BSD Zero Clause License
COPYING.GPLv2 GNU General Public License version 2 COPYING.GPLv2 GNU General Public License version 2
COPYING.GPLv3 GNU General Public License version 3 COPYING.GPLv3 GNU General Public License version 3
COPYING.LGPLv2.1 GNU Lesser General Public License version 2.1 COPYING.LGPLv2.1 GNU Lesser General Public License version 2.1
COPYING.CC-BY-SA-4.0 Creative Commons Attribution-ShareAlike 4.0
International Public License
AUTHORS The main authors of XZ Utils AUTHORS The main authors of XZ Utils
THANKS Incomplete list of people who have helped making THANKS Incomplete list of people who have helped making

10
THANKS
View File

@ -52,11 +52,9 @@ has been important. :-) In alphabetical order:
- Bjarni Ingi Gislason - Bjarni Ingi Gislason
- John Paul Adrian Glaubitz - John Paul Adrian Glaubitz
- Bill Glessner - Bill Glessner
- Matthew Good
- Michał Górny - Michał Górny
- Jason Gorski - Jason Gorski
- Juan Manuel Guerrero - Juan Manuel Guerrero
- Gabriela Gutierrez
- Diederik de Haas - Diederik de Haas
- Joachim Henke - Joachim Henke
- Christian Hesse - Christian Hesse
@ -65,7 +63,6 @@ has been important. :-) In alphabetical order:
- Nicholas Jackson - Nicholas Jackson
- Sam James - Sam James
- Hajin Jang - Hajin Jang
- Hans Jansen
- Jouk Jansen - Jouk Jansen
- Jun I Jin - Jun I Jin
- Kiyoshi Kanazawa - Kiyoshi Kanazawa
@ -76,7 +73,6 @@ has been important. :-) In alphabetical order:
- Richard Koch - Richard Koch
- Anton Kochkov - Anton Kochkov
- Ville Koskinen - Ville Koskinen
- Sergey Kosukhin
- Marcin Kowalczyk - Marcin Kowalczyk
- Jan Kratochvil - Jan Kratochvil
- Christian Kujau - Christian Kujau
@ -84,7 +80,6 @@ has been important. :-) In alphabetical order:
- Ilya Kurdyukov - Ilya Kurdyukov
- Peter Lawler - Peter Lawler
- James M Leddy - James M Leddy
- Kelvin Lee
- Vincent Lefevre - Vincent Lefevre
- Hin-Tak Leung - Hin-Tak Leung
- Andraž 'ruskie' Levstik - Andraž 'ruskie' Levstik
@ -95,7 +90,6 @@ has been important. :-) In alphabetical order:
- Lorenzo De Liso - Lorenzo De Liso
- H.J. Lu - H.J. Lu
- Bela Lubkin - Bela Lubkin
- Chenxi Mao
- Gregory Margo - Gregory Margo
- Julien Marrec - Julien Marrec
- Ed Maste - Ed Maste
@ -153,11 +147,10 @@ has been important. :-) In alphabetical order:
- Dan Stromberg - Dan Stromberg
- Jia Tan - Jia Tan
- Vincent Torri - Vincent Torri
- Alexey Tourbin
- Paul Townsend - Paul Townsend
- Mohammed Adnène Trojette - Mohammed Adnène Trojette
- Alexey Tourbin
- Taiki Tsunekawa - Taiki Tsunekawa
- Maksym Vatsyk
- Loganaden Velvindron - Loganaden Velvindron
- Patrick J. Volkerding - Patrick J. Volkerding
- Martin Väth - Martin Väth
@ -172,7 +165,6 @@ has been important. :-) In alphabetical order:
- Charles Wilson - Charles Wilson
- Lars Wirzenius - Lars Wirzenius
- Pilorz Wojciech - Pilorz Wojciech
- Chien Wong
- Ryan Young - Ryan Young
- Andreas Zieringer - Andreas Zieringer

4
TODO
View File

@ -24,6 +24,10 @@ Known bugs
tuklib_exit() doesn't block signals => EINTR is possible. tuklib_exit() doesn't block signals => EINTR is possible.
SIGTSTP is not handled. If xz is stopped, the estimated remaining
time and calculated (de)compression speed won't make sense in the
progress indicator (xz --verbose).
If liblzma has created threads and fork() gets called, liblzma If liblzma has created threads and fork() gets called, liblzma
code will break in the child process unless it calls exec() and code will break in the child process unless it calls exec() and
doesn't touch liblzma. doesn't touch liblzma.

View File

@ -1,10 +1,12 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: 0BSD
############################################################################### ###############################################################################
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################### ###############################################################################
set -e -x set -e -x

View File

@ -1,287 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: 0BSD
#############################################################################
#
# Script meant to be used for Continuous Integration automation for POSIX
# systems. On GitHub, this is used by Ubuntu and MacOS builds.
#
#############################################################################
#
# Author: Jia Tan
#
#############################################################################
set -e
USAGE="Usage: $0
-a [autogen flags]
-b [autotools|cmake]
-c [crc32|crc64|sha256]
-d [encoders|decoders|bcj|delta|threads|shared|nls|small|ifunc|clmul|sandbox]
-f [CFLAGS]
-l [destdir]
-m [compiler]
-n [ARTIFACTS_DIR_NAME]
-p [all|build|test]
-s [srcdir]"
# Absolute path of script directory
ABS_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
# Default CLI option values
AUTOGEN_FLAGS=""
BUILD_SYSTEM="autotools"
CHECK_TYPE="crc32,crc64,sha256"
BCJ="y"
DELTA="y"
ENCODERS="y"
DECODERS="y"
THREADS="y"
SHARED="y"
NATIVE_LANG_SUPPORT="y"
SMALL="n"
IFUNC="y"
CLMUL="y"
SANDBOX="y"
SRC_DIR="$ABS_DIR/../"
DEST_DIR="$SRC_DIR/../xz_build"
PHASE="all"
ARTIFACTS_DIR_NAME="output"
###################
# Parse arguments #
###################
while getopts a:b:c:d:l:m:n:s:p:f:h opt; do
# b option can have either value "autotools" OR "cmake"
case ${opt} in
h)
echo "$USAGE"
exit 0
;;
a)
AUTOGEN_FLAGS="$OPTARG"
;;
b)
case "$OPTARG" in
autotools) ;;
cmake) ;;
*) echo "Invalid build system: $OPTARG"; exit 1;;
esac
BUILD_SYSTEM="$OPTARG"
;;
c) CHECK_TYPE="$OPTARG"
;;
# d options can be a comma separated list of things to disable at
# configure time
d)
for disable_arg in $(echo "$OPTARG" | sed "s/,/ /g"); do
case "$disable_arg" in
encoders) ENCODERS="n" ;;
decoders) DECODERS="n" ;;
bcj) BCJ="n" ;;
delta) DELTA="n" ;;
threads) THREADS="n" ;;
shared) SHARED="n";;
nls) NATIVE_LANG_SUPPORT="n";;
small) SMALL="y";;
ifunc) IFUNC="n";;
clmul) CLMUL="n";;
sandbox) SANDBOX="n";;
*) echo "Invalid disable value: $disable_arg"; exit 1 ;;
esac
done
;;
l) DEST_DIR="$OPTARG"
;;
m)
CC="$OPTARG"
export CC
;;
n) ARTIFACTS_DIR_NAME="$OPTARG"
;;
s) SRC_DIR="$OPTARG"
;;
p) PHASE="$OPTARG"
;;
f)
CFLAGS="$OPTARG"
export CFLAGS
;;
esac
done
####################
# Helper Functions #
####################
# These two functions essentially implement the ternary "?" operator.
add_extra_option() {
# First argument is option value ("y" or "n")
# Second argument is option to set if "y"
# Third argument is option to set if "n"
if [ "$1" = "y" ]
then
EXTRA_OPTIONS="$EXTRA_OPTIONS $2"
else
EXTRA_OPTIONS="$EXTRA_OPTIONS $3"
fi
}
add_to_filter_list() {
# First argument is option value ("y" or "n")
# Second argument is option to set if "y"
if [ "$1" = "y" ]
then
FILTER_LIST="$FILTER_LIST$2"
fi
}
###############
# Build Phase #
###############
if [ "$PHASE" = "all" ] || [ "$PHASE" = "build" ]
then
# Checksum options should be specified differently based on the
# build system. It must be calculated here since we won't know
# the build system used until all args have been parsed.
# Autotools - comma separated
# CMake - semi-colon separated
if [ "$BUILD_SYSTEM" = "autotools" ]
then
SEP=","
else
SEP=";"
fi
CHECK_TYPE_TEMP=""
for crc in $(echo "$CHECK_TYPE" | sed "s/,/ /g"); do
case "$crc" in
# Remove "crc32" from cmake build, if specified.
crc32)
if [ "$BUILD_SYSTEM" = "cmake" ]
then
continue
fi
;;
crc64) ;;
sha256) ;;
*) echo "Invalid check type: $crc"; exit 1 ;;
esac
CHECK_TYPE_TEMP="$CHECK_TYPE_TEMP$SEP$crc"
done
# Remove the first character from $CHECK_TYPE_TEMP since it will
# always be the delimiter.
CHECK_TYPE="${CHECK_TYPE_TEMP:1}"
FILTER_LIST="lzma1$SEP"lzma2
# Build based on arguments
mkdir -p "$DEST_DIR"
# Generate configure option values
EXTRA_OPTIONS=""
case $BUILD_SYSTEM in
autotools)
cd "$SRC_DIR"
# Run autogen.sh script if not already run
if [ ! -f configure ]
then
./autogen.sh "$AUTOGEN_FLAGS"
fi
cd "$DEST_DIR"
add_to_filter_list "$BCJ" ",x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv"
add_to_filter_list "$DELTA" ",delta"
add_extra_option "$ENCODERS" "--enable-encoders=$FILTER_LIST" "--disable-encoders"
add_extra_option "$DECODERS" "--enable-decoders=$FILTER_LIST" "--disable-decoders"
add_extra_option "$THREADS" "" "--disable-threads"
add_extra_option "$SHARED" "" "--disable-shared"
add_extra_option "$NATIVE_LANG_SUPPORT" "" "--disable-nls"
add_extra_option "$SMALL" "--enable-small" ""
add_extra_option "$IFUNC" "" "--disable-ifunc"
add_extra_option "$CLMUL" "" "--disable-clmul-crc"
add_extra_option "$SANDBOX" "" "--enable-sandbox=no"
# Run configure script
"$SRC_DIR"/configure --enable-werror --enable-checks="$CHECK_TYPE" $EXTRA_OPTIONS --config-cache
# Build the project
make
;;
cmake)
cd "$DEST_DIR"
add_to_filter_list "$BCJ" ";x86;powerpc;ia64;arm;armthumb;arm64;sparc;riscv"
add_to_filter_list "$DELTA" ";delta"
add_extra_option "$THREADS" "-DENABLE_THREADS=ON" "-DENABLE_THREADS=OFF"
# Disable MicroLZMA if encoders are not configured.
add_extra_option "$ENCODERS" "-DENCODERS=$FILTER_LIST" "-DENCODERS= -DMICROLZMA_ENCODER=OFF"
# Disable MicroLZMA and lzip decoders if decoders are not configured.
add_extra_option "$DECODERS" "-DDECODERS=$FILTER_LIST" "-DDECODERS= -DMICROLZMA_DECODER=OFF -DLZIP_DECODER=OFF"
# CMake disables the shared library by default.
add_extra_option "$SHARED" "-DBUILD_SHARED_LIBS=ON" ""
add_extra_option "$SMALL" "-DHAVE_SMALL=ON" ""
if test -n "$CC" ; then
EXTRA_OPTIONS="$EXTRA_OPTIONS -DCMAKE_C_COMPILER=$CC"
fi
# Remove old cache file to clear previous settings.
rm -f "CMakeCache.txt"
cmake "$SRC_DIR/CMakeLists.txt" -B "$DEST_DIR" $EXTRA_OPTIONS -DADDITIONAL_CHECK_TYPES="$CHECK_TYPE" -G "Unix Makefiles"
cmake --build "$DEST_DIR"
;;
esac
fi
##############
# Test Phase #
##############
if [ "$PHASE" = "all" ] || [ "$PHASE" = "test" ]
then
case $BUILD_SYSTEM in
autotools)
cd "$DEST_DIR"
# If the tests fail, copy the test logs into the artifacts folder
if make check
then
:
else
mkdir -p "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
cp ./tests/*.log "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
exit 1
fi
;;
cmake)
cd "$DEST_DIR"
if make test
then
:
else
mkdir -p "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
cp ./Testing/Temporary/*.log "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
exit 1
fi
;;
esac
fi

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: 0BSD #
############################################################################### ###############################################################################
# #
# Wrapper for GNU groff to convert man pages to a few formats # Wrapper for GNU groff to convert man pages to a few formats
@ -18,6 +17,9 @@
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################### ###############################################################################
FORMAT=$1 FORMAT=$1

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: 0BSD #
############################################################################# #############################################################################
# #
# Get the version string from version.h and print it out without # Get the version string from version.h and print it out without
@ -10,6 +9,9 @@
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################# #############################################################################
sed -n 's/LZMA_VERSION_STABILITY_ALPHA/alpha/ sed -n 's/LZMA_VERSION_STABILITY_ALPHA/alpha/

View File

@ -1,5 +1,3 @@
# SPDX-License-Identifier: 0BSD
############################################################################# #############################################################################
# #
# remove-ordinals.cmake # remove-ordinals.cmake
@ -18,6 +16,9 @@
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################# #############################################################################
file(READ "${INPUT_FILE}" STR) file(READ "${INPUT_FILE}" STR)

View File

@ -1,12 +1,11 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# tuklib_common.cmake - common functions and macros for tuklib_*.cmake files # tuklib_common.cmake - common functions and macros for tuklib_*.cmake files
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
function(tuklib_add_definitions TARGET_OR_ALL DEFINITIONS) function(tuklib_add_definitions TARGET_OR_ALL DEFINITIONS)
# DEFINITIONS may be an empty string/list but it's fine here. There is # DEFINITIONS may be an empty string/list but it's fine here. There is

View File

@ -1,12 +1,11 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# tuklib_cpucores.cmake - see tuklib_cpucores.m4 for description and comments # tuklib_cpucores.cmake - see tuklib_cpucores.m4 for description and comments
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CheckCSourceCompiles) include(CheckCSourceCompiles)

View File

@ -1,12 +1,11 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# tuklib_integer.cmake - see tuklib_integer.m4 for description and comments # tuklib_integer.cmake - see tuklib_integer.m4 for description and comments
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(TestBigEndian) include(TestBigEndian)
@ -60,64 +59,25 @@ function(tuklib_integer TARGET_OR_ALL)
endif() endif()
endif() endif()
# Guess that unaligned access is fast on these archs: # Unaligned access is fast on x86(-64), big endian PowerPC, and usually on
# - 32/64-bit x86 / x86-64 # 32/64-bit ARM too. There are others too and ARM could be a false match.
# - 32/64-bit big endian PowerPC
# - 64-bit little endian PowerPC
# - Some 32-bit ARM
# - Some 64-bit ARM64 (AArch64)
# - Some 32/64-bit RISC-V
# #
# CMake doesn't provide a standardized/normalized list of processor arch # Guess the default value for the option.
# names. For example, x86-64 may be "x86_64" (Linux), "AMD64" (Windows), # CMake's ability to give info about the target arch seems bad.
# or even "EM64T" (64-bit WinXP). # The the same arch can have different name depending on the OS.
#
# FIXME: The regex is based on guessing, not on factual information!
#
# NOTE: Compared to the Autoconf test, this lacks the GCC/Clang test
# on ARM and always assumes that unaligned is fast on ARM.
set(FAST_UNALIGNED_GUESS OFF) set(FAST_UNALIGNED_GUESS OFF)
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" PROCESSOR) if(CMAKE_SYSTEM_PROCESSOR MATCHES
"[Xx3456]86|^[Xx]64|^[Aa][Mm][Dd]64|^[Aa][Rr][Mm]|^aarch|^powerpc|^ppc")
# There is no ^ in the first regex branch to allow "i" at the beginning if(NOT WORDS_BIGENDIAN OR
# so it can match "i386" to "i786", and "x86_64". NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc|^ppc")
if(PROCESSOR MATCHES "[x34567]86|^x64|^amd64|^em64t")
set(FAST_UNALIGNED_GUESS ON)
elseif(PROCESSOR MATCHES "^powerpc|^ppc")
if(WORDS_BIGENDIAN OR PROCESSOR MATCHES "64")
set(FAST_UNALIGNED_GUESS ON)
endif()
elseif(PROCESSOR MATCHES "^arm|^aarch64|^riscv")
# On 32-bit and 64-bit ARM, GCC and Clang
# #define __ARM_FEATURE_UNALIGNED if
# unaligned access is supported.
#
# Exception: GCC at least up to 13.2.0
# defines it even when using -mstrict-align
# so in that case this autodetection goes wrong.
# Most of the time -mstrict-align isn't used so it
# shouldn't be a common problem in practice. See:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111555
#
# RISC-V C API Specification says that if
# __riscv_misaligned_fast is defined then
# unaligned access is known to be fast.
#
# MSVC is handled as a special case: We assume that
# 32/64-bit ARM supports fast unaligned access.
# If MSVC gets RISC-V support then this will assume
# fast unaligned access on RISC-V too.
check_c_source_compiles("
#if !defined(__ARM_FEATURE_UNALIGNED) \
&& !defined(__riscv_misaligned_fast) \
&& !defined(_MSC_VER)
compile error
#endif
int main(void) { return 0; }
"
TUKLIB_FAST_UNALIGNED_DEFINED_BY_PREPROCESSOR)
if(TUKLIB_FAST_UNALIGNED_DEFINED_BY_PREPROCESSOR)
set(FAST_UNALIGNED_GUESS ON) set(FAST_UNALIGNED_GUESS ON)
endif() endif()
endif() endif()
option(TUKLIB_FAST_UNALIGNED_ACCESS option(TUKLIB_FAST_UNALIGNED_ACCESS
"Enable if the system supports *fast* unaligned memory access \ "Enable if the system supports *fast* unaligned memory access \
with 16-bit, 32-bit, and 64-bit integers." with 16-bit, 32-bit, and 64-bit integers."

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# tuklib_large_file_support.cmake # tuklib_large_file_support.cmake
# #
@ -11,7 +8,9 @@
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CheckCSourceCompiles) include(CheckCSourceCompiles)

View File

@ -1,12 +1,11 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# tuklib_mbstr.cmake - see tuklib_mbstr.m4 for description and comments # tuklib_mbstr.cmake - see tuklib_mbstr.m4 for description and comments
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CheckSymbolExists) include(CheckSymbolExists)

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# tuklib_physmem.cmake - see tuklib_physmem.m4 for description and comments # tuklib_physmem.cmake - see tuklib_physmem.m4 for description and comments
# #
@ -9,7 +6,9 @@
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CheckCSourceCompiles) include(CheckCSourceCompiles)

View File

@ -1,12 +1,11 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# tuklib_progname.cmake - see tuklib_progname.m4 for description and comments # tuklib_progname.cmake - see tuklib_progname.m4 for description and comments
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CheckSymbolExists) include(CheckSymbolExists)

View File

@ -1,12 +1,13 @@
# -*- Autoconf -*- # -*- Autoconf -*-
# SPDX-License-Identifier: 0BSD # Process this file with autoconf to produce a configure script.
############################################################################### ###############################################################################
# #
# Process this file with autoconf to produce a configure script.
#
# Author: Lasse Collin # Author: Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################### ###############################################################################
# NOTE: Don't add useless checks. autoscan detects this and that, but don't # NOTE: Don't add useless checks. autoscan detects this and that, but don't
@ -78,8 +79,8 @@ fi
# Filters # # Filters #
########### ###########
m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv])dnl m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc])dnl
m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv]) m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,arm64,sparc])
m4_define([LZ_FILTERS], [lzma1,lzma2]) m4_define([LZ_FILTERS], [lzma1,lzma2])
m4_foreach([NAME], [SUPPORTED_FILTERS], m4_foreach([NAME], [SUPPORTED_FILTERS],
@ -309,7 +310,7 @@ case $enable_microlzma in
;; ;;
*) *)
AC_MSG_RESULT([]) AC_MSG_RESULT([])
AC_MSG_ERROR([--enable-microlzma accepts only 'yes' or 'no'.]) AC_MSG_ERROR([--enable-microlzma accepts only `yes' or `no'.])
;; ;;
esac esac
AM_CONDITIONAL(COND_MICROLZMA, test "x$enable_microlzma" = xyes) AM_CONDITIONAL(COND_MICROLZMA, test "x$enable_microlzma" = xyes)
@ -363,7 +364,7 @@ case $enable_assembler in
;; ;;
*) *)
AC_MSG_RESULT([]) AC_MSG_RESULT([])
AC_MSG_ERROR([--enable-assembler accepts only 'yes', 'no', or 'x86' (32-bit).]) AC_MSG_ERROR([--enable-assembler accepts only `yes', `no', or `x86' (32-bit).])
;; ;;
esac esac
AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86) AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86)
@ -379,16 +380,6 @@ AC_ARG_ENABLE([clmul-crc], AS_HELP_STRING([--disable-clmul-crc],
[], [enable_clmul_crc=yes]) [], [enable_clmul_crc=yes])
############################
# ARM64 CRC32 Instructions #
############################
AC_ARG_ENABLE([arm64-crc32], AS_HELP_STRING([--disable-arm64-crc32],
[Do not use ARM64 CRC32 instructions even if support for it
is detected.]),
[], [enable_arm64_crc32=yes])
##################### #####################
# Size optimization # # Size optimization #
##################### #####################
@ -402,7 +393,7 @@ if test "x$enable_small" = xyes; then
AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.]) AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.])
elif test "x$enable_small" != xno; then elif test "x$enable_small" != xno; then
AC_MSG_RESULT([]) AC_MSG_RESULT([])
AC_MSG_ERROR([--enable-small accepts only 'yes' or 'no']) AC_MSG_ERROR([--enable-small accepts only `yes' or `no'])
fi fi
AC_MSG_RESULT([$enable_small]) AC_MSG_RESULT([$enable_small])
AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes) AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
@ -414,8 +405,8 @@ AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
AC_MSG_CHECKING([if threading support is wanted]) AC_MSG_CHECKING([if threading support is wanted])
AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads=METHOD], AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads=METHOD],
[Supported METHODS are 'yes', 'no', 'posix', 'win95', and [Supported METHODS are `yes', `no', `posix', `win95', and
'vista'. The default is 'yes'. Using 'no' together with `vista'. The default is `yes'. Using `no' together with
--enable-small makes liblzma thread unsafe.]), --enable-small makes liblzma thread unsafe.]),
[], [enable_threads=yes]) [], [enable_threads=yes])
@ -442,7 +433,7 @@ case $enable_threads in
;; ;;
*) *)
AC_MSG_RESULT([]) AC_MSG_RESULT([])
AC_MSG_ERROR([--enable-threads only accepts 'yes', 'no', 'posix', 'win95', or 'vista']) AC_MSG_ERROR([--enable-threads only accepts `yes', `no', `posix', `win95', or `vista'])
;; ;;
esac esac
@ -528,24 +519,20 @@ AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
AC_MSG_CHECKING([if sandboxing should be used]) AC_MSG_CHECKING([if sandboxing should be used])
AC_ARG_ENABLE([sandbox], [AS_HELP_STRING([--enable-sandbox=METHOD], AC_ARG_ENABLE([sandbox], [AS_HELP_STRING([--enable-sandbox=METHOD],
[Sandboxing METHOD can be [Sandboxing METHOD can be
'auto', 'no', 'capsicum', 'pledge', or 'landlock'. `auto', `no', `capsicum', or `pledge'.
The default is 'auto' which enables sandboxing if The default is `auto' which enables sandboxing if
a supported sandboxing method is found.])], a supported sandboxing method is found.])],
[], [enable_sandbox=auto]) [], [enable_sandbox=auto])
case $enable_xzdec-$enable_xz-$enable_sandbox in case $enable_sandbox in
no-no-*) auto)
enable_sandbox=no
AC_MSG_RESULT([no, --disable-xz and --disable-xzdec was used])
;;
*-*-auto)
AC_MSG_RESULT([maybe (autodetect)]) AC_MSG_RESULT([maybe (autodetect)])
;; ;;
*-*-no | *-*-capsicum | *-*-pledge | *-*-landlock) no | capsicum | pledge)
AC_MSG_RESULT([$enable_sandbox]) AC_MSG_RESULT([$enable_sandbox])
;; ;;
*) *)
AC_MSG_RESULT([]) AC_MSG_RESULT([])
AC_MSG_ERROR([--enable-sandbox only accepts 'auto', 'no', 'capsicum', 'pledge', or 'landlock'.]) AC_MSG_ERROR([--enable-sandbox only accepts `auto', `no', `capsicum', or `pledge'.])
;; ;;
esac esac
@ -635,10 +622,21 @@ AS_CASE([$enable_threads],
AC_DEFINE([MYTHREAD_POSIX], [1], AC_DEFINE([MYTHREAD_POSIX], [1],
[Define to 1 when using POSIX threads (pthreads).]) [Define to 1 when using POSIX threads (pthreads).])
# This is nice to have but not mandatory. # These are nice to have but not mandatory.
#
# FIXME: xz uses clock_gettime if it is available and can do
# it even when threading is disabled. Moving this outside
# of pthread detection may be undesirable because then
# liblzma may get linked against librt even when librt isn't
# needed by liblzma.
OLD_CFLAGS=$CFLAGS OLD_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_CHECK_FUNCS([pthread_condattr_setclock]) AC_SEARCH_LIBS([clock_gettime], [rt])
AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock])
AC_CHECK_DECL([CLOCK_MONOTONIC], [AC_DEFINE(
[HAVE_CLOCK_MONOTONIC], [1], [Define to 1 if
`CLOCK_MONOTONIC' is declared in <time.h>.])], [],
[[#include <time.h>]])
CFLAGS=$OLD_CFLAGS CFLAGS=$OLD_CFLAGS
], ],
[win95], [ [win95], [
@ -709,44 +707,23 @@ fi
# --with-pic and --without-pic though. As long as neither --with-pic nor # --with-pic and --without-pic though. As long as neither --with-pic nor
# --without-pic is used then we can use #ifdef PIC to detect if the file is # --without-pic is used then we can use #ifdef PIC to detect if the file is
# being built for a shared library. # being built for a shared library.
AS_IF([test "x$enable_symbol_versions" = xno], [ if test "x$enable_symbol_versions" = xno ; then
enable_symbol_versions=no enable_symbol_versions=no
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
], [test "x$enable_shared" = xno], [ elif test "x$enable_shared" = xno ; then
enable_symbol_versions=no enable_symbol_versions=no
AC_MSG_RESULT([no (not building a shared library)]) AC_MSG_RESULT([no (not building a shared library)])
], [ else
# "yes" means that symbol version are to be used but we need to
# autodetect which variant to use.
if test "x$enable_symbol_versions" = xyes ; then
case "$host_cpu-$host_os" in case "$host_cpu-$host_os" in
microblaze*) microblaze*)
# GCC 12 on MicroBlaze doesn't support # GCC 12 on MicroBlaze doesn't support __symver__
# __symver__ attribute. It's simplest and # attribute. It's simplest and safest to use the
# safest to use the generic version on that # generic version on that platform since then only
# platform since then only the linker script # the linker script is needed. The RHEL/CentOS 7
# is needed. The RHEL/CentOS 7 compatibility # compatibility symbols don't matter on MicroBlaze.
# symbols don't matter on MicroBlaze.
enable_symbol_versions=generic enable_symbol_versions=generic
;; ;;
*-linux*) *-linux*)
# NVIDIA HPC Compiler doesn't support symbol
# versioning but the linker script can still
# be used.
AC_EGREP_CPP([use_generic_symbol_versioning],
[#ifdef __NVCOMPILER
use_generic_symbol_versioning
#endif],
[enable_symbol_versions=generic],
[enable_symbol_versions=linux])
;;
*)
enable_symbol_versions=generic
;;
esac
fi
if test "x$enable_symbol_versions" = xlinux ; then
case "$pic_mode-$enable_static" in case "$pic_mode-$enable_static" in
default-*) default-*)
# Use symvers if PIC is defined. # Use symvers if PIC is defined.
@ -767,6 +744,7 @@ AS_IF([test "x$enable_symbol_versions" = xno], [
possibly picking only src/liblzma/.libs/liblzma.a from the static build.]) possibly picking only src/liblzma/.libs/liblzma.a from the static build.])
;; ;;
esac esac
enable_symbol_versions=linux
AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX], AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX],
[$have_symbol_versions_linux], [$have_symbol_versions_linux],
[Define to 1 to if GNU/Linux-specific details [Define to 1 to if GNU/Linux-specific details
@ -777,12 +755,13 @@ AS_IF([test "x$enable_symbol_versions" = xno], [
time with Libtool if neither --with-pic nor time with Libtool if neither --with-pic nor
--without-pic is used). This define must be --without-pic is used). This define must be
used together with liblzma_linux.map.]) used together with liblzma_linux.map.])
elif test "x$enable_symbol_versions" != xgeneric ; then ;;
AC_MSG_RESULT([]) *)
AC_MSG_ERROR([unknown symbol versioning variant '$enable_symbol_versions']) enable_symbol_versions=generic
fi ;;
esac
AC_MSG_RESULT([yes ($enable_symbol_versions)]) AC_MSG_RESULT([yes ($enable_symbol_versions)])
]) fi
AM_CONDITIONAL([COND_SYMVERS_LINUX], AM_CONDITIONAL([COND_SYMVERS_LINUX],
[test "x$enable_symbol_versions" = xlinux]) [test "x$enable_symbol_versions" = xlinux])
@ -879,6 +858,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
]) ])
CFLAGS="$OLD_CFLAGS" CFLAGS="$OLD_CFLAGS"
# The Win95 threading lacks a thread-safe one-time initialization function. # The Win95 threading lacks a thread-safe one-time initialization function.
# The one-time initialization is needed for crc32_small.c and crc64_small.c # The one-time initialization is needed for crc32_small.c and crc64_small.c
# create the CRC tables. So if small mode is enabled, the threading mode is # create the CRC tables. So if small mode is enabled, the threading mode is
@ -893,86 +873,6 @@ if test "x$enable_small$enable_threads$have_func_attribute_constructor" \
__attribute__((__constructor__))]) __attribute__((__constructor__))])
fi fi
# __attribute__((__ifunc__())) can be used to choose between different
# implementations of the same function at runtime. This is slightly more
# efficient than using __attribute__((__constructor__)) and setting
# a function pointer.
AC_ARG_ENABLE([ifunc], [AS_HELP_STRING([--enable-ifunc],
[Use __attribute__((__ifunc__())). Enabled by default on
GNU/Linux (glibc) and FreeBSD.])],
[], [enable_ifunc=auto])
# When enable_ifunc is 'auto', allow the use of __attribute__((__ifunc__()))
# if compiler support is detected and we are building for GNU/Linux (glibc)
# or FreeBSD. uClibc and musl don't support ifunc in their dynamic linkers
# but some compilers still accept the attribute when compiling for these
# C libraries, which results in broken binaries. That's why we need to
# check which libc is being used.
if test "x$enable_ifunc" = xauto ; then
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_MSG_CHECKING([if __attribute__((__ifunc__())) can be used])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
/*
* Force a compilation error when not using glibc on Linux
* or if we are not using FreeBSD. uClibc will define
* __GLIBC__ but does not support ifunc, so we must have
* an extra check to disable with uClibc.
*/
#if defined(__linux__)
# include <features.h>
# if !defined(__GLIBC__) || defined(__UCLIBC__)
compile error
# endif
#elif !defined(__FreeBSD__)
compile error
#endif
static void func(void) { return; }
/*
* The attribute __no_profile_instrument_function__ is
* needed with GCC to prevent improper instrumentation in
* the ifunc resolver.
*/
__attribute__((__no_profile_instrument_function__))
static void (*resolve_func (void)) (void) { return func; }
void func_ifunc (void)
__attribute__((__ifunc__("resolve_func")));
/*
* 'clang -Wall' incorrectly warns that resolve_func is
* unused (-Wunused-function). Correct assembly output is
* still produced. This problem exists at least in Clang
* versions 4 to 17. The following silences the bogus warning:
*/
void make_clang_quiet(void);
void make_clang_quiet(void) { resolve_func()(); }
]])], [
enable_ifunc=yes
], [
enable_ifunc=no
])
AC_MSG_RESULT([$enable_ifunc])
CFLAGS="$OLD_CFLAGS"
fi
if test "x$enable_ifunc" = xyes ; then
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_IFUNC], [1],
[Define to 1 if __attribute__((__ifunc__()))
is supported for functions.])
# ifunc explicitly does not work with -fsanitize=address.
# If configured, it will result in a liblzma build that will fail
# when liblzma is loaded at runtime (when the ifunc resolver
# executes).
AS_CASE([$CFLAGS], [*-fsanitize=*], [AC_MSG_ERROR([
CFLAGS contains '-fsanitize=' which is incompatible with ifunc.
Use --disable-ifunc when using '-fsanitize'.])])
fi
############################################################################### ###############################################################################
# Checks for library functions. # Checks for library functions.
############################################################################### ###############################################################################
@ -980,22 +880,6 @@ fi
# Gnulib replacements as needed # Gnulib replacements as needed
gl_GETOPT gl_GETOPT
# If clock_gettime() is available, liblzma with pthreads may use it, and
# xz may use it even when threading support is disabled. In XZ Utils 5.4.x
# and older, configure checked for clock_gettime() only when using pthreads.
# This way non-threaded builds of liblzma didn't get a useless dependency on
# librt which further had a dependency on libpthread. Avoiding these was
# useful when a small build was needed, for example, for initramfs use.
#
# The above reasoning is thoroughly obsolete: On GNU/Linux, librt hasn't
# been needed for clock_gettime() since glibc 2.17 (2012-12-25).
# Solaris 10 needs librt but Solaris 11 doesn't anymore.
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_CHECK_FUNCS([clock_gettime])
AC_CHECK_DECL([CLOCK_MONOTONIC], [AC_DEFINE([HAVE_CLOCK_MONOTONIC], [1],
[Define to 1 if 'CLOCK_MONOTONIC' is declared in <time.h>.])], [],
[[#include <time.h>]])
# Find the best function to set timestamps. # Find the best function to set timestamps.
AC_CHECK_FUNCS([futimens futimes futimesat utimes _futime utime], [break]) AC_CHECK_FUNCS([futimens futimes futimesat utimes _futime utime], [break])
@ -1115,121 +999,21 @@ __m128i my_clmul(__m128i a)
[Define to 1 if _mm_set_epi64x and [Define to 1 if _mm_set_epi64x and
_mm_clmulepi64_si128 are usable. _mm_clmulepi64_si128 are usable.
See configure.ac for details.]) See configure.ac for details.])
enable_clmul_crc=yes
], [
enable_clmul_crc=no
])
AC_MSG_RESULT([$enable_clmul_crc])
])
# ARM64 C Language Extensions define CRC32 functions in arm_acle.h.
# These are supported by at least GCC and Clang which both need
# __attribute__((__target__("+crc"))), unless the needed compiler flags
# are used to support the CRC instruction.
AC_MSG_CHECKING([if ARM64 CRC32 instruction is usable])
AS_IF([test "x$enable_arm64_crc32" = xno], [
AC_MSG_RESULT([no, --disable-arm64-crc32 was used])
], [
# Set -Werror here because some versions of Clang (14 and older)
# do not report the unsupported __attribute__((__target__("+crc")))
# or __crc32d() as an error, only as a warning. This does not need
# to be done with CMake because tests will attempt to link and the
# error will be reported then.
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <arm_acle.h>
#include <stdint.h>
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
__attribute__((__target__("+crc")))
#endif
uint32_t my_crc(uint32_t a, uint64_t b)
{
return __crc32d(a, b);
}
]])], [
AC_DEFINE([HAVE_ARM64_CRC32], [1],
[Define to 1 if ARM64 CRC32 instruction is supported.
See configure.ac for details.])
enable_arm64_crc32=yes
], [
enable_arm64_crc32=no
])
AC_MSG_RESULT([$enable_arm64_crc32])
CFLAGS="$OLD_CFLAGS"
])
# Check for ARM64 CRC32 instruction runtime detection.
# getauxval() is supported on Linux, elf_aux_info() on FreeBSD, and
# sysctlbyname("hw.optional.armv8_crc32", ...) is supported on Darwin
# (macOS, iOS, etc.). Note that sysctlbyname() is supported on FreeBSD,
# NetBSD, and possibly others too but the string is specific to Apple OSes.
# The C code is responsible for checking defined(__APPLE__) before using
# sysctlbyname("hw.optional.armv8_crc32", ...).
AS_IF([test "x$enable_arm64_crc32" = xyes], [
AC_CHECK_FUNCS([getauxval elf_aux_info sysctlbyname])
])
# Check for sandbox support. If one is found, set enable_sandbox=found.
#
# About -fsanitize: Of our three sandbox methods, only Landlock is
# incompatible with -fsanitize. FreeBSD 13.2 with Capsicum was tested with
# -fsanitize=address,undefined and had no issues. OpenBSD (as of version
# 7.4) has minimal support for process instrumentation. OpenBSD does not
# distribute the additional libraries needed (libasan, libubsan, etc.) with
# GCC or Clang needed for runtime sanitization support and instead only
# support -fsanitize-minimal-runtime for minimal undefined behavior
# sanitization. This minimal support is compatible with our use of the
# Pledge sandbox. So only Landlock will result in a build that cannot
# compress or decompress a single file to standard out.
AS_CASE([$enable_sandbox],
[auto | capsicum], [
AC_CHECK_FUNCS([cap_rights_limit], [enable_sandbox=found])
]
)
AS_CASE([$enable_sandbox],
[auto | pledge], [
AC_CHECK_FUNCS([pledge], [enable_sandbox=found])
]
)
AS_CASE([$enable_sandbox],
[auto | landlock], [
AC_MSG_CHECKING([if Linux Landlock is usable])
# A compile check is done here because some systems have
# linux/landlock.h, but do not have the syscalls defined
# in order to actually use Linux Landlock.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/landlock.h>
#include <sys/syscall.h>
#include <sys/prctl.h>
void my_sandbox(void)
{
(void)prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
(void)SYS_landlock_create_ruleset;
(void)SYS_landlock_restrict_self;
(void)LANDLOCK_CREATE_RULESET_VERSION;
return;
}
]])], [
enable_sandbox=found
AS_CASE([$CFLAGS], [*-fsanitize=*], [AC_MSG_ERROR([
CFLAGS contains '-fsanitize=' which is incompatible with the Landlock
sandboxing. Use --disable-sandbox when using '-fsanitize'.])])
AC_DEFINE([HAVE_LINUX_LANDLOCK], [1],
[Define to 1 if Linux Landlock is supported.
See configure.ac for details.])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
], [ ], [
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
]) ])
])
# Check for sandbox support. If one is found, set enable_sandbox=found.
AS_CASE([$enable_sandbox],
[auto | capsicum], [
AX_CHECK_CAPSICUM([enable_sandbox=found], [:])
]
)
AS_CASE([$enable_sandbox],
[auto | pledge], [
AC_CHECK_FUNCS([pledge], [enable_sandbox=found ; break])
] ]
) )
@ -1279,6 +1063,7 @@ AS_IF([test "$GCC" = yes], [
-Wall \ -Wall \
-Wextra \ -Wextra \
-Wvla \ -Wvla \
-Wc99-c11-compat \
-Wformat=2 \ -Wformat=2 \
-Winit-self \ -Winit-self \
-Wmissing-include-dirs \ -Wmissing-include-dirs \

View File

@ -1,5 +1,9 @@
## SPDX-License-Identifier: 0BSD ##
## Author: Lasse Collin ## Author: Lasse Collin
##
## This file has been put into the public domain.
## You can do whatever you want with this file.
##
EXTRA_DIST = \ EXTRA_DIST = \
translation.bash translation.bash

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file crc32.c /// \file crc32.c
@ -7,6 +5,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h" #include "sysdefs.h"

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file full_flush.c /// \file full_flush.c
@ -7,6 +5,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h" #include "sysdefs.h"

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file hex2bin.c /// \file hex2bin.c
@ -7,6 +5,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h" #include "sysdefs.h"

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file known_sizes.c /// \file known_sizes.c
@ -11,6 +9,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h" #include "sysdefs.h"

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file memusage.c /// \file memusage.c
@ -7,6 +5,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h" #include "sysdefs.h"

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file repeat.c /// \file repeat.c
@ -11,6 +9,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h" #include "sysdefs.h"

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file sync_flush.c /// \file sync_flush.c
@ -7,6 +5,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h" #include "sysdefs.h"

View File

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: 0BSD
############################################################################### ###############################################################################
# #
@ -21,6 +20,9 @@
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################### ###############################################################################
set -e set -e

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file 01_compress_easy.c /// \file 01_compress_easy.c
@ -11,6 +9,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <stdbool.h> #include <stdbool.h>
@ -26,7 +27,7 @@ show_usage_and_exit(const char *argv0)
{ {
fprintf(stderr, "Usage: %s PRESET < INFILE > OUTFILE\n" fprintf(stderr, "Usage: %s PRESET < INFILE > OUTFILE\n"
"PRESET is a number 0-9 and can optionally be " "PRESET is a number 0-9 and can optionally be "
"followed by 'e' to indicate extreme preset\n", "followed by `e' to indicate extreme preset\n",
argv0); argv0);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file 02_decompress.c /// \file 02_decompress.c
@ -11,6 +9,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <stdbool.h> #include <stdbool.h>

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file 03_compress_custom.c /// \file 03_compress_custom.c
@ -11,6 +9,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <stdbool.h> #include <stdbool.h>

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file 04_compress_easy_mt.c /// \file 04_compress_easy_mt.c
@ -11,6 +9,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <stdbool.h> #include <stdbool.h>

View File

@ -1,5 +1,3 @@
// SPDX-License-Identifier: 0BSD
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
/// \file 11_file_info.c /// \file 11_file_info.c
@ -11,6 +9,9 @@
// //
// Author: Lasse Collin // Author: Lasse Collin
// //
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <stdbool.h> #include <stdbool.h>
@ -32,7 +33,7 @@ print_file_size(lzma_stream *strm, FILE *infile, const char *filename)
// large files on 32-bit systems (POSIX versions fseeko() and // large files on 32-bit systems (POSIX versions fseeko() and
// ftello() can support large files). // ftello() can support large files).
if (fseek(infile, 0, SEEK_END)) { if (fseek(infile, 0, SEEK_END)) {
fprintf(stderr, "Error seeking the file '%s': %s\n", fprintf(stderr, "Error seeking the file `%s': %s\n",
filename, strerror(errno)); filename, strerror(errno));
return false; return false;
} }
@ -79,7 +80,7 @@ print_file_size(lzma_stream *strm, FILE *infile, const char *filename)
if (ferror(infile)) { if (ferror(infile)) {
fprintf(stderr, fprintf(stderr,
"Error reading from '%s': %s\n", "Error reading from `%s': %s\n",
filename, strerror(errno)); filename, strerror(errno));
return false; return false;
} }
@ -103,7 +104,7 @@ print_file_size(lzma_stream *strm, FILE *infile, const char *filename)
// switch fseeko() or lseek(). // switch fseeko() or lseek().
if (fseek(infile, (long)(strm->seek_pos), SEEK_SET)) { if (fseek(infile, (long)(strm->seek_pos), SEEK_SET)) {
fprintf(stderr, "Error seeking the " fprintf(stderr, "Error seeking the "
"file '%s': %s\n", "file `%s': %s\n",
filename, strerror(errno)); filename, strerror(errno));
return false; return false;
} }
@ -132,24 +133,24 @@ print_file_size(lzma_stream *strm, FILE *infile, const char *filename)
case LZMA_FORMAT_ERROR: case LZMA_FORMAT_ERROR:
// .xz magic bytes weren't found. // .xz magic bytes weren't found.
fprintf(stderr, "The file '%s' is not " fprintf(stderr, "The file `%s' is not "
"in the .xz format\n", filename); "in the .xz format\n", filename);
return false; return false;
case LZMA_OPTIONS_ERROR: case LZMA_OPTIONS_ERROR:
fprintf(stderr, "The file '%s' has .xz headers that " fprintf(stderr, "The file `%s' has .xz headers that "
"are not supported by this liblzma " "are not supported by this liblzma "
"version\n", filename); "version\n", filename);
return false; return false;
case LZMA_DATA_ERROR: case LZMA_DATA_ERROR:
fprintf(stderr, "The file '%s' is corrupt\n", fprintf(stderr, "The file `%s' is corrupt\n",
filename); filename);
return false; return false;
case LZMA_MEM_ERROR: case LZMA_MEM_ERROR:
fprintf(stderr, "Memory allocation failed when " fprintf(stderr, "Memory allocation failed when "
"decoding the file '%s'\n", filename); "decoding the file `%s'\n", filename);
return false; return false;
// LZMA_MEMLIMIT_ERROR shouldn't happen because we used // LZMA_MEMLIMIT_ERROR shouldn't happen because we used
@ -182,7 +183,7 @@ main(int argc, char **argv)
FILE *infile = fopen(argv[i], "rb"); FILE *infile = fopen(argv[i], "rb");
if (infile == NULL) { if (infile == NULL) {
fprintf(stderr, "Cannot open the file '%s': %s\n", fprintf(stderr, "Cannot open the file `%s': %s\n",
argv[i], strerror(errno)); argv[i], strerror(errno));
success = false; success = false;
} }

View File

@ -1,5 +1,9 @@
# SPDX-License-Identifier: 0BSD #
# Author: Lasse Collin # Author: Lasse Collin
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
CC = c99 CC = c99
CFLAGS = -g CFLAGS = -g

View File

@ -0,0 +1,127 @@
/*
* xz_pipe_comp.c
* A simple example of pipe-only xz compressor implementation.
* version: 2010-07-12 - by Daniel Mealha Cabrita
* Not copyrighted -- provided to the public domain.
*
* Compiling:
* Link with liblzma. GCC example:
* $ gcc -llzma xz_pipe_comp.c -o xz_pipe_comp
*
* Usage example:
* $ cat some_file | ./xz_pipe_comp > some_file.xz
*/
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdbool.h>
#include <lzma.h>
/* COMPRESSION SETTINGS */
/* analogous to xz CLI options: -0 to -9 */
#define COMPRESSION_LEVEL 6
/* boolean setting, analogous to xz CLI option: -e */
#define COMPRESSION_EXTREME true
/* see: /usr/include/lzma/check.h LZMA_CHECK_* */
#define INTEGRITY_CHECK LZMA_CHECK_CRC64
/* read/write buffer sizes */
#define IN_BUF_MAX 4096
#define OUT_BUF_MAX 4096
/* error codes */
#define RET_OK 0
#define RET_ERROR_INIT 1
#define RET_ERROR_INPUT 2
#define RET_ERROR_OUTPUT 3
#define RET_ERROR_COMPRESSION 4
/* note: in_file and out_file must be open already */
int xz_compress (FILE *in_file, FILE *out_file)
{
uint32_t preset = COMPRESSION_LEVEL | (COMPRESSION_EXTREME ? LZMA_PRESET_EXTREME : 0);
lzma_check check = INTEGRITY_CHECK;
lzma_stream strm = LZMA_STREAM_INIT; /* alloc and init lzma_stream struct */
uint8_t in_buf [IN_BUF_MAX];
uint8_t out_buf [OUT_BUF_MAX];
size_t in_len; /* length of useful data in in_buf */
size_t out_len; /* length of useful data in out_buf */
bool in_finished = false;
bool out_finished = false;
lzma_action action;
lzma_ret ret_xz;
int ret;
ret = RET_OK;
/* initialize xz encoder */
ret_xz = lzma_easy_encoder (&strm, preset, check);
if (ret_xz != LZMA_OK) {
fprintf (stderr, "lzma_easy_encoder error: %d\n", (int) ret_xz);
return RET_ERROR_INIT;
}
while ((! in_finished) && (! out_finished)) {
/* read incoming data */
in_len = fread (in_buf, 1, IN_BUF_MAX, in_file);
if (feof (in_file)) {
in_finished = true;
}
if (ferror (in_file)) {
in_finished = true;
ret = RET_ERROR_INPUT;
}
strm.next_in = in_buf;
strm.avail_in = in_len;
/* if no more data from in_buf, flushes the
internal xz buffers and closes the xz data
with LZMA_FINISH */
action = in_finished ? LZMA_FINISH : LZMA_RUN;
/* loop until there's no pending compressed output */
do {
/* out_buf is clean at this point */
strm.next_out = out_buf;
strm.avail_out = OUT_BUF_MAX;
/* compress data */
ret_xz = lzma_code (&strm, action);
if ((ret_xz != LZMA_OK) && (ret_xz != LZMA_STREAM_END)) {
fprintf (stderr, "lzma_code error: %d\n", (int) ret_xz);
out_finished = true;
ret = RET_ERROR_COMPRESSION;
} else {
/* write compressed data */
out_len = OUT_BUF_MAX - strm.avail_out;
fwrite (out_buf, 1, out_len, out_file);
if (ferror (out_file)) {
out_finished = true;
ret = RET_ERROR_OUTPUT;
}
}
} while (strm.avail_out == 0);
}
lzma_end (&strm);
return ret;
}
int main ()
{
int ret;
ret = xz_compress (stdin, stdout);
return ret;
}

View File

@ -0,0 +1,123 @@
/*
* xz_pipe_decomp.c
* A simple example of pipe-only xz decompressor implementation.
* version: 2012-06-14 - by Daniel Mealha Cabrita
* Not copyrighted -- provided to the public domain.
*
* Compiling:
* Link with liblzma. GCC example:
* $ gcc -llzma xz_pipe_decomp.c -o xz_pipe_decomp
*
* Usage example:
* $ cat some_file.xz | ./xz_pipe_decomp > some_file
*/
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdbool.h>
#include <lzma.h>
/* read/write buffer sizes */
#define IN_BUF_MAX 4096
#define OUT_BUF_MAX 4096
/* error codes */
#define RET_OK 0
#define RET_ERROR_INIT 1
#define RET_ERROR_INPUT 2
#define RET_ERROR_OUTPUT 3
#define RET_ERROR_DECOMPRESSION 4
/* note: in_file and out_file must be open already */
int xz_decompress (FILE *in_file, FILE *out_file)
{
lzma_stream strm = LZMA_STREAM_INIT; /* alloc and init lzma_stream struct */
const uint32_t flags = LZMA_TELL_UNSUPPORTED_CHECK | LZMA_CONCATENATED;
const uint64_t memory_limit = UINT64_MAX; /* no memory limit */
uint8_t in_buf [IN_BUF_MAX];
uint8_t out_buf [OUT_BUF_MAX];
size_t in_len; /* length of useful data in in_buf */
size_t out_len; /* length of useful data in out_buf */
bool in_finished = false;
bool out_finished = false;
lzma_action action;
lzma_ret ret_xz;
int ret;
ret = RET_OK;
/* initialize xz decoder */
ret_xz = lzma_stream_decoder (&strm, memory_limit, flags);
if (ret_xz != LZMA_OK) {
fprintf (stderr, "lzma_stream_decoder error: %d\n", (int) ret_xz);
return RET_ERROR_INIT;
}
while ((! in_finished) && (! out_finished)) {
/* read incoming data */
in_len = fread (in_buf, 1, IN_BUF_MAX, in_file);
if (feof (in_file)) {
in_finished = true;
}
if (ferror (in_file)) {
in_finished = true;
ret = RET_ERROR_INPUT;
}
strm.next_in = in_buf;
strm.avail_in = in_len;
/* if no more data from in_buf, flushes the
internal xz buffers and closes the decompressed data
with LZMA_FINISH */
action = in_finished ? LZMA_FINISH : LZMA_RUN;
/* loop until there's no pending decompressed output */
do {
/* out_buf is clean at this point */
strm.next_out = out_buf;
strm.avail_out = OUT_BUF_MAX;
/* decompress data */
ret_xz = lzma_code (&strm, action);
if ((ret_xz != LZMA_OK) && (ret_xz != LZMA_STREAM_END)) {
fprintf (stderr, "lzma_code error: %d\n", (int) ret_xz);
out_finished = true;
ret = RET_ERROR_DECOMPRESSION;
} else {
/* write decompressed data */
out_len = OUT_BUF_MAX - strm.avail_out;
fwrite (out_buf, 1, out_len, out_file);
if (ferror (out_file)) {
out_finished = true;
ret = RET_ERROR_OUTPUT;
}
}
} while (strm.avail_out == 0);
}
/* Bug fix (2012-06-14): If no errors were detected, check
that the last lzma_code() call returned LZMA_STREAM_END.
If not, the file is probably truncated. */
if ((ret == RET_OK) && (ret_xz != LZMA_STREAM_END)) {
fprintf (stderr, "Input truncated or corrupt\n");
ret = RET_ERROR_DECOMPRESSION;
}
lzma_end (&strm);
return ret;
}
int main ()
{
int ret;
ret = xz_decompress (stdin, stdout);
return ret;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -1,11 +1,12 @@
# SPDX-License-Identifier: 0BSD
############################################################################### ###############################################################################
# #
# Makefile to build XZ Utils using DJGPP # Makefile to build XZ Utils using DJGPP
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################### ###############################################################################
# For debugging, set comment "#define NDEBUG 1" from config.h to enable # For debugging, set comment "#define NDEBUG 1" from config.h to enable

View File

@ -1,5 +1,3 @@
/* SPDX-License-Identifier: 0BSD */
/* How many MiB of RAM to assume if the real amount cannot be determined. */ /* How many MiB of RAM to assume if the real amount cannot be determined. */
#define ASSUME_RAM 32 #define ASSUME_RAM 32
@ -117,14 +115,14 @@
/* Define to 1 if you have the <sys/time.h> header file. */ /* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the 'utimes' function. */ /* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1 #define HAVE_UTIMES 1
/* Define to 1 or 0, depending whether the compiler supports simple visibility /* Define to 1 or 0, depending whether the compiler supports simple visibility
declarations. */ declarations. */
#define HAVE_VISIBILITY 0 #define HAVE_VISIBILITY 0
/* Define to 1 if the system has the type '_Bool'. */ /* Define to 1 if the system has the type `_Bool'. */
#define HAVE__BOOL 1 #define HAVE__BOOL 1
/* Define to 1 if the GNU C extension __builtin_assume_aligned is supported. /* Define to 1 if the GNU C extension __builtin_assume_aligned is supported.
@ -147,7 +145,7 @@
/* Define to the home page for this package. */ /* Define to the home page for this package. */
#define PACKAGE_URL "https://xz.tukaani.org/xz-utils/" #define PACKAGE_URL "https://xz.tukaani.org/xz-utils/"
/* The size of 'size_t', as computed by sizeof. */ /* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4 #define SIZEOF_SIZE_T 4
/* Define to 1 if the system supports fast unaligned access to 16-bit and /* Define to 1 if the system supports fast unaligned access to 16-bit and

View File

@ -61,7 +61,7 @@ PROJECT_BRIEF =
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory. # the logo to the output directory.
PROJECT_LOGO = ../doc/xz-logo.png PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
@ -1246,7 +1246,7 @@ HTML_HEADER =
# that doxygen normally uses. # that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER = footer.html HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of # sheet that is used by each HTML page. It can be used to fine-tune the look of
@ -1286,7 +1286,7 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available. # files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = ../COPYING.CC-BY-SA-4.0 HTML_EXTRA_FILES =
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output # The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
# should be rendered with a dark or light theme. # should be rendered with a dark or light theme.

View File

@ -1,13 +0,0 @@
<hr class="footer"/>
<p style="text-align: right;padding-right: 12px;">
XZ logo &copy; 2023 by Jia Tan is licensed under
<a href="COPYING.CC-BY-SA-4.0"
rel="license"
style="display:inline-block;">
CC BY-SA 4.0
</a>
</p>
</body>
</html>

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: 0BSD #
############################################################################# #############################################################################
# #
# Updates the Doxygen generated documentation files in the source tree. # Updates the Doxygen generated documentation files in the source tree.
@ -17,6 +16,9 @@
# Authors: Jia Tan # Authors: Jia Tan
# Lasse Collin # Lasse Collin
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################# #############################################################################
set -e set -e

View File

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: 0BSD #
############################################################################# #############################################################################
# #
# 7z2lzma.bash is very primitive .7z to .lzma converter. The input file must # 7z2lzma.bash is very primitive .7z to .lzma converter. The input file must
@ -18,6 +17,9 @@
# #
# Author: Lasse Collin <lasse.collin@tukaani.org> # Author: Lasse Collin <lasse.collin@tukaani.org>
# #
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
############################################################################# #############################################################################
# You can use 7z or 7za, both will work. # You can use 7z or 7za, both will work.

View File

@ -1,5 +1,3 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* /*
scanlzma, scan for lzma compressed data in stdin and echo it to stdout. scanlzma, scan for lzma compressed data in stdin and echo it to stdout.
Copyright (C) 2006 Timo Lindfors Copyright (C) 2006 Timo Lindfors

View File

@ -1,5 +1,3 @@
## SPDX-License-Identifier: GPL-2.0-or-later
## ##
## Copyright (C) 2004-2007 Free Software Foundation, Inc. ## Copyright (C) 2004-2007 Free Software Foundation, Inc.
## ##
@ -23,17 +21,7 @@ libgnu_a_SOURCES =
libgnu_a_DEPENDENCIES = $(LIBOBJS) libgnu_a_DEPENDENCIES = $(LIBOBJS)
libgnu_a_LIBADD = $(LIBOBJS) libgnu_a_LIBADD = $(LIBOBJS)
EXTRA_DIST = \ EXTRA_DIST = getopt.in.h getopt.c getopt1.c getopt_int.h
getopt.in.h \
getopt.c \
getopt1.c \
getopt_int.h \
getopt-cdefs.h \
getopt-core.h \
getopt-ext.h \
getopt-pfx-core.h \
getopt-pfx-ext.h
BUILT_SOURCES = $(GETOPT_H) BUILT_SOURCES = $(GETOPT_H)
MOSTLYCLEANFILES = getopt.h getopt.h-t MOSTLYCLEANFILES = getopt.h getopt.h-t

View File

@ -1,72 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* getopt-on-non-glibc compatibility macros.
Copyright (C) 1989-2023 Free Software Foundation, Inc.
This file is part of gnulib.
Unlike most of the getopt implementation, it is NOT shared
with the GNU C Library.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_CDEFS_H
#define _GETOPT_CDEFS_H 1
/* This header should not be used directly; include getopt.h or
unistd.h instead. It does not have a protective #error, because
the guard macro for getopt.h in gnulib is not fixed. */
/* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect
a number of the internal macros supplied to GNU libc's headers by
sys/cdefs.h. Provide fallback definitions for all of them. */
#ifdef HAVE_SYS_CDEFS_H
# include <sys/cdefs.h>
#endif
#ifndef __BEGIN_DECLS
# ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# else
# define __BEGIN_DECLS /* nothing */
# endif
#endif
#ifndef __END_DECLS
# ifdef __cplusplus
# define __END_DECLS }
# else
# define __END_DECLS /* nothing */
# endif
#endif
#ifndef __GNUC_PREREQ
# if defined __GNUC__ && defined __GNUC_VERSION__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# else
# define __GNUC_PREREQ(maj, min) 0
# endif
#endif
#ifndef __THROW
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
# if __cplusplus >= 201103L
# define __THROW noexcept (true)
# else
# define __THROW throw ()
# endif
# else
# define __THROW
# endif
#endif
#endif /* _GETOPT_CDEFS_H */

View File

@ -1,98 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Declarations for getopt (basic, portable features only).
Copyright (C) 1989-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_CORE_H
#define _GETOPT_CORE_H 1
/* This header should not be used directly; include getopt.h or
unistd.h instead. Unlike most bits headers, it does not have
a protective #error, because the guard macro for getopt.h in
gnulib is not fixed. */
__BEGIN_DECLS
/* For communication from 'getopt' to the caller.
When 'getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when 'ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to 'getopt'.
On entry to 'getopt', zero means this is the first call; initialize.
When 'getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, 'optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message 'getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, 'optopt' is set to the option letter, and '?' is
returned.
The OPTS string is a list of characters which are recognized option
letters, optionally followed by colons, specifying that that letter
takes an argument, to be placed in 'optarg'.
If a letter in OPTS is followed by two colons, its argument is
optional. This behavior is specific to the GNU 'getopt'.
The argument '--' causes premature termination of argument
scanning, explicitly telling 'getopt' that there are no more
options.
If OPTS begins with '-', then non-option arguments are treated as
arguments to the option '\1'. This behavior is specific to the GNU
'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
the environment, then do not permute arguments.
For standards compliance, the 'argv' argument has the type
char *const *, but this is inaccurate; if argument permutation is
enabled, the argv array (not the strings it points to) must be
writable. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
__THROW _GL_ARG_NONNULL ((2, 3));
__END_DECLS
#endif /* _GETOPT_CORE_H */

View File

@ -1,79 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Declarations for getopt (GNU extensions).
Copyright (C) 1989-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_EXT_H
#define _GETOPT_EXT_H 1
/* This header should not be used directly; include getopt.h instead.
Unlike most bits headers, it does not have a protective #error,
because the guard macro for getopt.h in gnulib is not fixed. */
__BEGIN_DECLS
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of 'struct option' terminated by an element containing a name which is
zero.
The field 'has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field 'flag' is not NULL, it points to a variable that is set
to the value given in the field 'val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an 'int' to
a compiled-in constant, such as set a value from 'optarg', set the
option's 'flag' field to zero and its 'val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero 'flag' field, 'getopt'
returns the contents of the 'val' field. */
struct option
{
const char *name;
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the 'has_arg' field of 'struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind)
__THROW _GL_ARG_NONNULL ((2, 3));
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind)
__THROW _GL_ARG_NONNULL ((2, 3));
__END_DECLS
#endif /* _GETOPT_EXT_H */

View File

@ -1,68 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* getopt (basic, portable features) gnulib wrapper header.
Copyright (C) 1989-2023 Free Software Foundation, Inc.
This file is part of gnulib.
Unlike most of the getopt implementation, it is NOT shared
with the GNU C Library.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_PFX_CORE_H
#define _GETOPT_PFX_CORE_H 1
/* This header should not be used directly; include getopt.h or
unistd.h instead. It does not have a protective #error, because
the guard macro for getopt.h in gnulib is not fixed. */
/* Standalone applications should #define __GETOPT_PREFIX to an
identifier that prefixes the external functions and variables
defined in getopt-core.h and getopt-ext.h. Systematically
rename identifiers so that they do not collide with the system
functions and variables. Renaming avoids problems with some
compilers and linkers. */
#ifdef __GETOPT_PREFIX
# ifndef __GETOPT_ID
# define __GETOPT_CONCAT(x, y) x ## y
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
# endif
# undef getopt
# undef optarg
# undef opterr
# undef optind
# undef optopt
# define getopt __GETOPT_ID (getopt)
# define optarg __GETOPT_ID (optarg)
# define opterr __GETOPT_ID (opterr)
# define optind __GETOPT_ID (optind)
# define optopt __GETOPT_ID (optopt)
/* Work around a problem on macOS, which declares getopt with a
trailing __DARWIN_ALIAS(getopt) that would expand to something like
__asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */
# ifdef __APPLE__
# define _GETOPT
# endif
/* The system's getopt.h may have already included getopt-core.h to
declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that
getopt-core.h declares them with prefixes. */
# undef _GETOPT_CORE_H
#endif
#include <getopt-core.h>
#endif /* _GETOPT_PFX_CORE_H */

View File

@ -1,72 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* getopt (GNU extensions) gnulib wrapper header.
Copyright (C) 1989-2023 Free Software Foundation, Inc.
This file is part of gnulib.
Unlike most of the getopt implementation, it is NOT shared
with the GNU C Library.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_PFX_EXT_H
#define _GETOPT_PFX_EXT_H 1
/* This header should not be used directly; include getopt.h instead.
It does not have a protective #error, because the guard macro for
getopt.h in gnulib is not fixed. */
/* Standalone applications should #define __GETOPT_PREFIX to an
identifier that prefixes the external functions and variables
defined in getopt-core.h and getopt-ext.h. Systematically
rename identifiers so that they do not collide with the system
functions and variables. Renaming avoids problems with some
compilers and linkers. */
#ifdef __GETOPT_PREFIX
# ifndef __GETOPT_ID
# define __GETOPT_CONCAT(x, y) x ## y
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
# endif
# undef getopt_long
# undef getopt_long_only
# undef option
# undef _getopt_internal
# define getopt_long __GETOPT_ID (getopt_long)
# define getopt_long_only __GETOPT_ID (getopt_long_only)
# define option __GETOPT_ID (option)
# define _getopt_internal __GETOPT_ID (getopt_internal)
/* The system's getopt.h may have already included getopt-ext.h to
declare the unprefixed identifiers. Undef _GETOPT_EXT_H so that
getopt-ext.h declares them with prefixes. */
# undef _GETOPT_EXT_H
#endif
/* Standalone applications get correct prototypes for getopt_long and
getopt_long_only; they declare "char **argv". For backward
compatibility with old applications, if __GETOPT_PREFIX is not
defined, we supply GNU-libc-compatible, but incorrect, prototypes
using "char *const *argv". (GNU libc is stuck with the incorrect
prototypes, as they are baked into older versions of LSB.) */
#ifndef __getopt_argv_const
# if defined __GETOPT_PREFIX
# define __getopt_argv_const /* empty */
# else
# define __getopt_argv_const const
# endif
#endif
#include <getopt-ext.h>
#endif /* _GETOPT_PFX_EXT_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,27 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Declarations for getopt. /* Declarations for getopt.
Copyright (C) 1989-2023 Free Software Foundation, Inc. Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007
This file is part of gnulib. Free Software Foundation, Inc.
Unlike most of the getopt implementation, it is NOT shared This file is part of the GNU C Library.
with the GNU C Library, which supplies a different version of
this file.
This file is free software: you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as it under the terms of the GNU Lesser General Public License as published by
published by the Free Software Foundation; either version 2.1 of the the Free Software Foundation; either version 2.1, or (at your option)
License, or (at your option) any later version. any later version.
This file is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License along
along with this program. If not, see <https://www.gnu.org/licenses/>. */ with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GETOPT_H #ifndef _GETOPT_H
#ifndef __need_getopt
# define _GETOPT_H 1 # define _GETOPT_H 1
#endif
/* Standalone applications should #define __GETOPT_PREFIX to an /* Standalone applications should #define __GETOPT_PREFIX to an
identifier that prefixes the external functions and variables identifier that prefixes the external functions and variables
@ -32,29 +31,196 @@
identifiers so that they do not collide with the system functions identifiers so that they do not collide with the system functions
and variables. Renaming avoids problems with some compilers and and variables. Renaming avoids problems with some compilers and
linkers. */ linkers. */
#if defined __GETOPT_PREFIX #if defined __GETOPT_PREFIX && !defined __need_getopt
# include <stdlib.h> # include <stdlib.h>
# include <stdio.h> # include <stdio.h>
# ifndef _MSC_VER
# include <unistd.h> # include <unistd.h>
# endif # undef __need_getopt
# undef getopt
# undef getopt_long
# undef getopt_long_only
# undef optarg
# undef opterr
# undef optind
# undef optopt
# define __GETOPT_CONCAT(x, y) x ## y
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
# define getopt __GETOPT_ID (getopt)
# define getopt_long __GETOPT_ID (getopt_long)
# define getopt_long_only __GETOPT_ID (getopt_long_only)
# define optarg __GETOPT_ID (optarg)
# define opterr __GETOPT_ID (opterr)
# define optind __GETOPT_ID (optind)
# define optopt __GETOPT_ID (optopt)
#endif #endif
/* From Gnulib's lib/arg-nonnull.h: */ /* Standalone applications get correct prototypes for getopt_long and
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools getopt_long_only; they declare "char **argv". libc uses prototypes
that the values passed as arguments n, ..., m must be non-NULL pointers. with "char *const *argv" that are incorrect because getopt_long and
n = 1 stands for the first argument, n = 2 for the second argument etc. */ getopt_long_only can permute argv; this is required for backward
#ifndef _GL_ARG_NONNULL compatibility (e.g., for LSB 2.0.1).
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
but it caused redefinition warnings if both unistd.h and getopt.h were
included, since unistd.h includes getopt.h having previously defined
__need_getopt.
The only place where __getopt_argv_const is used is in definitions
of getopt_long and getopt_long_only below, but these are visible
only if __need_getopt is not defined, so it is quite safe to rewrite
the conditional as follows:
*/
#if !defined __need_getopt
# if defined __GETOPT_PREFIX
# define __getopt_argv_const /* empty */
# else # else
# define _GL_ARG_NONNULL(params) # define __getopt_argv_const const
# endif # endif
#endif #endif
#include <getopt-cdefs.h> /* If __GNU_LIBRARY__ is not already defined, either we are being used
#include <getopt-pfx-core.h> standalone, or this is the first header included in the source file.
#include <getopt-pfx-ext.h> If we are being used with glibc, we need to include <features.h>, but
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
not defined, include <ctype.h>, which will pull in <features.h> for us
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
doesn't flood the namespace with stuff the way some other headers do.) */
#if !defined __GNU_LIBRARY__
# include <ctype.h>
#endif
#endif /* _GETOPT_H */ #ifndef __THROW
# ifndef __GNUC_PREREQ
# define __GNUC_PREREQ(maj, min) (0)
# endif
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
# else
# define __THROW
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
const char *name;
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
# define no_argument 0
# define required_argument 1
# define optional_argument 2
#endif /* need getopt */
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, `optopt' is set to the option letter, and '?' is
returned.
The OPTS string is a list of characters which are recognized option
letters, optionally followed by colons, specifying that that letter
takes an argument, to be placed in `optarg'.
If a letter in OPTS is followed by two colons, its argument is
optional. This behavior is specific to the GNU `getopt'.
The argument `--' causes premature termination of argument
scanning, explicitly telling `getopt' that there are no more
options.
If OPTS begins with `-', then non-option arguments are treated as
arguments to the option '\1'. This behavior is specific to the GNU
`getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in
the environment, then do not permute arguments. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
__THROW;
#ifndef __need_getopt
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind)
__THROW;
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind)
__THROW;
#endif
#ifdef __cplusplus
}
#endif
/* Make sure we later can get all the definitions and declarations. */
#undef __need_getopt
#endif /* getopt.h */

View File

@ -1,32 +1,41 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* getopt_long and getopt_long_only entry points for GNU getopt. /* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987-2023 Free Software Foundation, Inc. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006
This file is part of the GNU C Library and is also part of gnulib. Free Software Foundation, Inc.
Patches to this file should be submitted to both projects. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or modify
modify it under the terms of the GNU Lesser General Public it under the terms of the GNU Lesser General Public License as published by
License as published by the Free Software Foundation; either the Free Software Foundation; either version 2.1, or (at your option)
version 2.1 of the License, or (at your option) any later version. any later version.
The GNU C Library is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Lesser General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public License along
License along with the GNU C Library; if not, see with this program; if not, write to the Free Software Foundation,
<https://www.gnu.org/licenses/>. */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _LIBC #ifdef _LIBC
# ifdef HAVE_CONFIG_H # include <getopt.h>
#else
# include <config.h> # include <config.h>
# include "getopt.h"
#endif #endif
#include "getopt_int.h"
#include <stdio.h>
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#endif #endif
#include "getopt.h" #ifndef NULL
#include "getopt_int.h" #define NULL 0
#endif
int int
getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
@ -42,7 +51,7 @@ _getopt_long_r (int argc, char **argv, const char *options,
struct _getopt_data *d) struct _getopt_data *d)
{ {
return _getopt_internal_r (argc, argv, options, long_options, opt_index, return _getopt_internal_r (argc, argv, options, long_options, opt_index,
0, d, 0); 0, 0, d);
} }
/* Like getopt_long, but '-' as well as '--' can indicate a long option. /* Like getopt_long, but '-' as well as '--' can indicate a long option.
@ -65,14 +74,13 @@ _getopt_long_only_r (int argc, char **argv, const char *options,
struct _getopt_data *d) struct _getopt_data *d)
{ {
return _getopt_internal_r (argc, argv, options, long_options, opt_index, return _getopt_internal_r (argc, argv, options, long_options, opt_index,
1, d, 0); 1, 0, d);
} }
#ifdef TEST #ifdef TEST
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
int int
main (int argc, char **argv) main (int argc, char **argv)
@ -84,7 +92,7 @@ main (int argc, char **argv)
{ {
int this_option_optind = optind ? optind : 1; int this_option_optind = optind ? optind : 1;
int option_index = 0; int option_index = 0;
static const struct option long_options[] = static struct option long_options[] =
{ {
{"add", 1, 0, 0}, {"add", 1, 0, 0},
{"append", 0, 0, 0}, {"append", 0, 0, 0},
@ -134,11 +142,11 @@ main (int argc, char **argv)
break; break;
case 'c': case 'c':
printf ("option c with value '%s'\n", optarg); printf ("option c with value `%s'\n", optarg);
break; break;
case 'd': case 'd':
printf ("option d with value '%s'\n", optarg); printf ("option d with value `%s'\n", optarg);
break; break;
case '?': case '?':

View File

@ -1,29 +1,25 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Internal declarations for getopt. /* Internal declarations for getopt.
Copyright (C) 1989-2023 Free Software Foundation, Inc. Copyright (C) 1989-1994,1996-1999,2001,2003,2004
This file is part of the GNU C Library and is also part of gnulib. Free Software Foundation, Inc.
Patches to this file should be submitted to both projects. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or modify
modify it under the terms of the GNU Lesser General Public it under the terms of the GNU General Public License as published by
License as published by the Free Software Foundation; either the Free Software Foundation; either version 2, or (at your option)
version 2.1 of the License, or (at your option) any later version. any later version.
The GNU C Library is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Lesser General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU General Public License along
License along with the GNU C Library; if not, see with this program; if not, write to the Free Software Foundation,
<https://www.gnu.org/licenses/>. */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GETOPT_INT_H #ifndef _GETOPT_INT_H
#define _GETOPT_INT_H 1 #define _GETOPT_INT_H 1
#include <getopt.h>
extern int _getopt_internal (int ___argc, char **___argv, extern int _getopt_internal (int ___argc, char **___argv,
const char *__shortopts, const char *__shortopts,
const struct option *__longopts, int *__longind, const struct option *__longopts, int *__longind,
@ -33,32 +29,6 @@ extern int _getopt_internal (int ___argc, char **___argv,
/* Reentrant versions which can handle parsing multiple argument /* Reentrant versions which can handle parsing multiple argument
vectors at the same time. */ vectors at the same time. */
/* Describe how to deal with options that follow non-option ARGV-elements.
REQUIRE_ORDER means don't recognize them as options; stop option
processing when the first non-option is seen. This is what POSIX
specifies should happen.
PERMUTE means permute the contents of ARGV as we scan, so that
eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written
to expect this.
RETURN_IN_ORDER is an option available to programs that were
written to expect options and other ARGV-elements in any order
and that care about the ordering of the two. We describe each
non-option ARGV-element as if it were the argument of an option
with character code 1.
The special argument '--' forces an end of option-scanning regardless
of the value of 'ordering'. In the case of RETURN_IN_ORDER, only
'--' can cause 'getopt' to return -1 with 'optind' != ARGC. */
enum __ord
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
};
/* Data type for reentrant functions. */ /* Data type for reentrant functions. */
struct _getopt_data struct _getopt_data
{ {
@ -83,17 +53,58 @@ struct _getopt_data
by advancing to the next ARGV-element. */ by advancing to the next ARGV-element. */
char *__nextchar; char *__nextchar;
/* See __ord above. */ /* Describe how to deal with options that follow non-option ARGV-elements.
enum __ord __ordering;
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters, or by calling getopt.
PERMUTE is the default. We permute the contents of ARGV as we
scan, so that eventually all the non-options are at the end.
This allows options to be given in any order, even with programs
that were not written to expect this.
RETURN_IN_ORDER is an option available to programs that were
written to expect options and other ARGV-elements in any order
and that care about the ordering of the two. We describe each
non-option ARGV-element as if it were the argument of an option
with character code 1. Using `-' as the first character of the
list of option characters selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} __ordering;
/* If the POSIXLY_CORRECT environment variable is set
or getopt was called. */
int __posixly_correct;
/* Handle permutation of arguments. */ /* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have /* Describe the part of ARGV that contains non-options that have
been skipped. 'first_nonopt' is the index in ARGV of the first been skipped. `first_nonopt' is the index in ARGV of the first
of them; 'last_nonopt' is the index after the last of them. */ of them; `last_nonopt' is the index after the last of them. */
int __first_nonopt; int __first_nonopt;
int __last_nonopt; int __last_nonopt;
#if defined _LIBC && defined USE_NONOPTION_FLAGS
int __nonoption_flags_max_len;
int __nonoption_flags_len;
# endif
}; };
/* The initializer is necessary to set OPTIND and OPTERR to their /* The initializer is necessary to set OPTIND and OPTERR to their
@ -103,8 +114,8 @@ struct _getopt_data
extern int _getopt_internal_r (int ___argc, char **___argv, extern int _getopt_internal_r (int ___argc, char **___argv,
const char *__shortopts, const char *__shortopts,
const struct option *__longopts, int *__longind, const struct option *__longopts, int *__longind,
int __long_only, struct _getopt_data *__data, int __long_only, int __posixly_correct,
int __posixly_correct); struct _getopt_data *__data);
extern int _getopt_long_r (int ___argc, char **___argv, extern int _getopt_long_r (int ___argc, char **___argv,
const char *__shortopts, const char *__shortopts,

1
m4/.gitignore vendored
View File

@ -1,4 +1,3 @@
build-to-host.m4
codeset.m4 codeset.m4
extern-inline.m4 extern-inline.m4
fcntl-o.m4 fcntl-o.m4

85
m4/ax_check_capsicum.m4 Normal file
View File

@ -0,0 +1,85 @@
# -*- Autoconf -*-
# SYNOPSIS
#
# AX_CHECK_CAPSICUM([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro searches for an installed Capsicum header and library,
# and if found:
# - AC_DEFINE([HAVE_CAPSICUM]) is called.
# - AC_DEFINE([HAVE_SYS_CAPSICUM_H]) is called if <sys/capsicum.h>
# is present (otherwise <sys/capability.h> must be used).
# - CAPSICUM_LIB is set to the -l option needed to link Capsicum support,
# and AC_SUBST([CAPSICUM_LIB]) is called.
# - The shell commands in ACTION-IF-FOUND are run. The default
# ACTION-IF-FOUND prepends ${CAPSICUM_LIB} into LIBS. If you don't
# want to modify LIBS and don't need to run any other commands either,
# use a colon as ACTION-IF-FOUND.
#
# If Capsicum support isn't found:
# - The shell commands in ACTION-IF-NOT-FOUND are run. The default
# ACTION-IF-NOT-FOUND calls AC_MSG_WARN to print a warning that
# Capsicum support wasn't found.
#
# You should use autoheader to include a definition for the symbols above
# in a config.h file.
#
# Sample usage in a C/C++ source is as follows:
#
# #ifdef HAVE_CAPSICUM
# # ifdef HAVE_SYS_CAPSICUM_H
# # include <sys/capsicum.h>
# # else
# # include <sys/capability.h>
# # endif
# #endif /* HAVE_CAPSICUM */
#
# LICENSE
#
# Copyright (c) 2014 Google Inc.
# Copyright (c) 2015 Lasse Collin <lasse.collin@tukaani.org>
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
#serial 2
AC_DEFUN([AX_CHECK_CAPSICUM], [
# On FreeBSD >= 11.x and Linux, Capsicum is uses <sys/capsicum.h>.
# If this header is found, it is assumed to be the right one.
capsicum_header_found=no
AC_CHECK_HEADERS([sys/capsicum.h], [capsicum_header_found=yes])
if test "$capsicum_header_found" = no ; then
# On FreeBSD 10.x Capsicum uses <sys/capability.h>. Such a header exists
# on Linux too but it describes POSIX.1e capabilities. Look for the
# declaration of cap_rights_limit to check if <sys/capability.h> is
# a Capsicum header.
AC_CHECK_DECL([cap_rights_limit], [capsicum_header_found=yes], [],
[#include <sys/capability.h>])
fi
capsicum_lib_found=no
CAPSICUM_LIB=
if test "$capsicum_header_found" = yes ; then
AC_LANG_PUSH([C])
# FreeBSD >= 10.x has Capsicum functions in libc.
AC_LINK_IFELSE([AC_LANG_CALL([], [cap_rights_limit])],
[capsicum_lib_found=yes], [])
# Linux has Capsicum functions in libcaprights.
AC_CHECK_LIB([caprights], [cap_rights_limit],
[CAPSICUM_LIB=-lcaprights
capsicum_lib_found=yes], [])
AC_LANG_POP([C])
fi
AC_SUBST([CAPSICUM_LIB])
if test "$capsicum_lib_found" = yes ; then
AC_DEFINE([HAVE_CAPSICUM], [1], [Define to 1 if Capsicum is available.])
m4_default([$1], [LIBS="${CAPSICUM_LIB} $LIBS"])
else
m4_default([$2], [AC_MSG_WARN([Capsicum support not found])])
fi])

View File

@ -1,5 +1,3 @@
dnl SPDX-License-Identifier: GPL-3.0-or-later WITH Autoconf-exception-macro
# =========================================================================== # ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html # https://www.gnu.org/software/autoconf-archive/ax_pthread.html
# =========================================================================== # ===========================================================================

View File

@ -1,72 +1,71 @@
dnl SPDX-License-Identifier: FSFULLR # getopt.m4 serial 14 (modified version)
dnl Copyright (C) 2002-2006, 2008 Free Software Foundation, Inc.
# getopt.m4 serial 49 (modified version)
dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
# This version has been modified to reduce complexity since we only need # The getopt module assume you want GNU getopt, with getopt_long etc,
# GNU getopt_long and do not care about replacing getopt. # rather than vanilla POSIX getopt. This means your code should
# always include <getopt.h> for the getopt prototypes.
# Check for a POSIX compliant getopt function with GNU extensions (such as AC_DEFUN([gl_GETOPT_SUBSTITUTE],
# options with optional arguments) and the functions getopt_long,
# getopt_long_only.
AC_DEFUN([gl_FUNC_GETOPT_GNU],
[ [
AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) AC_LIBOBJ([getopt])
AC_LIBOBJ([getopt1])
gl_GETOPT_SUBSTITUTE_HEADER
])
if test -n "$gl_replace_getopt"; then AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
gl_GETOPT_SUBSTITUTE [
fi GETOPT_H=getopt.h
AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
[Define to rpl_ if the getopt replacement functions and variables
should be used.])
AC_SUBST([GETOPT_H])
]) ])
AC_DEFUN([gl_GETOPT_CHECK_HEADERS], AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
[ [
gl_replace_getopt= if test -z "$GETOPT_H"; then
AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
if test -z "$gl_replace_getopt"; then
AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes])
fi fi
if test -z "$gl_replace_getopt"; then if test -z "$GETOPT_H"; then
AC_CHECK_FUNCS([getopt_long], [], [gl_replace_getopt=yes]) AC_CHECK_FUNCS([getopt_long], [], [GETOPT_H=getopt.h])
fi fi
dnl BSD getopt_long uses a way to reset option processing, that is different dnl BSD getopt_long uses a way to reset option processing, that is different
dnl from GNU and Solaris (which copied the GNU behavior). We support both dnl from GNU and Solaris (which copied the GNU behavior). We support both
dnl GNU and BSD style resetting of getopt_long(), so there's no need to use dnl GNU and BSD style resetting of getopt_long(), so there's no need to use
dnl GNU getopt_long() on BSD due to different resetting style. dnl GNU getopt_long() on BSD due to different resetting style.
if test -z "$gl_replace_getopt"; then dnl
dnl With getopt_long(), some BSD versions have a bug in handling optional
dnl arguments. This bug appears only if the environment variable
dnl POSIXLY_CORRECT has been set, so it shouldn't be too bad in most
dnl cases; probably most don't have that variable set. But if we actually
dnl hit this bug, it is a real problem due to our heavy use of optional
dnl arguments.
dnl
dnl According to CVS logs, the bug was introduced in OpenBSD in 2003-09-22
dnl and copied to FreeBSD in 2004-02-24. It was fixed in both in 2006-09-22,
dnl so the affected versions shouldn't be popular anymore anyway. NetBSD
dnl never had this bug. TODO: What about Darwin and others?
if test -z "$GETOPT_H"; then
AC_CHECK_DECL([optreset], AC_CHECK_DECL([optreset],
[AC_DEFINE([HAVE_OPTRESET], 1, [AC_DEFINE([HAVE_OPTRESET], 1,
[Define to 1 if getopt.h declares extern int optreset.])], [Define to 1 if getopt.h declares extern int optreset.])],
[], [#include <getopt.h>]) [], [#include <getopt.h>])
fi fi
dnl POSIX 2008 does not specify leading '+' behavior, but see dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on dnl option string (as of 2005-05-05). We don't use that feature, so this
dnl the next version of POSIX. We don't use that feature, so this
dnl is not a problem for us. Thus, the respective test was removed here. dnl is not a problem for us. Thus, the respective test was removed here.
dnl Checks for getopt handling '-' as a leading character in an option
dnl string were removed, since we also don't use that feature.
]) ])
AC_DEFUN([gl_GETOPT_SUBSTITUTE], AC_DEFUN([gl_GETOPT_IFELSE],
[ [
AC_LIBOBJ([getopt]) AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
AC_LIBOBJ([getopt1]) AS_IF([test -n "$GETOPT_H"], [$1], [$2])
AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
[Define to rpl_ if the getopt replacement functions and variables
should be used.])
GETOPT_H=getopt.h
AC_SUBST([GETOPT_H])
]) ])
AC_DEFUN([gl_GETOPT], [gl_FUNC_GETOPT_GNU]) AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])

View File

@ -1,5 +1,3 @@
dnl SPDX-License-Identifier: FSFULLR
# Find a POSIX-conforming shell. # Find a POSIX-conforming shell.
# Copyright (C) 2007-2008 Free Software Foundation, Inc. # Copyright (C) 2007-2008 Free Software Foundation, Inc.

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# SYNOPSIS # SYNOPSIS
# #
@ -10,11 +7,13 @@
# #
# Common checks for tuklib. # Common checks for tuklib.
# #
############################################################################# # COPYING
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
AC_DEFUN_ONCE([TUKLIB_COMMON], [ AC_DEFUN_ONCE([TUKLIB_COMMON], [
AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_HOST])

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# SYNOPSIS # SYNOPSIS
# #
@ -20,11 +17,13 @@
# GetSystemInfo() is used on Cygwin) # GetSystemInfo() is used on Cygwin)
# - pstat_getdynamic(): HP-UX # - pstat_getdynamic(): HP-UX
# #
############################################################################# # COPYING
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
AC_DEFUN_ONCE([TUKLIB_CPUCORES], [ AC_DEFUN_ONCE([TUKLIB_CPUCORES], [
AC_REQUIRE([TUKLIB_COMMON]) AC_REQUIRE([TUKLIB_COMMON])

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# SYNOPSIS # SYNOPSIS
# #
@ -14,11 +11,13 @@
# - Does the hardware support fast unaligned access to 16-bit, 32-bit, # - Does the hardware support fast unaligned access to 16-bit, 32-bit,
# and 64-bit integers # and 64-bit integers
# #
############################################################################# # COPYING
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
AC_DEFUN_ONCE([TUKLIB_INTEGER], [ AC_DEFUN_ONCE([TUKLIB_INTEGER], [
AC_REQUIRE([TUKLIB_COMMON]) AC_REQUIRE([TUKLIB_COMMON])
@ -66,42 +65,22 @@ AC_MSG_CHECKING([if unaligned memory access should be used])
AC_ARG_ENABLE([unaligned-access], AS_HELP_STRING([--enable-unaligned-access], AC_ARG_ENABLE([unaligned-access], AS_HELP_STRING([--enable-unaligned-access],
[Enable if the system supports *fast* unaligned memory access [Enable if the system supports *fast* unaligned memory access
with 16-bit, 32-bit, and 64-bit integers. By default, with 16-bit, 32-bit, and 64-bit integers. By default,
this is enabled on x86, x86-64, this is enabled only on x86, x86_64, big endian PowerPC,
32/64-bit big endian PowerPC, and some ARM systems.]),
64-bit little endian PowerPC,
and some ARM, ARM64, and RISC-V systems.]),
[], [enable_unaligned_access=auto]) [], [enable_unaligned_access=auto])
if test "x$enable_unaligned_access" = xauto ; then if test "x$enable_unaligned_access" = xauto ; then
# NOTE: There might be other architectures on which unaligned access # TODO: There may be other architectures, on which unaligned access
# is fast. # is OK.
case $host_cpu in case $host_cpu in
i?86|x86_64|powerpc|powerpc64|powerpc64le) i?86|x86_64|powerpc|powerpc64)
enable_unaligned_access=yes enable_unaligned_access=yes
;; ;;
arm*|aarch64*|riscv*) arm*|aarch64*)
# On 32-bit and 64-bit ARM, GCC and Clang # On 32-bit and 64-bit ARM, GCC and Clang
# #define __ARM_FEATURE_UNALIGNED if # #define __ARM_FEATURE_UNALIGNED if
# unaligned access is supported. # unaligned access is supported.
#
# Exception: GCC at least up to 13.2.0
# defines it even when using -mstrict-align
# so in that case this autodetection goes wrong.
# Most of the time -mstrict-align isn't used so it
# shouldn't be a common problem in practice. See:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111555
#
# RISC-V C API Specification says that if
# __riscv_misaligned_fast is defined then
# unaligned access is known to be fast.
#
# MSVC is handled as a special case: We assume that
# 32/64-bit ARM supports fast unaligned access.
# If MSVC gets RISC-V support then this will assume
# fast unaligned access on RISC-V too.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#if !defined(__ARM_FEATURE_UNALIGNED) \ #ifndef __ARM_FEATURE_UNALIGNED
&& !defined(__riscv_misaligned_fast) \
&& !defined(_MSC_VER)
compile error compile error
#endif #endif
int main(void) { return 0; } int main(void) { return 0; }

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# SYNOPSIS # SYNOPSIS
# #
@ -18,11 +15,13 @@
# functions, but each function is put into a separate .c file so # functions, but each function is put into a separate .c file so
# that it is possible to pick only what is strictly needed. # that it is possible to pick only what is strictly needed.
# #
############################################################################# # COPYING
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
AC_DEFUN_ONCE([TUKLIB_MBSTR], [ AC_DEFUN_ONCE([TUKLIB_MBSTR], [
AC_REQUIRE([TUKLIB_COMMON]) AC_REQUIRE([TUKLIB_COMMON])

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# SYNOPSIS # SYNOPSIS
# #
@ -32,11 +29,13 @@
# - sysinfo() works on Linux/dietlibc and probably on other Linux # - sysinfo() works on Linux/dietlibc and probably on other Linux
# systems whose libc may lack sysconf(). # systems whose libc may lack sysconf().
# #
############################################################################# # COPYING
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
AC_DEFUN_ONCE([TUKLIB_PHYSMEM], [ AC_DEFUN_ONCE([TUKLIB_PHYSMEM], [
AC_REQUIRE([TUKLIB_COMMON]) AC_REQUIRE([TUKLIB_COMMON])

View File

@ -1,6 +1,3 @@
# SPDX-License-Identifier: 0BSD
#############################################################################
# #
# SYNOPSIS # SYNOPSIS
# #
@ -14,16 +11,18 @@
# This .m4 file is needed allow this module to use glibc's # This .m4 file is needed allow this module to use glibc's
# program_invocation_name. # program_invocation_name.
# #
############################################################################# # COPYING
# #
# Author: Lasse Collin # Author: Lasse Collin
# #
############################################################################# # This file has been put into the public domain.
# You can do whatever you want with this file.
#
AC_DEFUN_ONCE([TUKLIB_PROGNAME], [ AC_DEFUN_ONCE([TUKLIB_PROGNAME], [
AC_REQUIRE([TUKLIB_COMMON]) AC_REQUIRE([TUKLIB_COMMON])
AC_CHECK_DECL([program_invocation_name], [AC_DEFINE( AC_CHECK_DECL([program_invocation_name], [AC_DEFINE(
[HAVE_PROGRAM_INVOCATION_NAME], [1], [HAVE_PROGRAM_INVOCATION_NAME], [1],
[Define to 1 if 'program_invocation_name' is declared in <errno.h>.])], [Define to 1 if `program_invocation_name' is declared in <errno.h>.])],
[], [#include <errno.h>]) [], [#include <errno.h>])
])dnl ])dnl

View File

@ -1,5 +1,3 @@
dnl SPDX-License-Identifier: FSFULLR
# visibility.m4 serial 8 # visibility.m4 serial 8
dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc. dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation

113
macosx/build.sh Executable file
View File

@ -0,0 +1,113 @@
#!/bin/sh
###############################################################################
# Author: Anders F Björklund <afb@users.sourceforge.net>
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
###############################################################################
mkdir -p Root
mkdir -p Resources
# Abort immediately if something goes wrong.
set -e
GCC="gcc-4.2"
SDK="/Developer/SDKs/MacOSX10.5.sdk"
MDT="10.5"
GTT=i686-apple-darwin9
ARCHES1="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
ARCHES2="-arch ppc -arch i386"
PKGFORMAT="10.5" # xar
# avoid "unknown required load command: 0x80000022" from linking on Snow Leopard
uname -r | grep ^1 >/dev/null && LDFLAGS="$LDFLAGS -Wl,-no_compact_linkedit"
# Clean up if it was already configured.
[ -f Makefile ] && make distclean
# Build the regular fat program
CC="$GCC" \
CFLAGS="-O2 -g $ARCHES1 -isysroot $SDK -mmacosx-version-min=$MDT" \
../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec $GTT
make
make check
make DESTDIR=`pwd`/Root install
make distclean
# Build the size-optimized program
CC="$GCC" \
CFLAGS="-Os -g $ARCHES2 -isysroot $SDK -mmacosx-version-min=$MDT" \
../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads $GTT
make -C src/liblzma
make -C src/xzdec
make -C src/xzdec DESTDIR=`pwd`/Root install
cp -a ../extra Root/usr/local/share/doc/xz
make distclean
# Move development files to different package
test -d liblzma && rm -r liblzma
mkdir -p liblzma/usr/local
mv Root/usr/local/include liblzma/usr/local
mv Root/usr/local/lib liblzma/usr/local
mkdir -p Root/usr/local/lib
cp -p liblzma/usr/local/lib/liblzma.5.dylib Root/usr/local/lib
mkdir -p liblzma/usr/local/share/doc/xz
mv Root/usr/local/share/doc/xz/examples* liblzma/usr/local/share/doc/xz
# Strip debugging symbols and make relocatable
for bin in xz lzmainfo xzdec lzmadec; do
strip -S Root/usr/local/bin/$bin
install_name_tool -change /usr/local/lib/liblzma.5.dylib @executable_path/../lib/liblzma.5.dylib Root/usr/local/bin/$bin
done
for lib in liblzma.5.dylib; do
strip -S Root/usr/local/lib/$lib
install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
done
# Create tarball, but without the HFS+ attrib
rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
( cd liblzma; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../liblzma.tbz ./usr/local )
# Include documentation files for package
cp -p ../README Resources/ReadMe.txt
cp -p ../COPYING Resources/License.txt
# Make an Installer.app package
ID="org.tukaani.xz"
VERSION=`cd ..; sh build-aux/version.sh`
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g $PKGFORMAT --verbose
$PACKAGEMAKER -r liblzma -w -k -i $ID.liblzma -n $VERSION -o liblzma.pkg -g $PKGFORMAT --verbose
# Put the package in a disk image
if [ "$PKGFORMAT" != "10.5" ]; then
hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
hdiutil internet-enable -yes -quiet XZ.dmg
fi
echo
echo "Build completed successfully."
echo

View File

@ -1,10 +1,4 @@
# SPDX-License-Identifier: FSFUL
# Makefile variables for PO directory in any package using GNU gettext. # Makefile variables for PO directory in any package using GNU gettext.
#
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation gives
# unlimited permission to use, copy, distribute, and modify it.
# Usually the message domain is the same as the package name. # Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE) DOMAIN = $(PACKAGE)
@ -14,7 +8,7 @@ subdir = po
top_builddir = .. top_builddir = ..
# These options get passed to xgettext. # These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --no-wrap --package-name='XZ Utils' XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the # This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
@ -24,14 +18,7 @@ XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --no-wrap --package-name='XZ Utils'
# or entity, or to disclaim their copyright. The empty string stands for # or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim # the public domain; in this case the translators are expected to disclaim
# their copyright. # their copyright.
COPYRIGHT_HOLDER = The XZ Utils authors and contributors COPYRIGHT_HOLDER =
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU = no
# This is the email address or URL to which the translators shall report # This is the email address or URL to which the translators shall report
# bugs in the untranslated strings: # bugs in the untranslated strings:
@ -53,35 +40,7 @@ MSGID_BUGS_ADDRESS =
# message catalogs shall be used. It is usually empty. # message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES = EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' # Although you may need slightly wider terminal than 80 chars, it is
# context. Possible values are "yes" and "no". Set this to yes if the # much nicer to edit the output of --help when this is set.
# package uses functions taking also a message context, like pgettext(), or XGETTEXT_OPTIONS += --no-wrap
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. MSGMERGE += --no-wrap
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS = --no-wrap
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
#
# Although one may need slightly wider terminal than 80 chars, it is
# much nicer to edit the output of --help when --no-wrap is set.
MSGINIT_OPTIONS = --no-wrap
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = yes
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = yes

View File

@ -1,5 +1,3 @@
# SPDX-License-Identifier: 0BSD
# List of source files which contain translatable strings. # List of source files which contain translatable strings.
src/xz/args.c src/xz/args.c
src/xz/coder.c src/xz/coder.c
@ -8,10 +6,8 @@ src/xz/hardware.c
src/xz/list.c src/xz/list.c
src/xz/main.c src/xz/main.c
src/xz/message.c src/xz/message.c
src/xz/mytime.c
src/xz/options.c src/xz/options.c
src/xz/signals.c src/xz/signals.c
src/xz/suffix.c src/xz/suffix.c
src/xz/util.c src/xz/util.c
src/lzmainfo/lzmainfo.c
src/common/tuklib_exit.c src/common/tuklib_exit.c

469
po/de.po

File diff suppressed because it is too large Load Diff

500
po/eo.po

File diff suppressed because it is too large Load Diff

500
po/es.po

File diff suppressed because it is too large Load Diff

652
po/hr.po

File diff suppressed because it is too large Load Diff

552
po/hu.po

File diff suppressed because it is too large Load Diff

569
po/ko.po

File diff suppressed because it is too large Load Diff

481
po/pl.po

File diff suppressed because it is too large Load Diff

528
po/ro.po

File diff suppressed because it is too large Load Diff

498
po/sv.po

File diff suppressed because it is too large Load Diff

509
po/uk.po

File diff suppressed because it is too large Load Diff

501
po/vi.po

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
# SPDX-License-Identifier: 0BSD
#
# SOME DESCRIPTIVE TITLE.
# Copyright (C) The XZ Utils authors and contributors
# This file is published under the BSD Zero Clause License.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#

View File

@ -1,14 +1,14 @@
# Chinese translations for xz package # Chinese translations for xz package
# xz 软件包的简体中文翻译。 # xz 软件包的简体中文翻译。
# This file is put in the public domain. # This file is put in the public domain.
# Boyuan Yang <073plan@gmail.com>, 2019, 2022, 2023, 2024. # Boyuan Yang <073plan@gmail.com>, 2019, 2022, 2023.
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: xz 5.6.0-pre1\n" "Project-Id-Version: xz 5.4.4-pre1\n"
"Report-Msgid-Bugs-To: xz@tukaani.org\n" "Report-Msgid-Bugs-To: xz@tukaani.org\n"
"POT-Creation-Date: 2024-01-26 19:40+0800\n" "POT-Creation-Date: 2023-07-18 23:34+0800\n"
"PO-Revision-Date: 2024-02-05 15:15-0500\n" "PO-Revision-Date: 2023-07-19 14:24-0400\n"
"Last-Translator: Boyuan Yang <073plan@gmail.com>\n" "Last-Translator: Boyuan Yang <073plan@gmail.com>\n"
"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
"Language: zh_CN\n" "Language: zh_CN\n"
@ -17,181 +17,144 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
"X-Bugs: Report translation errors to the Language-Team address.\n" "X-Bugs: Report translation errors to the Language-Team address.\n"
"X-Generator: Poedit 3.4.2\n" "X-Generator: Poedit 3.2.2\n"
#: src/xz/args.c:78 #: src/xz/args.c:77
#, c-format #, c-format
msgid "%s: Invalid argument to --block-list" msgid "%s: Invalid argument to --block-list"
msgstr "%s--block-list 的无效参数" msgstr "%s--block-list 的无效参数"
#: src/xz/args.c:88 #: src/xz/args.c:87
#, c-format #, c-format
msgid "%s: Too many arguments to --block-list" msgid "%s: Too many arguments to --block-list"
msgstr "%s--block-list 得到过多参数" msgstr "%s--block-list 得到过多参数"
#: src/xz/args.c:125 #: src/xz/args.c:116
#, c-format
msgid "In --block-list, block size is missing after filter chain number '%c:'"
msgstr "在 --block-list 中,块大小在过滤器链编号 '%c:' 之后缺失"
#: src/xz/args.c:151
msgid "0 can only be used as the last element in --block-list" msgid "0 can only be used as the last element in --block-list"
msgstr "0 仅可用于 --block-list 的最后一个元素" msgstr "0 仅可用于 --block-list 的最后一个元素"
#: src/xz/args.c:540 #: src/xz/args.c:451
#, c-format #, c-format
msgid "%s: Unknown file format type" msgid "%s: Unknown file format type"
msgstr "%s未知文件格式类型" msgstr "%s未知文件格式类型"
#: src/xz/args.c:563 src/xz/args.c:571 #: src/xz/args.c:474 src/xz/args.c:482
#, c-format #, c-format
msgid "%s: Unsupported integrity check type" msgid "%s: Unsupported integrity check type"
msgstr "%s不支持的完整性检查类型" msgstr "%s不支持的完整性检查类型"
#: src/xz/args.c:607 #: src/xz/args.c:518
msgid "Only one file can be specified with '--files' or '--files0'." msgid "Only one file can be specified with `--files' or `--files0'."
msgstr "仅可使用 '--files' 或 '--files0' 指定单个文件。" msgstr "仅可使用“--files”或“--files0”指定一个文件。"
#. TRANSLATORS: This is a translatable #. TRANSLATORS: This is a translatable
#. string because French needs a space #. string because French needs a space
#. before the colon ("%s : %s"). #. before the colon ("%s : %s").
#: src/xz/args.c:622 src/xz/coder.c:1059 src/xz/coder.c:1075 #: src/xz/args.c:533 src/xz/coder.c:691 src/xz/coder.c:707 src/xz/coder.c:967
#: src/xz/coder.c:1375 src/xz/coder.c:1378 src/xz/file_io.c:686 #: src/xz/coder.c:970 src/xz/file_io.c:605 src/xz/file_io.c:679
#: src/xz/file_io.c:760 src/xz/file_io.c:850 src/xz/file_io.c:1021 #: src/xz/file_io.c:769 src/xz/file_io.c:940 src/xz/list.c:369
#: src/xz/list.c:369 src/xz/list.c:415 src/xz/list.c:477 src/xz/list.c:591 #: src/xz/list.c:415 src/xz/list.c:477 src/xz/list.c:581 src/xz/list.c:590
#: src/xz/list.c:600
#, c-format #, c-format
msgid "%s: %s" msgid "%s: %s"
msgstr "%s%s" msgstr "%s%s"
#: src/xz/args.c:678 #: src/xz/args.c:589
#, c-format #, c-format
msgid "The environment variable %s contains too many arguments" msgid "The environment variable %s contains too many arguments"
msgstr "环境变量 %s 包含过多参数" msgstr "环境变量 %s 包含过多参数"
#: src/xz/args.c:780 #: src/xz/args.c:691
msgid "Compression support was disabled at build time" msgid "Compression support was disabled at build time"
msgstr "压缩支持已在构建时禁用" msgstr "压缩支持已在构建时禁用"
#: src/xz/args.c:787 #: src/xz/args.c:698
msgid "Decompression support was disabled at build time" msgid "Decompression support was disabled at build time"
msgstr "解压支持已在构建时禁用" msgstr "解压支持已在构建时禁用"
#: src/xz/args.c:793 #: src/xz/args.c:704
msgid "Compression of lzip files (.lz) is not supported" msgid "Compression of lzip files (.lz) is not supported"
msgstr "不支持对 lzip 文件 (.lz) 的压缩" msgstr "不支持对 lzip 文件 (.lz) 的压缩"
#: src/xz/args.c:815 #: src/xz/args.c:735
msgid "--block-list is ignored unless compressing to the .xz format"
msgstr "除非压缩为 .xz 格式,--block-list 将被忽略"
#: src/xz/args.c:828 src/xz/args.c:837
msgid "With --format=raw, --suffix=.SUF is required unless writing to stdout" msgid "With --format=raw, --suffix=.SUF is required unless writing to stdout"
msgstr "启用 --format-raw 选项时,必须指定 --suffix=.SUF 获知写入至标准输出" msgstr "启用 --format-raw 选项时,必须指定 --suffix=.SUF 获知写入至标准输出"
#: src/xz/coder.c:141 #: src/xz/coder.c:115
msgid "Maximum number of filters is four" msgid "Maximum number of filters is four"
msgstr "过滤器最多数量为四" msgstr "过滤器最多数量为四"
#: src/xz/coder.c:179 #: src/xz/coder.c:134
#, c-format
msgid "Error in --filters%s=FILTERS option:"
msgstr "在 --filters%s=过滤器 选项中出现错误:"
#: src/xz/coder.c:229
msgid "Memory usage limit is too low for the given filter setup." msgid "Memory usage limit is too low for the given filter setup."
msgstr "内存用量限制对指定过滤器设置过低。" msgstr "内存用量限制对指定过滤器设置过低。"
#: src/xz/coder.c:244 #: src/xz/coder.c:169
#, c-format
msgid "filter chain %u used by --block-list but not specified with --filters%u="
msgstr "--block-list 使用了过滤器链 %u但未经由 --filters%u= 指定"
#: src/xz/coder.c:375
msgid "Using a preset in raw mode is discouraged." msgid "Using a preset in raw mode is discouraged."
msgstr "不推荐在 raw 模式使用预设等级。" msgstr "不推荐在 raw 模式使用预设等级。"
#: src/xz/coder.c:377 #: src/xz/coder.c:171
msgid "The exact options of the presets may vary between software versions." msgid "The exact options of the presets may vary between software versions."
msgstr "各个预设等级所使用的准确选项列表在不同软件版本之间可能不同。" msgstr "各个预设等级所使用的准确选项列表在不同软件版本之间可能不同。"
#: src/xz/coder.c:403 #: src/xz/coder.c:194
msgid "The .lzma format supports only the LZMA1 filter" msgid "The .lzma format supports only the LZMA1 filter"
msgstr ".lzma 格式只支持 LZMA1 过滤器" msgstr ".lzma 格式只支持 LZMA1 过滤器"
#: src/xz/coder.c:411 #: src/xz/coder.c:202
msgid "LZMA1 cannot be used with the .xz format" msgid "LZMA1 cannot be used with the .xz format"
msgstr "LZMA1 无法用于 .xz 格式" msgstr "LZMA1 无法用于 .xz 格式"
#: src/xz/coder.c:435 #: src/xz/coder.c:219
#, c-format msgid "The filter chain is incompatible with --flush-timeout"
msgid "Filter chain %u is incompatible with --flush-timeout" msgstr "过滤器链和 --flush-timeout 不兼容"
msgstr "过滤器链 %u 和 --flush-timeout 不兼容"
#: src/xz/coder.c:444 #: src/xz/coder.c:225
msgid "Switching to single-threaded mode due to --flush-timeout" msgid "Switching to single-threaded mode due to --flush-timeout"
msgstr "因 --flush-timeout 而切换至单线程模式" msgstr "因 --flush-timeout 而切换至单线程模式"
#: src/xz/coder.c:485 #: src/xz/coder.c:249
#, c-format
msgid "Unsupported options in filter chain %u"
msgstr "过滤器链 %u 中存在不支持的选项"
#: src/xz/coder.c:516
#, c-format #, c-format
msgid "Using up to %<PRIu32> threads." msgid "Using up to %<PRIu32> threads."
msgstr "使用最多 %<PRIu32> 个线程。" msgstr "使用最多 %<PRIu32> 个线程。"
#: src/xz/coder.c:532 #: src/xz/coder.c:265
msgid "Unsupported filter chain or filter options" msgid "Unsupported filter chain or filter options"
msgstr "不支持的过滤器链或过滤器选项" msgstr "不支持的过滤器链或过滤器选项"
#: src/xz/coder.c:553 #: src/xz/coder.c:277
#, c-format #, c-format
msgid "Decompression will need %s MiB of memory." msgid "Decompression will need %s MiB of memory."
msgstr "解压缩需要 %s MiB 的内存。" msgstr "解压缩需要 %s MiB 的内存。"
#: src/xz/coder.c:585 #: src/xz/coder.c:309
#, c-format #, c-format
msgid "Reduced the number of threads from %s to %s to not exceed the memory usage limit of %s MiB" msgid "Reduced the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
msgstr "已将所使用的线程数从 %s 减小为 %s以不超出 %s MiB 的内存用量限制" msgstr "已将所使用的线程数从 %s 减小为 %s以不超出 %s MiB 的内存用量限制"
#: src/xz/coder.c:605 #: src/xz/coder.c:329
#, c-format #, c-format
msgid "Reduced the number of threads from %s to one. The automatic memory usage limit of %s MiB is still being exceeded. %s MiB of memory is required. Continuing anyway." msgid "Reduced the number of threads from %s to one. The automatic memory usage limit of %s MiB is still being exceeded. %s MiB of memory is required. Continuing anyway."
msgstr "已将所使用的线程数从 %s 减小为 1。这仍然超出了自动的内存使用限制 %s MiB。需要 %s MiB 的内存。继续操作。" msgstr "已将所使用的线程数从 %s 减小为 1。这仍然超出了自动的内存使用限制 %s MiB。需要 %s MiB 的内存。继续操作。"
#: src/xz/coder.c:632 #: src/xz/coder.c:356
#, c-format #, c-format
msgid "Switching to single-threaded mode to not exceed the memory usage limit of %s MiB" msgid "Switching to single-threaded mode to not exceed the memory usage limit of %s MiB"
msgstr "正在切换到单线程模式以不超出 %s MiB 的内存用量限制" msgstr "正在切换到单线程模式以不超出 %s MiB 的内存用量限制"
#: src/xz/coder.c:757 #: src/xz/coder.c:411
#, c-format #, c-format
msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB" msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
msgstr "已调整 LZMA%c 字典大小(从 %s MiB 调整为 %s MiB以不超出 %s MiB 的内存用量限制" msgstr "已调整 LZMA%c 字典大小(从 %s MiB 调整为 %s MiB以不超出 %s MiB 的内存用量限制"
#: src/xz/coder.c:767 #: src/xz/file_io.c:110 src/xz/file_io.c:118
#, fuzzy, c-format
#| msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
msgid "Adjusted LZMA%c dictionary size for --filters%u from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
msgstr "已调整 LZMA%c 字典大小(从 %s MiB 调整为 %s MiB以不超出 %s MiB 的内存用量限制"
#: src/xz/coder.c:1141
#, c-format
msgid "Error changing to filter chain %u: %s"
msgstr "更改为过滤器链 %u 时出错:%s"
#: src/xz/file_io.c:137 src/xz/file_io.c:145
#, c-format #, c-format
msgid "Error creating a pipe: %s" msgid "Error creating a pipe: %s"
msgstr "创建管道时出错:%s" msgstr "创建管道时出错:%s"
#: src/xz/file_io.c:333 #: src/xz/file_io.c:252
msgid "Failed to enable the sandbox" msgid "Failed to enable the sandbox"
msgstr "沙盒启用失败" msgstr "沙盒启用失败"
#: src/xz/file_io.c:375 #: src/xz/file_io.c:294
#, c-format #, c-format
msgid "%s: poll() failed: %s" msgid "%s: poll() failed: %s"
msgstr "%spoll() 失败:%s" msgstr "%spoll() 失败:%s"
@ -206,111 +169,111 @@ msgstr "%spoll() 失败:%s"
#. it is possible that the user has put a new file in place #. it is possible that the user has put a new file in place
#. of the original file, and in that case it obviously #. of the original file, and in that case it obviously
#. shouldn't be removed. #. shouldn't be removed.
#: src/xz/file_io.c:442 #: src/xz/file_io.c:361
#, c-format #, c-format
msgid "%s: File seems to have been moved, not removing" msgid "%s: File seems to have been moved, not removing"
msgstr "%s文件似乎已移动不再进行删除操作" msgstr "%s文件似乎已移动不再进行删除操作"
#: src/xz/file_io.c:449 src/xz/file_io.c:1005 #: src/xz/file_io.c:368 src/xz/file_io.c:924
#, c-format #, c-format
msgid "%s: Cannot remove: %s" msgid "%s: Cannot remove: %s"
msgstr "%s无法删除%s" msgstr "%s无法删除%s"
#: src/xz/file_io.c:475 #: src/xz/file_io.c:394
#, c-format #, c-format
msgid "%s: Cannot set the file owner: %s" msgid "%s: Cannot set the file owner: %s"
msgstr "%s无法设置文件所有者%s" msgstr "%s无法设置文件所有者%s"
#: src/xz/file_io.c:488 #: src/xz/file_io.c:407
#, c-format #, c-format
msgid "%s: Cannot set the file group: %s" msgid "%s: Cannot set the file group: %s"
msgstr "%s无法设置文件所有组%s" msgstr "%s无法设置文件所有组%s"
#: src/xz/file_io.c:507 #: src/xz/file_io.c:426
#, c-format #, c-format
msgid "%s: Cannot set the file permissions: %s" msgid "%s: Cannot set the file permissions: %s"
msgstr "%s无法设置文件权限%s" msgstr "%s无法设置文件权限%s"
#: src/xz/file_io.c:633 #: src/xz/file_io.c:552
#, c-format #, c-format
msgid "Error getting the file status flags from standard input: %s" msgid "Error getting the file status flags from standard input: %s"
msgstr "从标准输入获取文件状态标志出错:%s" msgstr "从标准输入获取文件状态标志出错:%s"
#: src/xz/file_io.c:691 src/xz/file_io.c:753 #: src/xz/file_io.c:610 src/xz/file_io.c:672
#, c-format #, c-format
msgid "%s: Is a symbolic link, skipping" msgid "%s: Is a symbolic link, skipping"
msgstr "%s是符号链接跳过" msgstr "%s是符号链接跳过"
#: src/xz/file_io.c:782 #: src/xz/file_io.c:701
#, c-format #, c-format
msgid "%s: Is a directory, skipping" msgid "%s: Is a directory, skipping"
msgstr "%s是目录跳过" msgstr "%s是目录跳过"
#: src/xz/file_io.c:788 #: src/xz/file_io.c:707
#, c-format #, c-format
msgid "%s: Not a regular file, skipping" msgid "%s: Not a regular file, skipping"
msgstr "%s不是标准文件跳过" msgstr "%s不是标准文件跳过"
#: src/xz/file_io.c:805 #: src/xz/file_io.c:724
#, c-format #, c-format
msgid "%s: File has setuid or setgid bit set, skipping" msgid "%s: File has setuid or setgid bit set, skipping"
msgstr "%s文件有设置用户ID或设置组ID标识跳过" msgstr "%s文件有设置用户ID或设置组ID标识跳过"
#: src/xz/file_io.c:812 #: src/xz/file_io.c:731
#, c-format #, c-format
msgid "%s: File has sticky bit set, skipping" msgid "%s: File has sticky bit set, skipping"
msgstr "%s文件有粘滞位标识跳过" msgstr "%s文件有粘滞位标识跳过"
#: src/xz/file_io.c:819 #: src/xz/file_io.c:738
#, c-format #, c-format
msgid "%s: Input file has more than one hard link, skipping" msgid "%s: Input file has more than one hard link, skipping"
msgstr "%s输入文件有多于一个硬链接跳过" msgstr "%s输入文件有多于一个硬链接跳过"
#: src/xz/file_io.c:861 #: src/xz/file_io.c:780
msgid "Empty filename, skipping" msgid "Empty filename, skipping"
msgstr "空文件名,跳过" msgstr "空文件名,跳过"
#: src/xz/file_io.c:915 #: src/xz/file_io.c:834
#, c-format #, c-format
msgid "Error restoring the status flags to standard input: %s" msgid "Error restoring the status flags to standard input: %s"
msgstr "回复标准输入的状态标志时出错:%s" msgstr "回复标准输入的状态标志时出错:%s"
#: src/xz/file_io.c:963 #: src/xz/file_io.c:882
#, c-format #, c-format
msgid "Error getting the file status flags from standard output: %s" msgid "Error getting the file status flags from standard output: %s"
msgstr "获取标准输出的文件状态标志时出错:%s" msgstr "获取标准输出的文件状态标志时出错:%s"
#: src/xz/file_io.c:1162 #: src/xz/file_io.c:1060
#, c-format #, c-format
msgid "Error restoring the O_APPEND flag to standard output: %s" msgid "Error restoring the O_APPEND flag to standard output: %s"
msgstr "恢复标准输出的 O_APPEND 标志时出错:%s" msgstr "恢复标准输出的 O_APPEND 标志时出错:%s"
#: src/xz/file_io.c:1174 #: src/xz/file_io.c:1072
#, c-format #, c-format
msgid "%s: Closing the file failed: %s" msgid "%s: Closing the file failed: %s"
msgstr "%s关闭文件失败%s" msgstr "%s关闭文件失败%s"
#: src/xz/file_io.c:1210 src/xz/file_io.c:1472 #: src/xz/file_io.c:1108 src/xz/file_io.c:1371
#, c-format #, c-format
msgid "%s: Seeking failed when trying to create a sparse file: %s" msgid "%s: Seeking failed when trying to create a sparse file: %s"
msgstr "%s尝试创建稀疏文件时 seek 失败:%s" msgstr "%s尝试创建稀疏文件时 seek 失败:%s"
#: src/xz/file_io.c:1310 #: src/xz/file_io.c:1209
#, c-format #, c-format
msgid "%s: Read error: %s" msgid "%s: Read error: %s"
msgstr "%s读取错误%s" msgstr "%s读取错误%s"
#: src/xz/file_io.c:1340 #: src/xz/file_io.c:1239
#, c-format #, c-format
msgid "%s: Error seeking the file: %s" msgid "%s: Error seeking the file: %s"
msgstr "%sseek 文件时出错:%s" msgstr "%sseek 文件时出错:%s"
#: src/xz/file_io.c:1364 #: src/xz/file_io.c:1263
#, c-format #, c-format
msgid "%s: Unexpected end of file" msgid "%s: Unexpected end of file"
msgstr "%s未预期的文件结束" msgstr "%s未预期的文件结束"
#: src/xz/file_io.c:1423 #: src/xz/file_io.c:1322
#, c-format #, c-format
msgid "%s: Write error: %s" msgid "%s: Write error: %s"
msgstr "%s写入错误%s" msgstr "%s写入错误%s"
@ -529,63 +492,63 @@ msgstr "%s过小而不是有效的 .xz 文件"
#. to Ratio, the columns are right aligned. Check and Filename #. to Ratio, the columns are right aligned. Check and Filename
#. are left aligned. If you need longer words, it's OK to #. are left aligned. If you need longer words, it's OK to
#. use two lines here. Test with "xz -l foo.xz". #. use two lines here. Test with "xz -l foo.xz".
#: src/xz/list.c:741 #: src/xz/list.c:731
msgid "Strms Blocks Compressed Uncompressed Ratio Check Filename" msgid "Strms Blocks Compressed Uncompressed Ratio Check Filename"
msgstr " 流 块 压缩大小 解压大小 比例 校验 文件名" msgstr " 流 块 压缩大小 解压大小 比例 校验 文件名"
#: src/xz/list.c:1036 src/xz/list.c:1214 #: src/xz/list.c:1026 src/xz/list.c:1204
msgid "Yes" msgid "Yes"
msgstr "是" msgstr "是"
#: src/xz/list.c:1036 src/xz/list.c:1214 #: src/xz/list.c:1026 src/xz/list.c:1204
msgid "No" msgid "No"
msgstr "否" msgstr "否"
#: src/xz/list.c:1038 src/xz/list.c:1216 #: src/xz/list.c:1028 src/xz/list.c:1206
#, c-format #, c-format
msgid " Minimum XZ Utils version: %s\n" msgid " Minimum XZ Utils version: %s\n"
msgstr " 最低 XZ Utils 版本:%s\n" msgstr " 最低 XZ Utils 版本:%s\n"
#. TRANSLATORS: %s is an integer. Only the plural form of this #. TRANSLATORS: %s is an integer. Only the plural form of this
#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz". #. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
#: src/xz/list.c:1189 #: src/xz/list.c:1179
#, c-format #, c-format
msgid "%s file\n" msgid "%s file\n"
msgid_plural "%s files\n" msgid_plural "%s files\n"
msgstr[0] "%s 文件\n" msgstr[0] "%s 文件\n"
#: src/xz/list.c:1202 #: src/xz/list.c:1192
msgid "Totals:" msgid "Totals:"
msgstr "总计:" msgstr "总计:"
#: src/xz/list.c:1280 #: src/xz/list.c:1270
msgid "--list works only on .xz files (--format=xz or --format=auto)" msgid "--list works only on .xz files (--format=xz or --format=auto)"
msgstr "--list 仅适用于 .xz 文件(--format=xz 或 --format=auto" msgstr "--list 仅适用于 .xz 文件(--format=xz 或 --format=auto"
#: src/xz/list.c:1286 #: src/xz/list.c:1276
msgid "--list does not support reading from standard input" msgid "--list does not support reading from standard input"
msgstr "--list 不支持从标准输入读取" msgstr "--list 不支持从标准输入读取"
#: src/xz/main.c:96 #: src/xz/main.c:89
#, c-format #, c-format
msgid "%s: Error reading filenames: %s" msgid "%s: Error reading filenames: %s"
msgstr "%s读取文件名列表时出错%s" msgstr "%s读取文件名列表时出错%s"
#: src/xz/main.c:103 #: src/xz/main.c:96
#, c-format #, c-format
msgid "%s: Unexpected end of input when reading filenames" msgid "%s: Unexpected end of input when reading filenames"
msgstr "%s读取文件名列表时遇到未预期的输入结束" msgstr "%s读取文件名列表时遇到未预期的输入结束"
#: src/xz/main.c:127 #: src/xz/main.c:120
#, c-format #, c-format
msgid "%s: Null character found when reading filenames; maybe you meant to use '--files0' instead of '--files'?" msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
msgstr "%s读取文件名列表时获得了空字符您可能想要使用 '--files0' 而非 '--files'" msgstr "%s读取文件名列表时获得了空字符您可能想要使用“--files0”而非“--files”"
#: src/xz/main.c:207 #: src/xz/main.c:188
msgid "Compression and decompression with --robot are not supported yet." msgid "Compression and decompression with --robot are not supported yet."
msgstr "尚不支持带 --robot 的压缩和解压缩。" msgstr "尚不支持带 --robot 的压缩和解压缩。"
#: src/xz/main.c:285 #: src/xz/main.c:266
msgid "Cannot read data from standard input when reading filenames from standard input" msgid "Cannot read data from standard input when reading filenames from standard input"
msgstr "无法同时从标准输入读取数据和文件名列表" msgstr "无法同时从标准输入读取数据和文件名列表"
@ -593,68 +556,68 @@ msgstr "无法同时从标准输入读取数据和文件名列表"
#. of the line in messages. Usually it becomes "xz: ". #. of the line in messages. Usually it becomes "xz: ".
#. This is a translatable string because French needs #. This is a translatable string because French needs
#. a space before a colon. #. a space before a colon.
#: src/xz/message.c:671 src/xz/message.c:726 #: src/xz/message.c:670 src/xz/message.c:725
#, c-format #, c-format
msgid "%s: " msgid "%s: "
msgstr "%s" msgstr "%s"
#: src/xz/message.c:798 src/xz/message.c:857 #: src/xz/message.c:797 src/xz/message.c:856
msgid "Internal error (bug)" msgid "Internal error (bug)"
msgstr "内部错误bug" msgstr "内部错误bug"
#: src/xz/message.c:805 #: src/xz/message.c:804
msgid "Cannot establish signal handlers" msgid "Cannot establish signal handlers"
msgstr "无法建立信号处理器" msgstr "无法建立信号处理器"
#: src/xz/message.c:814 #: src/xz/message.c:813
msgid "No integrity check; not verifying file integrity" msgid "No integrity check; not verifying file integrity"
msgstr "无完整性检查;将不验证文件完整性" msgstr "无完整性检查;将不验证文件完整性"
#: src/xz/message.c:817 #: src/xz/message.c:816
msgid "Unsupported type of integrity check; not verifying file integrity" msgid "Unsupported type of integrity check; not verifying file integrity"
msgstr "不支持的完整性检查类型;将不验证文件完整性" msgstr "不支持的完整性检查类型;将不验证文件完整性"
#: src/xz/message.c:824 #: src/xz/message.c:823
msgid "Memory usage limit reached" msgid "Memory usage limit reached"
msgstr "达到内存使用限制" msgstr "达到内存使用限制"
#: src/xz/message.c:827 #: src/xz/message.c:826
msgid "File format not recognized" msgid "File format not recognized"
msgstr "无法识别文件格式" msgstr "无法识别文件格式"
#: src/xz/message.c:830 #: src/xz/message.c:829
msgid "Unsupported options" msgid "Unsupported options"
msgstr "不支持的选项" msgstr "不支持的选项"
#: src/xz/message.c:833 #: src/xz/message.c:832
msgid "Compressed data is corrupt" msgid "Compressed data is corrupt"
msgstr "压缩数据已损坏" msgstr "压缩数据已损坏"
#: src/xz/message.c:836 #: src/xz/message.c:835
msgid "Unexpected end of input" msgid "Unexpected end of input"
msgstr "输入意外结束" msgstr "输入意外结束"
#: src/xz/message.c:878 #: src/xz/message.c:877
#, c-format #, c-format
msgid "%s MiB of memory is required. The limiter is disabled." msgid "%s MiB of memory is required. The limiter is disabled."
msgstr "需要 %s MiB 的内存空间。限制已禁用。" msgstr "需要 %s MiB 的内存空间。限制已禁用。"
#: src/xz/message.c:906 #: src/xz/message.c:905
#, c-format #, c-format
msgid "%s MiB of memory is required. The limit is %s." msgid "%s MiB of memory is required. The limit is %s."
msgstr "需要 %s MiB 的内存空间。限制为 %s。" msgstr "需要 %s MiB 的内存空间。限制为 %s。"
#: src/xz/message.c:925 #: src/xz/message.c:924
#, c-format #, c-format
msgid "%s: Filter chain: %s\n" msgid "%s: Filter chain: %s\n"
msgstr "%s过滤器链%s\n" msgstr "%s过滤器链%s\n"
#: src/xz/message.c:936 #: src/xz/message.c:935
#, c-format #, c-format
msgid "Try '%s --help' for more information." msgid "Try `%s --help' for more information."
msgstr "请尝试执行 '%s --help' 来获取更多信息。" msgstr "请尝试执行“%s --help”来获取更多信息。"
#: src/xz/message.c:962 #: src/xz/message.c:961
#, c-format #, c-format
msgid "" msgid ""
"Usage: %s [OPTION]... [FILE]...\n" "Usage: %s [OPTION]... [FILE]...\n"
@ -665,15 +628,15 @@ msgstr ""
"使用 .xz 格式压缩或解压缩文件。\n" "使用 .xz 格式压缩或解压缩文件。\n"
"\n" "\n"
#: src/xz/message.c:969 #: src/xz/message.c:968
msgid "Mandatory arguments to long options are mandatory for short options too.\n" msgid "Mandatory arguments to long options are mandatory for short options too.\n"
msgstr "必选参数对长短选项同时适用。\n" msgstr "必选参数对长短选项同时适用。\n"
#: src/xz/message.c:973 #: src/xz/message.c:972
msgid " Operation mode:\n" msgid " Operation mode:\n"
msgstr " 操作模式:\n" msgstr " 操作模式:\n"
#: src/xz/message.c:976 #: src/xz/message.c:975
msgid "" msgid ""
" -z, --compress force compression\n" " -z, --compress force compression\n"
" -d, --decompress force decompression\n" " -d, --decompress force decompression\n"
@ -685,7 +648,7 @@ msgstr ""
" -t, --test 测试压缩文件完整性\n" " -t, --test 测试压缩文件完整性\n"
" -l, --list 列出 .xz 文件的信息" " -l, --list 列出 .xz 文件的信息"
#: src/xz/message.c:982 #: src/xz/message.c:981
msgid "" msgid ""
"\n" "\n"
" Operation modifiers:\n" " Operation modifiers:\n"
@ -693,7 +656,7 @@ msgstr ""
"\n" "\n"
" 操作修饰符:\n" " 操作修饰符:\n"
#: src/xz/message.c:985 #: src/xz/message.c:984
msgid "" msgid ""
" -k, --keep keep (don't delete) input files\n" " -k, --keep keep (don't delete) input files\n"
" -f, --force force overwrite of output file and (de)compress links\n" " -f, --force force overwrite of output file and (de)compress links\n"
@ -703,24 +666,16 @@ msgstr ""
" -f, --force 强制覆写输出文件和(解)压缩链接\n" " -f, --force 强制覆写输出文件和(解)压缩链接\n"
" -c, --stdout 向标准输出写入,同时不要删除输入文件" " -c, --stdout 向标准输出写入,同时不要删除输入文件"
#: src/xz/message.c:994 #: src/xz/message.c:993
msgid "" msgid ""
" --single-stream decompress only the first stream, and silently\n" " --single-stream decompress only the first stream, and silently\n"
" ignore possible remaining input data" " ignore possible remaining input data"
msgstr " --single-stream 仅解压缩第一个流,忽略其后可能继续出现的输入数据" msgstr " --single-stream 仅解压缩第一个流,忽略其后可能继续出现的输入数据"
#: src/xz/message.c:997 #: src/xz/message.c:996
#, fuzzy
#| msgid ""
#| " --no-sparse do not create sparse files when decompressing\n"
#| " -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n"
#| " --files[=FILE] read filenames to process from FILE; if FILE is\n"
#| " omitted, filenames are read from the standard input;\n"
#| " filenames must be terminated with the newline character\n"
#| " --files0[=FILE] like --files but use the null character as terminator"
msgid "" msgid ""
" --no-sparse do not create sparse files when decompressing\n" " --no-sparse do not create sparse files when decompressing\n"
" -S, --suffix=.SUF use the suffix '.SUF' on compressed files\n" " -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n"
" --files[=FILE] read filenames to process from FILE; if FILE is\n" " --files[=FILE] read filenames to process from FILE; if FILE is\n"
" omitted, filenames are read from the standard input;\n" " omitted, filenames are read from the standard input;\n"
" filenames must be terminated with the newline character\n" " filenames must be terminated with the newline character\n"
@ -732,7 +687,7 @@ msgstr ""
" 将从标准输入读取文件名列表;文件名必须使用换行符分隔\n" " 将从标准输入读取文件名列表;文件名必须使用换行符分隔\n"
" --files0[=文件] 类似 --files但使用空字符进行分隔" " --files0[=文件] 类似 --files但使用空字符进行分隔"
#: src/xz/message.c:1006 #: src/xz/message.c:1005
msgid "" msgid ""
"\n" "\n"
" Basic file format and compression options:\n" " Basic file format and compression options:\n"
@ -740,18 +695,12 @@ msgstr ""
"\n" "\n"
" 基本文件格式和压缩选项:\n" " 基本文件格式和压缩选项:\n"
#: src/xz/message.c:1008 #: src/xz/message.c:1007
#, fuzzy
#| msgid ""
#| " -F, --format=FMT file format to encode or decode; possible values are\n"
#| " `auto' (default), `xz', `lzma', `lzip', and `raw'\n"
#| " -C, --check=CHECK integrity check type: `none' (use with caution),\n"
#| " `crc32', `crc64' (default), or `sha256'"
msgid "" msgid ""
" -F, --format=FMT file format to encode or decode; possible values are\n" " -F, --format=FMT file format to encode or decode; possible values are\n"
" 'auto' (default), 'xz', 'lzma', 'lzip', and 'raw'\n" " `auto' (default), `xz', `lzma', `lzip', and `raw'\n"
" -C, --check=CHECK integrity check type: 'none' (use with caution),\n" " -C, --check=CHECK integrity check type: `none' (use with caution),\n"
" 'crc32', 'crc64' (default), or 'sha256'" " `crc32', `crc64' (default), or `sha256'"
msgstr "" msgstr ""
" -F, --format=格式 要编码或解码的文件格式;可能的值包括\n" " -F, --format=格式 要编码或解码的文件格式;可能的值包括\n"
" “auto”默认、“xz”、“lzma”、\n" " “auto”默认、“xz”、“lzma”、\n"
@ -759,11 +708,11 @@ msgstr ""
" -C, --check=类型 完整性检查类型“none”请谨慎使用、\n" " -C, --check=类型 完整性检查类型“none”请谨慎使用、\n"
" “crc32”、“crc64”默认或“sha256”" " “crc32”、“crc64”默认或“sha256”"
#: src/xz/message.c:1013 #: src/xz/message.c:1012
msgid " --ignore-check don't verify the integrity check when decompressing" msgid " --ignore-check don't verify the integrity check when decompressing"
msgstr " --ignore-check 解压缩时不要进行完整性检查验证" msgstr " --ignore-check 解压缩时不要进行完整性检查验证"
#: src/xz/message.c:1017 #: src/xz/message.c:1016
msgid "" msgid ""
" -0 ... -9 compression preset; default is 6; take compressor *and*\n" " -0 ... -9 compression preset; default is 6; take compressor *and*\n"
" decompressor memory usage into account before using 7-9!" " decompressor memory usage into account before using 7-9!"
@ -771,7 +720,7 @@ msgstr ""
" -0 ... -9 压缩预设等级;默认为 6使用 7-9 的等级之前,请先考虑\n" " -0 ... -9 压缩预设等级;默认为 6使用 7-9 的等级之前,请先考虑\n"
" 压缩和解压缩所需的内存用量!(会占用大量内存空间)" " 压缩和解压缩所需的内存用量!(会占用大量内存空间)"
#: src/xz/message.c:1021 #: src/xz/message.c:1020
msgid "" msgid ""
" -e, --extreme try to improve compression ratio by using more CPU time;\n" " -e, --extreme try to improve compression ratio by using more CPU time;\n"
" does not affect decompressor memory requirements" " does not affect decompressor memory requirements"
@ -779,19 +728,15 @@ msgstr ""
" -e, --extreme 尝试使用更多 CPU 时间来改进压缩比率;\n" " -e, --extreme 尝试使用更多 CPU 时间来改进压缩比率;\n"
" 不会影响解压缩的内存需求量" " 不会影响解压缩的内存需求量"
#: src/xz/message.c:1025 #: src/xz/message.c:1024
#, fuzzy
#| msgid ""
#| " -T, --threads=NUM use at most NUM threads; the default is 1; set to 0\n"
#| " to use as many threads as there are processor cores"
msgid "" msgid ""
" -T, --threads=NUM use at most NUM threads; the default is 0 which uses\n" " -T, --threads=NUM use at most NUM threads; the default is 1; set to 0\n"
" as many threads as there are processor cores" " to use as many threads as there are processor cores"
msgstr "" msgstr ""
" -T, --threads=数量 使用最多指定数量的线程;默认值为 1设置为 0\n" " -T, --threads=数量 使用最多指定数量的线程;默认值为 1设置为 0\n"
" 可以使用与处理器内核数量相同的线程数" " 可以使用与处理器内核数量相同的线程数"
#: src/xz/message.c:1030 #: src/xz/message.c:1029
msgid "" msgid ""
" --block-size=SIZE\n" " --block-size=SIZE\n"
" start a new .xz block after every SIZE bytes of input;\n" " start a new .xz block after every SIZE bytes of input;\n"
@ -801,24 +746,17 @@ msgstr ""
" 输入每读取指定块大小的数据后即开始一个新的 .xz 块;\n" " 输入每读取指定块大小的数据后即开始一个新的 .xz 块;\n"
" 使用该选项可以设置多线程压缩中的块大小" " 使用该选项可以设置多线程压缩中的块大小"
#: src/xz/message.c:1034 #: src/xz/message.c:1033
#, fuzzy
#| msgid ""
#| " --block-list=SIZES\n"
#| " start a new .xz block after the given comma-separated\n"
#| " intervals of uncompressed data"
msgid "" msgid ""
" --block-list=BLOCKS\n" " --block-list=SIZES\n"
" start a new .xz block after the given comma-separated\n" " start a new .xz block after the given comma-separated\n"
" intervals of uncompressed data; optionally, specify a\n" " intervals of uncompressed data"
" filter chain number (0-9) followed by a ':' before the\n"
" uncompressed data size"
msgstr "" msgstr ""
" --block-list=块大小列表\n" " --block-list=块大小列表\n"
" 在所给出的未压缩数据间隔大小的数据之后开始一个新的\n" " 在所给出的未压缩数据间隔大小的数据之后开始一个新的\n"
" .xz 块(使用逗号分隔)" " .xz 块(使用逗号分隔)"
#: src/xz/message.c:1040 #: src/xz/message.c:1037
msgid "" msgid ""
" --flush-timeout=TIMEOUT\n" " --flush-timeout=TIMEOUT\n"
" when compressing, if more than TIMEOUT milliseconds has\n" " when compressing, if more than TIMEOUT milliseconds has\n"
@ -829,7 +767,7 @@ msgstr ""
" 进行压缩时,如果从上次刷洗输出之后经过了指定的超时时间\n" " 进行压缩时,如果从上次刷洗输出之后经过了指定的超时时间\n"
" 且读取更多数据会被阻塞,则刷洗输出所有缓冲数据" " 且读取更多数据会被阻塞,则刷洗输出所有缓冲数据"
#: src/xz/message.c:1046 #: src/xz/message.c:1043
#, no-c-format #, no-c-format
msgid "" msgid ""
" --memlimit-compress=LIMIT\n" " --memlimit-compress=LIMIT\n"
@ -848,13 +786,13 @@ msgstr ""
" 所指定限制量单位为字节,或以百分号 % 结尾表示内存比例,\n" " 所指定限制量单位为字节,或以百分号 % 结尾表示内存比例,\n"
" 或者指定 0 取软件默认值" " 或者指定 0 取软件默认值"
#: src/xz/message.c:1055 #: src/xz/message.c:1052
msgid "" msgid ""
" --no-adjust if compression settings exceed the memory usage limit,\n" " --no-adjust if compression settings exceed the memory usage limit,\n"
" give an error instead of adjusting the settings downwards" " give an error instead of adjusting the settings downwards"
msgstr " --no-adjust 如果压缩设置超出内存用量限制,不调整设置而直接报错" msgstr " --no-adjust 如果压缩设置超出内存用量限制,不调整设置而直接报错"
#: src/xz/message.c:1061 #: src/xz/message.c:1058
msgid "" msgid ""
"\n" "\n"
" Custom filter chain for compression (alternative for using presets):" " Custom filter chain for compression (alternative for using presets):"
@ -862,27 +800,7 @@ msgstr ""
"\n" "\n"
" 用于压缩的自定义过滤器链(不使用预设等级时的备选用法):" " 用于压缩的自定义过滤器链(不使用预设等级时的备选用法):"
#: src/xz/message.c:1064 #: src/xz/message.c:1067
msgid ""
"\n"
" --filters=FILTERS set the filter chain using the liblzma filter string\n"
" syntax; use --filters-help for more information"
msgstr ""
#: src/xz/message.c:1070
msgid ""
" --filters1=FILTERS ... --filters9=FILTERS\n"
" set additional filter chains using the liblzma filter\n"
" string syntax to use with --block-list"
msgstr ""
#: src/xz/message.c:1076
msgid ""
" --filters-help display more information about the liblzma filter string\n"
" syntax and exit."
msgstr ""
#: src/xz/message.c:1087
msgid "" msgid ""
"\n" "\n"
" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n" " --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
@ -911,19 +829,7 @@ msgstr ""
" (hc3, hc4, bt2, bt3, bt4; bt4)\n" " (hc3, hc4, bt2, bt3, bt4; bt4)\n"
" depth=数字 最大搜索深度; 0=自动(默认)" " depth=数字 最大搜索深度; 0=自动(默认)"
#: src/xz/message.c:1102 #: src/xz/message.c:1082
#, fuzzy
#| msgid ""
#| "\n"
#| " --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n"
#| " --arm[=OPTS] ARM BCJ filter\n"
#| " --armthumb[=OPTS] ARM-Thumb BCJ filter\n"
#| " --arm64[=OPTS] ARM64 BCJ filter\n"
#| " --powerpc[=OPTS] PowerPC BCJ filter (big endian only)\n"
#| " --ia64[=OPTS] IA-64 (Itanium) BCJ filter\n"
#| " --sparc[=OPTS] SPARC BCJ filter\n"
#| " Valid OPTS for all BCJ filters:\n"
#| " start=NUM start offset for conversions (default=0)"
msgid "" msgid ""
"\n" "\n"
" --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n" " --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n"
@ -933,7 +839,6 @@ msgid ""
" --powerpc[=OPTS] PowerPC BCJ filter (big endian only)\n" " --powerpc[=OPTS] PowerPC BCJ filter (big endian only)\n"
" --ia64[=OPTS] IA-64 (Itanium) BCJ filter\n" " --ia64[=OPTS] IA-64 (Itanium) BCJ filter\n"
" --sparc[=OPTS] SPARC BCJ filter\n" " --sparc[=OPTS] SPARC BCJ filter\n"
" --riscv[=OPTS] RISC-V BCJ filter\n"
" Valid OPTS for all BCJ filters:\n" " Valid OPTS for all BCJ filters:\n"
" start=NUM start offset for conversions (default=0)" " start=NUM start offset for conversions (default=0)"
msgstr "" msgstr ""
@ -948,7 +853,7 @@ msgstr ""
" 所有过滤器可用选项:\n" " 所有过滤器可用选项:\n"
" start=数字 转换的起始偏移量(默认=0" " start=数字 转换的起始偏移量(默认=0"
#: src/xz/message.c:1116 #: src/xz/message.c:1095
msgid "" msgid ""
"\n" "\n"
" --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n" " --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n"
@ -959,7 +864,7 @@ msgstr ""
" --delta[=选项] 增量过滤器;有效选项(有效值;默认值):\n" " --delta[=选项] 增量过滤器;有效选项(有效值;默认值):\n"
" dist=NUM 相减的字节之间的距离 (1-256; 1)" " dist=NUM 相减的字节之间的距离 (1-256; 1)"
#: src/xz/message.c:1124 #: src/xz/message.c:1103
msgid "" msgid ""
"\n" "\n"
" Other options:\n" " Other options:\n"
@ -967,7 +872,7 @@ msgstr ""
"\n" "\n"
" 其它选项:\n" " 其它选项:\n"
#: src/xz/message.c:1127 #: src/xz/message.c:1106
msgid "" msgid ""
" -q, --quiet suppress warnings; specify twice to suppress errors too\n" " -q, --quiet suppress warnings; specify twice to suppress errors too\n"
" -v, --verbose be verbose; specify twice for even more verbose" " -v, --verbose be verbose; specify twice for even more verbose"
@ -975,21 +880,21 @@ msgstr ""
" -q, --quiet 不显示警告信息;指定两次可不显示错误信息\n" " -q, --quiet 不显示警告信息;指定两次可不显示错误信息\n"
" -v, --verbose 输出详细信息;指定两次可以输出更详细的信息" " -v, --verbose 输出详细信息;指定两次可以输出更详细的信息"
#: src/xz/message.c:1132 #: src/xz/message.c:1111
msgid " -Q, --no-warn make warnings not affect the exit status" msgid " -Q, --no-warn make warnings not affect the exit status"
msgstr " -Q, --no-warn 使得警告信息不影响程序退出返回值" msgstr " -Q, --no-warn 使得警告信息不影响程序退出返回值"
#: src/xz/message.c:1134 #: src/xz/message.c:1113
msgid " --robot use machine-parsable messages (useful for scripts)" msgid " --robot use machine-parsable messages (useful for scripts)"
msgstr " --robot 使用机器可解析的信息(对于脚本有用)" msgstr " --robot 使用机器可解析的信息(对于脚本有用)"
#: src/xz/message.c:1137 #: src/xz/message.c:1116
msgid "" msgid ""
" --info-memory display the total amount of RAM and the currently active\n" " --info-memory display the total amount of RAM and the currently active\n"
" memory usage limits, and exit" " memory usage limits, and exit"
msgstr " --info-memory 显示 RAM 总量和当前配置的内存用量限制,然后退出" msgstr " --info-memory 显示 RAM 总量和当前配置的内存用量限制,然后退出"
#: src/xz/message.c:1140 #: src/xz/message.c:1119
msgid "" msgid ""
" -h, --help display the short help (lists only the basic options)\n" " -h, --help display the short help (lists only the basic options)\n"
" -H, --long-help display this long help and exit" " -H, --long-help display this long help and exit"
@ -997,7 +902,7 @@ msgstr ""
" -h, --help 显示短帮助信息(仅列出基本选项)\n" " -h, --help 显示短帮助信息(仅列出基本选项)\n"
" -H, --long-help 显示本长帮助信息" " -H, --long-help 显示本长帮助信息"
#: src/xz/message.c:1144 #: src/xz/message.c:1123
msgid "" msgid ""
" -h, --help display this short help and exit\n" " -h, --help display this short help and exit\n"
" -H, --long-help display the long help (lists also the advanced options)" " -H, --long-help display the long help (lists also the advanced options)"
@ -1005,11 +910,11 @@ msgstr ""
" -h, --help 显示本短帮助信息并退出\n" " -h, --help 显示本短帮助信息并退出\n"
" -H, --long-help 显示长帮助信息(同时列出高级选项)" " -H, --long-help 显示长帮助信息(同时列出高级选项)"
#: src/xz/message.c:1149 #: src/xz/message.c:1128
msgid " -V, --version display the version number and exit" msgid " -V, --version display the version number and exit"
msgstr " -V, --version 显示软件版本号并退出" msgstr " -V, --version 显示软件版本号并退出"
#: src/xz/message.c:1151 #: src/xz/message.c:1130
msgid "" msgid ""
"\n" "\n"
"With no FILE, or when FILE is -, read standard input.\n" "With no FILE, or when FILE is -, read standard input.\n"
@ -1021,7 +926,7 @@ msgstr ""
#. for this package. Please add _another line_ saying #. for this package. Please add _another line_ saying
#. "Report translation bugs to <...>\n" with the email or WWW #. "Report translation bugs to <...>\n" with the email or WWW
#. address for translation bugs. Thanks. #. address for translation bugs. Thanks.
#: src/xz/message.c:1157 #: src/xz/message.c:1136
#, c-format #, c-format
msgid "Report bugs to <%s> (in English or Finnish).\n" msgid "Report bugs to <%s> (in English or Finnish).\n"
msgstr "" msgstr ""
@ -1029,33 +934,19 @@ msgstr ""
"请使用中文向 TP 简体中文翻译团队 <i18n-zh@googlegroups.com>\n" "请使用中文向 TP 简体中文翻译团队 <i18n-zh@googlegroups.com>\n"
"报告软件的简体中文翻译错误。\n" "报告软件的简体中文翻译错误。\n"
#: src/xz/message.c:1159 #: src/xz/message.c:1138
#, c-format #, c-format
msgid "%s home page: <%s>\n" msgid "%s home page: <%s>\n"
msgstr "%s 主页:<%s>\n" msgstr "%s 主页:<%s>\n"
#: src/xz/message.c:1163 #: src/xz/message.c:1142
msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE." msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
msgstr "这是开发版本,不适用于生产环境使用。" msgstr "这是开发版本,不适用于生产环境使用。"
#: src/xz/message.c:1180
msgid ""
"Filter chains are set using the --filters=FILTERS or\n"
"--filters1=FILTERS ... --filters9=FILTERS options. Each filter in the chain\n"
"can be separated by spaces or '--'. Alternatively a preset <0-9>[e] can be\n"
"specified instead of a filter chain.\n"
msgstr ""
#: src/xz/message.c:1186
#, fuzzy
#| msgid "Unsupported filter chain or filter options"
msgid "The supported filters and their options are:"
msgstr "不支持的过滤器链或过滤器选项"
#: src/xz/options.c:86 #: src/xz/options.c:86
#, c-format #, c-format
msgid "%s: Options must be 'name=value' pairs separated with commas" msgid "%s: Options must be `name=value' pairs separated with commas"
msgstr "%s选项必须按照 '名称=值' 的格式成对出现,使用半角逗号分隔" msgstr "%s选项必须按照“名称=值”的格式成对出现,使用半角逗号分隔"
#: src/xz/options.c:93 #: src/xz/options.c:93
#, c-format #, c-format
@ -1067,57 +958,54 @@ msgstr "%s无效的选项名称"
msgid "%s: Invalid option value" msgid "%s: Invalid option value"
msgstr "%s无效的选项值" msgstr "%s无效的选项值"
#: src/xz/options.c:248 #: src/xz/options.c:247
#, c-format #, c-format
msgid "Unsupported LZMA1/LZMA2 preset: %s" msgid "Unsupported LZMA1/LZMA2 preset: %s"
msgstr "不支持的 LZMA1/LZMA2 预设等级:%s" msgstr "不支持的 LZMA1/LZMA2 预设等级:%s"
#: src/xz/options.c:356 #: src/xz/options.c:355
msgid "The sum of lc and lp must not exceed 4" msgid "The sum of lc and lp must not exceed 4"
msgstr "lc 和 lp 的和必须不大于 4" msgstr "lc 和 lp 的和必须不大于 4"
#: src/xz/suffix.c:166 #: src/xz/suffix.c:160
#, c-format #, c-format
msgid "%s: Filename has an unknown suffix, skipping" msgid "%s: Filename has an unknown suffix, skipping"
msgstr "%s文件名有未知后缀跳过" msgstr "%s文件名有未知后缀跳过"
#: src/xz/suffix.c:187 #: src/xz/suffix.c:181
#, c-format #, c-format
msgid "%s: File already has '%s' suffix, skipping" msgid "%s: File already has `%s' suffix, skipping"
msgstr "%s文件已有 '%s' 后缀名,跳过" msgstr "%s文件已有“%s”后缀名,跳过"
#: src/xz/suffix.c:394 #: src/xz/suffix.c:388
#, c-format #, c-format
msgid "%s: Invalid filename suffix" msgid "%s: Invalid filename suffix"
msgstr "%s无效的文件名后缀" msgstr "%s无效的文件名后缀"
#: src/xz/util.c:107 #: src/xz/util.c:71
#, c-format #, c-format
msgid "%s: Value is not a non-negative decimal integer" msgid "%s: Value is not a non-negative decimal integer"
msgstr "%s值不是非负十进制整数" msgstr "%s值不是非负十进制整数"
#: src/xz/util.c:149 #: src/xz/util.c:113
#, c-format #, c-format
msgid "%s: Invalid multiplier suffix" msgid "%s: Invalid multiplier suffix"
msgstr "%s无效的乘数后缀" msgstr "%s无效的乘数后缀"
#: src/xz/util.c:151 #: src/xz/util.c:115
#, fuzzy msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
#| msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
msgid "Valid suffixes are 'KiB' (2^10), 'MiB' (2^20), and 'GiB' (2^30)."
msgstr "有效的后缀包括“KiB”2^10、“MiB”2^20和“GiB”2^30。" msgstr "有效的后缀包括“KiB”2^10、“MiB”2^20和“GiB”2^30。"
#: src/xz/util.c:168 #: src/xz/util.c:132
#, fuzzy, c-format #, c-format
#| msgid "Value of the option `%s' must be in the range [%<PRIu64>, %<PRIu64>]" msgid "Value of the option `%s' must be in the range [%<PRIu64>, %<PRIu64>]"
msgid "Value of the option '%s' must be in the range [%<PRIu64>, %<PRIu64>]"
msgstr "选项“%s”的值必须位于 [%<PRIu64>, %<PRIu64>] 范围内" msgstr "选项“%s”的值必须位于 [%<PRIu64>, %<PRIu64>] 范围内"
#: src/xz/util.c:291 #: src/xz/util.c:269
msgid "Compressed data cannot be read from a terminal" msgid "Compressed data cannot be read from a terminal"
msgstr "压缩数据不能从终端读取" msgstr "压缩数据不能从终端读取"
#: src/xz/util.c:304 #: src/xz/util.c:282
msgid "Compressed data cannot be written to a terminal" msgid "Compressed data cannot be written to a terminal"
msgstr "压缩数据不能向终端写入" msgstr "压缩数据不能向终端写入"

1
po4a/.gitignore vendored
View File

@ -1,3 +1,2 @@
/man /man
/xz-man.pot /xz-man.pot
/*.po.authors

2115
po4a/de.po

File diff suppressed because it is too large Load Diff

5173
po4a/fr.po

File diff suppressed because it is too large Load Diff

2604
po4a/ko.po

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
# SPDX-License-Identifier: 0BSD
# To add a new language, add it to po4a_langs and run "update-po" # To add a new language, add it to po4a_langs and run "update-po"
# to get a new .po file. After translating the .po file, run # to get a new .po file. After translating the .po file, run
# "update-po" again to generate the translated man pages. # "update-po" again to generate the translated man pages.
@ -7,10 +5,10 @@
[po4a_langs] de fr ko pt_BR ro uk [po4a_langs] de fr ko pt_BR ro uk
[po4a_paths] xz-man.pot $lang:$lang.po [po4a_paths] xz-man.pot $lang:$lang.po
[type: man] ../src/xz/xz.1 $lang:man/$lang/xz.1 add_$lang:?$lang.po.authors [type: man] ../src/xz/xz.1 $lang:man/$lang/xz.1
[type: man] ../src/xzdec/xzdec.1 $lang:man/$lang/xzdec.1 add_$lang:?$lang.po.authors [type: man] ../src/xzdec/xzdec.1 $lang:man/$lang/xzdec.1
[type: man] ../src/lzmainfo/lzmainfo.1 $lang:man/$lang/lzmainfo.1 add_$lang:?$lang.po.authors [type: man] ../src/lzmainfo/lzmainfo.1 $lang:man/$lang/lzmainfo.1
[type: man] ../src/scripts/xzdiff.1 $lang:man/$lang/xzdiff.1 add_$lang:?$lang.po.authors [type: man] ../src/scripts/xzdiff.1 $lang:man/$lang/xzdiff.1
[type: man] ../src/scripts/xzgrep.1 $lang:man/$lang/xzgrep.1 add_$lang:?$lang.po.authors [type: man] ../src/scripts/xzgrep.1 $lang:man/$lang/xzgrep.1
[type: man] ../src/scripts/xzless.1 $lang:man/$lang/xzless.1 add_$lang:?$lang.po.authors [type: man] ../src/scripts/xzless.1 $lang:man/$lang/xzless.1
[type: man] ../src/scripts/xzmore.1 $lang:man/$lang/xzmore.1 add_$lang:?$lang.po.authors [type: man] ../src/scripts/xzmore.1 $lang:man/$lang/xzmore.1

File diff suppressed because it is too large Load Diff

2624
po4a/ro.po

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More