summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2019-05-31 11:05:06 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-05-31 11:05:06 +0200
commitcca2cf9588e276284fd03711ab5d7eaf4ee9e6cc (patch)
tree02c29f9651f7160f56048c15b460615d562d10a4
parent84a35aa0caddf31849bf70d1d561d33eed4b81ea (diff)
downloadmm-common-cca2cf9588e276284fd03711ab5d7eaf4ee9e6cc.tar.gz
meson.build: Don't require curl or wget when use-network=false
None of those commands is used when network access is disabled.
-rw-r--r--meson.build14
-rwxr-xr-xutil/meson_aux/libstdcxx-tag.sh64
2 files changed, 43 insertions, 35 deletions
diff --git a/meson.build b/meson.build
index 17fbf43..085405f 100644
--- a/meson.build
+++ b/meson.build
@@ -226,9 +226,14 @@ install_data('README', install_dir: mm_common_docdir)
# Either curl or wget is required for downloading libstdc++.tag,
# used by Doxygen.
-curl = find_program('curl', required: false)
-if not curl.found()
- wget = find_program('wget', required: true)
+download_cmd = 'none'
+if get_option('use-network')
+ curl = find_program('curl', required: false)
+ download_cmd = 'curl'
+ if not curl.found()
+ wget = find_program('wget', required: true)
+ download_cmd = 'wget'
+ endif
endif
# Download libstdc++.tag if it does not exist or if it's out of date.
@@ -236,8 +241,7 @@ custom_target('libstdc++.tag',
output: 'libstdc++.tag',
command: [
files(join_paths('util', 'meson_aux', 'libstdcxx-tag.sh')),
- '@0@'.format(get_option('use-network')), # true or false
- curl.found() ? 'curl' : 'wget',
+ download_cmd,
join_paths(meson.current_source_dir(), 'doctags'),
'@OUTPUT@',
],
diff --git a/util/meson_aux/libstdcxx-tag.sh b/util/meson_aux/libstdcxx-tag.sh
index 73354a8..9ac83f2 100755
--- a/util/meson_aux/libstdcxx-tag.sh
+++ b/util/meson_aux/libstdcxx-tag.sh
@@ -2,38 +2,42 @@
# External command, intended to be called with custom_target() in meson.build
-# libstdcxx-tag.sh <use_network> <curl-or-wget> <srcdir> <output_path>
+# libstdcxx-tag.sh <curl-or-wget-or-none> <srcdir> <output_path>
-output_dirname="$(dirname "$4")"
-output_filename="$(basename "$4")"
+output_dirname="$(dirname "$3")"
+output_filename="$(basename "$3")"
# Remote location of the GNU libstdc++ Doxygen tag file.
libstdcxx_tag_url="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/$output_filename"
-if [ "$1" != "true" ]; then
- if [ -f "$4" ]; then
- echo "Did not check status of $4 because network is disabled."
- elif [ -f "$3/$output_filename" ]; then
- echo "Warning: $4 does not exist."
- echo "Copying from the source directory because network is disabled."
- echo "If you want an up-to-date copy, reconfigure with the -Duse-network=true option."
- cp --preserve=timestamps "$3/$output_filename" "$4"
- else
- echo "Error: $4 does not exist." >&2
- echo "Downloading it is not possible because network is disabled." >&2
- echo "Please reconfigure with the -Duse-network=true option." >&2
- exit 1
- fi
-elif [ "$2" = "curl" ]; then
- # These options don't contain filenames, and thus no spaces that
- # must be preserved in the call to curl.
- simple_curl_options="--compressed --connect-timeout 300 --globoff --location --max-time 3600 --remote-time --retry 5"
- if [ -f "$4" ]; then
- curl $simple_curl_options --time-cond "$4" --output "$4" "$libstdcxx_tag_url"
- else
- curl $simple_curl_options --output "$4" "$libstdcxx_tag_url"
- fi
-else
- wget --timestamping --no-directories --timeout=300 --tries=5 \
- --directory-prefix="$output_dirname" "$libstdcxx_tag_url"
-fi
+case "$1" in
+ curl)
+ # These options don't contain filenames, and thus no spaces that
+ # must be preserved in the call to curl.
+ simple_curl_options="--compressed --connect-timeout 300 --globoff --location --max-time 3600 --remote-time --retry 5"
+ if [ -f "$3" ]; then
+ curl $simple_curl_options --time-cond "$3" --output "$3" "$libstdcxx_tag_url"
+ else
+ curl $simple_curl_options --output "$3" "$libstdcxx_tag_url"
+ fi
+ ;;
+ wget)
+ wget --timestamping --no-directories --timeout=300 --tries=5 \
+ --directory-prefix="$output_dirname" "$libstdcxx_tag_url"
+ ;;
+ *)
+ if [ -f "$3" ]; then
+ echo "Did not check status of $3 because network is disabled."
+ elif [ -f "$2/$output_filename" ]; then
+ echo "Warning: $3 does not exist."
+ echo "Copying from the source directory because network is disabled."
+ echo "If you want an up-to-date copy, reconfigure with the -Duse-network=true option."
+ cp --preserve=timestamps "$2/$output_filename" "$3"
+ else
+ echo "Error: $3 does not exist." >&2
+ echo "Downloading it is not possible because network is disabled." >&2
+ echo "Please reconfigure with the -Duse-network=true option." >&2
+ exit 1
+ fi
+ ;;
+esac