2017-02-01 22:10:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cachedir="$HOME/.rncache"
|
|
|
|
mkdir -p "$cachedir"
|
|
|
|
|
2017-09-28 19:48:51 +00:00
|
|
|
function file_fail () {
|
|
|
|
cachefile=$1
|
|
|
|
msg=$2
|
|
|
|
|
|
|
|
echo "$msg. Debug info:" 2>&1
|
|
|
|
ls -l "$cachefile" 2>&1
|
|
|
|
shasum "$cachefile" 2>&1
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2017-02-01 22:10:43 +00:00
|
|
|
function fetch_and_unpack () {
|
|
|
|
file=$1
|
|
|
|
url=$2
|
2017-09-28 19:48:51 +00:00
|
|
|
hash=$3
|
|
|
|
cmd=$4
|
2017-02-01 22:10:43 +00:00
|
|
|
|
2017-09-28 19:48:51 +00:00
|
|
|
retries=4
|
|
|
|
fetched=no
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
if [ -f "$cachedir/$file" ]; then
|
|
|
|
if shasum -p "$cachedir/$file" |
|
|
|
|
awk -v hash="$hash" '{exit $1 != hash}'; then
|
|
|
|
break
|
|
|
|
else
|
|
|
|
echo "Incorrect hash:" 2>&1
|
|
|
|
shasum -p "$cachedir/$file" 2>&1
|
|
|
|
echo "Retrying..." 2>&1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
(( retries = retries - 1 ))
|
|
|
|
if (( retries < 0 )); then
|
|
|
|
file_fail "$cachedir/$file" "Failed to successfully download '$file'"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f "$cachedir/$file"
|
2017-02-01 22:10:43 +00:00
|
|
|
(cd "$cachedir"; curl -J -L -O "$url")
|
2017-09-28 19:48:51 +00:00
|
|
|
fetched=yes
|
|
|
|
done
|
2017-02-01 22:10:43 +00:00
|
|
|
|
|
|
|
dir=$(basename "$file" .tar.gz)
|
2017-09-28 19:48:51 +00:00
|
|
|
if [ "$fetched" = "yes" ] || [ ! -d "third-party/$dir" ]; then
|
2017-02-01 22:10:43 +00:00
|
|
|
(cd third-party;
|
2017-09-28 19:48:51 +00:00
|
|
|
rm -rf "$dir"
|
2017-02-01 22:10:43 +00:00
|
|
|
echo Unpacking "$cachedir/$file"...
|
2017-06-15 20:03:23 +00:00
|
|
|
if ! tar zxf "$cachedir/$file"; then
|
2017-09-28 19:48:51 +00:00
|
|
|
file_fail "$cachedir/$file" "Unpacking '$cachedir/$file' failed"
|
2017-06-15 20:03:23 +00:00
|
|
|
fi
|
2017-02-01 22:10:43 +00:00
|
|
|
cd "$dir"
|
|
|
|
eval "${cmd:-true}")
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
mkdir -p third-party
|
|
|
|
|
2017-05-10 11:24:24 +00:00
|
|
|
SCRIPTDIR=$(dirname "$0")
|
2017-02-01 22:10:43 +00:00
|
|
|
|
2018-08-23 21:09:19 +00:00
|
|
|
fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\""
|
|
|
|
fetch_and_unpack double-conversion-1.1.6.tar.gz https://github.com/google/double-conversion/archive/v1.1.6.tar.gz 1c7d88afde3aaeb97bb652776c627b49e132e8e0
|
2017-09-28 19:48:51 +00:00
|
|
|
fetch_and_unpack boost_1_63_0.tar.gz https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz c3f57e1d22a995e608983effbb752b54b6eab741
|
2018-04-14 00:19:02 +00:00
|
|
|
fetch_and_unpack folly-2016.10.31.00.tar.gz https://github.com/facebook/folly/archive/v2016.10.31.00.tar.gz fb8cdf8962d8c9d0c20a150b6ec3b75d1fa50696
|