Commit Graph

2298 Commits

Author SHA1 Message Date
Jia Tan 39f4a1a86a Tests: Add MicroLZMA test. 2024-02-23 20:58:36 +08:00
Jia Tan adaacafde6 Build: Define HAVE_MICROLZMA when it is configured. 2024-02-23 20:57:59 +08:00
Jia Tan eea78216d2 xz: Fix Capsicum sandbox compile error.
user_abort_pipe[] was still being used instead of the parameters.
2024-02-23 20:27:15 +08:00
Jia Tan 32b0a3ce19 Build: Fix ARM64 CRC32 instruction feature test.
Old versions of Clang reported the unsupported function attribute and
__crc32d() function as warnings instead of errors, so the feature test
passed when it shouldn't have, causing a compile error at build time.
-Werror was added to this feature test to fix this. The change is not
needed for CMake because check_c_source_compiles() also performs
linking and the error is caught then.

Thanks to Sebastian Andrzej Siewior for reporting this.
2024-02-23 16:12:32 +08:00
Lasse Collin 4c81c9611f CMake: Add LOCALEDIR to the windres workaround.
LOCALEDIR may contain spaces like in "C:\Program Files".
2024-02-22 19:16:35 +02:00
Lasse Collin de4337fd89 xz: Landlock: Fix error message if input file is a directory.
If xz is given a directory, it should look like this:

    $ xz /usr/bin
    xz: /usr/bin: Is a directory, skipping

The Landlock rules didn't allow opening directories for reading:

    $ xz /usr/bin
    xz: /usr/bin: Permission denied

The simplest fix was to allow opening directories for reading.
While it's a bit silly to allow it solely for the error message,
it shouldn't make the sandbox significantly weaker.

The single-file use case (like when called from GNU tar) is
still as strict as possible: all Landlock restrictions are
enabled before (de)compression starts.
2024-02-22 15:18:25 +02:00
Lasse Collin 120da10ae1 liblzma: Disable branchless C version in range decoder.
Thanks to Sebastian Andrzej Siewior and Sam James for
benchmarking on various systems.
2024-02-22 14:41:29 +02:00
Lasse Collin 00440f52be INSTALL: Clarify that --disable-assembler affects only 32-bit x86. 2024-02-21 17:41:32 +02:00
Lasse Collin 11405be84e Windows: build.bash: Include COPYING.0BSD in the package. 2024-02-21 16:57:20 +02:00
Lasse Collin c27cf64e3e Windows: build.bash: include liblzma-crt-mixing.txt in the package. 2024-02-21 16:57:20 +02:00
Lasse Collin 8d38941bae Windows: Major update to Windows build instructions. 2024-02-21 16:57:20 +02:00
Lasse Collin 4b5b0d3523 Windows: Update windows/README-Windows.txt.
It's for binary packages built with windows/build.bash.
2024-02-21 16:57:20 +02:00
Lasse Collin 1ee716f740 Windows: Update windows/build.bash.
Support for the old MinGW was dropped. Only MinGW-w64 with GCC
is supported now.

The script now supports also cross-compilation from GNU/Linux
(tests are not run). MSYS2 and also the old MSYS 1.0.11 work
for building on Windows. The i686 and x86_64 toolchains must
be in PATH to build both 32-bit and 64-bit versions.

Parallel builds are done if "nproc" from GNU coreutils is available.

MinGW-w64 runtime copyright information file was renamed from
COPYING-Windows.txt to COPYING.MinGW-w64-runtime.txt which
is the filename used by MinGW-w64 itself. Its existence
is now mandatory, it's checked at the beginning of the script.

