44 * Build script for creating single-file executables from Claude Code package
55 * Uses Bun's native embedding features with all optimizations enabled
66 *
7+ * Output files follow Tauri sidecar triple naming convention: name-platform-architecture
8+ * Examples: claude-code-x86_64-apple-darwin, claude-code-aarch64-unknown-linux-gnu
9+ *
710 * Usage:
811 * bun run build-executables.js # Build all platforms
912 * bun run build-executables.js linux # Build Linux executables only
@@ -21,35 +24,35 @@ import { join } from 'path';
2124const PLATFORMS = {
2225 linux : [
2326 // Linux x64 - glibc
24- { target : 'bun-linux-x64' , output : 'claude-code-linux-x64 ' } ,
25- { target : 'bun-linux-x64-modern' , output : 'claude-code-linux-x64-modern ' } ,
26- { target : 'bun-linux-x64-baseline' , output : 'claude-code-linux-x64-baseline ' } ,
27+ { target : 'bun-linux-x64' , output : 'claude-code-x86_64-unknown- linux-gnu ' } ,
28+ { target : 'bun-linux-x64-modern' , output : 'claude-code-modern-x86_64-unknown-linux-gnu ' } ,
29+ { target : 'bun-linux-x64-baseline' , output : 'claude-code-baseline-x86_64-unknown-linux-gnu ' } ,
2730
2831 // Linux ARM64 - glibc
29- { target : 'bun-linux-arm64' , output : 'claude-code-linux-arm64 ' } ,
32+ { target : 'bun-linux-arm64' , output : 'claude-code-aarch64-unknown- linux-gnu ' } ,
3033
3134 // Linux x64 - musl (Alpine Linux, etc.)
32- { target : 'bun-linux-x64-musl' , output : 'claude-code-linux-x64 -musl' } ,
33- { target : 'bun-linux-x64-musl-modern' , output : 'claude-code-linux-x64-musl-modern ' } ,
34- { target : 'bun-linux-x64-musl-baseline' , output : 'claude-code-linux-x64-musl-baseline ' } ,
35+ { target : 'bun-linux-x64-musl' , output : 'claude-code-x86_64-unknown-linux -musl' } ,
36+ { target : 'bun-linux-x64-musl-modern' , output : 'claude-code-modern-x86_64-unknown-linux-musl ' } ,
37+ { target : 'bun-linux-x64-musl-baseline' , output : 'claude-code-baseline-x86_64-unknown-linux-musl ' } ,
3538
3639 // Linux ARM64 - musl
37- { target : 'bun-linux-arm64-musl' , output : 'claude-code-linux-arm64 -musl' }
40+ { target : 'bun-linux-arm64-musl' , output : 'claude-code-aarch64-unknown-linux -musl' }
3841 ] ,
3942 macos : [
4043 // macOS x64
41- { target : 'bun-darwin-x64' , output : 'claude-code-macos-x64 ' } ,
42- { target : 'bun-darwin-x64-modern' , output : 'claude-code-macos-x64-modern ' } ,
43- { target : 'bun-darwin-x64-baseline' , output : 'claude-code-macos-x64-baseline ' } ,
44+ { target : 'bun-darwin-x64' , output : 'claude-code-x86_64-apple-darwin ' } ,
45+ { target : 'bun-darwin-x64-modern' , output : 'claude-code-modern-x86_64-apple-darwin ' } ,
46+ { target : 'bun-darwin-x64-baseline' , output : 'claude-code-baseline-x86_64-apple-darwin ' } ,
4447
4548 // macOS ARM64 (Apple Silicon)
46- { target : 'bun-darwin-arm64' , output : 'claude-code-macos-arm64 ' }
49+ { target : 'bun-darwin-arm64' , output : 'claude-code-aarch64-apple-darwin ' }
4750 ] ,
4851 windows : [
4952 // Windows x64
50- { target : 'bun-windows-x64' , output : 'claude-code-windows-x64 .exe' } ,
51- { target : 'bun-windows-x64-modern' , output : 'claude-code-windows-x64-modern .exe' } ,
52- { target : 'bun-windows-x64-baseline' , output : 'claude-code-windows-x64-baseline .exe' }
53+ { target : 'bun-windows-x64' , output : 'claude-code-x86_64-pc- windows-msvc .exe' } ,
54+ { target : 'bun-windows-x64-modern' , output : 'claude-code-modern-x86_64-pc-windows-msvc .exe' } ,
55+ { target : 'bun-windows-x64-baseline' , output : 'claude-code-baseline-x86_64-pc-windows-msvc .exe' }
5356 ]
5457} ;
5558
@@ -109,16 +112,20 @@ async function cleanupBundledFile() {
109112}
110113
111114async function getCurrentPlatform ( ) {
112- const arch = process . arch === 'x64' ? 'x64' : 'arm64' ;
113- const platform = process . platform === 'darwin' ? 'darwin' :
114- process . platform === 'linux' ? 'linux' :
115- process . platform === 'win32' ? 'windows' : null ;
115+ const arch = process . arch === 'x64' ? 'x86_64' : 'aarch64' ;
116+ let targetTriple ;
116117
117- if ( ! platform ) {
118+ if ( process . platform === 'darwin' ) {
119+ targetTriple = `${ arch } -apple-darwin` ;
120+ } else if ( process . platform === 'linux' ) {
121+ targetTriple = `${ arch } -unknown-linux-gnu` ;
122+ } else if ( process . platform === 'win32' ) {
123+ targetTriple = `${ arch } -pc-windows-msvc` ;
124+ } else {
118125 throw new Error ( `Unsupported platform: ${ process . platform } ` ) ;
119126 }
120127
121- return `bun- ${ platform } - ${ arch } ` ;
128+ return targetTriple ;
122129}
123130
124131async function main ( ) {
@@ -146,17 +153,19 @@ async function main() {
146153 platformsToBuild = PLATFORMS . windows ;
147154 } else if ( arg === 'current' ) {
148155 // Build only for current platform
149- const currentTarget = await getCurrentPlatform ( ) ;
156+ const currentTargetTriple = await getCurrentPlatform ( ) ;
150157 const allPlatforms = [
151158 ...PLATFORMS . linux ,
152159 ...PLATFORMS . macos ,
153160 ...PLATFORMS . windows
154161 ] ;
155- const current = allPlatforms . find ( p => p . target === currentTarget ) ;
162+
163+ // Find platform by matching the target triple in the output name
164+ const current = allPlatforms . find ( p => p . output . includes ( currentTargetTriple ) ) ;
156165 if ( current ) {
157166 platformsToBuild = [ current ] ;
158167 } else {
159- console . error ( `Current platform ${ currentTarget } not found in build targets` ) ;
168+ console . error ( `Current platform ${ currentTargetTriple } not found in build targets` ) ;
160169 process . exit ( 1 ) ;
161170 }
162171 } else {
@@ -189,6 +198,7 @@ async function main() {
189198 console . log ( '\nExecutables are available in the src-tauri/binaries/ directory' ) ;
190199 console . log ( '\nNotes:' ) ;
191200 console . log ( '- All executables include embedded assets (yoga.wasm, ripgrep binaries)' ) ;
201+ console . log ( '- File names follow Tauri sidecar triple naming convention (name-platform-architecture)' ) ;
192202 console . log ( '- Modern variants require CPUs from 2013+ (AVX2 support)' ) ;
193203 console . log ( '- Baseline variants support older CPUs (pre-2013)' ) ;
194204 console . log ( '- Musl variants are for Alpine Linux and similar distributions' ) ;
0 commit comments