From 795c1dcebc5a2179e00613bba183b2a4af49858a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D1=80=D0=B8=D0=B3=D0=BE=D1=80=D0=B8=D0=B9=20=D0=A1?= =?UTF-8?q?=D0=B0=D1=84=D1=80=D0=BE=D0=BD=D0=BE=D0=B2?= Date: Sun, 17 May 2026 20:12:02 +0000 Subject: [PATCH] Delete build.sh --- build.sh | 185 ------------------------------------------------------- 1 file changed, 185 deletions(-) delete mode 100644 build.sh diff --git a/build.sh b/build.sh deleted file mode 100644 index 88cf6cf..0000000 --- a/build.sh +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2026 Safronov Grigorii -# -# Licensed under the CDDL, Version 1.0 (the "License"); -# you may not use this file except in compliance with the License. -# -# You may obtain a copy of the License at -# https://opensource.org/licenses/CDDL-1.0 -# -# Универсальный скрипт сборки futriis для Linux и Illumos -# НЕ ТРЕБУЕТ GCC - использует CGO_ENABLED=0 для всех платформ - -set -e - -echo "" -echo "🔨 Building futriis database..." - -# Определение ОС -OS=$(uname -s | tr '[:upper:]' '[:lower:]') - -# Цвета для вывода -if [ -t 1 ]; then - RED='\033[0;31m' - GREEN='\033[0;32m' - YELLOW='\033[1;33m' - BLUE='\033[0;34m' - NC='\033[0m' -else - RED=''; GREEN=''; YELLOW=''; BLUE=''; NC='' -fi - -# Функции -error_msg() { echo -e "${RED}❌ $1${NC}"; } -success_msg() { echo -e "${GREEN}✅ $1${NC}"; } -info_msg() { echo -e "${BLUE}📋 $1${NC}"; } -warning_msg() { echo -e "${YELLOW}⚠️ $1${NC}"; } -print_separator() { echo "================================================"; } - -# Проверка Go -check_go() { - info_msg "Checking Go installation..." - if ! command -v go >/dev/null 2>&1; then - error_msg "Go is not installed or not in PATH" - exit 1 - fi - - GO_VERSION=$(go version | awk '{print $3}') - success_msg "Go found: $GO_VERSION" - - # Настраиваем Go proxy для ускорения - go env -w GOPROXY=https://proxy.golang.org,direct 2>/dev/null || true - info_msg "Go proxy: $(go env GOPROXY)" -} - -# Подготовка vendor с видимым прогрессом -setup_vendor() { - info_msg "Checking vendor directory..." - - # Проверяем, нужно ли обновить vendor - NEED_VENDOR=false - - if [ ! -d "vendor" ] || [ ! -f "vendor/modules.txt" ]; then - warning_msg "Vendor directory not found or incomplete" - NEED_VENDOR=true - elif [ "go.mod" -nt "vendor/modules.txt" ]; then - warning_msg "go.mod is newer than vendor directory" - NEED_VENDOR=true - fi - - if [ "$NEED_VENDOR" = true ]; then - info_msg "Creating/updating vendor directory..." - echo "" - info_msg "Step 1/2: Downloading modules..." - go mod download -x 2>&1 | grep -E "^(GET|Downloading)" | head -20 || true - echo "" - info_msg "Step 2/2: Creating vendor directory..." - go mod vendor - success_msg "Vendor dependencies ready" - echo "" - else - info_msg "Vendor directory is up to date" - fi -} - -# Сборка статического бинарника -build_static() { - local target_os=$1 - local target_arch="amd64" - local output_name="futriis-${target_os}" - local output_path="bin/${output_name}" - - info_msg "Building for ${target_os} (static, no CGO)..." - - export GOOS="${target_os}" - export GOARCH="${target_arch}" - export CGO_ENABLED=0 - - local build_tags="" - if [ "${target_os}" = "illumos" ] || [ "${target_os}" = "solaris" ]; then - build_tags="-tags=illumos" - output_name="futriis-illumos" - output_path="bin/futriis-illumos" - elif [ "${target_os}" = "linux" ]; then - output_name="futriis-linux" - output_path="bin/futriis-linux" - fi - - # Создаём bin директорию - mkdir -p bin - - # Сборка - 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}" - cp "${output_path}" "./${output_name}" 2>/dev/null || true - info_msg "Binary copied to: ./${output_name}" - - SIZE=$(ls -lh "${output_path}" | awk '{print $5}') - info_msg "Binary size: ${SIZE}" - return 0 - else - error_msg "Build failed for ${target_os}" - return 1 - fi -} - -# Основная функция -main() { - print_separator - echo -e "${GREEN}🔨 Building futriis database (static, no GCC required)${NC}" - print_separator - - info_msg "Detected OS: ${OS}" - - check_go - setup_vendor - - print_separator - - # Сборка для текущей ОС - BUILD_SUCCESS=true - - case "${OS}" in - linux) - if ! build_static "linux"; then - BUILD_SUCCESS=false - fi - ;; - sunos|illumos) - if ! build_static "illumos"; then - BUILD_SUCCESS=false - fi - ;; - darwin) - info_msg "Detected macOS, cross-compiling for Linux..." - if ! build_static "linux"; then - BUILD_SUCCESS=false - fi - ;; - *) - warning_msg "Unknown OS: ${OS}, building for Linux..." - if ! build_static "linux"; then - BUILD_SUCCESS=false - fi - ;; - esac - - print_separator - - if [ "$BUILD_SUCCESS" = true ]; then - success_msg "Build complete!" - echo "" - info_msg "To run the database:" - echo " ./futriis-linux # On Linux" - echo " ./futriis-illumos # On Illumos/OpenIndiana" - echo "" - info_msg "Binary location: bin/" - ls -lh bin/ 2>/dev/null || true - else - error_msg "Build failed" - exit 1 - fi -} - -# Запуск -main "$@"