33# download-core.sh - Download runanywhere-core source from runanywhere-binaries
44#
55# This script downloads the runanywhere-core source tarball and iOS/macOS dependencies
6- # from the public runanywhere-binaries repository.
6+ # from the public runanywhere-binaries repository for REMOTE build mode .
77#
88# Usage:
99# ./scripts/download-core.sh [version]
10- # ./scripts/download-core.sh # Uses LATEST_CORE_VERSION
11- # ./scripts/download-core.sh 1.0.0 # Specific version
10+ # ./scripts/download-core.sh # Uses LATEST_CORE_VERSION
11+ # ./scripts/download-core.sh 0. 1.0 # Specific version
1212#
1313# Environment variables:
14- # RUNANYWHERE_CORE_VERSION - Override version to download
15- # SKIP_DEPS - Set to "true" to skip downloading dependencies (onnxruntime, sherpa-onnx)
14+ # RUNANYWHERE_CORE_VERSION - Override core version to download
15+ # SKIP_DEPS - Set to "true" to skip downloading dependencies
16+ #
17+ # After running this script, use BUILD_MODE=remote ./scripts/build-ios.sh
1618#
1719
1820set -e
@@ -21,6 +23,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2123PROJECT_ROOT=" $( cd " ${SCRIPT_DIR} /.." && pwd) "
2224THIRD_PARTY_DIR=" ${PROJECT_ROOT} /third_party"
2325CORE_DIR=" ${THIRD_PARTY_DIR} /runanywhere-core"
26+ DEPS_DIR=" ${CORE_DIR} /third_party"
2427
2528# GitHub repository for published binaries
2629BINARIES_REPO=" RunanywhereAI/runanywhere-binaries"
@@ -36,6 +39,8 @@ NC='\033[0m'
3639echo -e " ${GREEN} ========================================${NC} "
3740echo -e " ${GREEN} RunAnywhere Core Download Script${NC} "
3841echo -e " ${GREEN} ========================================${NC} "
42+ echo " This script prepares REMOTE build mode."
43+ echo " "
3944
4045# Determine version to download
4146get_version () {
@@ -45,19 +50,19 @@ get_version() {
4550 echo " $1 "
4651 else
4752 # Fetch latest version from runanywhere-binaries
48- echo -e " ${YELLOW} Fetching latest core version...${NC} "
53+ echo -e " ${YELLOW} Fetching latest core version...${NC} " >&2
4954 LATEST=$( curl -sL " ${RAW_URL} /LATEST_CORE_VERSION" 2> /dev/null || echo " " )
5055 if [[ -z " ${LATEST} " ]]; then
51- echo -e " ${RED} Failed to fetch LATEST_CORE_VERSION${NC} "
52- echo -e " ${YELLOW} Please specify a version: ./scripts/download-core.sh 1.0.0 ${NC} "
56+ echo -e " ${RED} Failed to fetch LATEST_CORE_VERSION${NC} " >&2
57+ echo -e " ${YELLOW} Please specify a version: ./scripts/download-core.sh 0. 1.0${NC} " >&2
5358 exit 1
5459 fi
5560 echo " ${LATEST} "
5661 fi
5762}
5863
5964VERSION=$( get_version " $1 " )
60- echo " Version: ${VERSION} "
65+ echo " Core Version: ${VERSION} "
6166echo " "
6267
6368# Create directories
@@ -106,35 +111,40 @@ download_ios_deps() {
106111 return
107112 fi
108113
109- local IOS_DEPS_DIR=" ${CORE_DIR} /third_party"
110- mkdir -p " ${IOS_DEPS_DIR} "
114+ mkdir -p " ${DEPS_DIR} "
111115
112116 # ONNX Runtime for iOS
113117 echo -e " ${GREEN} Downloading ONNX Runtime for iOS...${NC} "
114118 local ONNX_ZIP=" onnxruntime-ios-v${VERSION} .zip"
115119 local ONNX_URL=" ${BINARIES_URL} /releases/download/core-v${VERSION} /${ONNX_ZIP} "
120+ echo " URL: ${ONNX_URL} "
116121
117- if curl -L --fail -o " ${IOS_DEPS_DIR } /${ONNX_ZIP} " " ${ONNX_URL} " 2> /dev/null; then
118- cd " ${IOS_DEPS_DIR } "
122+ if curl -L --fail -o " ${DEPS_DIR } /${ONNX_ZIP} " " ${ONNX_URL} " 2> /dev/null; then
123+ cd " ${DEPS_DIR } "
119124 unzip -q -o " ${ONNX_ZIP} "
120125 rm " ${ONNX_ZIP} "
121126 echo -e " ${GREEN} ✓ ONNX Runtime for iOS downloaded${NC} "
127+ # List what was extracted
128+ ls -la * .xcframework 2> /dev/null || true
122129 else
123- echo -e " ${YELLOW} ⚠ ONNX Runtime for iOS not found in release (may need separate download) ${NC} "
130+ echo -e " ${YELLOW} ⚠ ONNX Runtime for iOS not found in release${NC} "
124131 fi
125132
126133 # Sherpa-ONNX for iOS
127134 echo -e " ${GREEN} Downloading Sherpa-ONNX for iOS...${NC} "
128135 local SHERPA_ZIP=" sherpa-onnx-ios-v${VERSION} .zip"
129136 local SHERPA_URL=" ${BINARIES_URL} /releases/download/core-v${VERSION} /${SHERPA_ZIP} "
137+ echo " URL: ${SHERPA_URL} "
130138
131- if curl -L --fail -o " ${IOS_DEPS_DIR } /${SHERPA_ZIP} " " ${SHERPA_URL} " 2> /dev/null; then
132- cd " ${IOS_DEPS_DIR } "
139+ if curl -L --fail -o " ${DEPS_DIR } /${SHERPA_ZIP} " " ${SHERPA_URL} " 2> /dev/null; then
140+ cd " ${DEPS_DIR } "
133141 unzip -q -o " ${SHERPA_ZIP} "
134142 rm " ${SHERPA_ZIP} "
135143 echo -e " ${GREEN} ✓ Sherpa-ONNX for iOS downloaded${NC} "
144+ # List what was extracted
145+ ls -la * .xcframework 2> /dev/null || true
136146 else
137- echo -e " ${YELLOW} ⚠ Sherpa-ONNX for iOS not found in release (may need separate download) ${NC} "
147+ echo -e " ${YELLOW} ⚠ Sherpa-ONNX for iOS not found in release${NC} "
138148 fi
139149
140150 cd " ${PROJECT_ROOT} "
@@ -149,21 +159,21 @@ download_macos_deps() {
149159 return
150160 fi
151161
152- local MACOS_DEPS_DIR=" ${CORE_DIR} /third_party"
153- mkdir -p " ${MACOS_DEPS_DIR} "
162+ mkdir -p " ${DEPS_DIR} "
154163
155164 # ONNX Runtime for macOS
156165 echo -e " ${GREEN} Downloading ONNX Runtime for macOS...${NC} "
157166 local ONNX_ZIP=" onnxruntime-macos-v${VERSION} .zip"
158167 local ONNX_URL=" ${BINARIES_URL} /releases/download/core-v${VERSION} /${ONNX_ZIP} "
168+ echo " URL: ${ONNX_URL} "
159169
160- if curl -L --fail -o " ${MACOS_DEPS_DIR } /${ONNX_ZIP} " " ${ONNX_URL} " 2> /dev/null; then
161- cd " ${MACOS_DEPS_DIR } "
170+ if curl -L --fail -o " ${DEPS_DIR } /${ONNX_ZIP} " " ${ONNX_URL} " 2> /dev/null; then
171+ cd " ${DEPS_DIR } "
162172 unzip -q -o " ${ONNX_ZIP} "
163173 rm " ${ONNX_ZIP} "
164174 echo -e " ${GREEN} ✓ ONNX Runtime for macOS downloaded${NC} "
165175 else
166- echo -e " ${YELLOW} ⚠ ONNX Runtime for macOS not found in release (may need separate download) ${NC} "
176+ echo -e " ${YELLOW} ⚠ ONNX Runtime for macOS not found in release${NC} "
167177 fi
168178
169179 cd " ${PROJECT_ROOT} "
@@ -177,6 +187,35 @@ save_version_info() {
177187 echo -e " ${GREEN} Version ${VERSION} saved to DOWNLOADED_VERSION${NC} "
178188}
179189
190+ # =============================================================================
191+ # Verify downloads
192+ # =============================================================================
193+ verify_downloads () {
194+ echo " "
195+ echo -e " ${GREEN} Verifying downloads...${NC} "
196+
197+ # Check core source
198+ if [ -f " ${CORE_DIR} /CMakeLists.txt" ]; then
199+ echo -e " ${GREEN} ✓ Core source${NC} "
200+ else
201+ echo -e " ${RED} ✗ Core source NOT found${NC} "
202+ fi
203+
204+ # Check sherpa-onnx
205+ if [ -d " ${DEPS_DIR} /sherpa-onnx.xcframework" ]; then
206+ echo -e " ${GREEN} ✓ sherpa-onnx.xcframework${NC} "
207+ else
208+ echo -e " ${YELLOW} ⚠ sherpa-onnx.xcframework not found${NC} "
209+ fi
210+
211+ # Check onnxruntime
212+ if [ -d " ${DEPS_DIR} /onnxruntime.xcframework" ]; then
213+ echo -e " ${GREEN} ✓ onnxruntime.xcframework${NC} "
214+ else
215+ echo -e " ${YELLOW} ⚠ onnxruntime.xcframework not found${NC} "
216+ fi
217+ }
218+
180219# =============================================================================
181220# Main
182221# =============================================================================
@@ -185,14 +224,23 @@ download_core_source
185224download_ios_deps
186225download_macos_deps
187226save_version_info
227+ verify_downloads
188228
189229echo " "
190230echo -e " ${GREEN} ========================================${NC} "
191231echo -e " ${GREEN} Download Complete!${NC} "
192232echo -e " ${GREEN} ========================================${NC} "
193- echo " Core source: ${CORE_DIR} "
233+ echo " "
234+ echo " Downloaded to: ${CORE_DIR} "
194235echo " Version: ${VERSION} "
195236echo " "
196- echo " To use in CMake, set:"
197- echo " -DRUNANYWHERE_CORE_DIR=${CORE_DIR} "
237+ echo " Directory structure:"
238+ echo " third_party/"
239+ echo " runanywhere-core/ # Core source"
240+ echo " third_party/"
241+ echo " sherpa-onnx.xcframework # STT/TTS/VAD"
242+ echo " onnxruntime.xcframework # ONNX Runtime"
243+ echo " "
244+ echo " To build iOS XCFrameworks:"
245+ echo " BUILD_MODE=remote ./scripts/build-ios.sh"
198246echo " "
0 commit comments