Update vendor_build.sh
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
# You may obtain a copy of the License at
|
||||
# https://opensource.org/licenses/CDDL-1.0
|
||||
#
|
||||
# Скрипт сборки futriis с использованием vendoring зависимостей
|
||||
# Скрипт сборки futriix с использованием vendoring зависимостей
|
||||
# Поддерживает Linux и Illumos (OpenIndiana)
|
||||
# НЕ ТРЕБУЕТ GCC - использует CGO_ENABLED=0 для всех платформ
|
||||
|
||||
@@ -18,16 +18,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[0;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}"; }
|
||||
info_msg() { echo -e "${LIGHT_CYAN}📋 $1${NC}"; }
|
||||
warning_msg() { echo -e "${YELLOW}⚠️ $1${NC}"; }
|
||||
print_separator() { echo "================================================"; }
|
||||
|
||||
@@ -42,7 +42,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)"
|
||||
}
|
||||
@@ -51,7 +50,6 @@ check_go() {
|
||||
setup_vendor() {
|
||||
info_msg "Checking vendor directory..."
|
||||
|
||||
# Проверяем, нужно ли обновить vendor
|
||||
NEED_VENDOR=false
|
||||
|
||||
if [ ! -d "vendor" ] || [ ! -f "vendor/modules.txt" ]; then
|
||||
@@ -87,7 +85,7 @@ create_bin_dir() {
|
||||
build_static() {
|
||||
local target_os=$1
|
||||
local target_arch="amd64"
|
||||
local output_name="futriis-${target_os}-vendor"
|
||||
local output_name="futriix-${target_os}-vendor"
|
||||
|
||||
info_msg "Building for ${target_os} (static, no CGO)..."
|
||||
|
||||
@@ -98,9 +96,9 @@ build_static() {
|
||||
local build_tags=""
|
||||
if [ "${target_os}" = "illumos" ] || [ "${target_os}" = "solaris" ]; then
|
||||
build_tags="-tags=illumos"
|
||||
output_name="futriis-illumos-vendor"
|
||||
output_name="futriix-illumos-vendor"
|
||||
elif [ "${target_os}" = "linux" ]; then
|
||||
output_name="futriis-linux-vendor"
|
||||
output_name="futriix-linux-vendor"
|
||||
fi
|
||||
|
||||
local output_path="bin/${output_name}"
|
||||
@@ -129,15 +127,15 @@ build_current() {
|
||||
|
||||
export CGO_ENABLED=0
|
||||
|
||||
local output_path="bin/futriis-current-vendor"
|
||||
local output_path="bin/futriix-current-vendor"
|
||||
|
||||
if go build -mod=vendor \
|
||||
-ldflags="-s -w -X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||
-o "${output_path}" ./cmd/futriis; then
|
||||
|
||||
success_msg "Current OS build successful: ${output_path}"
|
||||
cp "${output_path}" ./futriis-current-vendor 2>/dev/null || true
|
||||
info_msg "Binary copied to: ./futriis-current-vendor"
|
||||
cp "${output_path}" ./futriix-current-vendor 2>/dev/null || true
|
||||
info_msg "Binary copied to: ./futriix-current-vendor"
|
||||
|
||||
SIZE=$(ls -lh "${output_path}" | awk '{print $5}')
|
||||
info_msg "Binary size: $SIZE"
|
||||
@@ -151,8 +149,8 @@ build_current() {
|
||||
# Очистка
|
||||
clean() {
|
||||
info_msg "Cleaning binary files..."
|
||||
rm -f bin/futriis-*-vendor
|
||||
rm -f ./futriis-*-vendor
|
||||
rm -f bin/futriix-*-vendor
|
||||
rm -f ./futriix-*-vendor
|
||||
success_msg "Clean completed"
|
||||
}
|
||||
|
||||
@@ -209,7 +207,7 @@ show_help() {
|
||||
# Основная функция
|
||||
main() {
|
||||
print_separator
|
||||
echo -e "${GREEN}🔨 Building futriis database with vendoring (no GCC required)${NC}"
|
||||
echo -e "${GREEN}🔨 Building futriix database with vendoring (no GCC required)${NC}"
|
||||
print_separator
|
||||
|
||||
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
@@ -258,11 +256,11 @@ main() {
|
||||
success_msg "All builds completed successfully!"
|
||||
echo ""
|
||||
info_msg "Generated binaries:"
|
||||
ls -lh bin/futriis-*-vendor 2>/dev/null || echo " No binaries in bin/"
|
||||
ls -lh bin/futriix-*-vendor 2>/dev/null || echo " No binaries in bin/"
|
||||
echo ""
|
||||
info_msg "To run the database:"
|
||||
echo " ./futriis-linux-vendor # On Linux"
|
||||
echo " ./futriis-illumos-vendor # On Illumos/OpenIndiana"
|
||||
echo " ./futriix-linux-vendor # On Linux"
|
||||
echo " ./futriix-illumos-vendor # On Illumos/OpenIndiana"
|
||||
echo ""
|
||||
info_msg "Note: All binaries are statically linked and do not require GCC"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user