New commits:
commit a07458a1e89df7f5ddc679f1386c2bca565f7d80
Author: Remko van der Vossen <wich AT sourcemage.org>
Commit: Remko van der Vossen <wich AT sourcemage.org>
wget: use {optional_,}depends_one_of for SSL library
commit 78b9d33a79484808d1d329e557b894e82bfc73b5
Author: Remko van der Vossen <wich AT sourcemage.org>
Commit: Remko van der Vossen <wich AT sourcemage.org>
depends_one_of.function: new functions
new functions to depend on one of a set of spells with differing build
options for each such as is the case for curl and wget being able to
depend on various libraries providing SSL functionality with different
APIs.
diff --git a/ChangeLog b/ChangeLog
index af8567b..10d9eea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-11-30 Remko van der Vossen <wich AT sourcemage.org>
+ * depends_one_of.function: new functions to depend on one of a set of
+ spells with differing build options for each
+
2022-11-29 Remko van der Vossen <wich AT sourcemage.org>
* smgl/smgl-base: new spell, more slimmed down base for chroot
* smgl/smgl-system: new spell, replacement for basesystem on top of
diff --git a/depends_one_of.function b/depends_one_of.function
new file mode 100644
index 0000000..5915152
--- /dev/null
+++ b/depends_one_of.function
@@ -0,0 +1,110 @@
+#---------------------------------------------------------------------
+## @Synopsis Set of functions for handling one of a set type dependencies
+##
+## @Copyright Source Mage Team
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+## Depend on one of the given list of spells, and add the given
+## options to OPTS
+##
+## @param spell_1
+## @param options_1
+## @param spell_2
+## @param options_2
+## @param ...
+## @param description
+#---------------------------------------------------------------------
+function depends_one_of() {
+ local -a choices
+ local -A options
+ local -A subs
+
+ local persist_var="$1"
+ shift
+
+ while (($# >= 3)); do
+ local this_sub=
+ if [[ "$1" == '-sub' ]]; then
+ this_sub="$2"
+ shift 2
+ fi
+
+ local this_spell="$1"
+ choices+=("$this_spell")
+ options["$this_spell"]="$2"
+ [[ -z "$this_sub" ]] || subs["$this_spell"]="$this_sub"
+ shift 2
+ done
+
+ persistent_load spell_config.p
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR} has a dependency on some
$1"
+ declare -g choice=${!persist_var}
+ if [[ $RECONFIGURE || -z "${!persist_var}" ]] || ! list_find
"${!persist_var}" "${choices[@]}"; then
+ select_provider choice "${!persist_var}" 0 "${choices[@]}"
+ else
+ message "${MESSAGE_COLOR}Using ${SPELL_COLOR}${choice}${DEFAULT_COLOR}"
+ fi
+ config_set_option "$persist_var" "$choice"
+ local -a depends_args
+ [[ -z "${subs["$choice"]}" ]] || depends_args+=(-sub "${subs["$choice"]}")
+ depends_args+=("$choice" "${options["$choice"]}")
+
+ depends "${depends_args[@]}"
+}
+
+#---------------------------------------------------------------------
+## Optionally depend on one of the given list of spells, and add the
+## given options to OPTS
+##
+## @param persist_var
+## @param spell_1
+## @param options_1
+## @param spell_2
+## @param options_2
+## @param ...
+## @param options_none
+## @param description
+#---------------------------------------------------------------------
+function optional_depends_one_of() {
+ local -a choices
+ local -A options
+ local -A subs
+
+ local persist_var="$1"
+ shift
+
+ while (($# >= 4)); do
+ local this_sub=
+ if [[ "$1" == '-sub' ]]; then
+ this_sub="$2"
+ shift 2
+ fi
+
+ local this_spell="$1"
+ choices+=("$this_spell")
+ options["$this_spell"]="$2"
+ [[ -z "$this_sub" ]] || subs["$this_spell"]="$this_sub"
+ shift 2
+ done
+
+ persistent_load spell_config.p
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR} has an optional dependency
on some $2"
+ declare -g choice=${!persist_var}
+ if [[ $RECONFIGURE || -z "${!persist_var}" ]] || ! list_find
"${!persist_var}" none "${choices[@]}"; then
+ select_provider choice "${!persist_var}" 1 "${choices[@]}"
+ else
+ message "${MESSAGE_COLOR}Using ${SPELL_COLOR}${choice}${DEFAULT_COLOR}"
+ fi
+ config_set_option "$persist_var" "$choice"
+ if [[ "$choice" != 'none' ]]; then
+ local -a depends_args
+ [[ -z "${subs["$choice"]}" ]] || depends_args+=(-sub
"${subs["$choice"]}")
+ depends_args+=("$choice" "${options["$choice"]}")
+
+ depends "${depends_args[@]}"
+ else
+ private_common_depends "${choices[0]}" off optional '' "$1"
+ fi
+ unset choice
+}
diff --git a/ftp/wget/CONFIGURE b/ftp/wget/CONFIGURE
index 0cbdfaf..dfa83ef 100755
--- a/ftp/wget/CONFIGURE
+++ b/ftp/wget/CONFIGURE
@@ -1,9 +1,2 @@
-if [[ "$WGET_SSL" == "openssl" ]]; then
- WGET_SSL="SSL" &&
- persistent_add WGET_SSL
-fi &&
-
-config_query_list WGET_SSL "Which SSL backend do you want for https and
ftps?" none gnutls SSL &&
-
config_query_option WGET_OPTS "Enable IPv6 support?" y \
"--enable-ipv6" "--disable-ipv6"
diff --git a/ftp/wget/DEPENDS b/ftp/wget/DEPENDS
index 297d610..5505752 100755
--- a/ftp/wget/DEPENDS
+++ b/ftp/wget/DEPENDS
@@ -1,3 +1,5 @@
+. "$GRIMOIRE/depends_one_of.function"
+
depends smgl-fhs &&