]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
11 months agoBuild: Fix a typo in autogen.sh
Firas Khalil Khana [Tue, 10 Sep 2024 09:30:32 +0000 (12:30 +0300)] 
Build: Fix a typo in autogen.sh

Fixes: e9be74f5b129fe8a5388d588e68b1b7f5168a310
Closes: https://github.com/tukaani-project/xz/pull/141
11 months agoTranslations: Update Chinese (simplified) translation
Lasse Collin [Mon, 2 Sep 2024 17:08:40 +0000 (20:08 +0300)] 
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.

11 months agoTranslations: Update the Catalan translation
Lasse Collin [Mon, 2 Sep 2024 16:40:50 +0000 (19:40 +0300)] 
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 fccebe2b4fd513488fc920e4dac32562ed3c7637
    and 093490b58271e9424ce38a7b1b38bcf61b9c86c6. xz.pot in the TP
    is older than these commits.

11 months agoUpdate THANKS
Lasse Collin [Thu, 22 Aug 2024 11:06:16 +0000 (14:06 +0300)] 
Update THANKS

11 months agoCMake: Don't install lzmadec.1 symlinks if XZ_TOOL_LZMADEC=OFF
Lasse Collin [Thu, 22 Aug 2024 11:06:16 +0000 (14:06 +0300)] 
CMake: Don't install lzmadec.1 symlinks if XZ_TOOL_LZMADEC=OFF

Thanks-to: 榆柳松 (ZhengSen Wang) <wzhengsen@gmail.com>
Fixes: fb50c6ba1d4c9405e5b12b5988b01a3002638c5d
Closes: https://github.com/tukaani-project/xz/pull/134
11 months agoCMake: Fix the build when XZ_TOOL_LZMADEC=OFF
Lasse Collin [Thu, 22 Aug 2024 11:06:16 +0000 (14:06 +0300)] 
CMake: Fix the build when XZ_TOOL_LZMADEC=OFF

Co-developed-by: 榆柳松 (ZhengSen Wang) <wzhengsen@gmail.com>
Fixes: fb50c6ba1d4c9405e5b12b5988b01a3002638c5d
Fixes: https://github.com/tukaani-project/xz/pull/134
11 months agoUpdate THANKS
Lasse Collin [Thu, 22 Aug 2024 08:01:07 +0000 (11:01 +0300)] 
Update THANKS

11 months agoliblzma: Fix x86-64 movzw compatibility in range_decoder.h
Yifeng Li [Thu, 22 Aug 2024 02:18:49 +0000 (02:18 +0000)] 
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: 3182a330c1512cc1f5c87b5c5a272578e60a5158
Fixes: https://github.com/tukaani-project/xz/issues/121
Closes: https://github.com/tukaani-project/xz/pull/136
12 months agoBuild: Comment that elf_aux_info(3) will be available on OpenBSD >= 7.6
Lasse Collin [Fri, 19 Jul 2024 17:02:43 +0000 (20:02 +0300)] 
Build: Comment that elf_aux_info(3) will be available on OpenBSD >= 7.6

12 months agoRevert "liblzma: Add ARM64 CRC32 instruction support detection on OpenBSD"
Lasse Collin [Fri, 19 Jul 2024 16:42:26 +0000 (19:42 +0300)] 
Revert "liblzma: Add ARM64 CRC32 instruction support detection on OpenBSD"

This reverts commit dc03f6290f5b9bd3d50c7e12e58dee870889d599.

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.

12 months agoliblzma: Tweak a comment
Lasse Collin [Sat, 13 Jul 2024 19:10:37 +0000 (22:10 +0300)] 
liblzma: Tweak a comment

13 months agoCMake: Bump maximum policy version to 3.30
Lasse Collin [Thu, 11 Jul 2024 19:17:56 +0000 (22:17 +0300)] 
CMake: Bump maximum policy version to 3.30

13 months agoCMake: Require CMake 3.20 or later
Lasse Collin [Sat, 6 Jul 2024 12:13:19 +0000 (15:13 +0300)] 
CMake: Require CMake 3.20 or later

This allows a few cleanups.

13 months agoUpdate THANKS
Lasse Collin [Tue, 9 Jul 2024 11:27:51 +0000 (14:27 +0300)] 
Update THANKS

