From: Mathias Preiner Date: Mon, 26 Aug 2019 22:38:04 +0000 (-0700) Subject: Make contrib/get-* more robust. (#3198) X-Git-Tag: cvc5-1.0.0~3990 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b9ecdf85954e937bd569cba018b6b09eee787a1;p=cvc5.git Make contrib/get-* more robust. (#3198) We use the command which to determine if a command is available on the system. However, which is not installed on all platforms by default (e.g. CentOS). command is a shell builtin that can be used for the same purpose. --- diff --git a/contrib/get-abc b/contrib/get-abc index fa90f240f..5d3f32fb5 100755 --- a/contrib/get-abc +++ b/contrib/get-abc @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # source "$(dirname "$0")/get-script-header.sh" diff --git a/contrib/get-antlr-3.4 b/contrib/get-antlr-3.4 index a3dfb410d..ecc92d998 100755 --- a/contrib/get-antlr-3.4 +++ b/contrib/get-antlr-3.4 @@ -34,7 +34,7 @@ cd $ANTLR_HOME_DIR || exit 1 webget https://www.antlr3.org/download/antlr-3.4-complete.jar share/java/antlr-3.4-complete.jar webget https://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz src/libantlr3c-3.4.tar.gz tee bin/antlr3 < /dev/null + if [ -x "$(command -v git)" ] then git clone "$1" "$2" else diff --git a/contrib/get-script-header.sh b/contrib/get-script-header.sh index e5b708042..4e2a133b3 100644 --- a/contrib/get-script-header.sh +++ b/contrib/get-script-header.sh @@ -15,9 +15,9 @@ if ! [ -e src/parser/cvc/Cvc.g ]; then fi function webget { - if which wget &>/dev/null; then + if [ -x "$(command -v wget)" ]; then wget -c -O "$2" "$1" - elif which curl &>/dev/null; then + elif [ -x "$(command -v curl)" ]; then curl -L "$1" >"$2" else echo "Can't figure out how to download from web. Please install wget or curl." >&2 diff --git a/contrib/get-symfpu b/contrib/get-symfpu index a31d27e06..b17c00299 100755 --- a/contrib/get-symfpu +++ b/contrib/get-symfpu @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # source "$(dirname "$0")/get-script-header.sh" diff --git a/contrib/get-win-dependencies b/contrib/get-win-dependencies index f3fbd6cf7..1138e3071 100755 --- a/contrib/get-win-dependencies +++ b/contrib/get-win-dependencies @@ -1,10 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash # # win32-build script # Morgan Deters # Tue, 15 Jan 2013 11:11:24 -0500 # +set -e -o pipefail + export WINDOWS_BUILD=yes export MAKE_CFLAGS= export MAKE_CXXFLAGS= @@ -50,10 +52,10 @@ function reporterror { } function webget { - if which curl &>/dev/null; then - curl -L "$1" >"$2" - elif which wget &>/dev/null; then + if [ -x "$(command -v wget)" ]; then wget -c -O "$2" "$1" + elif [ -x "$(command -v curl)" ]; then + curl -L "$1" >"$2" else echo "Can't figure out how to download from web. Please install wget or curl." >&2 exit 1