Commit Graph

1913 Commits

Author SHA1 Message Date
Jia Tan d0faa85df5 CI: Tests for disabling threading on CMake builds. 2023-03-29 23:46:43 +08:00
Jia Tan 8be5cc3b13 CI: Removes CMakeCache.txt between builds.
If the cache file is not removed, CMake will not reset configurations
back to their default values. In order to make the tests independent, it
is simplest to purge the cache. Unfortunatly, this will slow down the
tests a little and repeat some checks.
2023-03-29 23:46:43 +08:00
Jia Tan 2cb6028fc3 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-03-29 23:46:38 +08:00
Jia Tan 4d7fac0b07 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-03-29 23:24:12 +08:00
Jia Tan 20cd905d89 CI: Runs CMake feature tests.
Now, CMake will run similar feature disable tests that the Autotools
version did before. In order to do this without repeating lines in
ci.yml, it now makes sense to use the GitHub Workflow matrix to create
a loop.
2023-03-24 23:41:06 +08:00
Jia Tan 4fabdb269f CI: ci_build.sh allows CMake features to be configured.
Also included various clean ups for style and helper functions for
repeated work.
2023-03-24 23:08:24 +08:00
Jia Tan cf3d1f130e CI: Change ci_build.sh to use bash instead of sh.
This script is only meant to be run as part of the CI build/test process
on machines that are known to have bash (Ubuntu and MacOS). If this
assumption changes in the future, then the bash specific commands will
need to be replaced with a more portable option. For now, it is
convenient to use bash commands.
2023-03-24 20:06:33 +08:00
Jia Tan ddfe164368 CMake: Only build xzdec if decoders are enabled. 2023-03-24 20:05:59 +08:00
Jia Tan 116e81f002 Build: Removes redundant check for LZMA1 filter support. 2023-03-23 21:48:52 +08:00
Lasse Collin 0ba234f692 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-03-23 21:48:52 +08:00
Jia Tan b0891684b4 CMake: Conditionally build xz list.* files if decoders are enabled. 2023-03-23 21:48:52 +08:00
Jia Tan 2c1a830efb 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-03-23 21:48:52 +08:00
Lasse Collin 8be136f667 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:07:51 +02:00
Lasse Collin 53cc475f26 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:04:37 +02:00
Lasse Collin 3b8890a402 Update THANKS. 2023-03-21 13:12:03 +02:00
Lasse Collin 5a5bd7f871 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 13:11:49 +02:00
Lasse Collin dfe1710784 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:45:59 +02:00
Jia Tan f0c580c5fc Add NEWS for 5.4.2. 2023-03-18 22:23:39 +08:00
Jia Tan af4925e604 Add NEWS for 5.2.11. 2023-03-18 22:10:12 +08:00
Lasse Collin 5a7b930efa Update the copy of GNU GPLv3 from gnu.org to COPYING.GPLv3. 2023-03-18 16:00:54 +02:00
Lasse Collin b473a92891 Change a few HTTP URLs to HTTPS.
The xz man page timestamp was intentionally left unchanged.
2023-03-18 15:56:07 +02:00
Jia Tan 8b2f6001b4 CMake: Fix typo in a comment. 2023-03-18 00:40:28 +08:00
Lasse Collin 76e2315e14 Windows: build.bash: Copy liblzma API docs to the output package. 2023-03-17 18:36:22 +02:00
Lasse Collin 133cf55edc Windows: Add microlzma_*.c to the VS project files.
These should have been included in 5.3.2alpha already.
2023-03-17 08:53:38 +02:00
Lasse Collin 75c9ca450f CMake: Add microlzma_*.c to the build.
These should have been included in 5.3.2alpha already.
2023-03-17 08:43:51 +02:00
Lasse Collin 0cc3313bd4 Build: Update comments about unaligned access to mention 64-bit. 2023-03-17 08:41:36 +02:00
Lasse Collin 5e57e33013 Tests: Update .gitignore. 2023-03-17 00:02:34 +02:00
Lasse Collin 0007394d54 po4a/update-po: Display the script name consistently in error messages. 2023-03-17 00:02:34 +02:00
Jia Tan 509157c80c 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 01:42:28 +08:00
Jia Tan fd90e2f4c2 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 01:42:28 +08:00
Jia Tan 4f50763b98 CI: Add doxygen as a dependency.
Autogen now requires --no-doxygen or having doxygen installed to run
without errors.
2023-03-17 01:42:28 +08:00
Lasse Collin f68f4b27f6 COPYING: Add a note about the included Doxygen-generated HTML. 2023-03-17 01:42:28 +08:00
Jia Tan 8979308528 Doc: Update PACKAGERS with details about liblzma API docs install. 2023-03-17 01:42:28 +08:00
Jia Tan 55ba6e9300 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 01:42:28 +08:00
Jia Tan 16f2125559 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 01:42:28 +08:00
Jia Tan 1321852a3b 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 01:42:28 +08:00
Jia Tan b1216a7772 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 01:42:28 +08:00
Lasse Collin c97d12f300 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 01:42:28 +08:00
Jia Tan 1b7661faa4 Tests: Remove unused macros and functions. 2023-03-13 20:49:53 +08:00
Jia Tan af55191102 liblzma: Defines masks for return values from lzma_index_checks(). 2023-03-13 20:49:53 +08:00
Jia Tan 8f38cdd9ab 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:49:53 +08:00
Lasse Collin 717aa3651c xz: Simplify the error-label in Capsicum sandbox code.
Also remove unneeded "sandbox_allowed = false;" as this code
will never be run more than once (making it work with multiple
input files isn't trivial).
2023-03-11 18:46:45 +02:00
Lasse Collin a0eecc235d xz: Make Capsicum sandbox more strict with stdin and stdout. 2023-03-08 23:22:15 +08:00
Jia Tan 916448d624 Revert: "Add warning if Capsicum sandbox system calls are unsupported."
The warning causes the exit status to be 2, so this will cause problems
for many scripted use cases for xz. The sandbox usage is already very
limited already, so silently disabling this allows it to be more usable.
2023-03-08 23:22:11 +08:00
Jia Tan 01587dda2a xz: Fix -Wunused-label in io_sandbox_enter().
Thanks to Xin Li for recommending the fix.
2023-03-07 20:02:22 +08:00
Jia Tan 5fb9367866 xz: Add warning if Capsicum sandbox system calls are unsupported.
The warning is only used when errno == ENOSYS. Otherwise, xz still
issues a fatal error.
2023-03-06 21:37:45 +08:00
Jia Tan 61ee82cb12 xz: Skip Capsicum sandbox system calls when they are unsupported.
If a system has the Capsicum header files but does not actually
implement the system calls, then this would render xz unusable. Instead,
we can check if errno == ENOSYS and not issue a fatal error.
2023-03-06 21:27:53 +08:00
Jia Tan f070722b57 xz: Reorder cap_enter() to beginning of capsicum sandbox code.
cap_enter() puts the process into the sandbox. If later calls to
cap_rights_limit() fail, then the process can still have some extra
protections.
2023-03-06 21:08:26 +08:00
Jia Tan f1ab1f6b33 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-01 21:42:31 +08:00
Lasse Collin 4b7fb3bf41 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-02-27 18:38:35 +02:00