13 months agoxz: Remove the TODO comment about --recursive
Lasse Collin [Sat, 6 Jul 2024 11:04:48 +0000 (14:04 +0300)] 
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.

13 months agoDocument --disable-loongarch-crc32 in INSTALL
Lasse Collin [Sat, 6 Jul 2024 11:04:16 +0000 (14:04 +0300)] 
Document --disable-loongarch-crc32 in INSTALL

13 months agoCMake: Link xz against Threads::Threads if using pthreads
Lasse Collin [Wed, 3 Jul 2024 17:45:48 +0000 (20:45 +0300)] 
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: ac05f1b0d7cda1e7ae79775a8dfecc54601d7f1c
Fixes: https://github.com/tukaani-project/xz/issues/129#issuecomment-2204522994
13 months agoUpdate THANKS
Lasse Collin [Tue, 2 Jul 2024 19:49:33 +0000 (22:49 +0300)] 
Update THANKS

13 months agoCMake: Improve NLS error messages
Lasse Collin [Tue, 2 Jul 2024 17:23:35 +0000 (20:23 +0300)] 
CMake: Improve NLS error messages

13 months agoCMake: Update the comment at the top of CMakeLists.txt
Lasse Collin [Tue, 2 Jul 2024 17:19:47 +0000 (20:19 +0300)] 
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.

