-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: ship universal binaries for macOS
This mostly reverts commit 737afb3. We have to build in an OOT directory to make it work. This also requires to bump minimum SDK to 11.1 (for ARM64 mostly but it also fix an issue with strtonum() which is detected as available but really is since 11.0 only). This does not currently work as the host has to be ARM64 (to be able to run both binaries). Otherwise, we would have to cross-compile. See actions/runner-images#2187 for availability.
- Loading branch information
1 parent
870702b
commit 518eb92
Showing
6 changed files
with
99 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Apply lipo recursively to trees. | ||
""" | ||
|
||
import sys | ||
import os | ||
import shutil | ||
import subprocess | ||
|
||
# Parse arguments | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser( | ||
description=sys.modules[__name__].__doc__, | ||
formatter_class=argparse.RawDescriptionHelpFormatter, | ||
) | ||
parser.add_argument("output", help="Output tree") | ||
parser.add_argument("input", help="Input trees", nargs="+") | ||
options = parser.parse_args() | ||
output = options.output | ||
inputs = options.input | ||
|
||
|
||
def ismacho(path): | ||
"""Check if a file is Mach-O""" | ||
fnull = open(os.devnull, "w") | ||
try: | ||
subprocess.check_call(["lipo", "-info", path], stdout=fnull, stderr=fnull) | ||
except subprocess.CalledProcessError: | ||
return False | ||
return True | ||
|
||
|
||
# Copy | ||
for root, dirs, files in os.walk(inputs[0]): | ||
# Create root directory in output | ||
oroot = root[len(inputs[0]) :].lstrip("/") | ||
oroot = os.path.join(output, oroot) | ||
if not os.path.isdir(oroot): | ||
os.makedirs(oroot) | ||
shutil.copystat(root, oroot) | ||
|
||
# Copy files | ||
for f in files: | ||
of = os.path.join(oroot, f) | ||
f = os.path.join(root, f) | ||
if os.path.islink(f): | ||
# Symlink | ||
linkto = os.readlink(f) | ||
os.symlink(linkto, of) | ||
elif ismacho(f): | ||
sff = [os.path.join(r, f[len(inputs[0]) :].lstrip("/")) for r in inputs] | ||
args = ["lipo", "-create", "-output", of] | ||
args.extend(sff) | ||
subprocess.check_call(args) | ||
else: | ||
# Regular file, just copy from the first input directory | ||
shutil.copyfile(f, of) | ||
shutil.copystat(f, of) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters