Skip to content

Commit 76d6c5f

Browse files
committed
Use 7z to create more efficient ZIP archives
For a full set of Godot 4.1.1 editor + export template builds, this saves 28 MB without affecting decompression times or archive compatibility. Any ZIP decompression software can decompress these 7z-created ZIP archives; they use the standard DEFLATE algorithm. Creating archives is expected to be about twice as slow as `zip -9`, but given the bandwidth and download time savings, it's probably worth it.
1 parent 2398d61 commit 76d6c5f

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

build-release.sh

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export basedir=$(pwd)
88
# For signing keystore and password.
99
source ./config.sh
1010

11+
export ZIP="7z a -bso0 -bd -mx9"
12+
1113
can_sign_windows=0
1214
if [ ! -z "${SIGN_KEYSTORE}" ] && [ ! -z "${SIGN_PASSWORD}" ] && [[ $(type -P "osslsigncode") ]]; then
1315
can_sign_windows=1
@@ -47,7 +49,7 @@ sign_macos() {
4749
codesign --force --timestamp \
4850
--options=runtime --entitlements editor.entitlements \
4951
-s ${OSX_KEY_ID} -v ${_appname} && \
50-
zip -r ${_binname}_signed.zip ${_appname}"
52+
$ZIP -r ${_binname}_signed.zip ${_appname}"
5153

5254
_request_uuid=$(ssh "${OSX_HOST}" "xcrun notarytool submit ${_macos_tmpdir}/${_binname}_signed.zip --team-id \"${APPLE_TEAM}\" --apple-id \"${APPLE_ID}\" --password \"${APPLE_ID_PASSWORD}\" --no-progress --output-format json")
5355
_request_uuid=$(echo ${_request_uuid} | sed -e 's/.*"id":"\([^"]*\)".*/\1/')
@@ -61,7 +63,7 @@ sign_macos() {
6163
ssh "${OSX_HOST}" "
6264
cd ${_macos_tmpdir} && \
6365
xcrun stapler staple ${_appname} && \
64-
zip -r ${_binname}_stapled.zip ${_appname}"
66+
$ZIP -r ${_binname}_stapled.zip ${_appname}"
6567
scp "${OSX_HOST}:${_macos_tmpdir}/${_binname}_stapled.zip" "${_reldir}/${_binname}.zip"
6668
ssh "${OSX_HOST}" "rm -rf ${_macos_tmpdir}"
6769
fi
@@ -82,7 +84,7 @@ sign_macos_template() {
8284
codesign --force -s - \
8385
--options=linker-signed \
8486
-v macos_template.app/Contents/MacOS/* && \
85-
zip -r macos_signed.zip macos_template.app"
87+
$ZIP -r macos_signed.zip macos_template.app"
8688

8789
scp "${OSX_HOST}:${_macos_tmpdir}/macos_signed.zip" "${_reldir}/macos.zip"
8890
ssh "${OSX_HOST}" "rm -rf ${_macos_tmpdir}"
@@ -240,22 +242,22 @@ if [ "${build_classical}" == "1" ]; then
240242
# Editor
241243
binname="${godot_basename}_linux.x86_64"
242244
cp out/linux/x86_64/tools/godot.linuxbsd.editor.x86_64 ${binname}
243-
zip -q -9 "${reldir}/${binname}.zip" ${binname}
245+
$ZIP "${reldir}/${binname}.zip" ${binname}
244246
rm ${binname}
245247

246248
binname="${godot_basename}_linux.x86_32"
247249
cp out/linux/x86_32/tools/godot.linuxbsd.editor.x86_32 ${binname}
248-
zip -q -9 "${reldir}/${binname}.zip" ${binname}
250+
$ZIP "${reldir}/${binname}.zip" ${binname}
249251
rm ${binname}
250252

251253
binname="${godot_basename}_linux.arm64"
252254
cp out/linux/arm64/tools/godot.linuxbsd.editor.arm64 ${binname}
253-
zip -q -9 "${reldir}/${binname}.zip" ${binname}
255+
$ZIP "${reldir}/${binname}.zip" ${binname}
254256
rm ${binname}
255257

256258
binname="${godot_basename}_linux.arm32"
257259
cp out/linux/arm32/tools/godot.linuxbsd.editor.arm32 ${binname}
258-
zip -q -9 "${reldir}/${binname}.zip" ${binname}
260+
$ZIP "${reldir}/${binname}.zip" ${binname}
259261
rm ${binname}
260262

261263
# Templates
@@ -279,7 +281,7 @@ if [ "${build_classical}" == "1" ]; then
279281
cp out/windows/x86_64/tools/godot.windows.editor.x86_64.console.exe ${wrpname}
280282
strip ${wrpname}
281283
sign_windows ${wrpname}
282-
zip -q -9 "${reldir}/${binname}.zip" ${binname} ${wrpname}
284+
$ZIP "${reldir}/${binname}.zip" ${binname} ${wrpname}
283285
rm ${binname} ${wrpname}
284286

285287
binname="${godot_basename}_win32.exe"
@@ -290,7 +292,7 @@ if [ "${build_classical}" == "1" ]; then
290292
cp out/windows/x86_32/tools/godot.windows.editor.x86_32.console.exe ${wrpname}
291293
strip ${wrpname}
292294
sign_windows ${wrpname}
293-
zip -q -9 "${reldir}/${binname}.zip" ${binname} ${wrpname}
295+
$ZIP "${reldir}/${binname}.zip" ${binname} ${wrpname}
294296
rm ${binname} ${wrpname}
295297

296298
# Templates
@@ -313,7 +315,7 @@ if [ "${build_classical}" == "1" ]; then
313315
mkdir -p Godot.app/Contents/MacOS
314316
cp out/macos/tools/godot.macos.editor.universal Godot.app/Contents/MacOS/Godot
315317
chmod +x Godot.app/Contents/MacOS/Godot
316-
zip -q -9 -r "${reldir}/${binname}.zip" Godot.app
318+
$ZIP -r "${reldir}/${binname}.zip" Godot.app
317319
rm -rf Godot.app
318320
sign_macos ${reldir} ${binname} 0
319321

@@ -325,7 +327,7 @@ if [ "${build_classical}" == "1" ]; then
325327
cp out/macos/templates/godot.macos.template_release.universal macos_template.app/Contents/MacOS/godot_macos_release.universal
326328
cp out/macos/templates/godot.macos.template_debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.universal
327329
chmod +x macos_template.app/Contents/MacOS/godot_macos*
328-
zip -q -9 -r "${templatesdir}/macos.zip" macos_template.app
330+
$ZIP -r "${templatesdir}/macos.zip" macos_template.app
329331
rm -rf macos_template.app
330332
sign_macos_template ${templatesdir} 0
331333

@@ -370,15 +372,15 @@ if [ "${build_classical}" == "1" ]; then
370372
cp -r deps/vulkansdk-macos/MoltenVK/MoltenVK.xcframework ios_xcode/
371373
rm -rf ios_xcode/MoltenVK.xcframework/{macos,tvos}*
372374
cd ios_xcode
373-
zip -q -9 -r "${templatesdir}/ios.zip" *
375+
$ZIP -r "${templatesdir}/ios.zip" *
374376
cd ..
375377
rm -rf ios_xcode
376378

377379
## Templates TPZ (Classical) ##
378380

379381
echo "${templates_version}" > ${templatesdir}/version.txt
380382
pushd ${templatesdir}/..
381-
zip -q -9 -r -D "${reldir}/${godot_basename}_export_templates.tpz" templates/*
383+
$ZIP -r "${reldir}/${godot_basename}_export_templates.tpz" templates/*
382384
popd
383385

384386
## SHA-512 sums (Classical) ##
@@ -402,14 +404,14 @@ if [ "${build_mono}" == "1" ]; then
402404
mkdir -p ${binbasename}_x86_64
403405
cp out/linux/x86_64/tools-mono/godot.linuxbsd.editor.x86_64.mono ${binbasename}_x86_64/${binbasename}.x86_64
404406
cp -rp out/linux/x86_64/tools-mono/GodotSharp ${binbasename}_x86_64/
405-
zip -r -q -9 "${reldir_mono}/${binbasename}_x86_64.zip" ${binbasename}_x86_64
407+
$ZIP -r "${reldir_mono}/${binbasename}_x86_64.zip" ${binbasename}_x86_64
406408
rm -rf ${binbasename}_x86_64
407409

408410
binbasename="${godot_basename}_mono_linux"
409411
mkdir -p ${binbasename}_x86_32
410412
cp out/linux/x86_32/tools-mono/godot.linuxbsd.editor.x86_32.mono ${binbasename}_x86_32/${binbasename}.x86_32
411413
cp -rp out/linux/x86_32/tools-mono/GodotSharp/ ${binbasename}_x86_32/
412-
zip -r -q -9 "${reldir_mono}/${binbasename}_x86_32.zip" ${binbasename}_x86_32
414+
$ZIP -r "${reldir_mono}/${binbasename}_x86_32.zip" ${binbasename}_x86_32
413415
rm -rf ${binbasename}_x86_32
414416

415417
binbasename="${godot_basename}_mono_linux"
@@ -449,7 +451,7 @@ if [ "${build_mono}" == "1" ]; then
449451
cp out/windows/x86_64/tools-mono/godot.windows.editor.x86_64.mono.console.exe ${binname}/${wrpname}.exe
450452
strip ${binname}/${wrpname}.exe
451453
sign_windows ${binname}/${wrpname}.exe
452-
zip -r -q -9 "${reldir_mono}/${binname}.zip" ${binname}
454+
$ZIP -r "${reldir_mono}/${binname}.zip" ${binname}
453455
rm -rf ${binname}
454456

455457
binname="${godot_basename}_mono_win32"
@@ -462,7 +464,7 @@ if [ "${build_mono}" == "1" ]; then
462464
cp out/windows/x86_32/tools-mono/godot.windows.editor.x86_32.mono.console.exe ${binname}/${wrpname}.exe
463465
strip ${binname}/${wrpname}.exe
464466
sign_windows ${binname}/${wrpname}.exe
465-
zip -r -q -9 "${reldir_mono}/${binname}.zip" ${binname}
467+
$ZIP -r "${reldir_mono}/${binname}.zip" ${binname}
466468
rm -rf ${binname}
467469

468470
# Templates
@@ -486,7 +488,7 @@ if [ "${build_mono}" == "1" ]; then
486488
cp out/macos/tools-mono/godot.macos.editor.universal.mono Godot_mono.app/Contents/MacOS/Godot
487489
cp -rp out/macos/tools-mono/GodotSharp Godot_mono.app/Contents/Resources/GodotSharp
488490
chmod +x Godot_mono.app/Contents/MacOS/Godot
489-
zip -q -9 -r "${reldir_mono}/${binname}.zip" Godot_mono.app
491+
$ZIP -r "${reldir_mono}/${binname}.zip" Godot_mono.app
490492
rm -rf Godot_mono.app
491493
sign_macos ${reldir_mono} ${binname} 1
492494

@@ -497,7 +499,7 @@ if [ "${build_mono}" == "1" ]; then
497499
cp out/macos/templates-mono/godot.macos.template_debug.universal.mono macos_template.app/Contents/MacOS/godot_macos_debug.universal
498500
cp out/macos/templates-mono/godot.macos.template_release.universal.mono macos_template.app/Contents/MacOS/godot_macos_release.universal
499501
chmod +x macos_template.app/Contents/MacOS/godot_macos*
500-
zip -q -9 -r "${templatesdir_mono}/macos.zip" macos_template.app
502+
$ZIP -r "${templatesdir_mono}/macos.zip" macos_template.app
501503
rm -rf macos_template.app
502504
sign_macos_template ${templatesdir_mono} 1
503505

@@ -521,7 +523,7 @@ if [ "${build_mono}" == "1" ]; then
521523
cp -r deps/vulkansdk-macos/MoltenVK/MoltenVK.xcframework ios_xcode/
522524
rm -rf ios_xcode/MoltenVK.xcframework/{macos,tvos}*
523525
cd ios_xcode
524-
zip -q -9 -r "${templatesdir_mono}/ios.zip" *
526+
$ZIP -r "${templatesdir_mono}/ios.zip" *
525527
cd ..
526528
rm -rf ios_xcode
527529

@@ -541,7 +543,7 @@ if [ "${build_mono}" == "1" ]; then
541543

542544
echo "${templates_version}.mono" > ${templatesdir_mono}/version.txt
543545
pushd ${templatesdir_mono}/..
544-
zip -q -9 -r -D "${reldir_mono}/${godot_basename}_mono_export_templates.tpz" templates/*
546+
$ZIP -r "${reldir_mono}/${godot_basename}_mono_export_templates.tpz" templates/*
545547
popd
546548

547549
## SHA-512 sums (Mono) ##

0 commit comments

Comments
 (0)