#!/usr/bin/env bash

#
# install-qt-sdk-osx
#
# Copyright (C) 2009-18 by RStudio, Inc.
#
# Unless you have received this program directly from RStudio pursuant
# to the terms of a commercial license agreement with RStudio, then
# this program is licensed to you under the terms of version 3 of the
# GNU Affero General Public License. This program is distributed WITHOUT
# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
#
#

# This archive includes the files required to build against Qt. It
# was created by installing Qt via an interactive installer, and
# manually removing components not needed by RStudio.

QT_VERSION=5.10.1
QT_SDK_BINARY=QtSDK-${QT_VERSION}-mac.tar.gz
QT_SDK_URL=https://s3.amazonaws.com/rstudio-buildtools/$QT_SDK_BINARY

# set Qt SDK dir if not already defined
if [ -z "$QT_SDK_DIR" ]; then
  QT_SDK_DIR=~/Qt${QT_VERSION}
fi

if ! test -e $QT_SDK_DIR
then
   # download and install
   curl -L $QT_SDK_URL > /tmp/$QT_SDK_BINARY
   cd `dirname $QT_SDK_DIR`
   tar xzf /tmp/$QT_SDK_BINARY
   rm /tmp/$QT_SDK_BINARY
else
   echo "Qt $QT_VERSION SDK already installed"
fi

