Commit Graph

2536 Commits

Author SHA1 Message Date
Lasse Collin 6ad5739094
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.

(cherry picked from commit 5ca96a9348)
2024-09-06 19:06:23 +03:00
Lasse Collin 4107f20667
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.

(cherry picked from commit ebd155c3a1)
2024-09-06 19:06:23 +03:00
Lasse Collin ff697eb154
liblzma: CRC CLMUL: Omit is_arch_extension_supported() when not needed
On E2K the function compiles only due to compiler emulation but the
function is never used. It's cleaner to omit the function when it's
not needed even though it's a "static inline" function.

Thanks to Ilya Kurdyukov.

(cherry picked from commit 30a2d5d510)
2024-09-06 19:00:30 +03:00
Lasse Collin 4e4a568f6a
CMake: Prefer C11 with a fallback to C99
There is no need to make a similar change in configure.ac.
With Autoconf 2.72, the deprecated macro AC_PROG_CC_C99
is an alias for AC_PROG_CC which prefers a C11 compiler.

(cherry picked from commit 2178acf8a4)
2024-09-06 18:56:17 +03:00
Lasse Collin 849e757a8c
Update THANKS
(cherry picked from commit c97e9c12fe)
2024-09-06 18:56:17 +03:00
Lasse Collin 1305056a54
Tests: Improve the CRC32 test
A similar one was already there for CRC64 but nowadays also CRC32
has a CLMUL implementation, so it's good to test it better too.

(cherry picked from commit 89e9f12e03)
2024-09-06 18:56:17 +03:00
Lasse Collin a44493ec41
xz: Fix white space
(cherry picked from commit c7164b1927)
2024-09-06 18:56:17 +03:00
Lasse Collin 5e74a6a813
liblzma: Fix a typo in a comment
Thanks to Sam James for spotting it.

Fixes: f644473a21
(cherry picked from commit 0a32d2072c)
2024-09-06 18:56:17 +03:00
Lasse Collin 3f7edc673c
liblzma: Fix a comment indentation
(cherry picked from commit afd9b4d282)
2024-09-06 18:56:16 +03:00
Lasse Collin 8a9cc7ca08
liblzma: Fix white space
(cherry picked from commit 50e6bff274)
2024-09-06 18:56:16 +03:00
RainRat b29b13082f
Fix typos
Closes: https://github.com/tukaani-project/xz/pull/124
(cherry picked from commit 9e73918a4f)
2024-09-06 18:51:59 +03:00
Lasse Collin 6f66155e01
tuklib_integer: Fix building on OpenBSD/sparc64 that uses GCC 4.2
GCC 4.2 doesn't have __builtin_bswap16() and friends so tuklib_integer.h
tries to use OS-specific byte swap methods instead. On OpenBSD those
macros are swap16/32/64 instead of bswap16/32/64 like on other *BSDs
and Darwin.

An alternative to "#ifdef __OpenBSD__" could be "#ifdef swap16" as it
is a macro. But since OpenBSD seems to be a special case under this
special case of "*BSDs and Darwin", checking for __OpenBSD__ seems
the more conservative choice now.

Thanks to Christian Weisgerber and Brad Smith who both submitted
the same patch a few hours apart.

Co-authored-by: Christian Weisgerber <naddy@mips.inka.de>
Co-authored-by: Brad Smith <brad@comstyle.com>
Closes: https://github.com/tukaani-project/xz/pull/126
(cherry picked from commit 04b23addf3)
2024-09-06 18:51:59 +03:00
Lasse Collin 5522759d31
Update THANKS
(cherry picked from commit f5c2ae58ec)
2024-09-06 18:51:58 +03:00
Lasse Collin 45aed6f37f
CMake: Fix wrong version variable
liblzma_VERSION has never existed in the repository. xz_VERSION from
the project() command was used for liblzma SOVERSION so use xz_VERSION
here too.

The wrong variable did no harm in practice as PROJECT_VERSION
was used as the fallback. It has the same value as xz_VERSION.

Fixes: 7e3493d40e
(cherry picked from commit 1d3c61575f)
2024-09-06 18:51:58 +03:00
Lasse Collin 198271a6ed
CMake: Fix liblzma filename in Windows environments
This is a mess because liblzma DLL outside Cygwin and MSYS2
is liblzma.dll instead of lzma.dll to avoid a conflict with
lzma.dll from LZMA SDK.

