Skip to content

Commit

Permalink
scripts: Update to mac-toolchain-build 1.1.0.
Browse files Browse the repository at this point in the history
Minor fixes and improvements to progress output.
  • Loading branch information
bradleysepos committed Oct 5, 2019
1 parent 16710d1 commit f506bc6
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions scripts/mac-toolchain-build
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function mac_toolchain_build {
# internal vars
local NAME VERSION SELF SELF_NAME HELP CREL SUDO TOTAL
NAME="mac-toolchain-build"
VERSION="1.0.0"
VERSION="1.1.0"
SELF="${BASH_SOURCE[0]}"
SELF_NAME=$(basename "${SELF}")
HELP="\
Expand Down Expand Up @@ -305,9 +305,10 @@ default install-dir: /usr/local"
PREFIX="${1:-/usr/local}"

# check installed tool versions, skip if adequate
local INSTALLED_VERSIONS SKIP TOOL_PATH
local INSTALLED_VERSIONS SKIP NOT_SKIPPED_TOTAL TOOL_PATH
INSTALLED_VERSIONS=()
SKIP=()
NOT_SKIPPED_TOTAL=0
for I in "${!NAMES[@]}"; do
if [[ "${NAMES[I]}" == "meson" ]]; then
TOOL_PATH=
Expand All @@ -318,6 +319,7 @@ default install-dir: /usr/local"
if [[ "${FORCE}" == false ]] && check_version_gte "${INSTALLED_VERSIONS[I]}" "${VERSIONS[I]}"; then
SKIP[$I]=true
else
NOT_SKIPPED_TOTAL=$((NOT_SKIPPED_TOTAL+1))
SKIP[$I]=false
fi
done
Expand Down Expand Up @@ -354,18 +356,19 @@ default install-dir: /usr/local"

# host
local CPU_COUNT
CPU_COUNT=$(sysctl -n hw.ncpu 2>/dev/null)
CPU_COUNT=$(sysctl -n hw.activecpu 2>/dev/null)
CPU_COUNT="${CPU_COUNT:-1}"

# verify/fetch
local DOWNLOAD_VERBOSE I URLS_IREF URLS CHECKSUM
local DOWNLOAD_VERBOSE COUNT I URLS_IREF URLS CHECKSUM
DOWNLOAD_VERBOSE=false
COUNT=0
for I in "${!PKGS[@]}"; do
printf "Downloading [%02i/%02i] %s " "$((I+1))" "${#PKGS[@]}" "${NAMES[I]} ${VERSIONS[I]}"
if [[ "${SKIP[I]}" == true ]]; then
echo "(${INSTALLED_VERSIONS[I]} installed, skipping)"
continue
fi
COUNT=$((COUNT+1))
printf "Downloading [%02i/%02i] %s " "${COUNT}" "${NOT_SKIPPED_TOTAL}" "${NAMES[I]} ${VERSIONS[I]}"
URLS_IREF="${URLS_VARNAMES[I]}[@]"
URLS="${!URLS_IREF}"
CHECKSUM=$(${SHA256} "${PKG_DIR}/${PKGS[I]}" 2>/dev/null | awk '{ print $1 }')
Expand All @@ -383,12 +386,13 @@ default install-dir: /usr/local"
done

# extract
COUNT=0
for I in "${!PKGS[@]}"; do
printf "Extracting [%02i/%02i] %s " "$((I+1))" "${#PKGS[@]}" "${PKGS[I]}"
if [[ "${SKIP[I]}" == true ]]; then
echo "(${INSTALLED_VERSIONS[I]} installed, skipping)"
continue
fi
COUNT=$((COUNT+1))
printf "Extracting [%02i/%02i] %s " "${COUNT}" "${NOT_SKIPPED_TOTAL}" "${PKGS[I]}"
if [[ -e "${SOURCE_DIR}/${NAMES[I]}" ]]; then
rm -rf "${SOURCE_DIR}/${NAMES[I]}"
fi
Expand All @@ -401,7 +405,7 @@ default install-dir: /usr/local"
done

# build
local COUNT
local INDEX

# autoconf
INDEX=0
Expand Down Expand Up @@ -471,7 +475,7 @@ default install-dir: /usr/local"
INDEX=$((INDEX+1))
printf "Building [%02i/%02i] %s " "$((INDEX+1))" "${TOTAL}" "${NAMES[$INDEX]} ${VERSIONS[$INDEX]}"
if [[ "${SKIP[$INDEX]}" == true ]]; then
echo "(${INSTALLED_VERSIONS[$INDEX]} installed, skipping)"
echo "(${INSTALLED_VERSIONS[$INDEX]} installed globally, skipping)"
else
[[ "${SUDO}" != "" ]] && ${SUDO} -v
touch "${BUILD_DIR}/${NAMES[$INDEX]}.log"
Expand Down

0 comments on commit f506bc6

Please sign in to comment.