mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-03 22:45:56 +01:00
Build scripts & osxcross-macports: Tweak tarball download code
This commit is contained in:
parent
af53af4886
commit
4d46f4bbf2
@ -28,8 +28,6 @@ fi
|
||||
# mirror
|
||||
MIRROR="https://ftp.gnu.org/gnu"
|
||||
|
||||
require wget
|
||||
|
||||
pushd $BUILD_DIR &>/dev/null
|
||||
|
||||
function remove_locks()
|
||||
@ -41,7 +39,7 @@ function build_and_install()
|
||||
{
|
||||
if [ ! -f "have_$1_$2_${TARGET}" ]; then
|
||||
pushd $TARBALL_DIR &>/dev/null
|
||||
wget -c "$MIRROR/$1/$1-$2.tar.gz"
|
||||
download "$MIRROR/$1/$1-$2.tar.gz"
|
||||
popd &>/dev/null
|
||||
|
||||
echo "cleaning up ..."
|
||||
|
@ -28,7 +28,6 @@ if [ -z "$INSTALLPREFIX" ]; then
|
||||
INSTALLPREFIX="/usr/local"
|
||||
fi
|
||||
|
||||
require wget
|
||||
require cmake
|
||||
|
||||
function warn_if_installed()
|
||||
@ -71,8 +70,8 @@ LLVM_PKG+="llvm-${CLANG_VERSION}.src.${PKGCOMPRESSOR}"
|
||||
CLANG_PKG="$MIRROR/${CLANG_VERSION}/"
|
||||
CLANG_PKG+="cfe-${CLANG_VERSION}.src.${PKGCOMPRESSOR}"
|
||||
|
||||
wget -c $LLVM_PKG
|
||||
wget -c $CLANG_PKG
|
||||
download $LLVM_PKG
|
||||
download $CLANG_PKG
|
||||
|
||||
popd &>/dev/null
|
||||
|
||||
|
@ -30,8 +30,6 @@ fi
|
||||
# GCC mirror
|
||||
GCC_MIRROR="https://mirror.koddos.net/gcc"
|
||||
|
||||
require wget
|
||||
|
||||
pushd $BUILD_DIR &>/dev/null
|
||||
|
||||
function remove_locks()
|
||||
@ -45,9 +43,9 @@ if [ ! -f "have_gcc_${GCC_VERSION}_${TARGET}" ]; then
|
||||
|
||||
pushd $TARBALL_DIR &>/dev/null
|
||||
if [[ $GCC_VERSION != *-* ]]; then
|
||||
wget -c "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||
download "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||
else
|
||||
wget -c "$GCC_MIRROR/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||
download "$GCC_MIRROR/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||
fi
|
||||
popd &>/dev/null
|
||||
|
||||
|
@ -21,11 +21,6 @@ PUBKEYSHA1="214baa965af76ff71187e6c1ac91c559547f48ab"
|
||||
PLATFORM=$(uname -s)
|
||||
ARCH="x86_64"
|
||||
|
||||
if [ $PLATFORM == "FreeBSD" ]; then
|
||||
WGETOPTS="--ca-certificate="
|
||||
WGETOPTS+="/usr/local/share/certs/ca-root-nss.crt"
|
||||
fi
|
||||
|
||||
if [ -z "$BASHPID" ]; then
|
||||
BASHPID=$(sh -c 'echo $PPID')
|
||||
fi
|
||||
@ -72,7 +67,6 @@ unsupportedDepTarget()
|
||||
exit 1
|
||||
}
|
||||
|
||||
require "wget"
|
||||
require "openssl"
|
||||
|
||||
case $MACOSX_DEPLOYMENT_TARGET in
|
||||
@ -182,26 +176,63 @@ selectMirror()
|
||||
MIRROR=$(cat $SELECTEDMIRROR)
|
||||
}
|
||||
|
||||
function download()
|
||||
{
|
||||
local uri=$1
|
||||
local filename
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
filename=$2
|
||||
else
|
||||
filename=$(basename $1)
|
||||
fi
|
||||
|
||||
if which curl &>/dev/null; then
|
||||
## cURL ##
|
||||
local curl_opts="-L -C - "
|
||||
if [ -z "$VERBOSE" ]; then
|
||||
curl_opts+="-s "
|
||||
fi
|
||||
if [ $filename != "-" ]; then
|
||||
curl_opts+="-o $filename "
|
||||
fi
|
||||
curl $curl_opts $uri
|
||||
elif which wget &>/dev/null; then
|
||||
## wget ##
|
||||
local wget_opts="-c -O $filename "
|
||||
local output=$(wget --no-config 2>&1)
|
||||
if [[ $output != *--no-config* ]]; then
|
||||
wget_opts+="--no-config "
|
||||
fi
|
||||
if [ $PLATFORM == "FreeBSD" ]; then
|
||||
wget_opts="--ca-certificate="
|
||||
wget_opts+="/usr/local/share/certs/ca-root-nss.crt "
|
||||
fi
|
||||
if [ -z "$VERBOSE" ]; then
|
||||
wget_opts+="--quiet "
|
||||
fi
|
||||
wget $wget_opts $uri
|
||||
else
|
||||
echo "Required dependency 'curl or wget' not installed" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
getFileStdout()
|
||||
{
|
||||
verbosePlaceHolder
|
||||
local xargs=""
|
||||
[ -z "$VERBOSE" ] && xargs+="--quiet"
|
||||
wget $WGETOPTS "$1" -O- $xargs
|
||||
download $1 -
|
||||
#verbosePlaceHolder
|
||||
}
|
||||
|
||||
getFile()
|
||||
{
|
||||
verbosePlaceHolder
|
||||
local xargs=""
|
||||
if [ $# -ge 2 ]; then
|
||||
xargs+="-O $2 "
|
||||
download $1 $2
|
||||
else
|
||||
xargs+="-P $CACHE "
|
||||
download $1 "$CACHE/$(basename $1)"
|
||||
fi
|
||||
[ -z "$VERBOSE" ] && xargs+="--quiet"
|
||||
wget $WGETOPTS -c "$1" $xargs
|
||||
#verbosePlaceHolder
|
||||
}
|
||||
|
||||
|
@ -53,20 +53,10 @@ fi
|
||||
|
||||
function require()
|
||||
{
|
||||
set +e
|
||||
which $1 &>/dev/null
|
||||
while [ $? -ne 0 ]
|
||||
do
|
||||
if [ -z "$UNATTENDED" ]; then
|
||||
echo ""
|
||||
read -p "Please install '$1' then press enter"
|
||||
else
|
||||
if ! which $1 &>/dev/null; then
|
||||
echo "Required dependency '$1' is not installed" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
which $1 &>/dev/null
|
||||
done
|
||||
set -e
|
||||
}
|
||||
|
||||
if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "DragonFly" ]; then
|
||||
@ -399,6 +389,28 @@ function get_sources()
|
||||
fi
|
||||
}
|
||||
|
||||
function download()
|
||||
{
|
||||
local uri=$1
|
||||
local filename=$(basename $1)
|
||||
|
||||
if which curl &>/dev/null; then
|
||||
## cURL ##
|
||||
local curl_opts="-L -C - "
|
||||
curl $curl_opts -o $filename $uri
|
||||
elif which wget &>/dev/null; then
|
||||
## wget ##
|
||||
local wget_opts="-c "
|
||||
local output=$(wget --no-config 2>&1)
|
||||
if [[ $output != *--no-config* ]]; then
|
||||
wget_opts+="--no-config "
|
||||
fi
|
||||
wget $wget_opts -O $filename $uri
|
||||
else
|
||||
echo "Required dependency 'curl or wget' not installed" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function create_symlink()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user