|
47 | 47 | "allow_missing_preprocessor": True
|
48 | 48 | },
|
49 | 49 | "_bz2": {},
|
50 |
| - "_ctypes": {"shared_depends": ["libffi-7"]}, |
| 50 | + "_ctypes": { |
| 51 | + "shared_depends": ["libffi-7"], |
| 52 | + "static_depends_no_project": ["libffi"], |
| 53 | + }, |
51 | 54 | "_decimal": {},
|
52 | 55 | "_elementtree": {},
|
53 | 56 | "_hashlib": {
|
@@ -775,6 +778,7 @@ def hack_props(
|
775 | 778 | )
|
776 | 779 |
|
777 | 780 | # We need to copy linking settings for dynamic libraries to static libraries.
|
| 781 | + copy_link_to_lib(pcbuild_path / "libffi.props") |
778 | 782 | copy_link_to_lib(pcbuild_path / "openssl.props")
|
779 | 783 |
|
780 | 784 | # We should look against the static library variants.
|
@@ -892,32 +896,6 @@ def hack_project_files(
|
892 | 896 |
|
893 | 897 | pythoncore_proj = pcbuild_path / "pythoncore.vcxproj"
|
894 | 898 |
|
895 |
| - # normally the _ctypes extension/project pulls in libffi via |
896 |
| - # <Link><AdditionalDependencies>. However, as part of converting this |
897 |
| - # extension to static, we lose the transitive dependency. Here, we |
898 |
| - # hack pythoncore as a one-off to add the dependency. Ideally we would |
899 |
| - # handle this when hacking the extension's project. But it is easier to |
900 |
| - # do here. |
901 |
| - if static: |
902 |
| - libffi_path = td / "libffi" / "libffi.lib" |
903 |
| - try: |
904 |
| - # Python 3.9 version |
905 |
| - static_replace_in_file( |
906 |
| - pythoncore_proj, |
907 |
| - b"<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>", |
908 |
| - b"<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;" |
909 |
| - + bytes(libffi_path) |
910 |
| - + b";%(AdditionalDependencies)</AdditionalDependencies>", |
911 |
| - ) |
912 |
| - except NoSearchStringError: |
913 |
| - static_replace_in_file( |
914 |
| - pythoncore_proj, |
915 |
| - b"<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>", |
916 |
| - b"<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;" |
917 |
| - + bytes(libffi_path) |
918 |
| - + b";%(AdditionalDependencies)</AdditionalDependencies>", |
919 |
| - ) |
920 |
| - |
921 | 899 | if static:
|
922 | 900 | for extension, entry in sorted(CONVERT_TO_BUILTIN_EXTENSIONS.items()):
|
923 | 901 | if entry.get("ignore_static"):
|
@@ -2170,6 +2148,13 @@ def build_cpython(
|
2170 | 2148 | for record in entries:
|
2171 | 2149 | record["required"] = extension in REQUIRED_EXTENSIONS
|
2172 | 2150 |
|
| 2151 | + # Copy libffi static library as a one-off. |
| 2152 | + if static: |
| 2153 | + source = td / "libffi" / "libffi.lib" |
| 2154 | + dest = out_dir / "python" / "build" / "lib" / "libffi.lib" |
| 2155 | + log("copying %s to %s" % (source, dest)) |
| 2156 | + shutil.copyfile(source, dest) |
| 2157 | + |
2173 | 2158 | # Copy OpenSSL libraries as a one-off.
|
2174 | 2159 | for lib in ("crypto", "ssl"):
|
2175 | 2160 | if static:
|
|
0 commit comments