From 22a9e94a8203cc7eec573f11572080cc8b8d596e Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Sun, 4 Aug 2024 13:56:45 +0800 Subject: [PATCH] fix appstore validation error on macOS --- .github/workflows/build.yml | 2 +- .../fix-xcode14-module-header.patch | 41 ++----------------- patches/fix-xcode15-ios-validation.patch | 37 +++++++++++++++++ patches/fix-xcode15-macos-validation.patch | 13 ++++++ 4 files changed, 55 insertions(+), 38 deletions(-) rename opencv.patch => patches/fix-xcode14-module-header.patch (53%) create mode 100644 patches/fix-xcode15-ios-validation.patch create mode 100644 patches/fix-xcode15-macos-validation.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e836325..c13dd2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 \ diff --git a/opencv.patch b/patches/fix-xcode14-module-header.patch similarity index 53% rename from opencv.patch rename to patches/fix-xcode14-module-header.patch index 7bc2697..a104851 100644 --- a/opencv.patch +++ b/patches/fix-xcode14-module-header.patch @@ -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 @@ - - - -+ CFBundleExecutable -+ opencv2 -+ MinimumOSVersion -+ 100.0 - CFBundleName - ${OPENCV_APPLE_BUNDLE_NAME} - CFBundleIdentifier -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: @@ -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")) diff --git a/patches/fix-xcode15-ios-validation.patch b/patches/fix-xcode15-ios-validation.patch new file mode 100644 index 0000000..cdbb107 --- /dev/null +++ b/patches/fix-xcode15-ios-validation.patch @@ -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 @@ + + + ++ CFBundleExecutable ++ opencv2 ++ MinimumOSVersion ++ 100.0 + CFBundleName + ${OPENCV_APPLE_BUNDLE_NAME} + CFBundleIdentifier +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: diff --git a/patches/fix-xcode15-macos-validation.patch b/patches/fix-xcode15-macos-validation.patch new file mode 100644 index 0000000..df39908 --- /dev/null +++ b/patches/fix-xcode15-macos-validation.patch @@ -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 @@ + + + ++ CFBundleExecutable ++ opencv2 + CFBundleName + ${OPENCV_APPLE_BUNDLE_NAME} + CFBundleIdentifier