Upload libmozglue by itself

This commit is contained in:
Abe Jellinek 2026-09-23 13:47:24 -04:00
parent 68ff79b91a
commit 82022caa65
3 changed files with 50 additions and 37 deletions

View file

@ -709,12 +709,6 @@ if [ $BUILD_MAC == 1 ]; then
xz -d --stdout "$CALLDIR/mac/zotero.xz" > "$CONTENTSDIR/MacOS/zotero"
chmod 755 "$CONTENTSDIR/MacOS/zotero"
# Custom versions of Firefox components (XUL and libmozglue.dylib)
# with fixes and workarounds missing in the base ESR build
if [ -n "$custom_components_hash_mac" ]; then
cp -R "$MAC_RUNTIME_PATH/../MacOS/"* "$CONTENTSDIR/MacOS/"
fi
# Use our own updater, because Mozilla's requires updates signed by Mozilla
cd "$CONTENTSDIR/MacOS"
check_lfs_file "$CALLDIR/mac/updater.tar.xz"

View file

@ -56,15 +56,15 @@ cp x64/$fx_app_name/Contents/MacOS/firefox zotero
xz zotero
mv zotero.xz "$APP_ROOT_DIR/mac/zotero.xz"
# Package custom components for fetch_xulrunner.
# Upload MacOS-<hash>.tar.xz to ${custom_components_url}mac/<hash>.tar.xz and set
# custom_components_hash_mac in config.sh.
mkdir MacOS
cp x64/$fx_app_name/Contents/MacOS/{XUL,libmozglue.dylib} MacOS/
tar cfJ MacOS.tar.xz MacOS
components_hash=$(shasum -a 256 MacOS.tar.xz | cut -d ' ' -f 1)
mv MacOS.tar.xz "$APP_ROOT_DIR/mac/MacOS-$components_hash.tar.xz"
echo "Custom components hash: $components_hash"
# Package custom libmozglue.dylib for fetch_xulrunner.
# Upload the file to ${custom_components_url}mac/ and set custom_components_hash_mac in
# config.sh.
xz --stdout x64/$fx_app_name/Contents/MacOS/libmozglue.dylib > libmozglue.dylib.xz
components_hash=$(shasum -a 256 libmozglue.dylib.xz | cut -d ' ' -f 1)
mozglue_file="${GECKO_VERSION_MAC//esr}-libmozglue-$components_hash.dylib.xz"
mv libmozglue.dylib.xz "$APP_ROOT_DIR/mac/$mozglue_file"
echo "Custom libmozglue.dylib: $APP_ROOT_DIR/mac/$mozglue_file"
echo "custom_components_hash_mac=\"$components_hash\""
# Save a copy of ChannelPrefs.framework
#

View file

@ -612,31 +612,50 @@ if [ $BUILD_MAC == 1 ]; then
hdiutil detach -quiet /Volumes/Firefox
fi
# Download custom components (e.g., XUL), as an xz-compressed tarball of the MacOS folder with
# custom files in it
# Download and extract custom libmozglue.dylib
echo
rm -rf MacOS
if [ -n "$custom_components_hash_mac" ]; then
if [ -e "Firefox $GECKO_VERSION MacOS.zip" ]; then
echo "Using Firefox $GECKO_VERSION MacOS.zip"
unzip "Firefox $GECKO_VERSION MacOS.zip"
hash="$custom_components_hash_mac"
if [ -n "$hash" ]; then
xzfile="Firefox $GECKO_VERSION libmozglue.dylib.xz"
# Filename doesn't include "esr"
url="${custom_components_url}mac/${GECKO_VERSION//esr}-libmozglue-$hash.dylib.xz"
if [[ "$(uname)" = "Darwin" ]]; then
shasum="shasum -a 256"
else
echo "Downloading custom Firefox components"
echo
curl -o MacOS.tar.xz "${custom_components_url}mac/$custom_components_hash_mac.tar.xz"
# Verify hash
if [[ "`uname`" = "Darwin" ]]; then
shasum="shasum -a 256"
else
shasum=sha256sum
fi
echo
echo "$custom_components_hash_mac MacOS.tar.xz" | $shasum -c -
echo
tar xvf MacOS.tar.xz
shasum=sha256sum
fi
download_xz() {
echo "Downloading custom libmozglue.dylib"
echo
echo $url
curl -fo "$xzfile" "$url"
}
verify_hash() {
echo "$hash $xzfile" | $shasum -c -
}
# Download if file doesn't exist
if [ ! -e "$xzfile" ]; then
download_xz
fi
echo
if ! verify_hash; then
echo "SHA hash mismatch. Redownloading libmozglue.dylib…"
rm -f "$xzfile"
download_xz
echo
if ! verify_hash; then
echo "Hash still doesn't match. Aborting."
exit 1
fi
fi
echo
xz -d --stdout "$xzfile" > Firefox.app/Contents/MacOS/libmozglue.dylib
echo
fi