Commit Graph

2666 Commits

Author SHA1 Message Date
Lasse Collin dad1530915 Windows: Set DLL name accurately in StringFileInfo on Cygwin and MSYS2
Now the information in the "Details" tab in the file properties
dialog matches the naming convention of Cygwin and MSYS2. This
is only a cosmetic change.
2024-09-30 16:55:23 +03:00
Lasse Collin 8940ecb96f common_w32res.rc: White space edits
LANGUAGE and VS_VERSION_INFO begin new statements so put an empty line
between them.
2024-09-29 01:27:16 +03:00
Lasse Collin c3b9dad07d CMake: Add the resource files to the Cygwin and MSYS2 builds
Autotools-based build has always done this so this is for consistency.

However, the CMake build won't create the DEF file when building
for Cygwin or MSYS2 because in that context it should be useless.
(If Cygwin or MSYS2 is used to host building of normal Windows
binaries then the DEF file is still created.)
2024-09-29 01:26:45 +03:00
Lasse Collin da4f275bd1 CMake: Fix Windows resource file dependencies
If common_w32res.rc is modified, the resource files need to be rebuilt.
In contrast, the liblzma*.map files truly are link dependencies.
2024-09-29 01:26:13 +03:00
Lasse Collin 1c673c0aac CMake: Checking for CYGWIN covers MSYS2 too
On MSYS2, both CYGWIN and MSYS are set.
2024-09-29 01:26:13 +03:00
Lasse Collin 6aaa0173b8 Translations: Add the SPDX license identifier to pt_BR.po 2024-09-28 09:38:13 +03:00
Lasse Collin dc7b9f24b7 Windows/CMake: Use the correct resource file for lzmadec.exe
CMakeLists.txt was using xzdec_w32res.rc for both xzdec and lzmadec.

Fixes: 998d0b2953
2024-09-25 21:31:06 +03:00
Lasse Collin b834ae5f80 Translations: Update the Brazilian Portuguese translation 2024-09-25 21:29:59 +03:00
Lasse Collin eceb023d4c Update THANKS 2024-09-17 01:26:02 +03:00
Tobias Stoeckmann 76cfd0a9bb lzmainfo: Avoid integer overflow
The MB output can overflow with huge numbers. Most likely these are
invalid .lzma files anyway, but let's avoid garbage output.

lzmadec was adapted from LZMA Utils. The original code with this bug
was written in 2005, over 19 years ago.

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
Closes: https://github.com/tukaani-project/xz/pull/144
2024-09-17 01:26:02 +03:00
Tobias Stoeckmann 78355aebb7 xzdec: Remove unused short option -M
"xzdec -M123" exited with exit status 1 without printing
any messages. The "M:" entry should have been removed when
the memory usage limiter support was removed from xzdec.

Fixes: 792331bdee
Closes: https://github.com/tukaani-project/xz/pull/143
[ Lasse: Commit message edits ]
2024-09-16 23:33:29 +03:00
Lasse Collin e5758db7bd Update THANKS 2024-09-10 13:54:47 +03:00
Firas Khalil Khana 80ffa38f56 Build: Fix a typo in autogen.sh
Fixes: e9be74f5b1
Closes: https://github.com/tukaani-project/xz/pull/141
2024-09-10 13:43:00 +03:00
Lasse Collin 68c54e45d0 Translations: Update Chinese (simplified) translation
Differences to the zh_CN.po file from the Translation Project:

  - Two uses of \v were fixed.

  - Missing "OPTS" translation in --riscv[=OPTS] was copied from
    previous lines.

  - "make update-po" was run to remove line numbers from comments.
2024-09-02 20:08:40 +03:00
Lasse Collin 2230692aa1 Translations: Update the Catalan translation
Differences to the ca.po file from the Translation Project:

  - An overlong line translating --filters-help was wrapped.

  - "make update-po" was used to remove line numbers from the comments
    to match the changes in fccebe2b4f
    and 093490b582. xz.pot in the TP
    is older than these commits.
