Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions relenv/_resources/xz/crc32_table.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////
//
/// \file crc32_table.c
/// \brief Precalculated CRC32 table with correct endianness
//
// Author: Lasse Collin
//
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
///////////////////////////////////////////////////////////////////////////////

#include "common.h"

// Having the declaration here silences clang -Wmissing-variable-declarations.
extern const uint32_t lzma_crc32_table[8][256];

#ifdef WORDS_BIGENDIAN
# include "crc32_table_be.h"
#else
# include "crc32_table_le.h"
#endif
33 changes: 33 additions & 0 deletions relenv/_resources/xz/crc64_table.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
///////////////////////////////////////////////////////////////////////////////
//
/// \file crc64_table.c
/// \brief Precalculated CRC64 table with correct endianness
//
// Author: Lasse Collin
//
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
///////////////////////////////////////////////////////////////////////////////

#include "common.h"


// FIXME: Compared to crc64_fast.c this has to check for __x86_64__ too
// so that in 32-bit builds crc64_x86.S won't break due to a missing table.
#if (defined(__x86_64__) && defined(__SSSE3__) \
&& defined(__SSE4_1__) && defined(__PCLMUL__)) \
|| (defined(__e2k__) && __iset__ >= 6)
// No table needed. Use a typedef to avoid an empty translation unit.
typedef void lzma_crc64_dummy;

#else
// Having the declaration here silences clang -Wmissing-variable-declarations.
extern const uint64_t lzma_crc64_table[4][256];

# if defined(WORDS_BIGENDIAN)
# include "crc64_table_be.h"
# else
# include "crc64_table_le.h"
# endif
#endif
17 changes: 13 additions & 4 deletions relenv/_resources/xz/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
The config.h file was removed from XZ-Utils tarting with version 5.5.0.
XZ-Utils seems to build just fine with the config.h file from 5.4.7, so we're
including it here. This will be copied into the src/windows directory in the
extracted source for XZ-Utils.
The config.h file was removed from XZ-Utils starting with version 5.5.0.
XZ-Utils switched to CMake and removed Visual Studio project files and
pre-generated headers/sources.

We include the following files from XZ 5.4.7 to maintain compatibility with
Python's MSBuild-based build system on Windows (PCbuild/liblzma.vcxproj):

- config.h (src/common/config.h)
- crc32_table.c (src/liblzma/check/crc32_table.c)
- crc64_table.c (src/liblzma/check/crc64_table.c)

These files are copied into the extracted XZ source directory during the
Windows build process if they are missing.
8 changes: 8 additions & 0 deletions relenv/build/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ def update_xz(dirs: Dirs, env: EnvMapping) -> None:
config_file_source = dirs.root / "_resources" / "xz" / "config.h"
if not config_file.exists():
shutil.copy(str(config_file_source), str(config_file))

# Also copy crc32_table.c and crc64_table.c which are missing in newer XZ tarballs
check_dir = target_dir / "src" / "liblzma" / "check"
for filename in ["crc32_table.c", "crc64_table.c"]:
target_file = check_dir / filename
source_file = dirs.root / "_resources" / "xz" / filename
if not target_file.exists():
shutil.copy(str(source_file), str(target_file))
# Update externals.spdx.json with the correct version, url, and hash
# This became a thing in 3.12
if env["RELENV_PY_MAJOR_VERSION"] in ["3.12", "3.13", "3.14"]:
Expand Down
43 changes: 43 additions & 0 deletions relenv/python-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@
"linux",
"darwin"
]
},
"3.6.1": {
"url": "https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz",
"sha256": "b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e",
"platforms": [
"linux",
"darwin"
]
}
},
"sqlite": {
Expand All @@ -225,6 +233,16 @@
"darwin",
"win32"
]
},
"3.51.2.0": {
"url": "https://sqlite.org/2026/sqlite-autoconf-{version}.tar.gz",
"sha256": "fbd89f866b1403bb66a143065440089dd76100f2238314d92274a082d4f2b7bb",
"sqliteversion": "3510200",
"platforms": [
"linux",
"darwin",
"win32"
]
}
},
"xz": {
Expand All @@ -235,6 +253,15 @@
"linux",
"darwin"
]
},
"5.8.2": {
"url": "http://tukaani.org/xz/xz-{version}.tar.gz",
"sha256": "ce09c50a5962786b83e5da389c90dd2c15ecd0980a258dd01f70f9e7ce58a8f1",
"platforms": [
"linux",
"darwin",
"win32"
]
}
},
"libffi": {
Expand Down Expand Up @@ -262,6 +289,13 @@
"platforms": [
"linux"
]
},
"6.6": {
"url": "https://mirrors.ocf.berkeley.edu/gnu/ncurses/ncurses-{version}.tar.gz",
"sha256": "355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11",
"platforms": [
"linux"
]
}
},
"readline": {
Expand Down Expand Up @@ -344,6 +378,15 @@
"darwin",
"win32"
]
},
"2.7.4": {
"url": "https://github.com/libexpat/libexpat/releases/download/R_2_7_4/expat-{version}.tar.xz",
"sha256": "9e9cabb457c1e09de91db2706d8365645792638eb3be1f94dbb2149301086ac0",
"platforms": [
"linux",
"darwin",
"win32"
]
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def test_get_dependency_version_sqlite_all_platforms() -> None:
def test_get_dependency_version_xz_all_platforms() -> None:
"""Test getting XZ version for various platforms."""
# XZ 5.5.0+ removed MSBuild support, so Windows uses a fallback version
# and XZ is not in JSON for win32
for platform in ["linux", "darwin"]:
# BUT we now have XZ 5.8.2 in python-versions.json for win32 too
for platform in ["linux", "darwin", "win32"]:
result = get_dependency_version("xz", platform)
assert result is not None, f"XZ should be available for {platform}"
assert isinstance(result, dict)
Expand All @@ -166,10 +166,6 @@ def test_get_dependency_version_xz_all_platforms() -> None:
assert "xz" in result["url"].lower()
assert isinstance(result["sha256"], str)

# Windows should return None (uses hardcoded fallback in windows.py)
result = get_dependency_version("xz", "win32")
assert result is None, "XZ should not be in JSON for win32 (uses fallback)"


def test_get_dependency_version_nonexistent() -> None:
"""Test that nonexistent dependency returns None."""
Expand Down
Loading