2015-01-22 21:33:35 -05:00
|
|
|
#!/usr/bin/env bash
|
2014-12-04 04:56:01 -05:00
|
|
|
|
2015-02-13 04:08:52 -05:00
|
|
|
check_version() {
|
|
|
|
local version=$1 check=$2
|
|
|
|
local highest=$(echo -e "$version\n$check" | sort -nrt. -k1,1 -k2,2 -k3,3 | head -1)
|
|
|
|
[[ "$highest" = "$version" ]] && return 0
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2014-12-29 19:35:56 -05:00
|
|
|
echo -n "Checking if proper environment variables are set.. "
|
|
|
|
|
|
|
|
echo ${GOROOT:?} 2>&1 >/dev/null
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo "ERROR"
|
|
|
|
echo "GOROOT environment variable missing, please refer to Go installation document"
|
|
|
|
echo "https://github.com/Minio-io/minio/blob/master/BUILDDEPS.md#install-go-13"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ${GOPATH:?} 2>&1 >/dev/null
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo "ERROR"
|
|
|
|
echo "GOPATH environment variable missing, please refer to Go installation document"
|
|
|
|
echo "https://github.com/Minio-io/minio/blob/master/BUILDDEPS.md#install-go-13"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Done"
|
|
|
|
echo "Using GOPATH=${GOPATH} and GOROOT=${GOROOT}"
|
|
|
|
|
2014-12-04 04:56:01 -05:00
|
|
|
echo -n "Checking dependencies for Minio.. "
|
|
|
|
|
|
|
|
## Check all dependencies are present
|
|
|
|
MISSING=""
|
|
|
|
|
2015-02-13 04:09:15 -05:00
|
|
|
check_version "$(env go version | sed 's/^.* go\([0-9.]*\).*$/\1/')" "1.4.0"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
MISSING="${MISSING} golang(1.4.0)"
|
|
|
|
fi
|
|
|
|
|
2014-12-04 04:56:01 -05:00
|
|
|
env git --version > /dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
MISSING="${MISSING} git"
|
|
|
|
fi
|
|
|
|
|
|
|
|
env gcc --version > /dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
MISSING="${MISSING} build-essential"
|
|
|
|
fi
|
|
|
|
|
2015-01-06 18:30:02 -05:00
|
|
|
env yasm --version > /dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
MISSING="${MISSING} yasm"
|
|
|
|
fi
|
|
|
|
|
2015-01-27 15:59:21 -05:00
|
|
|
if ! yasm -f elf64 pkg/storage/erasure/gf-vect-dot-prod-avx2.asm -o /dev/null 2>/dev/null ; then
|
2015-01-06 23:50:58 -05:00
|
|
|
MISSING="${MISSING} yasm(1.2.0)"
|
2015-01-06 18:30:02 -05:00
|
|
|
fi
|
|
|
|
|
2015-02-03 03:42:16 -05:00
|
|
|
env mkdocs help >/dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
MISSING="${MISSING} mkdocs"
|
|
|
|
fi
|
|
|
|
|
2014-12-04 04:56:01 -05:00
|
|
|
## If dependencies are missing, warn the user and abort
|
|
|
|
if [ "x${MISSING}" != "x" ]; then
|
|
|
|
echo "ERROR"
|
|
|
|
echo
|
|
|
|
echo "The following build tools are missing:"
|
|
|
|
echo
|
|
|
|
echo "** ${MISSING} **"
|
|
|
|
echo
|
|
|
|
echo "Please install them "
|
2015-01-06 23:50:58 -05:00
|
|
|
echo "${MISSING}"
|
2014-12-04 04:56:01 -05:00
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-12-29 19:35:56 -05:00
|
|
|
echo "Done"
|