The file TODO is no longer copied to the package.
2024-02-20 21:04:29 +02:00
Jia Tan 60462e4260 Translations: Update the Romanian man page translations. 2024-02-20 23:32:22 +08:00
Jia Tan 10d733e5b8 Translations: Update the Korean man page translations. 2024-02-20 23:30:25 +08:00
Jia Tan 797a34b72a Translations: Update the Spanish translation. 2024-02-20 21:03:53 +08:00
Jia Tan 5c3751d019 Translations: Update the Romanian translation. 2024-02-20 20:18:07 +08:00
Jia Tan e2d31154ec Translations: Update the Croatian translation. 2024-02-20 20:15:50 +08:00
Jia Tan 704500f994 Translations: Update the German man page translations. 2024-02-20 20:05:44 +08:00
Jia Tan 1cfd3dca3f Translations: Update the German translation. 2024-02-20 19:58:25 +08:00
Jia Tan 28b9b3f16c Translations: Update the Hungarian translation. 2024-02-20 19:56:52 +08:00
Lasse Collin 00b06cd0af CMake: Fix building of lzmainfo when translations are enabled. 2024-02-19 16:48:18 +02:00
Lasse Collin b0d1422b60 CMake: Don't assume that -fvisibility=hidden is supported outside Windows.
The original code was good enough for supporting GNU/Linux
and a few others but it wasn't very portable.

CMake doesn't support Solaris Studio's -xldscope=hidden.
If it ever does, things should still work with this commit
as Solaris Studio supports not only its own __global but also
the GNU C __attribute__((visibility("default"))). Support for the
attribute was added in 2007 to Sun Studio 12 compiler version 5.9.
2024-02-19 16:28:49 +02:00
Lasse Collin 2ced9d34be CMake: Revise the component splitting. 2024-02-19 16:28:49 +02:00
Lasse Collin 426bdc709c CMake: Update the main comment and document CMAKE_BUILD_TYPE=Release. 2024-02-19 16:28:49 +02:00
Lasse Collin 4430e075f7 CMake: Use -O2 instead of -O3 in CMAKE_BUILD_TYPE=Release.
-O3 doesn't seem useful for speed but it makes the code bigger.
CMake makes is difficult for users to simply override the
optimization level: CFLAGS / CMAKE_C_FLAGS aren't helpful because
they go before CMAKE_C_FLAGS_RELEASE. Of course, users can override
CMAKE_C_FLAGS_RELEASE directly but then they have to remember to
add also -DNDEBUG to disable assertions.

