From 0851693cbe98cf4602293e384bc274fd914dead9 Mon Sep 17 00:00:00 2001 From: Skyler Saleh Date: Sat, 17 Apr 2021 15:50:41 -0700 Subject: [PATCH] Apple M1: More robust build for universal binaries - Fixed a typo in the Readme.md - Made the recursiveMergeBinaries function handle divergent binary file trees better. --- BuildMacOSUniversalBinary.py | 9 ++++++--- Readme.md | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/BuildMacOSUniversalBinary.py b/BuildMacOSUniversalBinary.py index 4e149e26f7..d9f19dea8c 100755 --- a/BuildMacOSUniversalBinary.py +++ b/BuildMacOSUniversalBinary.py @@ -175,11 +175,14 @@ def recursiveMergeBinaries(src0, src1, dst): # Loop over files in src1 and copy missing things over to dst for newpath1 in glob.glob(src1+"/*"): - filename = os.path.basename(newpath0) + filename = os.path.basename(newpath1) newpath0 = os.path.join(src0, filename) new_dst_path = os.path.join(dst, filename) - if not os.path.exists(newpath0) and not os.path.islink(newpath1): - shutil.copytree(newpath1, new_dst_path) + if (not os.path.exists(newpath0)) and (not os.path.islink(newpath1)): + if os.path.isdir(newpath1): + shutil.copytree(newpath1, new_dst_path) + else: + shutil.copy(newpath1, new_dst_path) # Fix up symlinks for path0 for newpath0 in glob.glob(src0+"/*"): diff --git a/Readme.md b/Readme.md index 041bde5be9..1b9cd7b872 100644 --- a/Readme.md +++ b/Readme.md @@ -69,7 +69,7 @@ application bundle using the following steps: 1. `mkdir build` 2. `cd build` -3. `python ../BuildMacOSUniveralBinary.py` +3. `python ../BuildMacOSUniversalBinary.py` 4. Universal binaries will be available in the `universal` folder Doing this requires installation of library dependencies for both x64 and ARM (or universal library