2021-04-10 08:13:19 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
set +x
|
|
|
|
|
|
|
|
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
|
2021-08-07 15:32:18 +03:00
|
|
|
echo "usage: $(basename "$0") [output-absolute-path]"
|
2021-04-10 08:13:19 +03:00
|
|
|
echo
|
2021-10-14 20:20:06 +03:00
|
|
|
echo "Generate distributable .zip archive from Firefox checkout folder that was previously built."
|
2021-04-10 08:13:19 +03:00
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
ZIP_PATH=$1
|
|
|
|
if [[ $ZIP_PATH != /* ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH is not absolute"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [[ $ZIP_PATH != *.zip ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH must have .zip extension"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [[ -f $ZIP_PATH ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH exists; can't do anything."
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-08-07 15:32:18 +03:00
|
|
|
if ! [[ -d $(dirname "$ZIP_PATH") ]]; then
|
2021-04-10 08:13:19 +03:00
|
|
|
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
trap "cd $(pwd -P)" EXIT
|
2021-08-07 15:32:18 +03:00
|
|
|
cd "$(dirname "$0")"
|
2021-04-10 08:13:19 +03:00
|
|
|
SCRIPT_FOLDER="$(pwd -P)"
|
2021-11-06 01:28:44 +03:00
|
|
|
source "${SCRIPT_FOLDER}/../utils.sh"
|
2021-04-10 08:13:19 +03:00
|
|
|
|
2021-11-06 03:04:11 +03:00
|
|
|
if [[ -z "${FF_CHECKOUT_PATH}" ]]; then
|
|
|
|
FF_CHECKOUT_PATH="$HOME/firefox"
|
2021-04-10 08:13:19 +03:00
|
|
|
fi
|
2021-11-06 03:04:11 +03:00
|
|
|
OBJ_FOLDER="${FF_CHECKOUT_PATH}/obj-build-playwright"
|
2021-04-10 08:13:19 +03:00
|
|
|
|
2021-11-06 03:04:11 +03:00
|
|
|
cd "${FF_CHECKOUT_PATH}"
|
2021-04-10 08:13:19 +03:00
|
|
|
|
2021-11-06 03:04:11 +03:00
|
|
|
if [[ "$2" == "--linux-arm64" ]]; then
|
|
|
|
CMD_STRIP=/usr/bin/aarch64-linux-gnu-strip ./mach package
|
|
|
|
else
|
|
|
|
./mach package
|
|
|
|
fi
|
|
|
|
node "${SCRIPT_FOLDER}/install-preferences.js" "${OBJ_FOLDER}/dist/firefox"
|
2021-04-10 08:13:19 +03:00
|
|
|
|
2021-11-06 03:04:11 +03:00
|
|
|
if ! [[ -d "$OBJ_FOLDER/dist/firefox" ]]; then
|
|
|
|
echo "ERROR: cannot find $OBJ_FOLDER/dist/firefox folder in the firefox checkout. Did you build?"
|
2021-04-10 08:13:19 +03:00
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy the libstdc++ version we linked against.
|
|
|
|
# TODO(aslushnikov): this won't be needed with official builds.
|
2022-04-22 22:35:35 +03:00
|
|
|
if is_linux; then
|
2021-11-06 03:04:11 +03:00
|
|
|
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 "${OBJ_FOLDER}/dist/firefox/libstdc++.so.6"
|
2022-04-22 22:35:35 +03:00
|
|
|
elif is_win; then
|
2021-11-06 01:28:44 +03:00
|
|
|
# Bundle vcruntime14_1.dll - see https://github.com/microsoft/playwright/issues/9974
|
|
|
|
cd "$(printMSVCRedistDir)"
|
|
|
|
cp -t "${OBJ_FOLDER}/dist/firefox" vcruntime140_1.dll
|
2021-04-10 08:13:19 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# tar resulting directory and cleanup TMP.
|
2021-11-06 03:04:11 +03:00
|
|
|
cd "${OBJ_FOLDER}/dist"
|
2021-08-07 15:32:18 +03:00
|
|
|
zip -r "$ZIP_PATH" firefox
|