Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/b-ios.sh
4768 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
cp ../ext/vulkan/iOS/Frameworks/libMoltenVK.dylib PPSSPP.app/Frameworks
54
ln -s ./ Payload
55
#ldid -w -S -IlibMoltenVK -K../../certificate.p12 -Upassword PPSSPP.app/Frameworks/libMoltenVK.dylib
56
if [ -e PPSSPP.app/Frameworks/libMoltenVK.dylib ]; then
57
echo "Signing PPSSPP.app/Frameworks/libMoltenVK.dylib ..."
58
ldid -S -IlibMoltenVK PPSSPP.app/Frameworks/libMoltenVK.dylib
59
fi
60
61
echo '<?xml version="1.0" encoding="UTF-8"?>
62
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
63
<plist version="1.0">
64
<dict>
65
<key>platform-application</key>
66
<true/>
67
<key>com.apple.private.security.storage.AppDataContainers</key>
68
<true/>
69
<key>com.apple.private.security.storage.MobileDocuments</key>
70
<true/>
71
<key>com.apple.private.security.container-required</key>
72
<false/>
73
<key>com.apple.private.security.no-container</key>
74
<true/>
75
<key>com.apple.private.security.no-sandbox</key>
76
<true/>
77
<key>com.apple.developer.kernel.extended-virtual-addressing</key>
78
<true/>
79
<key>com.apple.developer.kernel.increased-memory-limit</key>
80
<true/>
81
<key>com.apple.security.iokit-user-client-class</key>
82
<array>
83
<string>AGXDeviceUserClient</string>
84
<string>IOMobileFramebufferUserClient</string>
85
<string>IOSurfaceRootUserClient</string>
86
</array>
87
<key>get-task-allow</key>
88
<true/>
89
</dict>
90
</plist>' > ent.xml
91
#ldid -S ent.xml Payload/PPSSPP.app/PPSSPP
92
#ldid -w -Sent.xml -K../../certificate.p12 -Upassword PPSSPP.app
93
if [ -e PPSSPP.app/PPSSPP ]; then
94
echo "Signing PPSSPP.app/PPSSPP ..."
95
ldid -Sent.xml PPSSPP.app/PPSSPP
96
fi
97
version_number=`echo "$(git describe --always --match="v*" | sed -e 's@-\([^-]*\)-\([^-]*\)$@-\1-\2@;s@^v@@;s@%@~@g')"`
98
echo ${version_number} > PPSSPP.app/Version.txt
99
sudo -S chown -R 1004:3 Payload
100
101
# Put the xcarchive file in the artifact too, just to examine the contents
102
#cp -a build/PPSSPP.xcarchive ../build/
103
104
echo "Making ipa ..."
105
zip -r9 ../build/PPSSPP-iOS-v${version_number}.ipa Payload/PPSSPP.app
106
echo "IPA DONE :)"
107
108
echo "Making deb ..."
109
package_name="org.ppsspp.ppsspp-dev-latest_v${version_number}_iphoneos-arm"
110
mkdir $package_name
111
mkdir ${package_name}/DEBIAN
112
# TODO: Generate Preferences folder and it's contents too. Example of the contents at https://github.com/Halo-Michael/ppsspp-builder/tree/master/Preferences
113
114
echo "Package: org.ppsspp.ppsspp-dev-latest
115
Name: PPSSPP (Dev-Latest)
116
Architecture: iphoneos-arm
117
Description: A PSP emulator
118
Icon: file:///Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
119
Homepage: https://build.ppsspp.org/
120
Conflicts: com.myrepospace.theavenger.PPSSPP, net.angelxwind.ppsspp, net.angelxwind.ppsspp-testing, org.ppsspp.ppsspp, org.ppsspp.ppsspp-dev-working
121
Provides: com.myrepospace.theavenger.PPSSPP, net.angelxwind.ppsspp, net.angelxwind.ppsspp-testing
122
Replaces: com.myrepospace.theavenger.PPSSPP, net.angelxwind.ppsspp, net.angelxwind.ppsspp-testing
123
Depiction: https://cydia.ppsspp.org/?page/org.ppsspp.ppsspp-dev-latest
124
Maintainer: Henrik Rydgård
125
Author: Henrik Rydgårdq
126
Section: Games
127
Version: 0v${version_number}
128
" > ${package_name}/DEBIAN/control
129
chmod 0755 ${package_name}/DEBIAN/control
130
mkdir ${package_name}/Library
131
mkdir ${package_name}/Library/PPSSPPRepoIcons
132
# Seems to be 120x120 pixels (ie. 60x60@2x ?)
133
if [ -e ../ios/org.ppsspp.ppsspp.png ]; then
134
cp ../ios/org.ppsspp.ppsspp.png ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
135
chmod 0755 ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
136
# Let's use [email protected] as alternative
137
elif [ -e 'PPSSPP.app/[email protected]' ]; then
138
cp 'PPSSPP.app/[email protected]' ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
139
chmod 0755 ${package_name}/Library/PPSSPPRepoIcons/org.ppsspp.ppsspp-dev-latest.png
140
fi
141
mkdir ${package_name}/Library/PreferenceLoader
142
if [ -e ../ios/Preferences ]; then
143
cp -a ../ios/Preferences ${package_name}/Library/PreferenceLoader/
144
fi
145
mkdir ${package_name}/Applications
146
cp -a PPSSPP.app ${package_name}/Applications/PPSSPP.app
147
sudo -S chown -R 1004:3 ${package_name}
148
sudo -S dpkg -b ${package_name} ../build/${package_name}.deb
149
sudo -S rm -r ${package_name}
150
echo "User = $USER"
151
sudo -S chown $USER ../build/${package_name}.deb
152
echo "Done, you should get the ipa and deb now :)"
153
154