Skip to content

Commit c9d810d

Browse files
committed
copy xz config.h file from embedded version
config.h file is sourced from CPython's cpython-source-deps repo.
1 parent 8199622 commit c9d810d

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed

cpython-windows/build.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ def hack_project_files(
625625
static_replace_in_file(
626626
liblzma_path,
627627
b'<ClCompile Include="$(lzmaDir)src\\liblzma\\simple\\arm.c" />',
628-
b'<ClCompile Include="$(lzmaDir)src\\liblzma\\simple\\arm.c" />\r\n <ClCompile Include="$(lzmaDir)src\\liblzma\\simple\\arm64.c" />'
628+
b'<ClCompile Include="$(lzmaDir)src\\liblzma\\simple\\arm.c" />\r\n <ClCompile Include="$(lzmaDir)src\\liblzma\\simple\\arm64.c" />',
629629
)
630630
static_replace_in_file(
631631
liblzma_path,
@@ -1426,6 +1426,15 @@ def build_cpython(
14261426
for f in fs:
14271427
f.result()
14281428

1429+
# Copy the config.h file used by upstream CPython for xz 5.8.1
1430+
# https://github.com/python/cpython-source-deps/blob/665d407bd6bc941944db2152e4b5dca388ea586e/windows/config.h
1431+
xz_version = DOWNLOADS["xz"]["version"]
1432+
xz_path = td / ("xz-%s" % xz_version)
1433+
config_src = SUPPORT / "xz-suport" / "config.h"
1434+
config_dest = xz_path / "windows" / "config.h"
1435+
log(f"copying {config_src} to {config_dest}")
1436+
shutil.copyfile(config_src, config_dest)
1437+
14291438
extract_tar_to_directory(libffi_archive, td)
14301439

14311440
# We need all the OpenSSL library files in the same directory to appease

cpython-windows/xz-support/README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The upstream xz sources requires cmake to build on windows.
2+
This can be avoided by extracting a config.h file extracted from the CMake's
3+
results, as is done by CPython.
4+
This file may need to be updated when upgrading the xz version.
5+
The file in this directory is taken from the xz branch of
6+
https://github.com/python/cpython-source-deps.
7+
Specifically:
8+
https://github.com/python/cpython-source-deps/blob/665d407bd6bc941944db2152e4b5dca388ea586e/windows/config.h
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/* Configuration extracted from CMake'd project files.
2+
3+
This is used by CPython, and is not part of the regular xz release.
4+
*/
5+
6+
#define HAVE_CHECK_CRC32 1
7+
#define HAVE_CHECK_CRC64 1
8+
#define HAVE_CHECK_SHA256 1
9+
10+
#define HAVE_DECODERS 1
11+
#define HAVE_DECODER_ARM 1
12+
#define HAVE_DECODER_ARM64 1
13+
#define HAVE_DECODER_ARMTHUMB 1
14+
#define HAVE_DECODER_DELTA 1
15+
#define HAVE_DECODER_IA64 1
16+
#define HAVE_DECODER_POWERPC 1
17+
#define HAVE_DECODER_LZMA1 1
18+
#define HAVE_DECODER_LZMA2 1
19+
#define HAVE_DECODER_SPARC 1
20+
#define HAVE_DECODER_X86 1
21+
22+
#define HAVE_ENCODERS 1
23+
#define HAVE_ENCODER_ARM 1
24+
#define HAVE_ENCODER_ARM64 1
25+
#define HAVE_ENCODER_ARMTHUMB 1
26+
#define HAVE_ENCODER_DELTA 1
27+
#define HAVE_ENCODER_IA64 1
28+
#define HAVE_ENCODER_POWERPC 1
29+
#define HAVE_ENCODER_LZMA1 1
30+
#define HAVE_ENCODER_LZMA2 1
31+
#define HAVE_ENCODER_SPARC 1
32+
#define HAVE_ENCODER_X86 1
33+
34+
#if defined(_M_ARM64)
35+
36+
#undef HAVE_IMMINTRIN_H
37+
#undef HAVE_USABLE_CLMUL
38+
39+
#else
40+
41+
#define HAVE_IMMINTRIN_H 1
42+
#define HAVE_USABLE_CLMUL 1
43+
#define HAVE__MM_MOVEMASK_EPI8 1
44+
#define TUKLIB_FAST_UNALIGNED_ACCESS 1
45+
46+
#endif
47+
48+
#define HAVE___BUILTIN_ASSUME_ALIGNED 1
49+
#define HAVE__BOOL 1
50+
51+
#define HAVE_INTTYPES_H 1
52+
#define HAVE_MF_BT2 1
53+
#define HAVE_MF_BT3 1
54+
#define HAVE_MF_BT4 1
55+
#define HAVE_MF_HC3 1
56+
#define HAVE_MF_HC4 1
57+
#define HAVE_STDBOOL_H 1
58+
#define HAVE_STDINT_H 1
59+
#define HAVE_VISIBILITY 0
60+
61+
#define MYTHREAD_VISTA 1
62+
63+
#define PACKAGE_BUGREPORT "xz@tukaani.org"
64+
#define PACKAGE_NAME "XZ Utils"
65+
#define PACKAGE_URL "https://tukaani.org/xz/"
66+
67+
#define TUKLIB_SYMBOL_PREFIX lzma_

0 commit comments

Comments
 (0)