Skip to content

Commit 5426ee2

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 93d2533 commit 5426ee2

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

build-release.sh

+21-19
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 altool --notarize-app --primary-bundle-id \"${OSX_BUNDLE_ID}\" --username \"${APPLE_ID}\" --password \"${APPLE_ID_PASSWORD}\" --file ${_macos_tmpdir}/${_binname}_signed.zip")
5355
_request_uuid=$(echo ${_request_uuid} | sed -e 's/.*RequestUUID = //')
@@ -62,7 +64,7 @@ sign_macos() {
6264
ssh "${OSX_HOST}" "
6365
cd ${_macos_tmpdir} && \
6466
xcrun stapler staple ${_appname} && \
65-
zip -r ${_binname}_stapled.zip ${_appname}"
67+
$ZIP -r ${_binname}_stapled.zip ${_appname}"
6668
scp "${OSX_HOST}:${_macos_tmpdir}/${_binname}_stapled.zip" "${_reldir}/${_binname}.zip"
6769
ssh "${OSX_HOST}" "rm -rf ${_macos_tmpdir}"
6870
fi
@@ -83,7 +85,7 @@ sign_macos_template() {
8385
codesign --force -s - \
8486
--options=linker-signed \
8587
-v macos_template.app/Contents/MacOS/* && \
86-
zip -r macos_signed.zip macos_template.app"
88+
$ZIP -r macos_signed.zip macos_template.app"
8789

8890
scp "${OSX_HOST}:${_macos_tmpdir}/macos_signed.zip" "${_reldir}/macos.zip"
8991
ssh "${OSX_HOST}" "rm -rf ${_macos_tmpdir}"
@@ -242,13 +244,13 @@ if [ "${build_classical}" == "1" ]; then
242244
binname="${godot_basename}_linux.x86_64"
243245
cp out/linux/x86_64/tools/godot.linuxbsd.editor.x86_64 ${binname}
244246
strip ${binname}
245-
zip -q -9 "${reldir}/${binname}.zip" ${binname}
247+
$ZIP "${reldir}/${binname}.zip" ${binname}
246248
rm ${binname}
247249

248250
binname="${godot_basename}_linux.x86_32"
249251
cp out/linux/x86_32/tools/godot.linuxbsd.editor.x86_32 ${binname}
250252
strip ${binname}
251-
zip -q -9 "${reldir}/${binname}.zip" ${binname}
253+
$ZIP "${reldir}/${binname}.zip" ${binname}
252254
rm ${binname}
253255

254256
# Templates
@@ -269,7 +271,7 @@ if [ "${build_classical}" == "1" ]; then
269271
cp out/windows/x86_64/tools/godot.windows.editor.x86_64.console.exe ${wrpname}
270272
strip ${wrpname}
271273
sign_windows ${wrpname}
272-
zip -q -9 "${reldir}/${binname}.zip" ${binname} ${wrpname}
274+
$ZIP "${reldir}/${binname}.zip" ${binname} ${wrpname}
273275
rm ${binname} ${wrpname}
274276

275277
binname="${godot_basename}_win32.exe"
@@ -280,7 +282,7 @@ if [ "${build_classical}" == "1" ]; then
280282
cp out/windows/x86_32/tools/godot.windows.editor.x86_32.console.exe ${wrpname}
281283
strip ${wrpname}
282284
sign_windows ${wrpname}
283-
zip -q -9 "${reldir}/${binname}.zip" ${binname} ${wrpname}
285+
$ZIP "${reldir}/${binname}.zip" ${binname} ${wrpname}
284286
rm ${binname} ${wrpname}
285287

286288
# Templates
@@ -303,7 +305,7 @@ if [ "${build_classical}" == "1" ]; then
303305
mkdir -p Godot.app/Contents/MacOS
304306
cp out/macos/tools/godot.macos.editor.universal Godot.app/Contents/MacOS/Godot
305307
chmod +x Godot.app/Contents/MacOS/Godot
306-
zip -q -9 -r "${reldir}/${binname}.zip" Godot.app
308+
$ZIP -r "${reldir}/${binname}.zip" Godot.app
307309
rm -rf Godot.app
308310
sign_macos ${reldir} ${binname} 0
309311

@@ -315,7 +317,7 @@ if [ "${build_classical}" == "1" ]; then
315317
cp out/macos/templates/godot.macos.template_release.universal macos_template.app/Contents/MacOS/godot_macos_release.universal
316318
cp out/macos/templates/godot.macos.template_debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.universal
317319
chmod +x macos_template.app/Contents/MacOS/godot_macos*
318-
zip -q -9 -r "${templatesdir}/macos.zip" macos_template.app
320+
$ZIP -r "${templatesdir}/macos.zip" macos_template.app
319321
rm -rf macos_template.app
320322
sign_macos_template ${templatesdir} 0
321323

@@ -360,15 +362,15 @@ if [ "${build_classical}" == "1" ]; then
360362
cp -r deps/vulkansdk-macos/MoltenVK/MoltenVK.xcframework ios_xcode/
361363
rm -rf ios_xcode/MoltenVK.xcframework/{macos,tvos}*
362364
cd ios_xcode
363-
zip -q -9 -r "${templatesdir}/ios.zip" *
365+
$ZIP -r "${templatesdir}/ios.zip" *
364366
cd ..
365367
rm -rf ios_xcode
366368

367369
## Templates TPZ (Classical) ##
368370

369371
echo "${templates_version}" > ${templatesdir}/version.txt
370372
pushd ${templatesdir}/..
371-
zip -q -9 -r -D "${reldir}/${godot_basename}_export_templates.tpz" templates/*
373+
$ZIP -r "${reldir}/${godot_basename}_export_templates.tpz" templates/*
372374
popd
373375

374376
## SHA-512 sums (Classical) ##
@@ -393,15 +395,15 @@ if [ "${build_mono}" == "1" ]; then
393395
cp out/linux/x86_64/tools-mono/godot.linuxbsd.editor.x86_64.mono ${binbasename}_x86_64/${binbasename}.x86_64
394396
strip ${binbasename}_x86_64/${binbasename}.x86_64
395397
cp -rp out/linux/x86_64/tools-mono/GodotSharp ${binbasename}_x86_64/
396-
zip -r -q -9 "${reldir_mono}/${binbasename}_x86_64.zip" ${binbasename}_x86_64
398+
$ZIP -r "${reldir_mono}/${binbasename}_x86_64.zip" ${binbasename}_x86_64
397399
rm -rf ${binbasename}_x86_64
398400

399401
binbasename="${godot_basename}_mono_linux"
400402
mkdir -p ${binbasename}_x86_32
401403
cp out/linux/x86_32/tools-mono/godot.linuxbsd.editor.x86_32.mono ${binbasename}_x86_32/${binbasename}.x86_32
402404
strip ${binbasename}_x86_32/${binbasename}.x86_32
403405
cp -rp out/linux/x86_32/tools-mono/GodotSharp/ ${binbasename}_x86_32/
404-
zip -r -q -9 "${reldir_mono}/${binbasename}_x86_32.zip" ${binbasename}_x86_32
406+
$ZIP -r "${reldir_mono}/${binbasename}_x86_32.zip" ${binbasename}_x86_32
405407
rm -rf ${binbasename}_x86_32
406408

407409
# Templates
@@ -424,7 +426,7 @@ if [ "${build_mono}" == "1" ]; then
424426
cp out/windows/x86_64/tools-mono/godot.windows.editor.x86_64.mono.console.exe ${binname}/${wrpname}.exe
425427
strip ${binname}/${wrpname}.exe
426428
sign_windows ${binname}/${wrpname}.exe
427-
zip -r -q -9 "${reldir_mono}/${binname}.zip" ${binname}
429+
$ZIP -r "${reldir_mono}/${binname}.zip" ${binname}
428430
rm -rf ${binname}
429431

430432
binname="${godot_basename}_mono_win32"
@@ -437,7 +439,7 @@ if [ "${build_mono}" == "1" ]; then
437439
cp out/windows/x86_32/tools-mono/godot.windows.editor.x86_32.mono.console.exe ${binname}/${wrpname}.exe
438440
strip ${binname}/${wrpname}.exe
439441
sign_windows ${binname}/${wrpname}.exe
440-
zip -r -q -9 "${reldir_mono}/${binname}.zip" ${binname}
442+
$ZIP "${reldir_mono}/${binname}.zip" ${binname}
441443
rm -rf ${binname}
442444

443445
# Templates
@@ -461,7 +463,7 @@ if [ "${build_mono}" == "1" ]; then
461463
cp out/macos/tools-mono/godot.macos.editor.universal.mono Godot_mono.app/Contents/MacOS/Godot
462464
cp -rp out/macos/tools-mono/GodotSharp Godot_mono.app/Contents/Resources/GodotSharp
463465
chmod +x Godot_mono.app/Contents/MacOS/Godot
464-
zip -q -9 -r "${reldir_mono}/${binname}.zip" Godot_mono.app
466+
$ZIP -r "${reldir_mono}/${binname}.zip" Godot_mono.app
465467
rm -rf Godot_mono.app
466468
sign_macos ${reldir_mono} ${binname} 1
467469

@@ -472,7 +474,7 @@ if [ "${build_mono}" == "1" ]; then
472474
cp out/macos/templates-mono/godot.macos.template_debug.universal.mono macos_template.app/Contents/MacOS/godot_macos_debug.universal
473475
cp out/macos/templates-mono/godot.macos.template_release.universal.mono macos_template.app/Contents/MacOS/godot_macos_release.universal
474476
chmod +x macos_template.app/Contents/MacOS/godot_macos*
475-
zip -q -9 -r "${templatesdir_mono}/macos.zip" macos_template.app
477+
$ZIP -r "${templatesdir_mono}/macos.zip" macos_template.app
476478
rm -rf macos_template.app
477479
sign_macos_template ${templatesdir_mono} 1
478480

@@ -496,7 +498,7 @@ if [ "${build_mono}" == "1" ]; then
496498
cp -r deps/vulkansdk-macos/MoltenVK/MoltenVK.xcframework ios_xcode/
497499
rm -rf ios_xcode/MoltenVK.xcframework/{macos,tvos}*
498500
cd ios_xcode
499-
zip -q -9 -r "${templatesdir_mono}/ios.zip" *
501+
$ZIP -r "${templatesdir_mono}/ios.zip" *
500502
cd ..
501503
rm -rf ios_xcode
502504

@@ -516,7 +518,7 @@ if [ "${build_mono}" == "1" ]; then
516518

517519
echo "${templates_version}.mono" > ${templatesdir_mono}/version.txt
518520
pushd ${templatesdir_mono}/..
519-
zip -q -9 -r -D "${reldir_mono}/${godot_basename}_mono_export_templates.tpz" templates/*
521+
$ZIP -r "${reldir_mono}/${godot_basename}_mono_export_templates.tpz" templates/*
520522
popd
521523

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

0 commit comments

Comments
 (0)