13 months agoCMake: Drop support for pre-generated po/*.gmo files
Lasse Collin [Tue, 2 Jul 2024 17:12:40 +0000 (20:12 +0300)] 
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).

13 months agoCMake: Make XZ_NLS handling more robust
Lasse Collin [Tue, 2 Jul 2024 16:14:50 +0000 (19:14 +0300)] 
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
13 months agoCI: Add gettext as a dependency to CMake builds
Lasse Collin [Tue, 2 Jul 2024 16:39:05 +0000 (19:39 +0300)] 
CI: Add gettext as a dependency to CMake builds

13 months agoCMake: Fix ENABLE_NLS comment too
Lasse Collin [Tue, 2 Jul 2024 15:43:56 +0000 (18:43 +0300)] 
CMake: Fix ENABLE_NLS comment too

Fixes: 29f77c7b707f2458fb047e77497354b195e05b14
13 months agoCMake: The compile definition is ENABLE_NLS, not XZ_NLS
Lasse Collin [Tue, 2 Jul 2024 15:02:50 +0000 (18:02 +0300)] 
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: 29f77c7b707f2458fb047e77497354b195e05b14
13 months agoUpdate AUTHORS and THANKS
Lasse Collin [Mon, 1 Jul 2024 14:33:20 +0000 (17:33 +0300)] 
Update AUTHORS and THANKS

13 months agoliblzma: Speed up CRC32 calculation on 64-bit LoongArch
Xi Ruoyao [Fri, 28 Jun 2024 10:36:43 +0000 (13:36 +0300)] 
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
13 months agoliblzma: ARM64 CRC32: Align the buffer faster
Lasse Collin [Fri, 28 Jun 2024 11:20:49 +0000 (14:20 +0300)] 
liblzma: ARM64 CRC32: Align the buffer faster

Instead of doing it byte by byte, use the 1/2/4-byte CRC32 instructions.

13 months agoCI: Speed up Valgrind job by using --trace-children-skip-by-arg=...
Sam James [Fri, 28 Jun 2024 11:18:35 +0000 (14:18 +0300)] 
CI: Speed up Valgrind job by using --trace-children-skip-by-arg=...

This addresses the issue I mentioned in
6c095a98fbec70b790253a663173ecdb669108c4 and speeds up the Valgrind
job a bit, because non-xz tools aren't run unnecessarily with
Valgrind by the script tests.

13 months agoBuild: Prepend, not append, PTHREAD_CFLAGS to LIBS
Lasse Collin [Tue, 25 Jun 2024 13:00:22 +0000 (16:00 +0300)] 
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.

13 months agoBuild: Use AC_LINK_IFELSE to handle implicit function declarations
Lasse Collin [Tue, 25 Jun 2024 11:24:29 +0000 (14:24 +0300)] 
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.

13 months agoBuild: Use AC_LINK_IFELSE instead of -Werror
Lasse Collin [Mon, 24 Jun 2024 20:35:59 +0000 (23:35 +0300)] 
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.

13 months agoBuild: Sync the compile check changes from CMakeLists.txt
Lasse Collin [Mon, 24 Jun 2024 20:34:34 +0000 (23:34 +0300)] 
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.

13 months agoCMake: Not experimental anymore
Lasse Collin [Mon, 24 Jun 2024 17:14:43 +0000 (20:14 +0300)] 
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.

13 months agoCMake: Use configure_file() to copy a file
Lasse Collin [Tue, 25 Jun 2024 13:11:13 +0000 (16:11 +0300)] 
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.

13 months agoCMake: Always add pthread flags into CMAKE_REQUIRED_LIBRARIES
Lasse Collin [Tue, 25 Jun 2024 12:51:48 +0000 (15:51 +0300)] 
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.

13 months agoCMake: Tweak comments
Sam James [Mon, 24 Jun 2024 18:25:30 +0000 (19:25 +0100)] 
CMake: Tweak comments

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
13 months agoCMake: Edit white space for consistency
Lasse Collin [Mon, 24 Jun 2024 19:42:01 +0000 (22:42 +0300)] 
CMake: Edit white space for consistency

13 months agoCMake: Fix three checks if building with -flto
Lasse Collin [Mon, 24 Jun 2024 19:41:10 +0000 (22:41 +0300)] 
CMake: Fix three checks if building with -flto

In CMake, check_c_source_compiles() always links too. With
link-time optimization, unused functions may get omitted if
main() doesn't depend on them. Consider the following which
tries to check if somefunction() is available when <someheader.h>
has been included:

    #include <someheader.h>
    int foo(void) { return somefunction(); }
    int main(void) { return 0; }

LTO may omit foo() completely because the program as a whole doesn't
need it and then the program will link even if the symbol somefunction
isn't available in libc or other library being linked in, and then
the test may pass when it shouldn't.

What happens if <someheader.h> doesn't declare somefunction()?
Shouldn't the test fail in the compilation phase already? It should
but many compilers don't follow the C99 and later standards that
prohibit implicit function declarations. Instead such compilers
assume that somefunction() exists, compilation succeeds (with a
warning), and then linker with LTO omits the call to somefunction().

Change the tests so that they are part of main(). If compiler accepts
implicitly declared functions, LTO cannot omit them because it has to
assume that they might have side effects and thus linking will fail.
On the other hand, if the functions/intrinsics being used are supported,
they might get optimized away but in that case it's fine because they
really are supported.

It is fine to use __attribute__((target(...))) for main(). At least
it works with GCC 4.9 to 14.1 on x86-64.

Reported-by: Sam James <sam@gentoo.org>
13 months agoCMake: Use MATCHES instead of multiple STREQUAL
Lasse Collin [Mon, 24 Jun 2024 18:19:14 +0000 (21:19 +0300)] 
CMake: Use MATCHES instead of multiple STREQUAL

13 months agoCMake: Improve the comment about LIBS
Lasse Collin [Mon, 24 Jun 2024 18:06:18 +0000 (21:06 +0300)] 
CMake: Improve the comment about LIBS

13 months agoCMake: Fix a typo in a message
Lasse Collin [Mon, 24 Jun 2024 17:01:25 +0000 (20:01 +0300)] 
CMake: Fix a typo in a message

It was spotted with codespell.

13 months agoDocument CMake options in INSTALL
Lasse Collin [Mon, 24 Jun 2024 16:58:54 +0000 (19:58 +0300)] 
Document CMake options in INSTALL

13 months agoCI: Don't omit crc32 from the list with CMake anymore
Lasse Collin [Mon, 24 Jun 2024 14:18:44 +0000 (17:18 +0300)] 
CI: Don't omit crc32 from the list with CMake anymore

XZ_CHECKS accepts it but works without too.

13 months agoCI: Workaround buggy config.guess on Ubuntu 22.04LTS and 24.04LTS
Lasse Collin [Mon, 24 Jun 2024 14:39:54 +0000 (17:39 +0300)] 
CI: Workaround buggy config.guess on Ubuntu 22.04LTS and 24.04LTS

Check for the wrong triplet from config.guess and override it with
the --build option on the configure command line. Then i386 assembly
autodetection will work.

These Ubuntu versions (and as of writing, also Debian unstable)
ship config.guess version 2022-01-09 which contains a bug that
was fixed in version 2022-05-08. It results in a wrong configure
triplet when using CC="gcc -m32" to build i386 binaries.

Upstream fix:
https://git.savannah.gnu.org/cgit/config.git/commit/?id=f56a7140386d08a531bcfd444d632b28c61a6329

More information:
https://mail.gnu.org/archive/html/config-patches/2022-05/msg00003.html

13 months agoCI: Use CC="gcc -m32" to get i386 compiler on x86-64
Lasse Collin [Mon, 24 Jun 2024 12:24:52 +0000 (15:24 +0300)] 
CI: Use CC="gcc -m32" to get i386 compiler on x86-64

The old method put it in CFLAGS which is a wrong place because
config.guess doesn't read CFLAGS.

13 months agoCI: Let CMake use the CC environment variable
Lasse Collin [Mon, 24 Jun 2024 11:54:17 +0000 (14:54 +0300)] 
CI: Let CMake use the CC environment variable

CC from environment is used to initialize CMAKE_C_COMPILER so
setting CMAKE_C_COMPILER explicitly isn't needed.

The syntax in ci_build.bash was broken in case one wished to put
spaces in CC.

13 months agoCMake: Add autodetection for 32-bit x86 CRC assembly usage
Lasse Collin [Thu, 20 Jun 2024 20:25:42 +0000 (23:25 +0300)] 
CMake: Add autodetection for 32-bit x86 CRC assembly usage

13 months agoCMake: Move option(XZ_ASM_I386) downwards a few lines
Lasse Collin [Thu, 20 Jun 2024 20:00:59 +0000 (23:00 +0300)] 
CMake: Move option(XZ_ASM_I386) downwards a few lines

13 months agoDOS: Update Makefile and config.h for the CRC changes
Lasse Collin [Thu, 20 Jun 2024 15:45:41 +0000 (18:45 +0300)] 
DOS: Update Makefile and config.h for the CRC changes

13 months agoliblzma: Tidy up crc_common.h
Lasse Collin [Sun, 23 Jun 2024 12:35:35 +0000 (15:35 +0300)] 
liblzma: Tidy up crc_common.h

Prefix ARM64_RUNTIME_DETECTION with CRC_ and reorder it to be with
the other ARM64-specific lines. That macro isn't used outside this
file.

ARM64 CLMUL implementation doesn't exist yet and thus CRC64_ARM64_CLMUL
isn't used anywhere yet.

It's not ideal that the single-letter CRC utility macros are here
as they pollute the namespace of the LZ encoder files. Those could
be moved their own crc_macros.h like they were in 5.2.x but in practice
this is fine enough already.

13 months agoliblzma: Move lzma_crcXX_table[][] declarations to crc_common.h
Lasse Collin [Sun, 23 Jun 2024 11:22:08 +0000 (14:22 +0300)] 
liblzma: Move lzma_crcXX_table[][] declarations to crc_common.h

LZ encoder needs lzma_crc32_table[0] but otherwise those tables
are private to the CRC code. In contrast, the other things in
check.h are needed in several places.

13 months agoliblzma: Make 32-bit x86 CRC assembly co-exist with CLMUL
Lasse Collin [Wed, 19 Jun 2024 15:38:22 +0000 (18:38 +0300)] 
liblzma: Make 32-bit x86 CRC assembly co-exist with CLMUL

Now runtime detection of CLMUL support can pick between the CLMUL and
the generic assembly implementations. Whatever overhead this has for
builds that omit CLMUL completely isn't important because builds for
any non-ancient system is likely to include the CLMUL code too.

Handle the CRC tables in crcXX_fast.c files because now these files
are built even when assembly code is used.

If 32-bit x86 assembly is enabled then it will always be built even
if compiler flags were such that CLMUL would be allowed unconditionally.
That is, runtime detection will be used anyway. This keeps the build
rules simpler.

In LZ encoder, build and use lzma_lz_hash_table[256] if CLMUL CRC
is used without runtime detection. Previously this wasn't needed
because crc32_table.c included the lzma_crc32_table[][] in the build
unless encoder support had been disabled. Including an 8 KiB table
was silly when only 1 KiB is actually used. So now liblzma is 7 KiB
smaller if CLMUL is enabled without runtime detection.

13 months agoliblzma: CRC: Rename crcXX_generic to lzma_crcXX_generic
Lasse Collin [Wed, 19 Jun 2024 14:44:41 +0000 (17:44 +0300)] 
liblzma: CRC: Rename crcXX_generic to lzma_crcXX_generic

This prepares for the possibility that lzma_crc32_generic and
lzma_crc64_generic are extern functions.

13 months agoCMake: Define HAVE_CRC_X86_ASM when 32-bit x86 CRC assembly is used
Lasse Collin [Thu, 20 Jun 2024 19:55:22 +0000 (22:55 +0300)] 
CMake: Define HAVE_CRC_X86_ASM when 32-bit x86 CRC assembly is used

13 months agoBuild: Define HAVE_CRC_X86_ASM when 32-bit x86 CRC assembly is used
Lasse Collin [Fri, 10 May 2024 13:00:26 +0000 (16:00 +0300)] 
Build: Define HAVE_CRC_X86_ASM when 32-bit x86 CRC assembly is used

This makes it easier to determine when the CRC tables are needed.

13 months agoCI: Update to the new renamed options in CMakeLists.txt
Lasse Collin [Thu, 20 Jun 2024 21:46:09 +0000 (00:46 +0300)] 
CI: Update to the new renamed options in CMakeLists.txt

13 months agoCMake: Add XZ_EXTERNAL_SHA256
Lasse Collin [Thu, 20 Jun 2024 15:12:22 +0000 (18:12 +0300)] 
CMake: Add XZ_EXTERNAL_SHA256

13 months agoCMake: Move threading detection a few lines up
Lasse Collin [Thu, 20 Jun 2024 15:12:21 +0000 (18:12 +0300)] 
CMake: Move threading detection a few lines up

It feels clearer this way, and when support for external SHA-256
is added, this will keep the order of the library detection the
same as in configure.ac (check for pthreads before libmd) although
it shouldn't matter in practice.

13 months agoCMake: Move the sandbox code out of the liblzma section
Lasse Collin [Thu, 20 Jun 2024 15:12:21 +0000 (18:12 +0300)] 
CMake: Move the sandbox code out of the liblzma section

Sandboxing is for the command line tools, not liblzma.
No functional changes.

13 months agoCMake: Keep existing options in LIBS when adding -lrt
Lasse Collin [Thu, 20 Jun 2024 15:12:21 +0000 (18:12 +0300)] 
CMake: Keep existing options in LIBS when adding -lrt

This makes no difference yet because -lrt is currently the only option
that might be added to LIBS.

13 months agoCMake: Don't install scripts if the xz tool isn't built
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Don't install scripts if the xz tool isn't built

The scripts need the xz tool.

13 months agoCMake: Add XZ_TOOL_XZDEC and XZ_TOOL_LZMADEC
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Add XZ_TOOL_XZDEC and XZ_TOOL_LZMADEC

13 months agoCMake: Add XZ_TOOL_LZMAINFO
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Add XZ_TOOL_LZMAINFO

13 months agoCMake: Add XZ_TOOL_XZ
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Add XZ_TOOL_XZ

13 months agoWindows: Drop Visual Studio 2013 support
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
Windows: Drop Visual Studio 2013 support

This simplifies things a little. Building liblzma with VS2013 probably
still worked but building the command line tools was not supported.

Microsoft ended support for VS2013 on 2024-04.

13 months agoCMake: Add XZ_TOOL_SCRIPTS
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Add XZ_TOOL_SCRIPTS

13 months agoCMake: Add XZ_DOC
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Add XZ_DOC

13 months agoCMake: Refactor XZ_SYMBOL_VERSIONING to match configure.ac
Lasse Collin [Thu, 20 Jun 2024 18:53:03 +0000 (21:53 +0300)] 
CMake: Refactor XZ_SYMBOL_VERSIONING to match configure.ac

Make the available options and their behavior match
--enable-symbol-versions in configure.ac.

Don't enable symbol versions on Linux if not using glibc. Previously
the generic variant was selected on Microblaze or if using NVHPC
without checking that libc is glibc.

Leave the cache variable to "auto" or "yes" if that was specified
instead of setting it to the autodetected value by default. A downside
is that one cannot easily see which variant the autodetection code
has selected. The same applies to XZ_SANDBOX and XZ_THREADS though.

13 months agoCMake: Use the same option list for XZ_THREADS as in configure.ac
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Use the same option list for XZ_THREADS as in configure.ac

Also clarify that "yes" will fail if no threading support is found.
If no threading is wanted, it has to be disabled manually.

configure.ac doesn't behave this way at the moment. Instead it
assumes pthreads to be present if not targeting Windows. If pthreads
actually are missing, the build fails later.

13 months agoCMake: Use the same option list for XZ_SANDBOX as in configure.ac
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Use the same option list for XZ_SANDBOX as in configure.ac

It's simpler to document this way.

13 months agoCMake: Fix indentation
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Fix indentation

13 months agoCMake: Add warning options for GCC and Clang
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Add warning options for GCC and Clang

The list was copied from configure.ac and should be kept in sync.
(Pretend that the deleted comment in CMakeLists.txt didn't exist.)

There is no need to add equivalent of --enable-werror as CMake >= 3.24
supports -DCMAKE_COMPILE_WARNING_AS_ERROR=ON.

13 months agoCMake: Use \040 instead of \x20 for a space
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Use \040 instead of \x20 for a space

This is for consistency with 4c81c9611f8b2e1ad65eb7fa166afc570c58607e
where \040 has to be used because \0x20F gets interpret at three hex
digits. Octals escapes are never longer than three digits.

13 months agoCMake: Add XZ_ASSUME_RAM
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Add XZ_ASSUME_RAM

13 months agoCMake: Rename liblzma_INSTALL_CMAKEDIR to XZ_INSTALL_CMAKEDIR
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename liblzma_INSTALL_CMAKEDIR to XZ_INSTALL_CMAKEDIR

13 months agoCMake: Refactor ADDITIONAL_CHECK_TYPES to XZ_CHECKS
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Refactor ADDITIONAL_CHECK_TYPES to XZ_CHECKS

Now "crc32" is in the list too for completeness but it doesn't
actually have any effect. The description of the cache variable
says that "crc32 is always built" so it should be clear enough.

13 months agoCMake: Rename the cache variable POSIX_SHELL to XZ_POSIX_SHELL
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename the cache variable POSIX_SHELL to XZ_POSIX_SHELL

We still need the variable POSIX_SHELL for configure_file()
but it doesn't need to be a cache variable.

13 months agoCMake: Rename ENCODERS and DECODERS to use XZ_ prefix
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ENCODERS and DECODERS to use XZ_ prefix

13 months agoCMake: Rename MATCH_FINDERS to XZ_MATCH_FINDERS
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename MATCH_FINDERS to XZ_MATCH_FINDERS

13 months agoCMake: Rename SYMBOL_VERSIONING to XZ_SYMBOL_VERSIONING
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename SYMBOL_VERSIONING to XZ_SYMBOL_VERSIONING

13 months agoCMake: Rename ENABLE_THREADS to XZ_THREADS
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ENABLE_THREADS to XZ_THREADS

13 months agoCMake: Rename ENABLE_SANDBOX to XZ_SANDBOX
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ENABLE_SANDBOX to XZ_SANDBOX

13 months agoCMake: Rename ENABLE_X86_ASM to XZ_ASM_I386
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ENABLE_X86_ASM to XZ_ASM_I386

13 months agoCMake: Rename CREATE_XZ_SYMLINKS to XZ_TOOL_SYMLINKS
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename CREATE_XZ_SYMLINKS to XZ_TOOL_SYMLINKS

This only affects the names unxz and xzcat. The xz-prefixed script
symlinks (xzfgrep and such) are always created if scripts are enabled.

13 months agoCMake: Rename CREATE_LZMA_SYMLINKS to XZ_TOOL_LZMA_SYMLINKS
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename CREATE_LZMA_SYMLINKS to XZ_TOOL_LZMA_SYMLINKS

Update the description too.

It affects creation of not only the legacy lzma, unlzma, lzcat symlinks
but also lzgrep and other legacy names for the scripts. The last
LZMA Utils release was made in 2008 but these names are still used
in some places to handle .lzma files.

13 months agoCMake: Rename ALLOW_ARM64_CRC32 to XZ_ARM64_CRC32
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ALLOW_ARM64_CRC32 to XZ_ARM64_CRC32

Update description too.

13 months agoCMake: Rename ALLOW_CLMUL_CRC to XZ_CLMUL_CRC
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ALLOW_CLMUL_CRC to XZ_CLMUL_CRC

Update description too.

13 months agoCMake: Rename ENABLE_DOXYGEN to XZ_DOXYGEN
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ENABLE_DOXYGEN to XZ_DOXYGEN

13 months agoCMake: Rename LZIP_DECODER to XZ_LZIP_DECODER
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename LZIP_DECODER to XZ_LZIP_DECODER

13 months agoCMake: Rename MICROLZMA_ENCODER/DECODER to XZ_MICROLZMA_ENCODER/DECODER
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename MICROLZMA_ENCODER/DECODER to XZ_MICROLZMA_ENCODER/DECODER

13 months agoCMake: Rename ENABLE_SMALL to XZ_SMALL
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ENABLE_SMALL to XZ_SMALL

13 months agoCMake: Rename ENABLE_NLS to XZ_NLS
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Rename ENABLE_NLS to XZ_NLS

Also update the description to mention that this affects installation
of translated man pages too.

Prefixing the cache variables with the project name helps if
the package is used as a subproject in another package.
It also makes the package-specific options group more nicely
in ccmake and cmake-gui.

13 months agoCMake: Link Threads::Threads as PRIVATE to liblzma
Lasse Collin [Sat, 15 Jun 2024 20:34:29 +0000 (23:34 +0300)] 
CMake: Link Threads::Threads as PRIVATE to liblzma

This way pthread options aren't passed to the linker when linking
against shared liblzma but they are still passed when linking against
static liblzma. (Also, one never needs the include path of the
threading library to use liblzma since liblzma's API headers
don't #include <pthread.h>. But <pthread.h> tends to be in the
default include path so here this change makes no difference.)

One cannot mix target_link_libraries() calls that use the scope
(PRIVATE, PUBLIC, or INTERFACE) keyword and calls that don't use it.
The calls without the keyword are like PUBLIC except perhaps when
they aren't, or something like that... It seems best to always
specify a scope keyword as the meanings of those three keywords
at least are clear.

13 months agoCMake: Add empty lines
Lasse Collin [Sun, 16 Jun 2024 16:39:32 +0000 (19:39 +0300)] 
CMake: Add empty lines

13 months agoCMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads
Lasse Collin [Sun, 16 Jun 2024 16:37:36 +0000 (19:37 +0300)] 
CMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads

This shouldn't make much difference in practice as on Windows
no flags are needed anyway and unitialized variable (when threading
is disabled) expands to empty. But it's clearer this way.

13 months agoUpdate THANKS
Lasse Collin [Mon, 17 Jun 2024 15:20:14 +0000 (18:20 +0300)] 
Update THANKS

13 months agoCMake: Use native newlines in liblzma.pc
Lasse Collin [Sun, 16 Jun 2024 16:25:07 +0000 (19:25 +0300)] 
CMake: Use native newlines in liblzma.pc

vcpkg doesn't specify the newline type so it should be fine to
use native newlines in liblzma.pc on Windows.

13 months agoCMake: Use relative paths in liblzma.pc if possible
Lasse Collin [Sun, 16 Jun 2024 16:18:56 +0000 (19:18 +0300)] 
CMake: Use relative paths in liblzma.pc if possible

Now liblzma.pc can be relocatable only if using CMake >= 3.20
but that should be OK as now we shouldn't get broken liblzma.pc
if CMAKE_INSTALL_LIBDIR or CMAKE_INSTALL_INCLUDEDIR contain an
absolute path.

Thanks to Eli Schwartz.

13 months agoRevert "CMake: Set only "prefix" as an absolute path in liblzma.pc"
Lasse Collin [Sun, 16 Jun 2024 15:33:08 +0000 (18:33 +0300)] 
Revert "CMake: Set only "prefix" as an absolute path in liblzma.pc"

This reverts commit 5d1c649ba9eb7a5b9371252ebfbc2911dc774e69.

While CMAKE_INSTALL_<dir> tend to be relative paths, they don't need
to be. Thus the commit was broken. A fancier method is required.

Thanks to Eli Schwartz for the bug report and explanation.