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
|
|
|
|
|
|
|
if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; then
|
|
|
|
cd "${FF_CHECKOUT_PATH}"
|
|
|
|
echo "WARNING: checkout path from FF_CHECKOUT_PATH env: ${FF_CHECKOUT_PATH}"
|
|
|
|
else
|
2021-10-14 20:20:06 +03:00
|
|
|
cd "$HOME/firefox"
|
2021-04-10 08:13:19 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
OBJ_FOLDER="obj-build-playwright"
|
|
|
|
|
|
|
|
./mach package
|
2021-08-07 15:32:18 +03:00
|
|
|
node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/$OBJ_FOLDER/dist/firefox
|
2021-04-10 08:13:19 +03:00
|
|
|
|
|
|
|
if ! [[ -d $OBJ_FOLDER/dist/firefox ]]; then
|
|
|
|
echo "ERROR: cannot find $OBJ_FOLDER/dist/firefox folder in the checkout/. Did you build?"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy the libstdc++ version we linked against.
|
|
|
|
# TODO(aslushnikov): this won't be needed with official builds.
|
|
|
|
if [[ "$(uname)" == "Linux" ]]; then
|
|
|
|
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $OBJ_FOLDER/dist/firefox/libstdc++.so.6
|
2021-11-06 01:28:44 +03:00
|
|
|
elif [[ "$(uname)" == MINGW* ]]; then
|
|
|
|
# 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.
|
|
|
|
cd $OBJ_FOLDER/dist
|
2021-08-07 15:32:18 +03:00
|
|
|
zip -r "$ZIP_PATH" firefox
|