Skip to content

Commit

Permalink
Merge pull request #27 from yeatse/feature/macos-fix
Browse files Browse the repository at this point in the history
Fix AppStore validation error on macOS
  • Loading branch information
yeatse authored Aug 4, 2024
2 parents f5914e7 + 22a9e94 commit 6b959aa
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
IPHONEOS_DEPLOYMENT_TARGET: 12.0
MACOSX_DEPLOYMENT_TARGET: 10.13
run: |
git apply $GITHUB_WORKSPACE/opencv-spm/opencv.patch
git apply $GITHUB_WORKSPACE/opencv-spm/patches/*.patch
pip3 install pathlib
python3 platforms/apple/build_xcframework.py \
--iphoneos_archs=arm64 \
Expand Down
41 changes: 4 additions & 37 deletions opencv.patch → patches/fix-xcode14-module-header.patch
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
diff --git a/platforms/ios/Info.plist.in b/platforms/ios/Info.plist.in
index a166934bdf..76ab8fda4f 100644
--- a/platforms/ios/Info.plist.in
+++ b/platforms/ios/Info.plist.in
@@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>CFBundleExecutable</key>
+ <string>opencv2</string>
+ <key>MinimumOSVersion</key>
+ <string>100.0</string>
<key>CFBundleName</key>
<string>${OPENCV_APPLE_BUNDLE_NAME}</string>
<key>CFBundleIdentifier</key>
diff --git a/platforms/ios/build_framework.py b/platforms/ios/build_framework.py
index 1904a67ae7..04b5408242 100755
--- a/platforms/ios/build_framework.py
+++ b/platforms/ios/build_framework.py
@@ -410,7 +410,7 @@ class Builder:
shutil.rmtree(framework_dir)
os.makedirs(framework_dir)

- if self.dynamic:
+ if self.dynamic or builddirs[0].find("iphone") != -1 or builddirs[0].find("vision") != -1:
dstdir = framework_dir
else:
dstdir = os.path.join(framework_dir, "Versions", "A")
diff --git forkSrcPrefix/platforms/ios/build_framework.py forkDstPrefix/platforms/ios/build_framework.py
index 1904a67ae7c9709f8bced3fb3600c1b8662c306d..b59eef1e03d8ef6b7920df7159b9fd0e0aafbdee 100755
--- forkSrcPrefix/platforms/ios/build_framework.py
+++ forkDstPrefix/platforms/ios/build_framework.py
@@ -429,6 +429,12 @@ class Builder:
file.write(body)
if self.build_objc_wrapper:
Expand All @@ -39,15 +15,6 @@ index 1904a67ae7..04b5408242 100755
platform_name_map = {
"arm": "armv7-apple-ios",
"arm64": "arm64-apple-ios",
@@ -459,7 +465,7 @@ class Builder:
execute(lipocmd)

# dynamic framework has different structure, just copy the Plist directly
- if self.dynamic:
+ if self.dynamic or builddirs[0].find("iphone") != -1 or builddirs[0].find("vision") != -1:
resdir = dstdir
shutil.copyfile(self.getInfoPlist(builddirs), os.path.join(resdir, "Info.plist"))
else:
@@ -484,6 +490,24 @@ class Builder:
shutil.copyfile(os.path.join(CURRENT_FILE_DIR, "PrivacyInfo.xcprivacy"),
os.path.join(resdir, "PrivacyInfo.xcprivacy"))
Expand Down
37 changes: 37 additions & 0 deletions patches/fix-xcode15-ios-validation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git forkSrcPrefix/platforms/ios/Info.plist.in forkDstPrefix/platforms/ios/Info.plist.in
index a166934bdf020175cbe9a8eb88787c306e6b4592..76ab8fda4f6991b073d38c44a87bfa5d7901514c 100644
--- forkSrcPrefix/platforms/ios/Info.plist.in
+++ forkDstPrefix/platforms/ios/Info.plist.in
@@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>CFBundleExecutable</key>
+ <string>opencv2</string>
+ <key>MinimumOSVersion</key>
+ <string>100.0</string>
<key>CFBundleName</key>
<string>${OPENCV_APPLE_BUNDLE_NAME}</string>
<key>CFBundleIdentifier</key>
diff --git forkSrcPrefix/platforms/ios/build_framework.py forkDstPrefix/platforms/ios/build_framework.py
index b59eef1e03d8ef6b7920df7159b9fd0e0aafbdee..04b5408242e4f6642bfe1aaca3c6b964564c4a7d 100755
--- forkSrcPrefix/platforms/ios/build_framework.py
+++ forkDstPrefix/platforms/ios/build_framework.py
@@ -410,7 +410,7 @@ class Builder:
shutil.rmtree(framework_dir)
os.makedirs(framework_dir)

- if self.dynamic:
+ if self.dynamic or builddirs[0].find("iphone") != -1 or builddirs[0].find("vision") != -1:
dstdir = framework_dir
else:
dstdir = os.path.join(framework_dir, "Versions", "A")
@@ -465,7 +465,7 @@ class Builder:
execute(lipocmd)

# dynamic framework has different structure, just copy the Plist directly
- if self.dynamic:
+ if self.dynamic or builddirs[0].find("iphone") != -1 or builddirs[0].find("vision") != -1:
resdir = dstdir
shutil.copyfile(self.getInfoPlist(builddirs), os.path.join(resdir, "Info.plist"))
else:
13 changes: 13 additions & 0 deletions patches/fix-xcode15-macos-validation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git forkSrcPrefix/platforms/osx/Info.plist.in forkDstPrefix/platforms/osx/Info.plist.in
index a166934bdf020175cbe9a8eb88787c306e6b4592..fa70c2934907f8ab09db7046bce9f9debc59d739 100644
--- forkSrcPrefix/platforms/osx/Info.plist.in
+++ forkDstPrefix/platforms/osx/Info.plist.in
@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>CFBundleExecutable</key>
+ <string>opencv2</string>
<key>CFBundleName</key>
<string>${OPENCV_APPLE_BUNDLE_NAME}</string>
<key>CFBundleIdentifier</key>

0 comments on commit 6b959aa

Please sign in to comment.