2024-09-02 19:40:50 +03:00
Lasse Collin 3e7723ce26 Update THANKS 2024-09-02 17:33:50 +03:00
Lasse Collin d3e0e679b2 CMake: Don't install lzmadec.1 symlinks if XZ_TOOL_LZMADEC=OFF
Thanks-to: 榆柳松 (ZhengSen Wang) <wzhengsen@gmail.com>
Fixes: fb50c6ba1d
Closes: https://github.com/tukaani-project/xz/pull/134
2024-09-02 17:33:42 +03:00
Lasse Collin acdf21033a CMake: Fix the build when XZ_TOOL_LZMADEC=OFF
Co-developed-by: 榆柳松 (ZhengSen Wang) <wzhengsen@gmail.com>
Fixes: fb50c6ba1d
Fixes: https://github.com/tukaani-project/xz/pull/134
2024-09-02 17:33:06 +03:00
Lasse Collin 5e37598750 Update THANKS 2024-08-22 11:01:07 +03:00
Yifeng Li 6cd7c86078 liblzma: Fix x86-64 movzw compatibility in range_decoder.h
Support for instruction "movzw" without suffix in "GNU as" was
added in commit [1] and stabilized in binutils 2.27, released
in August 2016. Earlier systems don't accept this instruction
without a suffix, making range_decoder.h's inline assembly
unable to build on old systems such as Ubuntu 16.04, creating
error messages like:

    lzma_decoder.c: Assembler messages:
    lzma_decoder.c:371: Error: no such instruction: `movzw 2(%r11),%esi'
    lzma_decoder.c:373: Error: no such instruction: `movzw 4(%r11),%edi'
    lzma_decoder.c:388: Error: no such instruction: `movzw 6(%r11),%edx'
    lzma_decoder.c:398: Error: no such instruction: `movzw (%r11,%r14,4),%esi'

Change "movzw" to "movzwl" for compatibility.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c07315e0c610e0e3317b4c02266f81793df253d2

Suggested-by: Lasse Collin <lasse.collin@tukaani.org>
Tested-by: Yifeng Li <tomli@tomli.me>
Signed-off-by: Yifeng Li <tomli@tomli.me>
Fixes: 3182a330c1
Fixes: https://github.com/tukaani-project/xz/issues/121
Closes: https://github.com/tukaani-project/xz/pull/136
2024-08-22 10:59:08 +03:00
Lasse Collin bf901dee5d Build: Comment that elf_aux_info(3) will be available on OpenBSD >= 7.6 2024-07-19 20:06:24 +03:00
Lasse Collin f7103c2c2a Revert "liblzma: Add ARM64 CRC32 instruction support detection on OpenBSD"
This reverts commit dc03f6290f.

OpenBSD 7.6 will support elf_aux_info(3), and the detection code used
on FreeBSD will work on OpenBSD 7.6 too. Keep things simpler and drop
the OpenBSD-specific sysctl() method.

Thanks to Christian Weisgerber.
2024-07-19 20:06:24 +03:00
Lasse Collin 7c292dd0bf liblzma: Tweak a comment 2024-07-13 22:10:37 +03:00
Lasse Collin 6408edac55 CMake: Bump maximum policy version to 3.30 2024-07-11 22:17:56 +03:00
Lasse Collin 9231c39ffb CMake: Require CMake 3.20 or later
This allows a few cleanups.
2024-07-11 20:11:38 +03:00
Lasse Collin 028185dd48 Update THANKS 2024-07-09 14:27:51 +03:00
Lasse Collin baecfa1426 xz: Remove the TODO comment about --recursive
It won't be implemented. find + xargs is more flexible, for example,
it allows compressing small files in parallel. An example for that
has been included in the xz man page since 2010.
2024-07-06 14:04:48 +03:00
Lasse Collin f691d58fae Document --disable-loongarch-crc32 in INSTALL 2024-07-06 14:04:16 +03:00
Lasse Collin b3e53122f4 CMake: Link xz against Threads::Threads if using pthreads
The liblzma target was recently changed to link against Threads::Threads
with the PRIVATE keyword. I had forgotten that xz itself depends on
pthreads too due to pthread_sigmask(). Thus, the build broke when
building shared liblzma and pthread_sigmask() wasn't in libc.

