Skip to content

Commit 488c5cd

Browse files
committed
Add psp and support for new build script syntax
1 parent 113c5d9 commit 488c5cd

File tree

2 files changed

+74
-50
lines changed

2 files changed

+74
-50
lines changed

build.sh

100644100755
Lines changed: 60 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -49,34 +49,31 @@ mkdir -p $logPath
4949

5050
# start pulling sources and compile
5151
if [ ! -d "RetroArch" ]; then
52-
git clone "https://github.com/EmulatorJS/RetroArch.git" "RetroArch" || exit 1
52+
git clone --depth 1 "https://github.com/EmulatorJS/RetroArch.git" "RetroArch" || exit 1
5353
fi
54+
cd RetroArch
55+
git pull
56+
if [ ! -d "EmulatorJS" ]; then
57+
git clone "https://github.com/EmulatorJS/EmulatorJS.git" "EmulatorJS" --depth 1 || exit 1
58+
fi
59+
cd EmulatorJS
60+
git pull
5461

5562
cd "$outPath"
5663
rm -f *.bc
57-
cd "$buildPath"
58-
59-
rm -fr $tempPath
60-
mkdir -p $tempPath/
61-
cd $tempPath
62-
mkdir -p normal/
63-
mkdir -p threads/
64-
mkdir -p legacy/
65-
mkdir -p legacyThreads/
66-
cd $buildPath
6764