This commit changes -O3 to -O2 in CMAKE_C_FLAGS_RELEASE if and only if
CMAKE_C_FLAGS_RELEASE cache variable doesn't already exist. So if
a custom value is passed on the command line (or reconfiguring an
already-configured build), the cache variable won't be modified.
2024-02-19 16:28:49 +02:00
Lasse Collin 025eb6d787 CMake: Handle symbol versioning on MicroBlaze specially.
This is to match configure.ac.
2024-02-19 16:28:49 +02:00
Lasse Collin 2edd1a35b2 CMake: Keep build working even if lib/*.[ch] are removed. 2024-02-19 12:21:37 +02:00
Lasse Collin d753e2ce47 CMake: Install documentation. 2024-02-19 12:21:37 +02:00
Lasse Collin 7a0405bea9 CMake: Bump maximum policy version to 3.28.
CMP0154 doesn't affect us since we don't use FILE_SET.
2024-02-19 12:21:37 +02:00
Lasse Collin c2264ffbe3 CMake: Build lzmainfo. 2024-02-19 12:21:37 +02:00
Lasse Collin 998d0b2953 CMake: Build lzmadec. 2024-02-19 12:21:37 +02:00
Lasse Collin 74e8bc7417 CMake: Add test_scripts.sh to the tests.
In contrast to Automake, skipping of this test when decoders
are disabled is handled at CMake side instead of test_scripts.sh
because CMake-build doesn't create config.h.
2024-02-19 12:21:37 +02:00
Lasse Collin 4808f238a7 CMake: Install scripts.
Compared to the Autotools-based build, this has simpler handling
for the shell (@POSIX_SHELL@) and extra PATH entry for the scripts
(configure has --enable-path-for-scripts=PREFIX). The simpler
metho should be enough for non-ancient systems and Solaris.
2024-02-19 12:21:37 +02:00
Lasse Collin 3462362ebd Scripts: Use @PACKAGE_VERSION@ instead of @VERSION@.
PACKAGE_VERSION was already used in liblzma.pc.in.
This way only one version @foo@ is used.
2024-02-19 12:21:37 +02:00
Lasse Collin 67610c245b CMake: Simplify symlink creation and install translated man pages.
It helps that cmake_install.cmake doesn't parallelize installation
so symlinks can be created so that the target is always known to
exist (a requirement on Windows in some cases).

This bumps the minimum CMake version from 3.13 to 3.14 to use
file(CREATE_LINK ...). It could be made to work on 3.13 by
calling "cmake -E create_symlink" but it's uglier code and
slower in "make install". 3.14 should be a reasonable version
to require nowadays, especially since the Autotools build
is still the primary build system for most OSes.
2024-02-19 12:21:37 +02:00
Lasse Collin 50cc1d8a5a CMake: Add support for building and installing xz with translations.
If gettext tools are available, the .po files listed in po/LINGUAS
are converted using msgfmt. This allows building with translations
directly from xz.git without Autotools.

If gettext tools aren't available, the Autotools-created .gmo files
in the "po" directory will be used. This allows CMake-based build
to use translations from Autotools-generated tarball.

If translation support is found (Intl_FOUND) but both the
gettext tools and the pre-generated .gmo files are missing,
then "make" will fail.
2024-02-19 12:21:37 +02:00
Lasse Collin 746c471643 liblzma: Remove commented-out code. 2024-02-19 11:58:33 +02:00
Lasse Collin 4ce300ce08 xz: Delete old commented-out code. 2024-02-17 23:07:35 +02:00
Lasse Collin cae9a5e0bf xz: Use stricter pledge(2) and Landlock sandbox.
This makes these sandboxing methods stricter when no files are
created or deleted. That is, it's a middle ground between the
initial sandbox and the strictest single-file-to-stdout sandbox:
this allows opening files for reading but output has to go to stdout.
2024-02-17 23:07:35 +02:00
Lasse Collin 02e3505991 xz: Support Landlock ABI version 4.
Linux 6.7 added support for ABI version 4 which restricts
TCP connections which xz won't need and thus those can be
forbidden now. Since the ABI version is handled at runtime,
supporting version 4 won't cause any compatibility issues.

Note that new enough kernel headers are required to get
version 4 support enabled at build time.
2024-02-17 23:07:35 +02:00
Lasse Collin 374868d81d xz: Move sandboxing code to sandbox.c and improve Landlock sandbox.
Landlock is now always used just like pledge(2) is: first in more
permissive mode and later (under certain common conditions) in
a strict mode that doesn't allow opening more files.

I put pledge(2) first in sandbox.c because it's the simplest API
to use and still somewhat fine-grained for basic applications.
So it's the simplest thing to understand for anyone reading sandbox.c.
2024-02-17 23:07:35 +02:00
Lasse Collin 7312dfbb02 xz: Tweak comments. 2024-02-17 23:07:35 +02:00
Lasse Collin c701a5909a xz: Fix message_init() description.
Also explicitly initialize progress_automatic to make it clear
that it can be read before message_init() sets it. Static variable
was initialized to false by default already so this is only for
clarity.
2024-02-17 23:07:35 +02:00
Lasse Collin 9466306719 Build: Makefile.am: Sort EXTRA_DIST.
Dirs first, then files in case-sensitive ASCII order.
2024-02-17 19:42:30 +02:00
Lasse Collin f3440e78c9 Build: Don't install TODO. 2024-02-17 19:42:30 +02:00
Jia Tan a7a3b62e2a Translations: Update the Korean man page translations. 2024-02-18 01:09:11 +08:00
Jia Tan 9b315db2d5 Translations: Update the Korean translation. 2024-02-18 01:08:32 +08:00
Lasse Collin 56246607df Build: Install translated lzmainfo man pages.
All other translated man pages were being installed but
lzmainfo had been forgotten.
2024-02-17 16:23:14 +02:00
Lasse Collin f1d6b88aef liblzma: Avoid implementation-defined behavior in the RISC-V filter.
GCC docs promise that it works and a few other compilers do
too. Clang/LLVM is documented source code only but unsurprisingly
it behaves the same as others on x86-64 at least. But the
certainly-portable way is good enough here so use that.
2024-02-17 16:01:32 +02:00