On Cygwin the name was "liblzma-5.dll" while "cyglzma-5.dll"
would have been correct (and match what Libtool produces).
MSYS2 likely was broken too as it uses the "msys-" prefix.

This change has no effect with MinGW-w64 because with that
the "lib" prefix was correct already.

With MSVC builds this is a small breaking change that requires developers
to adjust the library name when linking against liblzma. The liblzma.dll
name is kept as is but the import library and static library are now
lzma.lib instead of liblzma.lib. This is helpful when using pkgconf
because "pkgconf --msvc-syntax --libs liblzma" outputs "lzma.lib"
(it's converted from "-llzma" in liblzma.pc). It would be easy to
keep the liblzma.lib naming but the pkgconf compatibility seems worth
it in the long run. The lzma.lib name is compatible with MinGW-w64
too as -llzma will find also lzma.lib.

vcpkg had been patching CMakeLists.txt this way since 2022 but I
learned this only recently. The reasoning for the patch makes sense,
and while this is a small breaking change with MSVC, it seems like
a decent compromise as it keeps the DLL name the same.

2022 patch in vcpkg: 0707a17ecf/ports/liblzma/win_output_name.patch
See the discussion: https://github.com/microsoft/vcpkg/pull/39024

Thanks to Vincent Torri for confirming the naming issue on Cygwin.

(cherry picked from commit e0d6d05ce0)
2024-09-06 18:51:58 +03:00
Lasse Collin 92e5425979
Fix version.sh compatiblity with Solaris
The ancient /bin/tr on Solaris doesn't support '\n'.
With /usr/xpg4/bin/tr it works but it might not be in PATH.

Another problem was that sed was given input that didn't have a newline
at the end. Text files must end with a newline to be portable.

Fix both problems:

  - Handle multiline input within sed itself to avoid one tr invocation.
    The default sed even on Solaris does understand \n.

  - Use octals in tr -d. \012 works for ASCII "line feed", it's even
    used as an example in the Solaris man page. But we must strip
    also ASCII "carriage return" \015 and EBCDIC "next line" \025.
    The EBCDIC case got handled with \n previously. Stripping \012
    and \015 on EBCDIC system won't matter as those control chars
    won't be present in the string in the first place.

An awk-based solution could be an alternative but it might need
special casing on Solaris to used nawk instead of awk. The changes
in this commit are smaller and should have a smaller risk for
regressions. It's also possible that version.sh will be dropped
entirely at some point.

(cherry picked from commit e7a42cda7c)
2024-09-06 18:51:58 +03:00
Lasse Collin 0c089a33a5
CI: Don't require po4a on Solaris
(cherry picked from commit a61c9ab475)
2024-09-06 18:51:58 +03:00
Lasse Collin 83d3792711
CI: Use set -e on Solaris too
(cherry picked from commit 5229bdf533)
2024-09-06 18:51:58 +03:00
Lasse Collin 9c64d4fd78
CMake: Install liblzma.pc even with MSVC
I had misunderstood that it wouldn't be useful with MSVC.
vcpkg had been installing liblzma.pc with custom rules since 2020,
years before liblzma.pc support was added to CMakeLists.txt.

See:
eb895b95aa/ports/liblzma/portfile.cmake
https://github.com/microsoft/vcpkg/pull/39024#issuecomment-2145064670
(cherry picked from commit afa938e429)
2024-09-06 18:51:57 +03:00
Sam James 42754176bd
ci: don't pin official GH actions via commit, just tag
There's no real value in doing it via commit for official GH actions. We
can keep using pinned commits for unofficial actions. It's hassle for no
gain.

Maybe going forward we can limit this further by only being paranoid
for the jobs with any access to tokens.

(cherry picked from commit 35f8649f08)
2024-09-06 18:51:57 +03:00
Christoph Junghans 9a5fee7022
ci: set -e on openbsd
Closes: https://github.com/tukaani-project/xz/pull/116
(cherry picked from commit e885dae37f)
2024-09-06 18:51:57 +03:00
Christoph Junghans a2d66de54f
ci: set -e on netbsd
(cherry picked from commit 21b02dd128)
2024-09-06 18:51:57 +03:00
Christoph Junghans 1bdc70176b
ci: actually fail on FreeBSD
Without "set -e" the job will always be successful.

See vmactions/freebsd-vm#72

(cherry picked from commit 8641f0c24c)
2024-09-06 18:51:57 +03:00
Andrew Murray 4132277103
Updated actions
Closes: https://github.com/tukaani-project/xz/pull/115
(cherry picked from commit ef616683ef)
2024-09-06 18:51:57 +03:00
Sam James 1575414636
ci: add po4a
(cherry picked from commit 57b440d316)
2024-09-06 18:51:57 +03:00
Sam James c3e293037e
ci: add Solaris
Inspired by 3f2a38b011.

It runs on Solaris 5.11 via a VirtualBox VM.

(cherry picked from commit 08cdf4be9a)
2024-09-06 18:51:56 +03:00
Sam James dc6b6011b4
xz: list: suppress -Wformat-nonliteral for Solaris
Solaris' GCC can't understand that our use is fine, unlike modern compilers:
```
list.c: In function 'print_totals_basic':
list.c:1191:4: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  uint64_to_str(totals.files, 0));
  ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
```

It's presumably because of older gettext missing format attributes.

This is with `gcc (GCC) 7.3.0`.

(cherry picked from commit b69768c8bd)
2024-09-06 18:51:56 +03:00
Lasse Collin 7ce2ac795a
Update THANKS
(cherry picked from commit b8d134e61e)
2024-09-06 18:51:49 +03:00
Lasse Collin 3ec664d3f6 Bump version and soname for 5.6.2 2024-05-29 18:03:51 +03:00
Lasse Collin 3cc0aa702e Add NEWS for 5.6.2 2024-05-29 18:03:04 +03:00
Lasse Collin 526d3f7f2c Add NEWS for 5.4.7 2024-05-29 18:03:04 +03:00
Lasse Collin 660b09279e Add NEWS for 5.2.13 2024-05-29 18:03:04 +03:00
Lasse Collin 7d76282dac Translations: Run po4a/update-po
Now the files are in the new formatting without source file
line numbers. Future updates should keep the diffs much smaller.
2024-05-29 17:47:47 +03:00
Lasse Collin 4470c3f7d8 Translations: Run "make -C po update-po"
In the past this wasn't done before releases; the Git repository
just contained the files from the Translation Project. But this
way it is clearer when comparing release tarballs against the
Git repository. In future releases this might no longer be necessary
within a stable branch as the .po files won't change so easily anymore
when creating a tarball.
2024-05-29 17:47:47 +03:00
Lasse Collin 33b8a85fac Build: Update po/*.po files only when needed
When po/xz.pot doesn't exist, running "make" or "make dist" will
create it. Then the .po files will be updated but only if they
actually would change more than the POT-Creation-Date line.
Then the .gmo files would be generated from the .po files.
This is the case before and after this commit.

However, "make dist" and thus "make mydist" did a forced update
to the files, updating them even if the only change was the
POT-Creation-Date line. This had pros and cons: It made it clear
that the .po file really is in sync with the recent strings in
the package. On the other hand, it added noise in form of changed
files in the source tree and distribution tarballs. It can be
ignored with something like "diff -I'^"POT-Creation-Date: '" but
it's still a minor annoyance *if* there's not enough value in
having the most recent timestamp.

Setting DIST_DEPENDS_ON_UPDATE_PO = no means that such forced
update won't happen in "make dist" anymore. However, the "mydist"
target will use xz.pot-update target which is the same target that
is run when xz.pot doesn't exist at all yet. Thus "mydist" will
ensure that the translations are up to date, without noise from
changes that would affect only the POT-Creation-Date line.

Note that po4a always uses msgmerge with --update, so POT-Creation-Date
in the man page translations is never the only change in .po files.
In that sense this commit makes the message translations behave more
similarly to the man page translations.

Distribution tarballs will still have non-reproducible POT-Creation-Date
in po/xz.pot and po4a/xz-man.pot but those are just two files. Even they
could be made reproducible from a Git timestamp if desired.

(cherry picked from commit 9284f1aea3)
2024-05-29 17:31:42 +03:00
Lasse Collin 09daebd66b po4a/update-po: Disable wrapping in .pot and .po files
The .po files from the Translation Project come with unwrapped
strings so this matches it.

This may reduce the noise in diffs too. When the beginning of
a paragraph had changed, the rest of the lines got rewrapped
in msgsid. Now it's just one very long line that changes when
a paragraph has been edited.

The --add-location=file option was removed as redundant. The line
numbers don't exist in the .pot file due to --porefs file and thus
they cannot get copied to the .po files either.

(cherry picked from commit 4beba1cd62)
2024-05-28 21:26:53 +03:00
Lasse Collin 51ad72dae4 Update contact info in README
(cherry picked from commit b14c130a58)
2024-05-28 18:41:35 +03:00
Lasse Collin 18463917f9 Translations: Use --package-name=xz-man with po4a
This is to match reality. See the added comment.

(cherry picked from commit 75f5f2e014)
2024-05-28 17:23:10 +03:00
Lasse Collin 26bbcb13cd Translations: Omit --package-name from po/Makevars
This is closer to the reality in the po/*.po files.

(cherry picked from commit eb217d016c)
2024-05-28 17:23:10 +03:00
Lasse Collin c35ee804b8 Translations: Omit man page line numbers from .pot and .po files
(cherry picked from commit 9114267038)
2024-05-28 12:21:22 +03:00
Lasse Collin 0f4429d47f Translations: Use the xgettext option --add-location=file
(cherry picked from commit 093490b582)
2024-05-28 12:21:22 +03:00
Lasse Collin a93e2c2d1d Translations: Use the msgmerge option --add-location=file
This way the PO file diffs are less noisy but the locations of the
strings are still present at file level, just without line numbers.

The option is available since gettext 0.19 (2014).
configure.ac requires 0.19.6.

(cherry picked from commit fccebe2b4f)
2024-05-28 12:21:22 +03:00
Lasse Collin d438989559 Build: Use $(SHELL) instead of sh to run scripts in Makefile.am
(cherry picked from commit f361d9ae85)
2024-05-28 12:21:22 +03:00
Lasse Collin 5781414b6e Translations: Change the home page URLs in man page translations
Since the source strings have changed, these would get marked as
fuzzy and the original string would be used instead. The original
and translated strings are identical in this case so it wouldn't
matter. But patching the translations helps still because then
po4a will show the correct translation percentage.

(cherry picked from commit a26dece347)
2024-05-23 18:18:05 +03:00
Lasse Collin 3670e0616e CMake: Add manual support for 32-bit x86 assembly files
One has to pass -DENABLE_X86_ASM=ON to cmake to enable the
CRC assembly code. Autodetection isn't done. Looking at
CMAKE_SYSTEM_PROCESSOR might not work as it comes from uname
unless cross-compilation is done using a CMake toolchain file.

On top of this, if the code is run on modern processors that support
the CLMUL instruction, then the C code should be faster (but then
one should also be using a x86-64 build if possible).

(cherry picked from commit 24387c234b)
2024-05-23 15:40:51 +03:00
Lasse Collin c1b001b09e CMake: Rename USE_DOXYGEN to ENABLE_DOXYGEN
It's more consistent with the other option() uses.

(cherry picked from commit 0fb3c9c3f6)
2024-05-23 15:40:51 +03:00
Lasse Collin 7213fe39c7 Use more confident language in COPYING
(cherry picked from commit 62733592a1)
2024-05-23 11:37:06 +03:00
Lasse Collin 15358be94a Add SPDX license identifiers to files under tests/ossfuzz
(cherry picked from commit 9ae2ebc1e5)
2024-05-23 11:37:06 +03:00
Lasse Collin 1aa92c7ffd Add SPDX license identifier to .codespellrc
(cherry picked from commit 9000d70eb9)
2024-05-23 11:37:06 +03:00
Lasse Collin 3c7e400fdc Move entries po4a/.gitignore to the top level .gitignore
The po4a directory is in EXTRA_DIST and thus all files there
are included in the package. .gitignore doesn't belong in the
package so keep that file out of the po4a directory.

(cherry picked from commit 903c16fcfa)
2024-05-23 11:37:06 +03:00