mirror of https://github.com/minio/minio.git
Merge pull request #161 from harshavardhana/pr_out_add_license_and_fix_development_scripts
This commit is contained in:
commit
be9f59c555
|
@ -1,78 +1,153 @@
|
||||||
|
#
|
||||||
|
# Mini Object Storage, (C) 2015 Minio, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
check_version() {
|
_init() {
|
||||||
local version=$1 check=$2
|
## Minimum required versions for build dependencies
|
||||||
local highest=$(echo -e "$version\n$check" | sort -nrt. -k1,1 -k2,2 -k3,3 | head -1)
|
GCC_VERSION="4.0"
|
||||||
[[ "$highest" = "$version" ]] && return 0
|
YASM_VERSION="1.2.0"
|
||||||
return 1
|
GIT_VERSION="1.0"
|
||||||
|
PIP_VERSION="1.4"
|
||||||
|
GO_VERSION="1.4"
|
||||||
|
|
||||||
|
## Check all dependencies are present
|
||||||
|
MISSING=""
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -n "Checking if proper environment variables are set.. "
|
###
|
||||||
|
#
|
||||||
|
# Takes two arguments
|
||||||
|
# arg1: version number in `x.x.x` format
|
||||||
|
# arg2: version number in `x.x.x` format
|
||||||
|
#
|
||||||
|
# example: check_version "$version1" "$version2"
|
||||||
|
#
|
||||||
|
# returns:
|
||||||
|
# 0 - Installed version is equal to required
|
||||||
|
# 1 - Installed version is greater than required
|
||||||
|
# 2 - Installed version is lesser than required
|
||||||
|
# 3 - If args have length zero
|
||||||
|
#
|
||||||
|
####
|
||||||
|
check_version () {
|
||||||
|
## validate args
|
||||||
|
[[ -z "$1" ]] && return 3
|
||||||
|
[[ -z "$2" ]] && return 3
|
||||||
|
|
||||||
echo ${GOROOT:?} 2>&1 >/dev/null
|
if [[ $1 == $2 ]]; then
|
||||||
if [ $? -eq 1 ]; then
|
return 0
|
||||||
echo "ERROR"
|
fi
|
||||||
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
|
local IFS=.
|
||||||
if [ $? -eq 1 ]; then
|
local i ver1=($1) ver2=($2)
|
||||||
echo "ERROR"
|
# fill empty fields in ver1 with zeros
|
||||||
echo "GOPATH environment variable missing, please refer to Go installation document"
|
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
|
||||||
echo "https://github.com/Minio-io/minio/blob/master/BUILDDEPS.md#install-go-13"
|
ver1[i]=0
|
||||||
exit 1
|
done
|
||||||
fi
|
for ((i=0; i<${#ver1[@]}; i++)); do
|
||||||
|
if [[ -z ${ver2[i]} ]]; then
|
||||||
|
# fill empty fields in ver2 with zeros
|
||||||
|
ver2[i]=0
|
||||||
|
fi
|
||||||
|
if ((10#${ver1[i]} > 10#${ver2[i]})); then
|
||||||
|
|
||||||
echo "Done"
|
return 1
|
||||||
echo "Using GOPATH=${GOPATH} and GOROOT=${GOROOT}"
|
fi
|
||||||
|
if ((10#${ver1[i]} < 10#${ver2[i]})); then
|
||||||
|
## Installed version is lesser than required - Bad condition
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
echo -n "Checking dependencies for Minio.. "
|
check_golang_env() {
|
||||||
|
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
|
||||||
|
|
||||||
## Check all dependencies are present
|
echo ${GOPATH:?} 2>&1 >/dev/null
|
||||||
MISSING=""
|
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
|
||||||
|
}
|
||||||
|
|
||||||
check_version "$(env go version | sed 's/^.* go\([0-9.]*\).*$/\1/')" "1.4"
|
check_deps() {
|
||||||
if [ $? -ne 0 ]; then
|
check_version "$(env pip --version 2>/dev/null| awk {'print $2'})" "${PIP_VERSION}"
|
||||||
MISSING="${MISSING} golang(1.4)"
|
if [ $? -ge 2 ]; then
|
||||||
fi
|
MISSING="pip"
|
||||||
|
fi
|
||||||
|
|
||||||
env git --version > /dev/null 2>&1
|
check_version "$(env go version 2>/dev/null | sed 's/^.* go\([0-9.]*\).*$/\1/')" "${GO_VERSION}"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ge 2 ]; then
|
||||||
MISSING="${MISSING} git"
|
MISSING="${MISSING} golang(1.4)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
env gcc --version > /dev/null 2>&1
|
check_version "$(env git --version 2>/dev/null | sed 's/^.* \([0-9.]*\).*$/\1/')" "${GIT_VERSION}"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ge 2 ]; then
|
||||||
MISSING="${MISSING} build-essential"
|
MISSING="${MISSING} git"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
env yasm --version > /dev/null 2>&1
|
check_version "$(env gcc --version 2>/dev/null | sed 's/^.* \([0-9.]*\).*$/\1/' | head -1)" "${GCC_VERSION}"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ge 2 ]; then
|
||||||
MISSING="${MISSING} yasm"
|
MISSING="${MISSING} build-essential"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! yasm -f elf64 pkg/storage/erasure/gf-vect-dot-prod-avx2.asm -o /dev/null 2>/dev/null ; then
|
check_version "$(env yasm --version 2>/dev/null | sed 's/^.* \([0-9.]*\).*$/\1/' | head -1)" "${YASM_VERSION}"
|
||||||
MISSING="${MISSING} yasm(1.2.0)"
|
if [ $? -ge 2 ]; then
|
||||||
fi
|
MISSING="${MISSING} yasm(1.2.0)"
|
||||||
|
fi
|
||||||
|
|
||||||
env mkdocs help >/dev/null 2>&1
|
env mkdocs help >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
MISSING="${MISSING} mkdocs"
|
MISSING="${MISSING} mkdocs"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
## If dependencies are missing, warn the user and abort
|
main() {
|
||||||
if [ "x${MISSING}" != "x" ]; then
|
echo -n "Checking if proper environment variables are set.. "
|
||||||
echo "ERROR"
|
check_golang_env
|
||||||
echo
|
|
||||||
echo "The following build tools are missing:"
|
echo "Done"
|
||||||
echo
|
echo "Using GOPATH=${GOPATH} and GOROOT=${GOROOT}"
|
||||||
echo "** ${MISSING} **"
|
|
||||||
echo
|
echo -n "Checking dependencies for Minio.. "
|
||||||
echo "Please install them "
|
check_deps
|
||||||
echo "${MISSING}"
|
|
||||||
echo
|
## If dependencies are missing, warn the user and abort
|
||||||
exit 1
|
if [ "x${MISSING}" != "x" ]; then
|
||||||
fi
|
echo "ERROR"
|
||||||
echo "Done"
|
echo
|
||||||
|
echo "The following build tools are missing:"
|
||||||
|
echo
|
||||||
|
echo "** ${MISSING} **"
|
||||||
|
echo
|
||||||
|
echo "Please install them "
|
||||||
|
echo "${MISSING}"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Done"
|
||||||
|
}
|
||||||
|
|
||||||
|
_init && main "$@"
|
||||||
|
|
|
@ -30,11 +30,50 @@ pop_dir() {
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
check_version() {
|
###
|
||||||
local version=$1 check=$2
|
#
|
||||||
local highest=$(echo -e "$version\n$check" | sort -nrt. -k1,1 -k2,2 -k3,3 | head -1)
|
# Takes two arguments
|
||||||
[[ "$highest" = "$version" ]] && return 0
|
# arg1: version number in `x.x.x` format
|
||||||
return 1
|
# arg2: version number in `x.x.x` format
|
||||||
|
#
|
||||||
|
# example: check_version "$version1" "$version2"
|
||||||
|
#
|
||||||
|
# returns:
|
||||||
|
# 0 - Installed version is equal to required
|
||||||
|
# 1 - Installed version is greater than required
|
||||||
|
# 2 - Installed version is lesser than required
|
||||||
|
# 3 - If args have length zero
|
||||||
|
#
|
||||||
|
####
|
||||||
|
check_version () {
|
||||||
|
## validate args
|
||||||
|
[[ -z $1 ]] && return 3
|
||||||
|
[[ -z $2 ]] && return 3
|
||||||
|
|
||||||
|
if [[ $1 == $2 ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
local IFS=.
|
||||||
|
local i ver1=($1) ver2=($2)
|
||||||
|
# fill empty fields in ver1 with zeros
|
||||||
|
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
|
||||||
|
ver1[i]=0
|
||||||
|
done
|
||||||
|
for ((i=0; i<${#ver1[@]}; i++)); do
|
||||||
|
if [[ -z ${ver2[i]} ]]; then
|
||||||
|
# fill empty fields in ver2 with zeros
|
||||||
|
ver2[i]=0
|
||||||
|
fi
|
||||||
|
if ((10#${ver1[i]} > 10#${ver2[i]})); then
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if ((10#${ver1[i]} < 10#${ver2[i]})); then
|
||||||
|
## Installed version is lesser than required - Bad condition
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
is_supported_arch() {
|
is_supported_arch() {
|
||||||
|
@ -137,24 +176,24 @@ main() {
|
||||||
push_dir ${MINIO_DEV}
|
push_dir ${MINIO_DEV}
|
||||||
|
|
||||||
check_version "$(env pip --version | awk {'print $2'})" ${PIP_VERSION}
|
check_version "$(env pip --version | awk {'print $2'})" ${PIP_VERSION}
|
||||||
[[ $? -ne 0 ]] && die "pip not installed"
|
[[ $? -ge 2 ]] && die "pip not installed"
|
||||||
|
|
||||||
check_version "$(env gcc --version | sed 's/^.* \([0-9.]*\).*$/\1/' | head -1)" ${GCC_VERSION}
|
check_version "$(env gcc --version | sed 's/^.* \([0-9.]*\).*$/\1/' | head -1)" ${GCC_VERSION}
|
||||||
[[ $? -ne 0 ]] && die "gcc not installed"
|
[[ $? -ge 2 ]] && die "gcc not installed"
|
||||||
|
|
||||||
check_version "$(env git --version | sed 's/^.* go\([0-9.]*\).*$/\1/')" ${GIT_VERSION}
|
check_version "$(env git --version | sed 's/^.* \([0-9.]*\).*$/\1/')" ${GIT_VERSION}
|
||||||
[[ $? -ne 1 ]] && die "Git not installed"
|
[[ $? -ge 2 ]] && die "Git not installed"
|
||||||
|
|
||||||
check_version "$(env go version 2>/dev/null | sed 's/^.* go\([0-9.]*\).*$/\1/')" ${GOLANG_VERSION}
|
check_version "$(env go version 2>/dev/null | sed 's/^.* go\([0-9.]*\).*$/\1/')" ${GOLANG_VERSION}
|
||||||
[[ $? -eq 0 ]] && \
|
[[ $? -le 1 ]] && \
|
||||||
[[ -z $GOROOT ]] && die "Please setup the goroot variable according to your current installation of golang." \
|
[[ -z $GOROOT ]] && die "Please setup the goroot variable according to your current installation of golang." \
|
||||||
|| install_go
|
|| install_go
|
||||||
|
|
||||||
check_version "$(env yasm --version 2>/dev/null)" ${YASM_VERSION}
|
check_version "$(env yasm --version 2>/dev/null | sed 's/^.* \([0-9.]*\).*$/\1/' | head -1)" ${YASM_VERSION}
|
||||||
[[ $? -eq 0 ]] || install_yasm
|
[[ $? -ge 2 ]] || install_yasm
|
||||||
|
|
||||||
env mkdocs help >/dev/null 2>&1
|
env mkdocs help >/dev/null 2>&1
|
||||||
[[ $? -eq 0 ]] || install_mkdocs
|
[[ $? -ne 0 ]] || install_mkdocs
|
||||||
|
|
||||||
setup_env
|
setup_env
|
||||||
source env.sh
|
source env.sh
|
||||||
|
@ -167,4 +206,4 @@ main() {
|
||||||
|
|
||||||
# Putting main function at the end of the script ensures that the execution
|
# Putting main function at the end of the script ensures that the execution
|
||||||
# won't start until the script is entirely downloaded.
|
# won't start until the script is entirely downloaded.
|
||||||
_init "$@" && main "$@"
|
_init && main "$@"
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Mini Object Storage, (C) 2015 Minio, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package minioapi
|
package minioapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Mini Object Storage, (C) 2015 Minio, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package minioapi
|
package minioapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Mini Object Storage, (C) 2015 Minio, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package minioapi
|
package minioapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Mini Object Storage, (C) 2015 Minio, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package minioapi
|
package minioapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Reference in New Issue