scripts/build-ios-app.sh
80 lines · 2670 bytes · executable
1#!/bin/sh
2# Builds Orgstar.app for the iOS Simulator in .build/ios-app from the OrgstarMobile product,
3# signed ad hoc. Install with `xcrun simctl install booted .build/ios-app/Orgstar.app`.
4# Usage: scripts/build-ios-app.sh [version]
5set -eu
6
7cd "$(dirname "$0")/.."
8version="${1:-0.1.0}"
9app=".build/ios-app/Orgstar.app"
10products=".build/ios/Build/Products/Debug-iphonesimulator"
11
12xcodebuild -scheme OrgstarMobile -destination 'generic/platform=iOS Simulator' -derivedDataPath .build/ios build -quiet
13
14rm -rf "$app"
15mkdir -p "$app"
16cp "$products/OrgstarMobile" "$app/OrgstarMobile"
17for bundle in "$products"/*.bundle; do
18 [ -e "$bundle" ] && cp -R "$bundle" "$app/"
19done
20
21cat > "$app/Info.plist" <<PLIST
22<?xml version="1.0" encoding="UTF-8"?>
23<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
24<plist version="1.0">
25<dict>
26 <key>CFBundleIdentifier</key>
27 <string>sh.krz.orgstar</string>
28 <key>CFBundleName</key>
29 <string>Orgstar</string>
30 <key>CFBundleDisplayName</key>
31 <string>Orgstar</string>
32 <key>CFBundleExecutable</key>
33 <string>OrgstarMobile</string>
34 <key>CFBundlePackageType</key>
35 <string>APPL</string>
36 <key>CFBundleShortVersionString</key>
37 <string>${version}</string>
38 <key>CFBundleVersion</key>
39 <string>${version}</string>
40 <key>CFBundleSupportedPlatforms</key>
41 <array><string>iPhoneSimulator</string></array>
42 <key>MinimumOSVersion</key>
43 <string>26.0</string>
44 <key>UIDeviceFamily</key>
45 <array><integer>1</integer><integer>2</integer></array>
46 <key>UILaunchScreen</key>
47 <dict/>
48 <key>UIApplicationSceneManifest</key>
49 <dict>
50 <key>UIApplicationSupportsMultipleScenes</key>
51 <true/>
52 </dict>
53 <key>UISupportedInterfaceOrientations</key>
54 <array>
55 <string>UIInterfaceOrientationPortrait</string>
56 <string>UIInterfaceOrientationLandscapeLeft</string>
57 <string>UIInterfaceOrientationLandscapeRight</string>
58 </array>
59 <key>UISupportedInterfaceOrientations~ipad</key>
60 <array>
61 <string>UIInterfaceOrientationPortrait</string>
62 <string>UIInterfaceOrientationPortraitUpsideDown</string>
63 <string>UIInterfaceOrientationLandscapeLeft</string>
64 <string>UIInterfaceOrientationLandscapeRight</string>
65 </array>
66 <key>CFBundleURLTypes</key>
67 <array>
68 <dict>
69 <key>CFBundleURLName</key>
70 <string>org-protocol</string>
71 <key>CFBundleURLSchemes</key>
72 <array><string>org-protocol</string></array>
73 </dict>
74 </array>
75</dict>
76</plist>
77PLIST
78
79codesign --force --sign - "$app"
80echo "$app"