Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/b-ios.sh
3185 views
1
#!/bin/sh
2
3
set -ex
4
5
# Assuming we're at the ppsspp (repo's root) directory
6
mkdir -p build # For the final IPA & DEB file
7
#rm -rf build-ios # Should we started from scratch instead of continuing from cache?
8
mkdir -p build-ios
9
cd build-ios
10
rm -rf PPSSPP.app # There seems to be an existing symlink, may be from ccache? We don't want to include old stuff that might be removed to be included in the final IPA file.
11
# It seems xcodebuild is looking for "git-version.cpp" file inside "build-ios" directory instead of at repo's root dir.
12
echo "const char *PPSSPP_GIT_VERSION = \"$(git describe --always)\";" > git-version.cpp
13
echo "#define PPSSPP_GIT_VERSION_NO_UPDATE 1" >> git-version.cpp
14
# Generate exportOptions.plist for xcodebuild
15
echo '<?xml version="1.0" encoding="UTF-8"?>
16
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
17
<plist version="1.0">
18
<dict>
19
<key>method</key>
20
<string>development</string>
21
<key>signingStyle</key>
22
<string>manual</string>
23
</dict>
24
</plist>' > exportOptions.plist
25
# TODO: Generate a self-signed certificate (but probably not a good idea to generate a different cert all the time). Example at https://stackoverflow.com/questions/27474751/how-can-i-codesign-an-app-without-being-in-the-mac-developer-program/53562496#53562496
26
27
# Should we run this script first before building? (Seems to only generate icons for Gold version)
28
#brew install pillow #python3 -m pip install --upgrade --break-system-packages --user Pillow
29
#pushd ../ios/assets.xcassets/AppIcon.appiconset
30
#python3 ../../generate_icons.py
31
#ls -la
32
#popd
33
34
# There are 2 ways to build PPSSPP for iOS, using make or xcodebuild
35
# Generate xcodeproject (only needed when building using xcode, similar to ./b.sh --ios-xcode)
36
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/ios.cmake -GXcode ..
37
# Build PPSSPP using xcode
38
#xcodebuild clean build -project PPSSPP.xcodeproj CODE_SIGNING_ALLOWED=NO -sdk iphoneos -configuration Release
39
xcodebuild -project PPSSPP.xcodeproj -scheme PPSSPP -sdk iphoneos -configuration Release clean build archive -archivePath ./build/PPSSPP.xcarchive CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO #CODE_SIGN_IDENTITY="iPhone Distribution: Your NAME / Company (TeamID)" #PROVISIONING_PROFILE="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
40
# Export IPA file from xcarchive (probably only works with signed build)
41
#xcodebuild -exportArchive -archivePath ./build/PPSSPP.xcarchive -exportPath ./build -exportOptionsPlist exportOptions.plist
42
# This folder only exist when building with xcodebuild
43
if [ -e Release-iphoneos ]; then
44
# It seems there is an existing (from ccache?) PPSSPP.app symlink, so we copy & overwrites the content instead of the symlink, to the same location with what make use.
45
mkdir -p PPSSPP.app
46
cp -Rfa Release-iphoneos/PPSSPP.app/. PPSSPP.app/
47
fi
48
49
# Build PPSSPP using Makefile (Might have missing stuff like Icons, similar to ./b.sh --ios)
50
#cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/ios.cmake ..
51
#make -j4
52
53
# When building with Makefile, we're missing these icon image files (may be need to run generate_icons.py first?). Let's use whatever we have (wrong size tho)
54
#cp -a assets/icon_regular_72.png Payload/PPSSPP.app/[email protected]
55
#cp -a assets/icon_regular_72.png Payload/PPSSPP.app/AppIcon76x76@2x~ipad.png
56
57
cp ../ext/vulkan/iOS/Frameworks/libMoltenVK.dylib PPSSPP.app/Frameworks
58
ln -s ./ Payload
59
#ldid -w -S -IlibMoltenVK -K../../certificate.p12 -Upassword PPSSPP.app/Frameworks/libMoltenVK.dylib
60
if [ -e PPSSPP.app/Frameworks/libMoltenVK.dylib ]; then
61
echo "Signing PPSSPP.app/Frameworks/libMoltenVK.dylib ..."
62
ldid -S -IlibMoltenVK PPSSPP.app/Frameworks/libMoltenVK.dylib
63
fi
64
65
echo '<?xml version="1.0" encoding="UTF-8"?>
66
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
67
<plist version="1.0">
68
<dict>
69
<key>platform-application</key>
70
<true/>
71
<key>com.apple.private.security.storage.AppDataContainers</key>
72
<true/>
73
<key>com.apple.private.security.storage.MobileDocuments</key>
74
<true/>
75
<key>com.apple.private.security.container-required</key>
76
<false/>
77
<key>com.apple.private.security.no-container</key>
78
<true/>
79
<key>com.apple.private.security.no-sandbox</key>
80
<true/>
81
<key>com.apple.developer.kernel.extended-virtual-addressing</key>
82
<true/>
83
<key>com.apple.developer.kernel.increased-memory-limit</key>
84
<true/>
85
<key>com.apple.security.iokit-user-client-class</key>
86
<array>
87
<string>AGXDeviceUserClient</string>
88
<string>IOMobileFramebufferUserClient</string>
89
<string>IOSurfaceRootUserClient</string>
90
</array>
91
<key>get-task-allow</key>
92
<true/>
93
</dict>
94
</plist>' > ent.xml
95
#ldid -S ent.xml Payload/PPSSPP.app/PPSSPP
96
#ldid -w -Sent.xml -K../../certificate.p12 -Upassword PPSSPP.app
97
if [ -e PPSSPP.app/PPSSPP ]; then
98
echo "Signing PPSSPP.app/PPSSPP ..."
99
ldid -Sent.xml PPSSPP.app/PPSSPP
100
fi
101
version_number=`echo "$(git describe --always --match="v*" | sed -e 's@-\([^-]*\)-\([^-]*\)$@-\1-\2@;s@^v@@;s@%@~@g')"`
102
echo ${version_number} > PPSSPP.app/Version.txt
103
sudo -S chown -R 1004:3 Payload
104
105
# Put the xcarchive file in the artifact too, just to examine the contents
106
#cp -a build/PPSSPP.xcarchive ../build/
107
108
echo "Making ipa ..."
109
zip -r9 ../build/PPSSPP-iOS-v${version_number}.ipa Payload/PPSSPP.app
110
echo "IPA DONE :)"
111
112
echo "Making deb ..."
113
package_name="org.ppsspp.ppsspp-dev-latest_v${version_number}_iphoneos-arm"
114
mkdir $package_name
115
mkdir ${package_name}/DEBIAN
116
# TODO: Generate Preferences folder and it's contents too. Example of the contents at https://github.com/Halo-Michael/ppsspp-builder/tree/master/Preferences
117
118
echo "Package: org.ppsspp.ppsspp-dev-latest
119
Name: PPSSPP (Dev-Latest)
120
Architecture: iphoneos-arm
121
Description: A PSP emulator
122
Icon: file:///Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
123
Homepage: https://build.ppsspp.org/
124
Conflicts: com.myrepospace.theavenger.PPSSPP, net.angelxwind.ppsspp, net.angelxwind.ppsspp-testing, org.ppsspp.ppsspp, org.ppsspp.ppsspp-dev-working
125
Provides: com.myrepospace.theavenger.PPSSPP, net.angelxwind.ppsspp, net.angelxwind.ppsspp-testing
126
Replaces: com.myrepospace.theavenger.PPSSPP, net.angelxwind.ppsspp, net.angelxwind.ppsspp-testing
127
Depiction: https://cydia.ppsspp.org/?page/org.ppsspp.ppsspp-dev-latest
128
Maintainer: Henrik Rydgård
129
Author: Henrik Rydgårdq
130
Section: Games
131
Version: 0v${version_number}
132
" > ${package_name}/DEBIAN/control
133
chmod 0755 ${package_name}/DEBIAN/control
134
mkdir ${package_name}/Library
135
mkdir ${package_name}/Library/PPSSPPRepoIcons
136
# Seems to be 120x120 pixels (ie. 60x60@2x ?)
137
if [ -e ../ios/org.ppsspp.ppsspp.png ]; then
138
cp ../ios/org.ppsspp.ppsspp.png ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
139
chmod 0755 ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
140
# Let's use [email protected] as alternative
141
elif [ -e 'PPSSPP.app/[email protected]' ]; then
142
cp 'PPSSPP.app/[email protected]' ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
143
chmod 0755 ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
144
fi
145
mkdir ${package_name}/Library/PreferenceLoader
146
if [ -e ../ios/Preferences ]; then
147
cp -a ../ios/Preferences ${package_name}/Library/PreferenceLoader/
148
fi
149
mkdir ${package_name}/Applications
150
cp -a PPSSPP.app ${package_name}/Applications/PPSSPP.app
151
sudo -S chown -R 1004:3 ${package_name}
152
sudo -S dpkg -b ${package_name} ../build/${package_name}.deb
153
sudo -S rm -r ${package_name}
154
echo "User = $USER"
155
sudo -S chown $USER ../build/${package_name}.deb
156
echo "Done, you should get the ipa and deb now :)"
157
158