Thanks to Peter Seiderer for the bug report.

Fixes: ac05f1b0d7
Fixes: https://github.com/tukaani-project/xz/issues/129#issuecomment-2204522994
2024-07-03 20:45:48 +03:00
Lasse Collin 5742ec1fc7 Update THANKS 2024-07-02 22:49:33 +03:00
Lasse Collin 2d13d10357 CMake: Improve NLS error messages 2024-07-02 22:41:48 +03:00
Lasse Collin 628d8d2c4f CMake: Update the comment at the top of CMakeLists.txt
While po/*.gmo files won't be used from the release tarball,
the generated translated man pages will be used still. Those
are text files and po4a has slightly more dependencies than
gettext tools so installing po4a might be a bit more challenging
in some situations.
2024-07-02 22:41:48 +03:00
Lasse Collin b4b23c94fd CMake: Drop support for pre-generated po/*.gmo files
When a release tarball is created using Autotools, the tarball includes
po/*.gmo files which are binary files generated from po/*.po. Other
tarball creation methods don't and won't create the .gmo files.

It feels clearer if CMake will never install pre-generated binary files
from the source package. If people are able to install CMake, they
likely are able to install gettext tools as well (assuming they want
translations).
2024-07-02 22:41:00 +03:00
Lasse Collin fb99f8e8c5 CMake: Make XZ_NLS handling more robust
If a user set XZ_NLS=ON but find_package(Intl) failed or CMake version
wasn't at least 3.20, the configuration would fail in a cryptic way.

If XZ_NLS is enabled, require that CMake is new enough and that either
gettext tools or pre-generated .gmo files are available. Otherwise fail
the configuration. Previously missing gettext tools and .gmo files would
only result in a warning.

Missing man page translations are still only a warning.

Thanks to Peter Seiderer for the bug report.

Fixes: https://github.com/tukaani-project/xz/issues/129
Closes: https://github.com/tukaani-project/xz/pull/130
2024-07-02 22:40:37 +03:00
Lasse Collin ec6157570e CI: Add gettext as a dependency to CMake builds 2024-07-02 22:40:37 +03:00
Lasse Collin 24f0f7e399 CMake: Fix ENABLE_NLS comment too
Fixes: 29f77c7b70
2024-07-02 22:39:46 +03:00
Lasse Collin a0df067613 CMake: The compile definition is ENABLE_NLS, not XZ_NLS
The CMake variables were renamed and accidentally also
the compile definition was renamed. As a result, translation
support wasn't actually enabled in the executables.

Fixes: 29f77c7b70
2024-07-02 18:39:43 +03:00
Lasse Collin 45d08abc33 Update AUTHORS and THANKS 2024-07-01 17:33:20 +03:00
Xi Ruoyao 7baf6835cf liblzma: Speed up CRC32 calculation on 64-bit LoongArch
The crc.w.{b/h/w/d}.w instructions in LoongArch can calculate the CRC32
result for 1/2/4/8 bytes in a single operation. Using these is much
faster compared to the generic method.

Optimized CRC32 is enabled unconditionally on 64-bit LoongArch because
the LoongArch specification says that CRC32 instructions shall be
implemented for 64-bit processors. Optimized CRC32 isn't enabled for
32-bit LoongArch processors because not enough information is available
about them.

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>

Closes: https://github.com/tukaani-project/xz/pull/86
2024-07-01 17:09:57 +03:00
Lasse Collin 0ed8936685 liblzma: ARM64 CRC32: Align the buffer faster
Instead of doing it byte by byte, use the 1/2/4-byte CRC32 instructions.
2024-06-28 14:20:49 +03:00
Sam James 7e99856f66 CI: Speed up Valgrind job by using --trace-children-skip-by-arg=...
This addresses the issue I mentioned in
6c095a98fb and speeds up the Valgrind
job a bit, because non-xz tools aren't run unnecessarily with
Valgrind by the script tests.
2024-06-28 14:18:35 +03:00
Lasse Collin 2402e8a1ae Build: Prepend, not append, PTHREAD_CFLAGS to LIBS
It shouldn't make any difference because LIBS should be empty
at that point in configure. But prepending is the correct way
because in general the libraries being added might require other
libraries that come later on the command line.
2024-06-26 15:48:56 +03:00
Lasse Collin 7bb46f2b7b Build: Use AC_LINK_IFELSE to handle implicit function declarations
It's more robust in case the compiler allows pre-C99 implicit function
declarations. If an x86 intrinsic is missing and gets treated as
implicit function, the linking step will very probably fail. This
isn't the only way to workaround implicit function declarations but
it might be the simplest and cleanest.

The problem hasn't been observed in the wild.

There are a couple more AC_COMPILE_IFELSE uses in configure.ac.
Of these, Landlock check calls prctl() and in theory could have
the same problem. In practice it doesn't as the check program
looks for several other things too. However, it was changed to
AC_LINK_IFELSE still to look more correct.

Similarly, m4/tuklib_cpucores.m4 and m4/tuklib_physmem.m4 were
updated although they haven't given any trouble either. They
have worked all these years because those check programs rely
on specific headers and types: if headers or types are missing,
compilation will fail. Using the linker makes these checks more
similar to the ones in cmake/tuklib_*.cmake which always link.
2024-06-26 15:48:56 +03:00
Lasse Collin 35eb57355a Build: Use AC_LINK_IFELSE instead of -Werror
AC_COMPILE_IFELSE needed -Werror because Clang <= 14 would merely
warn about the unsupported attribute and implicit function declaration.
Changing to AC_LINK_IFELSE handles the implicit declaration because
the symbol __crc32d is unlikely to exist in libc.

Note that the other part of the check is that #include <arm_acle.h>
must work. If the header is missing, most compilers give an error
and the linking step won't be attempted.

Avoiding -Werror makes the check more robust in case CFLAGS contains
warning flags that break -Werror anyway (but this isn't the only check
in configure.ac that has this problem). Using AC_LINK_IFELSE also makes
the check more similar to how it is done in CMakeLists.txt.
2024-06-26 15:48:56 +03:00
Lasse Collin 5a728813c3 Build: Sync the compile check changes from CMakeLists.txt
It's nice to keep these in sync. The use of main() will later allow
AC_LINK_IFELSE usage too which may avoid the more fragile -Werror.
2024-06-26 15:48:56 +03:00
Lasse Collin 5279828635 CMake: Not experimental anymore
While the CMake support has gotten a lot less testing than
the Autotools-based build, the supported features should now
be equal. The output may differ slightly, for example,
liblzma.pc may have

    Libs.private: -pthread -lpthread

with Autotools on GNU/Linux. CMake doesn't put any options
in Libs.private because on modern glibc the pthread functions
are in libc. The options options aren't required to link static
liblzma into an application.

Autotools-based build doesn't generate or install
lib/cmake/liblzma-*.cmake files. This means that on most
platforms one cannot rely on

    find_package(liblzma 5.2.5 REQUIRED CONFIG)

or such finding those files.
2024-06-26 15:48:56 +03:00
Lasse Collin de215a0517 CMake: Use configure_file() to copy a file
I had missed this simpler method before. It does create a dependency
so that if .in.h changes the copying is done again.
2024-06-25 16:13:39 +03:00
Lasse Collin e620f35097 CMake: Always add pthread flags into CMAKE_REQUIRED_LIBRARIES
It was weird to add CMAKE_THREAD_LIBS_INIT in CMAKE_REQUIRED_LIBRARIES
only if CLOCK_MONOTONIC is available. Alternative would be to remove
the thread libs from CMAKE_REQUIRED_LIBRARIES after the check for
pthread_condattr_setclock() but keeping the libs should be fine too.
Then it's ready in case more pthread functions were wanted some day.
2024-06-25 15:56:39 +03:00
Sam James 068a70e549 CMake: Tweak comments
Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
2024-06-25 14:55:15 +03:00
Lasse Collin 3c95c93bca CMake: Edit white space for consistency 2024-06-25 14:54:53 +03:00