Update build.sh
This commit is contained in:
32
build.sh
32
build.sh
@@ -7,13 +7,13 @@
|
|||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
# https://opensource.org/licenses/CDDL-1.0
|
# https://opensource.org/licenses/CDDL-1.0
|
||||||
#
|
#
|
||||||
# Универсальный скрипт сборки futriis для Linux и Illumos
|
# Универсальный скрипт сборки futriix для Linux и Illumos
|
||||||
# НЕ ТРЕБУЕТ GCC - использует CGO_ENABLED=0 для всех платформ
|
# НЕ ТРЕБУЕТ GCC - использует CGO_ENABLED=0 для всех платформ
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "🔨 Building futriis database..."
|
echo "🔨 Building futriix database..."
|
||||||
|
|
||||||
# Определение ОС
|
# Определение ОС
|
||||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
@@ -23,16 +23,16 @@ if [ -t 1 ]; then
|
|||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
CYAN='\033[1;36m' # Жирный-голубой (cyan)
|
LIGHT_CYAN='\033[1;36m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
else
|
else
|
||||||
RED=''; GREEN=''; YELLOW=''; CYAN=''; NC=''
|
RED=''; GREEN=''; YELLOW=''; LIGHT_CYAN=''; NC=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Функции
|
# Функции
|
||||||
error_msg() { echo -e "${RED}❌ $1${NC}"; }
|
error_msg() { echo -e "${RED}❌ $1${NC}"; }
|
||||||
success_msg() { echo -e "${GREEN}✅ $1${NC}"; }
|
success_msg() { echo -e "${GREEN}✅ $1${NC}"; }
|
||||||
info_msg() { echo -e "${CYAN}📋 $1${NC}"; } # Изменено с BLUE на CYAN
|
info_msg() { echo -e "${LIGHT_CYAN}📋 $1${NC}"; }
|
||||||
warning_msg() { echo -e "${YELLOW}⚠️ $1${NC}"; }
|
warning_msg() { echo -e "${YELLOW}⚠️ $1${NC}"; }
|
||||||
print_separator() { echo "================================================"; }
|
print_separator() { echo "================================================"; }
|
||||||
|
|
||||||
@@ -47,7 +47,6 @@ check_go() {
|
|||||||
GO_VERSION=$(go version | awk '{print $3}')
|
GO_VERSION=$(go version | awk '{print $3}')
|
||||||
success_msg "Go found: $GO_VERSION"
|
success_msg "Go found: $GO_VERSION"
|
||||||
|
|
||||||
# Настраиваем Go proxy для ускорения
|
|
||||||
go env -w GOPROXY=https://proxy.golang.org,direct 2>/dev/null || true
|
go env -w GOPROXY=https://proxy.golang.org,direct 2>/dev/null || true
|
||||||
info_msg "Go proxy: $(go env GOPROXY)"
|
info_msg "Go proxy: $(go env GOPROXY)"
|
||||||
}
|
}
|
||||||
@@ -56,7 +55,6 @@ check_go() {
|
|||||||
setup_vendor() {
|
setup_vendor() {
|
||||||
info_msg "Checking vendor directory..."
|
info_msg "Checking vendor directory..."
|
||||||
|
|
||||||
# Проверяем, нужно ли обновить vendor
|
|
||||||
NEED_VENDOR=false
|
NEED_VENDOR=false
|
||||||
|
|
||||||
if [ ! -d "vendor" ] || [ ! -f "vendor/modules.txt" ]; then
|
if [ ! -d "vendor" ] || [ ! -f "vendor/modules.txt" ]; then
|
||||||
@@ -86,7 +84,7 @@ setup_vendor() {
|
|||||||
build_static() {
|
build_static() {
|
||||||
local target_os=$1
|
local target_os=$1
|
||||||
local target_arch="amd64"
|
local target_arch="amd64"
|
||||||
local output_name="futriis-${target_os}"
|
local output_name="futriix-${target_os}"
|
||||||
local output_path="bin/${output_name}"
|
local output_path="bin/${output_name}"
|
||||||
|
|
||||||
info_msg "Building for ${target_os} (static, no CGO)..."
|
info_msg "Building for ${target_os} (static, no CGO)..."
|
||||||
@@ -98,17 +96,15 @@ build_static() {
|
|||||||
local build_tags=""
|
local build_tags=""
|
||||||
if [ "${target_os}" = "illumos" ] || [ "${target_os}" = "solaris" ]; then
|
if [ "${target_os}" = "illumos" ] || [ "${target_os}" = "solaris" ]; then
|
||||||
build_tags="-tags=illumos"
|
build_tags="-tags=illumos"
|
||||||
output_name="futriis-illumos"
|
output_name="futriix-illumos"
|
||||||
output_path="bin/futriis-illumos"
|
output_path="bin/futriix-illumos"
|
||||||
elif [ "${target_os}" = "linux" ]; then
|
elif [ "${target_os}" = "linux" ]; then
|
||||||
output_name="futriis-linux"
|
output_name="futriix-linux"
|
||||||
output_path="bin/futriis-linux"
|
output_path="bin/futriix-linux"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Создаём bin директорию
|
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
|
|
||||||
# Сборка
|
|
||||||
if go build -mod=vendor ${build_tags} -ldflags="-s -w" -o "${output_path}" ./cmd/futriis; then
|
if go build -mod=vendor ${build_tags} -ldflags="-s -w" -o "${output_path}" ./cmd/futriis; then
|
||||||
success_msg "Build successful for ${target_os}: ${output_path}"
|
success_msg "Build successful for ${target_os}: ${output_path}"
|
||||||
cp "${output_path}" "./${output_name}" 2>/dev/null || true
|
cp "${output_path}" "./${output_name}" 2>/dev/null || true
|
||||||
@@ -126,7 +122,7 @@ build_static() {
|
|||||||
# Основная функция
|
# Основная функция
|
||||||
main() {
|
main() {
|
||||||
print_separator
|
print_separator
|
||||||
echo -e "${GREEN}🔨 Building futriis database (static, no GCC required)${NC}"
|
echo -e "${GREEN}🔨 Building futriix database (static, no GCC required)${NC}"
|
||||||
print_separator
|
print_separator
|
||||||
|
|
||||||
info_msg "Detected OS: ${OS}"
|
info_msg "Detected OS: ${OS}"
|
||||||
@@ -136,7 +132,6 @@ main() {
|
|||||||
|
|
||||||
print_separator
|
print_separator
|
||||||
|
|
||||||
# Сборка для текущей ОС
|
|
||||||
BUILD_SUCCESS=true
|
BUILD_SUCCESS=true
|
||||||
|
|
||||||
case "${OS}" in
|
case "${OS}" in
|
||||||
@@ -170,8 +165,8 @@ main() {
|
|||||||
success_msg "Build complete!"
|
success_msg "Build complete!"
|
||||||
echo ""
|
echo ""
|
||||||
info_msg "To run the database:"
|
info_msg "To run the database:"
|
||||||
echo " ./futriis-linux # On Linux"
|
echo " ./futriix-linux # On Linux"
|
||||||
echo " ./futriis-illumos # On Illumos/OpenIndiana"
|
echo " ./futriix-illumos # On Illumos/OpenIndiana"
|
||||||
echo ""
|
echo ""
|
||||||
info_msg "Binary location: bin/"
|
info_msg "Binary location: bin/"
|
||||||
ls -lh bin/ 2>/dev/null || true
|
ls -lh bin/ 2>/dev/null || true
|
||||||
@@ -181,5 +176,4 @@ main() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Запуск
|
|
||||||
main "$@"
|
main "$@"
|
||||||
Reference in New Issue
Block a user