From 375d1c7456554b74a633909c3562d0e40c62d578 Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 19:09:19 +0200 Subject: [PATCH 1/8] Update windows.yml --- .github/workflows/windows.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 27fc1707..59971bc8 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -43,8 +43,9 @@ jobs: - 'cpython-3.9' - 'cpython-3.10' vcvars: - - 'vcvars32.bat' + - 'vcvarsamd64_x86.bat' - 'vcvars64.bat' + - 'vcvarsamd64_arm64.bat' profile: - 'static-noopt' - 'shared-pgo' From b6c39287c99800849e57b732b81dbbda61874b54 Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 19:10:24 +0200 Subject: [PATCH 2/8] Update windows.yml --- .github/workflows/windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 59971bc8..a175c175 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -129,3 +129,4 @@ jobs: with: name: 'cpython-install-only-${{ matrix.version }}' path: cpython-*.tar.gz + From c2caceeed98ac335d0eb010eaae4558b98d76f52 Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 19:41:51 +0200 Subject: [PATCH 3/8] Update build.py --- cpython-windows/build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index bcb91b94..f7d4a7cf 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1442,6 +1442,9 @@ def build_openssl_for_arch( elif arch == "amd64": configure = "VC-WIN64A" prefix = "64" + elif arch == "arm64": + configure = "VC-WIN64-ARM" + prefix = "arm64" # ??? else: print("invalid architecture: %s" % arch) sys.exit(1) @@ -2001,6 +2004,9 @@ def build_cpython( elif arch == "x86": build_platform = "win32" build_directory = "win32" + elif arch == "arm64": + build_platform = "arm64" + build_directory = "arm64" else: raise ValueError("unhandled arch: %s" % arch) @@ -2434,6 +2440,9 @@ def main(): if os.environ.get("Platform") == "x86": target_triple = "i686-pc-windows-msvc" arch = "x86" + elif os.environ.get("Platform") == "arm64": + target_triple = "aarch64-pc-windows-msvc" + arch = "arm64" else: target_triple = "x86_64-pc-windows-msvc" arch = "amd64" From f0c67ea2d8cda38abdfa1b2b6cbf2c7ea9ee4c91 Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 19:42:15 +0200 Subject: [PATCH 4/8] Update windows.yml --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a175c175..6bfe6658 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -43,7 +43,7 @@ jobs: - 'cpython-3.9' - 'cpython-3.10' vcvars: - - 'vcvarsamd64_x86.bat' + - 'vcvars32.bat' - 'vcvars64.bat' - 'vcvarsamd64_arm64.bat' profile: From 3ac95df4dab396757a358bc4e8ea85caf0ea6f40 Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 19:50:29 +0200 Subject: [PATCH 5/8] Update build.py --- cpython-windows/build.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index f7d4a7cf..08f64bd8 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -794,6 +794,8 @@ def hack_props( suffix = b"x64" elif arch == "win32": suffix = None + elif arch == "arm64": + suffix = b"arm64" # TODO check it else: raise Exception("unhandled architecture: %s" % arch) @@ -1444,7 +1446,7 @@ def build_openssl_for_arch( prefix = "64" elif arch == "arm64": configure = "VC-WIN64-ARM" - prefix = "arm64" # ??? + prefix = "arm64" # TODO check it ??? else: print("invalid architecture: %s" % arch) sys.exit(1) From 26418878bafac7ff5a84049ab14a3da9fb7d443d Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 19:57:06 +0200 Subject: [PATCH 6/8] Update build.py --- cpython-windows/build.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 08f64bd8..9c43ca96 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1513,6 +1513,7 @@ def build_openssl( root_32 = td / "x86" root_64 = td / "x64" + root_arm64 = td / "arm64" if arch == "x86": root_32.mkdir() @@ -1536,6 +1537,17 @@ def build_openssl( profile, jom_archive=jom_archive, ) + elif arch == "arm64": + root_64.mkdir() + build_openssl_for_arch( + perl_path, + "arm64", + openssl_archive, + nasm_archive, + root_arm64, + profile, + jom_archive=jom_archive, + ) else: raise ValueError("unhandled arch: %s" % arch) From 03f3a37f1e6e61f0e3871ae37cadcbde67f4c2db Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 20:08:53 +0200 Subject: [PATCH 7/8] Update build.py --- cpython-windows/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 9c43ca96..c4d282d3 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1555,6 +1555,8 @@ def build_openssl( if arch == "x86": shutil.copytree(root_32 / "install" / "32", install / "openssl" / "win32") + elif arch == "arm64": + shutil.copytree(root_arm64 / "install" / "arm64", install / "openssl" / "arm64") else: shutil.copytree(root_64 / "install" / "64", install / "openssl" / "amd64") From 4703094bd0d8f5f012a4d5d44fb6cb78577cf6b7 Mon Sep 17 00:00:00 2001 From: Adrian Antkowiak Date: Fri, 1 Oct 2021 20:29:22 +0200 Subject: [PATCH 8/8] Update build.py --- cpython-windows/build.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index c4d282d3..d2f9715d 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1448,8 +1448,7 @@ def build_openssl_for_arch( configure = "VC-WIN64-ARM" prefix = "arm64" # TODO check it ??? else: - print("invalid architecture: %s" % arch) - sys.exit(1) + raise Exception("unhandled architecture: %s" % arch) # The official CPython OpenSSL builds hack ms/uplink.c to change the # ``GetModuleHandle(NULL)`` invocation to load things from _ssl.pyd @@ -1549,7 +1548,7 @@ def build_openssl( jom_archive=jom_archive, ) else: - raise ValueError("unhandled arch: %s" % arch) + raise Exception("unhandled architecture: %s" % arch) install = td / "out" @@ -1660,9 +1659,14 @@ def build_libffi( if arch == "x86": args.append("-x86") artifacts_path = ffi_source_path / "i686-pc-cygwin" - else: + elif arch == "arm64": + args.append("-arm64") + artifacts_path = ffi_source_path / "aarch64-w64-cygwin" + elif arch == "amd64": args.append("-x64") artifacts_path = ffi_source_path / "x86_64-w64-cygwin" + else: + raise Exception("unhandled architecture: %s" % arch) subprocess.run(args, env=env, check=True) @@ -2024,7 +2028,7 @@ def build_cpython( build_platform = "arm64" build_directory = "arm64" else: - raise ValueError("unhandled arch: %s" % arch) + raise Exception("unhandled architecture: %s" % arch) with tempfile.TemporaryDirectory(prefix="python-build-") as td: td = pathlib.Path(td) @@ -2051,7 +2055,7 @@ def build_cpython( # We need all the OpenSSL library files in the same directory to appease # install rules. if not static: - openssl_arch = {"amd64": "amd64", "x86": "win32"}[arch] + openssl_arch = {"amd64": "amd64", "x86": "win32"}[arch] # TODO openssl_root = td / "openssl" / openssl_arch openssl_bin_path = openssl_root / "bin" openssl_lib_path = openssl_root / "lib" @@ -2459,9 +2463,11 @@ def main(): elif os.environ.get("Platform") == "arm64": target_triple = "aarch64-pc-windows-msvc" arch = "arm64" - else: + elif os.environ.get("Platform") == "x64": target_triple = "x86_64-pc-windows-msvc" arch = "amd64" + else: + raise Exception("unhandled architecture: %s" % os.environ.get("Platform")) # TODO need better dependency checking. openssl_archive = BUILD / ("openssl-%s-%s.tar" % (target_triple, args.profile))