@@ -33,7 +33,7 @@ JAR_LIB_DIR="${3:-}"
3333
3434print_header () {
3535 echo -e " ${BLUE} ╔════════════════════════════════════════════════════════════╗${NC} "
36- echo -e " ${BLUE} ║ 🎮 ArcadeDB Python Package - Docker Build Script ║${NC} "
36+ echo -e " ${BLUE} ║ 🎮 ArcadeDB Python Package - Build Script ║${NC} "
3737 echo -e " ${BLUE} ╚════════════════════════════════════════════════════════════╝${NC} "
3838 echo " "
3939}
@@ -60,7 +60,7 @@ print_usage() {
6060 echo " If omitted, JARs are pulled from arcadedata/arcadedb:<version>"
6161 echo " "
6262 echo " Build Methods:"
63- echo " Native: macOS builds natively on its platform "
63+ echo " Native: macOS/Windows build on matching native host architecture "
6464 echo " Docker: Linux uses Docker for manylinux compliance"
6565 echo " "
6666 echo " Examples:"
@@ -74,10 +74,24 @@ print_usage() {
7474 echo " ✅ Bundled platform-specific JRE (no Java required)"
7575 echo " ✅ Optimized JAR selection (see scripts/jar_exclusions.txt)"
7676 echo " ✅ Multi-platform support (4 platforms)"
77- echo " 📦 Size: ~215MB (compressed), ~289MB (installed) "
77+ echo " 📦 Size varies by platform/version; see CI summaries for current numbers "
7878 echo " "
7979}
8080
81+ normalize_arch () {
82+ case " $1 " in
83+ x86_64 | amd64)
84+ echo " amd64"
85+ ;;
86+ aarch64 | arm64)
87+ echo " arm64"
88+ ;;
89+ * )
90+ echo " $1 "
91+ ;;
92+ esac
93+ }
94+
8195# Check for help flag
8296if [[ " ${1:- } " == " -h" || " ${1:- } " == " --help" ]]; then
8397 print_header
176190# Use native build if we're already on the target platform
177191CURRENT_OS=" $( uname -s) "
178192CURRENT_ARCH=" $( uname -m) "
193+ CURRENT_ARCH_NORMALIZED=" $( normalize_arch " $CURRENT_ARCH " ) "
194+ TARGET_OS=" ${PLATFORM%%/* } "
195+ TARGET_ARCH=" ${PLATFORM##*/ } "
179196
180197USE_NATIVE=false
181- if [[ " $PLATFORM " == " darwin/" * ]] && [[ " $CURRENT_OS " == " Darwin" ]]; then
198+ if [[ " $TARGET_OS " == " darwin" ]]; then
199+ if [[ " $CURRENT_OS " != " Darwin" ]]; then
200+ echo -e " ${RED} ❌ ${PLATFORM} builds require a native macOS host${NC} "
201+ echo -e " ${YELLOW} 💡 jlink can only create a macOS JRE when run on macOS${NC} "
202+ exit 1
203+ fi
204+ if [[ " $CURRENT_ARCH_NORMALIZED " != " $TARGET_ARCH " ]]; then
205+ echo -e " ${RED} ❌ ${PLATFORM} builds require a matching native macOS architecture${NC} "
206+ echo -e " ${YELLOW} 💡 Host architecture: ${CURRENT_ARCH_NORMALIZED} ; target architecture: ${TARGET_ARCH}${NC} "
207+ exit 1
208+ fi
182209 USE_NATIVE=true
183- elif [[ " $PLATFORM " == " windows/" * ]] && [[ " $CURRENT_OS " == MINGW* || " $CURRENT_OS " == MSYS* || " $CURRENT_OS " == CYGWIN* ]]; then
210+ elif [[ " $TARGET_OS " == " windows" ]]; then
211+ if [[ " $CURRENT_OS " != MINGW* && " $CURRENT_OS " != MSYS* && " $CURRENT_OS " != CYGWIN* ]]; then
212+ echo -e " ${RED} ❌ ${PLATFORM} builds require a native Windows host${NC} "
213+ echo -e " ${YELLOW} 💡 jlink can only create a Windows JRE when run on Windows${NC} "
214+ exit 1
215+ fi
216+ if [[ " $CURRENT_ARCH_NORMALIZED " != " $TARGET_ARCH " ]]; then
217+ echo -e " ${RED} ❌ ${PLATFORM} builds require a matching native Windows architecture${NC} "
218+ echo -e " ${YELLOW} 💡 Host architecture: ${CURRENT_ARCH_NORMALIZED} ; target architecture: ${TARGET_ARCH}${NC} "
219+ exit 1
220+ fi
184221 USE_NATIVE=true
185- elif [[ " $PLATFORM " == " linux/amd64" ]] && [[ " $CURRENT_OS " == " Linux" ]] && [[ " $CURRENT_ARCH " == " x86_64" ]]; then
186- # For Linux, still use Docker for reproducibility (manylinux compliance)
187- USE_NATIVE=false
188222fi
189223
190224BUILD_METHOD=" Docker"
@@ -258,13 +292,6 @@ else
258292 # Determine Docker build platform (always Linux for cross-compilation)
259293 # We build ON linux/amd64 or linux/arm64, but FOR any target platform
260294 DOCKER_PLATFORM=" ${PLATFORM} "
261- if [[ " $PLATFORM " == darwin/* ]] || [[ " $PLATFORM " == windows/* ]]; then
262- # Cross-compiling for macOS/Windows - build on Linux
263- DOCKER_PLATFORM=" linux/amd64"
264- echo -e " ${CYAN} 🔧 Cross-compiling: Building on linux/amd64 for ${YELLOW}${PLATFORM}${NC} "
265- echo " "
266- fi
267-
268295 # Build Docker image
269296 echo -e " ${CYAN} 📦 Building Docker image...${NC} "
270297
0 commit comments