6865
compileProject() {
69-
name=$1
70-
downloadLink=$2
71-
branch=$3
72-
makefilePath=$4
73-
makefileName=$5
74-
makefileArg=$6
75-
legacy=$7
76-
thread=$8
66+
name="$1"
67+
repo="$2"
68+
branch="$3"
69+
makefilePath="$4"
70+
makefileName="$5"
71+
makefileArg="$6"
72+
custom="$7"
73+
build_command="$8"
7774

7875
if [ ! -d "$name" ]; then
79-
git clone "$downloadLink" "$name"
76+
git clone "$repo" "$name" --depth 1
8077
cd "$name"
8178
git submodule update --init --recursive
8279
cd ../
@@ -88,31 +85,35 @@ compileProject() {
8885
fi
8986
git pull
9087
git submodule update --recursive
91-
cd "$makefilePath"
9288

93-
build
94-
if [ "$thread" != "no" ]; then
89+
if [[ "$custom" = "true" ]]; then
90+
eval "$build_command"
91+
else
92+
cd "$makefilePath"
93+
94+
build
9595
buildThreads
96-
fi
97-
if [ "$legacy" != "no" ]; then
9896
buildLegacy
99-
if [ "$thread" != "no" ]; then
100-
buildThreadsLegacy
101-
fi
97+
buildThreadsLegacy
10298
fi
10399

104100
cd "$buildPath"
105101
}
106102

107-
if [ ! -d "EmulatorJS" ]; then
108-
git clone "https://github.com/EmulatorJS/EmulatorJS.git" "EmulatorJS" --depth 1 || exit 1
109-
fi
110-
cd EmulatorJS
111-
git pull
112-
cd ../
103+
cd "$buildPath"
113104

114105
compileStartPath="$PWD"
115106
for row in $(jq -r '.[] | @base64' ../cores.json); do
107+
cd "$buildPath"
108+
rm -fr $tempPath
109+
mkdir -p $tempPath/
110+
cd $tempPath
111+
mkdir -p normal/
112+
mkdir -p threads/
113+
mkdir -p legacy/
114+
mkdir -p legacyThreads/
115+
cd "$buildPath"
116+
116117
startTime=`date -u -Is`
117118

118119
cd $compileStartPath
@@ -129,6 +130,9 @@ for row in $(jq -r '.[] | @base64' ../cores.json); do
129130
makescript=`echo $(_jq '.') | jq -r '.makeoptions.makescript'`
130131
arguments=`echo $(_jq '.') | jq -r '.makeoptions.arguments[] | @base64'`
131132
options=`echo $(_jq '.') | jq -r '.options'`
133+
custom=`echo $(_jq '.') | jq -r '.makeoptions.custom'`
134+
build_command=`echo $(_jq '.') | jq -r '.makeoptions.build_command'`
135+
build_retroarch_command=`echo $(_jq '.') | jq -r '.makeoptions.build_retroarch_command'`
132136

133137
argumentstring=""
134138
for rowarg in $(echo "${arguments}"); do
@@ -138,7 +142,7 @@ for row in $(jq -r '.[] | @base64' ../cores.json); do
138142
echo "Starting compile of core $name"
139143
echo "Working dir $PWD"
140144

141-
compileProject "$name" "$repo.git" "$branch" "$buildpath" "$makescript" "$argumentstring" >> "$logPath/$name-compile.log"
145+
compileProject "$name" "$repo.git" "$branch" "$buildpath" "$makescript" "$argumentstring" "$custom" "$build_command" >> "$logPath/$name-compile.log"
142146

143147
# write JSON stanza for this core to disk
144148
echo ${row} | base64 --decode > "./core.json"
@@ -150,23 +154,29 @@ for row in $(jq -r '.[] | @base64' ../cores.json); do
150154
fi
151155

152156
echo "Building wasm's for core $name"
153-
cd "RetroArch"
154-
cd "dist-scripts"
157+
cd RetroArch/dist-scripts
155158

156-
mv core-temp/normal/*.bc ./
157-
emmake ./build-emulatorjs.sh emscripten clean no no >> "$logPath/$name-emake.log"
158-
rm -f *.bc
159+
if [[ "$custom" = "true" ]]; then
160+
eval "$build_retroarch_command" >> "$logPath/$name-emake.log"
161+
else
162+
mv core-temp/normal/*.bc ./
163+
emmake ./build-emulatorjs.sh --clean >> "$logPath/$name-emake.log"
164+
rm -f *.bc
159165

160-
mv core-temp/threads/*.bc ./
161-
emmake ./build-emulatorjs.sh emscripten clean yes no >> "$logPath/$name-emake.log"
162-
rm -f *.bc
166+
mv core-temp/threads/*.bc ./
167+
emmake ./build-emulatorjs.sh --clean --threads >> "$logPath/$name-emake.log"
168+
rm -f *.bc
163169

164-
mv core-temp/legacy/*.bc ./
165-
emmake ./build-emulatorjs.sh emscripten clean no yes >> "$logPath/$name-emake.log"
166-
rm -f *.bc
170+
mv core-temp/legacy/*.bc ./
171+
emmake ./build-emulatorjs.sh --clean --legacy >> "$logPath/$name-emake.log"
172+
rm -f *.bc
173+
174+
mv core-temp/legacyThreads/*.bc ./
175+
emmake ./build-emulatorjs.sh --clean --threads --legacy >> "$logPath/$name-emake.log"
176+
rm -f *.bc
167177

168-
mv core-temp/legacyThreads/*.bc ./
169-
emmake ./build-emulatorjs.sh emscripten clean yes yes >> "$logPath/$name-emake.log"
178+
rm -rf core-temp
179+
fi
170180
rm -f *.bc
171181

172182
echo "Packing core information for $name"
@@ -192,8 +202,8 @@ for row in $(jq -r '.[] | @base64' ../cores.json); do
192202
fi
193203

194204
# clean up to make sure the next build in the json gets the right license and core file
195-
rm ./license.txt
196-
rm ./core.json
205+
rm -f ./license.txt
206+
rm -f ./core.json
197207

198208
# write report to report file
199209
endTime=`date -u -Is`

cores.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,5 +584,19 @@
584584
"options": {},
585585
"license": "COPYING",
586586
"repo": "https://github.com/EmulatorJS/libretro-prboom"
587+
},
588+
{
589+
"name": "ppsspp",
590+
"extensions": [ "iso" ],
591+
"makeoptions": {
592+
"custom": "true",
593+
"build_command": "cd libretro/emscripten/ && bash build_emscripten.sh && cd ../../ && cp -r libretro/emscripten/build/ ../RetroArch/ffmpeg && cp libretro/emscripten/build/*.bc ../RetroArch/dist-scripts/",
594+
"build_retroarch_command": "emmake ./build-emulatorjs.sh --clean --threads"
595+
},
596+
"options": {
597+
"defaultWebGL2": true
598+
},
599+
"license": "LICENSE.TXT",
600+
"repo": "https://github.com/EmulatorJS/ppsspp"
587601
}
588602
]

0 commit comments

Comments
 (0)