|
40 | 40 | +] |
41 | 41 | --- /dev/null |
42 | 42 | +++ b/Apple/__main__.py |
43 | | -@@ -0,0 +1,1111 @@ |
| 43 | +@@ -0,0 +1,1108 @@ |
44 | 44 | +#!/usr/bin/env python3 |
45 | 45 | +########################################################################## |
46 | 46 | +# Apple XCframework build script |
|
472 | 472 | + relpath(PYTHON_DIR / "configure"), |
473 | 473 | + f"--host={host}", |
474 | 474 | + f"--build={sysconfig.get_config_var('BUILD_GNU_TYPE')}", |
475 | | -+ f"--with-build-python={build_python_path()}", |
476 | | -+ "--with-system-libmpdec", |
477 | 475 | + "--enable-framework", |
| 476 | ++ "PYTHON_FOR_REGEN=../build/python.exe", |
478 | 477 | + # Dependent libraries. |
479 | 478 | + f"--with-openssl={prefix_dir}", |
480 | | -+ f"LIBLZMA_CFLAGS=-I{prefix_dir}/include", |
481 | | -+ f"LIBLZMA_LIBS=-L{prefix_dir}/lib -llzma", |
| 479 | ++ f"CFLAGS=-I{prefix_dir}/include", |
| 480 | ++ f"LDFLAGS=-L{prefix_dir}/lib", |
482 | 481 | + f"LIBFFI_INCLUDEDIR={prefix_dir}/include", |
483 | 482 | + f"LIBFFI_LIBDIR={prefix_dir}/lib", |
484 | 483 | + "LIBFFI_LIB=ffi", |
485 | | -+ f"LIBMPDEC_CFLAGS=-I{prefix_dir}/include", |
486 | | -+ f"LIBMPDEC_LDFLAGS=-L{prefix_dir}/lib -lmpdec", |
487 | 484 | + ] |
488 | 485 | + |
489 | 486 | + if context.args: |
|
504 | 501 | + cwd(subdir(host)), |
505 | 502 | + ): |
506 | 503 | + run(["make"], host=host) |
507 | | -+ run(["make", "install"], host=host) |
| 504 | ++ run(["make", "install"], host=host, env={"DESTDIR": f"{Path.cwd()}/"}) |
508 | 505 | + |
509 | 506 | + |
510 | 507 | +def framework_path(host_triple: str, multiarch: str) -> Path: |
|
2241 | 2238 | +@end |
2242 | 2239 | --- /dev/null |
2243 | 2240 | +++ b/Apple/testbed/__main__.py |
2244 | | -@@ -0,0 +1,456 @@ |
| 2241 | +@@ -0,0 +1,472 @@ |
2245 | 2242 | +import argparse |
2246 | 2243 | +import json |
2247 | 2244 | +import os |
|
2250 | 2247 | +import shutil |
2251 | 2248 | +import subprocess |
2252 | 2249 | +import sys |
| 2250 | ++from itertools import chain |
2253 | 2251 | +from pathlib import Path |
2254 | 2252 | + |
2255 | 2253 | +TEST_SLICES = { |
|
2325 | 2323 | + return simulator |
2326 | 2324 | + |
2327 | 2325 | + |
| 2326 | ++# A backport of Path.relative_to(*, walk_up=True) |
| 2327 | ++def relative_to(target, other): |
| 2328 | ++ for step, path in enumerate(chain([other], other.parents)): |
| 2329 | ++ if path == target or path in target.parents: |
| 2330 | ++ break |
| 2331 | ++ else: |
| 2332 | ++ raise ValueError( |
| 2333 | ++ f"{str(target)!r} and {str(other)!r} have different anchors" |
| 2334 | ++ ) |
| 2335 | ++ parts = [".."] * step + list(target.parts[len(path.parts) :]) |
| 2336 | ++ return Path("/".join(parts)) |
| 2337 | ++ |
| 2338 | ++ |
2328 | 2339 | +def xcode_test(location: Path, platform: str, simulator: str, verbose: bool): |
2329 | 2340 | + # Build and run the test suite on the named simulator. |
2330 | 2341 | + args = [ |
|
2443 | 2454 | + if framework.suffix == ".xcframework": |
2444 | 2455 | + print(" Installing XCFramework...", end="") |
2445 | 2456 | + xc_framework_path.symlink_to( |
2446 | | -+ framework.relative_to(xc_framework_path.parent, walk_up=True) |
| 2457 | ++ relative_to(framework, xc_framework_path.parent) |
2447 | 2458 | + ) |
2448 | 2459 | + print(" done") |
2449 | 2460 | + else: |
|
2457 | 2468 | + else: |
2458 | 2469 | + test_framework_path.unlink(missing_ok=True) |
2459 | 2470 | + test_framework_path.symlink_to( |
2460 | | -+ framework.relative_to(test_framework_path.parent, walk_up=True) |
| 2471 | ++ relative_to(framework, test_framework_path.parent) |
2461 | 2472 | + ) |
2462 | 2473 | + print(" done") |
2463 | 2474 | + else: |
|
2475 | 2486 | + ).resolve() |
2476 | 2487 | + xc_framework_path.unlink() |
2477 | 2488 | + xc_framework_path.symlink_to( |
2478 | | -+ resolved_xc_framework_path.relative_to( |
2479 | | -+ xc_framework_path.parent, walk_up=True |
| 2489 | ++ relative_to( |
| 2490 | ++ resolved_xc_framework_path, |
| 2491 | ++ xc_framework_path.parent, |
2480 | 2492 | + ) |
2481 | 2493 | + ) |
2482 | 2494 | + print(" done") |
|
2492 | 2504 | + ).resolve() |
2493 | 2505 | + test_framework_path.unlink() |
2494 | 2506 | + test_framework_path.symlink_to( |
2495 | | -+ orig_test_framework_path.relative_to( |
2496 | | -+ test_framework_path.parent, walk_up=True |
| 2507 | ++ relative_to( |
| 2508 | ++ orig_test_framework_path, |
| 2509 | ++ test_framework_path.parent, |
2497 | 2510 | + ) |
2498 | 2511 | + ) |
2499 | 2512 | + print(" done") |
|
0 commit comments