download-tarballs revision 1422
1450N/A#!/bin/ksh93
1450N/A#
1450N/A###########################################################################
1450N/A#
1450N/A# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
1450N/A#
1450N/A# Permission is hereby granted, free of charge, to any person obtaining a
1450N/A# copy of this software and associated documentation files (the "Software"),
1450N/A# to deal in the Software without restriction, including without limitation
1450N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
1450N/A# and/or sell copies of the Software, and to permit persons to whom the
1450N/A# Software is furnished to do so, subject to the following conditions:
1450N/A#
1450N/A# The above copyright notice and this permission notice (including the next
1450N/A# paragraph) shall be included in all copies or substantial portions of the
1450N/A# Software.
1450N/A#
1450N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1450N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1450N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1450N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1450N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1450N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1450N/A# DEALINGS IN THE SOFTWARE.
1450N/A#
1450N/A###########################################################################
1450N/A#
1450N/A#
1450N/A
1450N/Aprogname="$0"
1450N/Afunction fatal_error
1450N/A{
1450N/A print -u2 "${progname}: ERROR: $*"
1450N/A exit 1
1450N/A}
1450N/A
1450N/ACLOBBER=0
1450N/AWGET='/usr/bin/wget'
1450N/AXMAKE="$(pwd)/open-src/util/build-tools/xmake ${VERBOSE_FLAGS} -k"
1450N/A# Make sure Solaris make, not GNU make, is first in the $PATH
1450N/Aexport PATH=/usr/bin:${PATH}
1450N/A
1450N/Aset -- $(getopt cn $*)
1450N/Aif [[ $? != 0 ]] ; then
1450N/A echo USAGE: $0 [-c] [-n]
1450N/A exit 2
1450N/Afi
1450N/A
1450N/Afor i in $* ; do
1450N/A case $i in
1450N/A -c) CLOBBER=1; shift;;
1450N/A -n) WGET="echo $WGET"; MAKE_FLAGS="$MAKE_FLAGS -n" ; shift;;
1450N/A esac
1450N/Adone
1450N/A
1450N/A${XMAKE} setup || fatal_error "make setup failed: cannot continue"
set -v
cd open-src
if [[ $CLOBBER == 1 ]] ; then
rm -rf tarballs
fi
if [[ ! -d tarballs ]] ; then
mkdir tarballs
fi
${XMAKE} download
cd ../..