2023-04-23 07:57:55 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2023-04-24 08:09:36 +00:00
|
|
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
|
|
ROOT_DIR="$(dirname $APP_ROOT_DIR)"
|
2023-04-23 07:57:55 +00:00
|
|
|
|
|
|
|
# Set ZOTERO_PROFILE environment variable to choose profile
|
|
|
|
if [ -n "${ZOTERO_PROFILE:-}" ]; then
|
|
|
|
profile="-p $ZOTERO_PROFILE"
|
|
|
|
fi
|
|
|
|
|
|
|
|
REBUILD=0
|
|
|
|
SKIP_BUNDLED_FILES=0
|
|
|
|
DEBUGGER=0
|
|
|
|
while getopts "rbd" opt; do
|
|
|
|
case $opt in
|
|
|
|
r)
|
|
|
|
REBUILD=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
b)
|
|
|
|
SKIP_BUNDLED_FILES=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
d)
|
|
|
|
DEBUGGER=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
\?)
|
|
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $REBUILD -eq 1 ]; then
|
|
|
|
PARAMS=""
|
|
|
|
if [ $DEBUGGER -eq 1 ]; then
|
|
|
|
PARAMS="-t"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check if build watch is running
|
|
|
|
# If not, run now
|
2023-04-29 11:45:59 +00:00
|
|
|
if ! ps u | grep js-build/build.js | grep -v grep > /dev/null; then
|
2023-04-23 07:57:55 +00:00
|
|
|
echo "Running JS build process"
|
|
|
|
echo
|
2023-04-24 08:09:36 +00:00
|
|
|
cd $ROOT_DIR
|
2023-07-25 04:52:00 +00:00
|
|
|
# TEMP: --openssl-legacy-provider avoids a build error in pdf.js
|
|
|
|
NODE_OPTIONS=--openssl-legacy-provider npm run build
|
2023-04-23 07:57:55 +00:00
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
2023-04-24 08:09:36 +00:00
|
|
|
"$SCRIPT_DIR/dir_build" -q $PARAMS
|
2023-04-23 07:57:55 +00:00
|
|
|
|
|
|
|
if [ "`uname`" = "Darwin" ]; then
|
|
|
|
# Sign the Word dylib so it works on Apple Silicon
|
2023-04-24 08:09:36 +00:00
|
|
|
"$SCRIPT_DIR/codesign_local" "$APP_ROOT_DIR/staging/Zotero.app"
|
2023-04-23 07:57:55 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
PARAMS=""
|
|
|
|
if [ $SKIP_BUNDLED_FILES -eq 1 ]; then
|
|
|
|
PARAMS="$PARAMS -ZoteroSkipBundledFiles"
|
|
|
|
fi
|
|
|
|
if [ $DEBUGGER -eq 1 ]; then
|
2024-07-20 06:17:31 +00:00
|
|
|
PARAMS="$PARAMS -jsdebugger"
|
2024-08-10 05:29:28 +00:00
|
|
|
else
|
|
|
|
PARAMS="$PARAMS -jsconsole"
|
2023-04-23 07:57:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "`uname`" = "Darwin" ]; then
|
|
|
|
command="Zotero.app/Contents/MacOS/zotero"
|
|
|
|
elif [ "`uname`" = "Linux" ]; then
|
|
|
|
command="Zotero_linux-x86_64/zotero"
|
|
|
|
elif [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
2023-05-11 04:17:12 +00:00
|
|
|
command="Zotero_win-x64/zotero.exe"
|
2023-04-23 07:57:55 +00:00
|
|
|
else
|
|
|
|
echo "Unknown platform" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-08-10 05:29:28 +00:00
|
|
|
"$APP_ROOT_DIR/staging/$command" $profile -ZoteroDebugText -purgecaches $PARAMS "$@"
|