Update build.sh

This commit is contained in:
2026-05-20 18:58:48 +00:00
parent 95d67d9197
commit 1649aaa293

View File

@@ -7,13 +7,13 @@
# You may obtain a copy of the License at
# https://opensource.org/licenses/CDDL-1.0
#
# Универсальный скрипт сборки futriis для Linux и Illumos
# Универсальный скрипт сборки futriix для Linux и Illumos
# НЕ ТРЕБУЕТ GCC - использует CGO_ENABLED=0 для всех платформ
set -e
echo ""
echo "🔨 Building futriis database..."
echo "🔨 Building futriix database..."
# Определение ОС
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
@@ -23,16 +23,16 @@ if [ -t 1 ]; then
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[1;36m' # Жирный-голубой (cyan)
LIGHT_CYAN='\033[1;36m'
NC='\033[0m'
else
RED=''; GREEN=''; YELLOW=''; CYAN=''; NC=''
RED=''; GREEN=''; YELLOW=''; LIGHT_CYAN=''; NC=''
fi
# Функции
error_msg() { echo -e "${RED}$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}"; }
print_separator() { echo "================================================"; }
@@ -47,7 +47,6 @@ check_go() {
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)"
}
@@ -56,7 +55,6 @@ check_go() {
setup_vendor() {
info_msg "Checking vendor directory..."
# Проверяем, нужно ли обновить vendor
NEED_VENDOR=false
if [ ! -d "vendor" ] || [ ! -f "vendor/modules.txt" ]; then
@@ -86,7 +84,7 @@ setup_vendor() {
build_static() {
local target_os=$1
local target_arch="amd64"
local output_name="futriis-${target_os}"
local output_name="futriix-${target_os}"
local output_path="bin/${output_name}"
info_msg "Building for ${target_os} (static, no CGO)..."
@@ -98,17 +96,15 @@ build_static() {
local build_tags=""
if [ "${target_os}" = "illumos" ] || [ "${target_os}" = "solaris" ]; then
build_tags="-tags=illumos"
output_name="futriis-illumos"
output_path="bin/futriis-illumos"
output_name="futriix-illumos"
output_path="bin/futriix-illumos"
elif [ "${target_os}" = "linux" ]; then
output_name="futriis-linux"
output_path="bin/futriis-linux"
output_name="futriix-linux"
output_path="bin/futriix-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
@@ -126,7 +122,7 @@ build_static() {
# Основная функция
main() {
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
info_msg "Detected OS: ${OS}"
@@ -136,7 +132,6 @@ main() {
print_separator
# Сборка для текущей ОС
BUILD_SUCCESS=true
case "${OS}" in
@@ -170,8 +165,8 @@ main() {
success_msg "Build complete!"
echo ""
info_msg "To run the database:"
echo " ./futriis-linux # On Linux"
echo " ./futriis-illumos # On Illumos/OpenIndiana"
echo " ./futriix-linux # On Linux"
echo " ./futriix-illumos # On Illumos/OpenIndiana"
echo ""
info_msg "Binary location: bin/"
ls -lh bin/ 2>/dev/null || true
@@ -181,5 +176,4 @@ main() {
fi
}
# Запуск
main "$@"