diff options
author | jahoti <jahoti@tilde.team> | 2021-12-02 00:00:00 +0000 |
---|---|---|
committer | jahoti <jahoti@tilde.team> | 2021-12-02 00:00:00 +0000 |
commit | 5a0026423b61915fd2f9544456b2634505a952b1 (patch) | |
tree | 957e2ea870efd88dd987e56c6c89d2a24bcb6ee6 /configure | |
parent | 6d819aaea70756b778e71478ec6ce40a8d680841 (diff) | |
download | browser-extension-build-sys.tar.gz browser-extension-build-sys.zip |
Allow testing behavior to be customizedbuild-sys
Adds PYTEST, PYTHON, BROWSER_BIN, TEST_PORT, and TEST_PROFILE variables
to configure.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 40 |
1 files changed, 30 insertions, 10 deletions
@@ -15,6 +15,12 @@ set -e +# Set BROWSERPATH appropriately +set_browserpath () { + BROWSERPATH="${BINARY:-$(realpath "$1")}" +} + +BINARY="$BROWSER_BIN" BROWSERPATH='' SRCDIR='' TARGET='' @@ -22,18 +28,23 @@ TARGET='' # Parse command line options while [ "x$1" != x ]; do case "$1" in - --srcdir=*) SRCDIR="$(echo "$1" | cut -c 10-)";; - --srcdir) SRCDIR="$2"; shift;; - "DESTDIR"=*) DESTDIR="$(echo "$1" | cut -c 9-)";; - "UPDATE_URL"=*) UPDATE_URL="$(echo "$1" | cut -c 12-)";; - --host=*) TARGET="$(echo "$1" | cut -c 8-)";; - --host) TARGET="$2"; shift;; + --srcdir=*) SRCDIR="$(echo "$1" | cut -c 10-)";; + --srcdir) SRCDIR="$2"; shift;; + BROWSER_BIN=*) BINARY="$(echo "$1" | cut -c 13-)";; + DESTDIR=*) DESTDIR="$(echo "$1" | cut -c 9-)";; + PYTEST=*) PYTEST="$(echo "$1" | cut -c 8-)";; + PYTHON=*) PYTHON="$(echo "$1" | cut -c 8-)";; + TEST_PORT=*) TEST_PORT="$(echo "$1" | cut -c 11-)";; + TEST_PROFILE=*) TEST_PROFILE="$(echo "$1" | cut -c 14-)";; + UPDATE_URL=*) UPDATE_URL="$(echo "$1" | cut -c 12-)";; + --host=*) TARGET="$(echo "$1" | cut -c 8-)";; + --host) TARGET="$2"; shift;; # browsers chromium | chrome | google-chrome | mozilla |\ firefox | librewolf | icecat | iceweasel | abrowser |\ - iceweasel-uxp | tor-browser) TARGET=$1;; - *) echo Ignoring option "'$1'";; + iceweasel-uxp | tor-browser) TARGET=$1;; + *) echo Ignoring option "'$1'";; esac shift done @@ -59,7 +70,7 @@ fi if [ "x$TARGET" = x ]; then echo Detecting target automatically. if [ -h /etc/alternatives/x-www-browser ]; then - BROWSERPATH="$(realpath /etc/alternatives/x-www-browser)" + set_browserpath /etc/alternatives/x-www-browser TARGET="$(/etc/alternatives/x-www-browser --version 2> /dev/null | tail -n 1 | awk '{ print $1 }' | tr [A-Z] [a-z])" else @@ -67,7 +78,7 @@ if [ "x$TARGET" = x ]; then echo Some make rules may fail. >&2 fi else - BROWSERPATH="$(realpath "$(which $TARGET)")" + set_browserpath "$(which $TARGET)" fi # Check and standardize target @@ -98,8 +109,17 @@ fi echo srcdir = "$SRCDIR" > record.conf echo default_target = "$TARGET" >> record.conf echo DESTDIR = "$DESTDIR" >> record.conf +echo PYTEST = "${PYTEST:-$(which pytest)}" >> record.conf +echo PYTHON = "${PYTHON:-$(which python3)}" >> record.conf echo UPDATE_URL = "$UPDATE_URL" >> record.conf +# Write test/config.py (if testing is enabled) +echo from .misc_constants import '*' > test/config.py +echo default_firefox_binary = "'${BINARY:-/usr/lib/icecat/icecat}'" >> test/config.py +echo default_clean_profile_dir = "'$TEST_PROFILE'" or \ + default_clean_profile_dir >> test/config.py +echo default_proxy_port = "${TEST_PORT:-1337}" >> test/config.py + # Prepare and run write_makefile.sh (as config.status) if [ ! -e config.status ]; then |