From 3fcff3382d439c0451421288f1d7d942be0de0c8 Mon Sep 17 00:00:00 2001 From: jahoti Date: Fri, 3 Dec 2021 00:00:00 +0000 Subject: Make testing configurable Add options to configure in accordance with #97 --- configure | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 06a43eb..a9a6a38 100755 --- a/configure +++ b/configure @@ -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,15 +70,15 @@ 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)" - TARGET="$(/etc/alternatives/x-www-browser --version 2> /dev/null | + set_browserpath /etc/alternatives/x-www-browser + TARGET="$("$BROWSERPATH" --version 2> /dev/null | tail -n 1 | awk '{ print $1 }' | tr [A-Z] [a-z])" else echo Warning: could not find target automatically. >&2 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,15 @@ 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 +# (Re-)write testing.conf +rm -f testing.conf +[ "x$BINARY" != x ] && echo BINARY "$BINARY" >> testing.conf +[ "x$TEST_PROFILE" != x ] && echo TEST_PROFILE "$TEST_PROFILE" >> testing.conf +[ "x$TEST_PORT" != x ] && echo TEST_PORT "$TEST_PORT" >> testing.conf # Prepare and run write_makefile.sh (as config.status) if [ ! -e config.status ]; then -- cgit v1.2.3