@@ -240,21 +240,21 @@ dev-frontend:
240240
241241# Build the frontend, bridge and desktop app and package them into a single installable.
242242[group (' package' )]
243- package :
243+ package TARGET_TRIPLE = " " :
244244 #!/usr/bin/env python
245245 import subprocess
246246 import sys
247247
248248 try:
249249 subprocess.run([" just" , " package-frontend" , " desktop_build=yes" ], check=True)
250- subprocess.run([" just" , " package-bridge" ], check=True)
251- subprocess.run([" just" , " package-desktop" ], check=True)
250+ subprocess.run([" just" , " package-bridge", " {{ TARGET_TRIPLE }} " ], check=True)
251+ subprocess.run([" just" , " package-desktop", " {{ TARGET_TRIPLE }} " ], check=True)
252252 except subprocess.CalledProcessError as e:
253253 sys.exit(e.returncode)
254254
255255# Build the bridge and package it into a single installable.
256256[group (' package' )]
257- package-bridge :
257+ package-bridge TARGET_TRIPLE = " " :
258258 #!/usr/bin/env python
259259 import os
260260 import platform
@@ -264,21 +264,29 @@ package-bridge:
264264 from pathlib import Path
265265
266266 try:
267- # Run the build command
268- subprocess.run([' just' , ' --justfile=src-syftbox/justfile' , ' build-client-target' ], check=True)
269-
270- # Get target triple
271- rustc_output = subprocess.run([' rustc' , ' -Vv' ], capture_output=True, text=True).stdout
272- target_triple = None
273- for line in rustc_output.splitlines():
274- if ' host:' in line:
275- target_triple = line.split(' host:' )[1 ].strip()
276- break
267+ target_triple = " {{ TARGET_TRIPLE }} "
268+ if not target_triple:
269+ # Get target triple
270+ rustc_output = subprocess.run([' rustc' , ' -Vv' ], capture_output=True, text=True).stdout
271+ target_triple = None
272+ for line in rustc_output.splitlines():
273+ if ' host:' in line:
274+ target_triple = line.split(' host:' )[1 ].strip()
275+ break
277276
278277 if not target_triple:
279278 print(f " {{ _red }} Failed to determine the target triple. Please check the Rust installation.{{ _nc }} " )
280279 sys.exit(1 )
281280
281+ # Run the build command
282+ if target_triple == " aarch64-apple-darwin" :
283+ subprocess.run([' just' , ' --justfile=src-syftbox/justfile' , ' build-client-target' , ' darwin' , ' arm64' ], check=True)
284+ elif target_triple == " x86_64-apple-darwin" :
285+ subprocess.run([' just' , ' --justfile=src-syftbox/justfile' , ' build-client-target' , ' darwin' , ' amd64' ], check=True)
286+ else :
287+ # The command will automatically determine the target triple
288+ subprocess.run([' just' , ' --justfile=src-syftbox/justfile' , ' build-client-target' ], check=True)
289+
282290 # Determine extension
283291 extension = ' .exe' if platform.system() == ' Windows' else ' '
284292
@@ -293,26 +301,37 @@ package-bridge:
293301 print(f " {{ _red }} No client binary found in src-syftbox/.out{{ _nc }} " )
294302 sys.exit(1 )
295303
296- for client_file in client_files:
297- shutil.copy2(client_file, dst)
304+ shutil.copy2(client_files[0], dst)
298305 except subprocess.CalledProcessError as e:
299306 sys.exit(e.returncode)
300307
301308# Build the desktop app and package it into a single installable.
302309[group (' package' )]
303- package-desktop :
310+ package-desktop TARGET_TRIPLE = " " :
304311 #!/usr/bin/env python
305312 import os
306313 import subprocess
307314 import sys
308315
309316 env = os .environ.copy()
317+ target_triple = " {{ TARGET_TRIPLE }} "
318+ if not target_triple:
319+ # Get target triple
320+ rustc_output = subprocess.run([' rustc' , ' -Vv' ], capture_output=True, text=True).stdout
321+ for line in rustc_output.splitlines():
322+ if ' host:' in line:
323+ target_triple = line.split(' host:' )[1 ].strip()
324+ break
325+
326+ if not target_triple:
327+ print(f " {{ _red }} Failed to determine the target triple. Please check the Rust installation.{{ _nc }} " )
328+ sys.exit(1 )
310329
311330 try:
312331 if env .get(' GITHUB_CI' ) == ' 1' :
313332 env [' CI' ] = ' false'
314333 env [' TAURI_BUNDLER_DMG_IGNORE_CI' ] = ' true'
315- subprocess.run([' bunx' , ' @tauri-apps/cli' , ' build' ], env =env , check=True)
334+ subprocess.run([' bunx' , ' @tauri-apps/cli' , ' build', " --ci" , " --target" , target_triple ], env =env , check=True)
316335 else :
317336 env [' TAURI_SIGNING_PRIVATE_KEY' ] = ' dummy'
318337 env [' TAURI_SIGNING_PRIVATE_KEY_PASSWORD' ] = ' dummy'
@@ -409,13 +428,26 @@ deploy-frontend-to-stage:
409428
410429# Update version numbers
411430[group (' utils' )]
412- update-version :
431+ update-version TARGET_TRIPLE = " " :
413432 #!/usr/bin/env python
414433 import json
415434 import re
416435 import subprocess
417436 from pathlib import Path
418437
438+ target_triple = " {{ TARGET_TRIPLE }} "
439+ if not target_triple:
440+ # Get target triple
441+ rustc_output = subprocess.run([' rustc' , ' -Vv' ], capture_output=True, text=True).stdout
442+ for line in rustc_output.splitlines():
443+ if ' host:' in line:
444+ target_triple = line.split(' host:' )[1 ].strip()
445+ break
446+
447+ if not target_triple:
448+ print(f " {{ _red }} Failed to determine the target triple. Please check the Rust installation.{{ _nc }} " )
449+ sys.exit(1 )
450+
419451 # Get versions
420452 with open(' src-frontend/package.json' ) as f:
421453 frontend_version = json.load(f)[' version' ]
@@ -424,7 +456,7 @@ update-version:
424456 desktop_version = json.load(f)[' version' ]
425457
426458 # Find and get daemon version
427- daemon_path = next(Path(' src-tauri/target/ binaries' ).glob(' syftbox_client*' ))
459+ daemon_path = next(Path(' src-tauri/binaries' ).glob(f ' syftbox_client-{target_triple} *' ))
428460 daemon_output = subprocess.run([str(daemon_path), ' --version' ], capture_output=True, text=True).stdout
429461 daemon_version = re.search(r' version ([0-9]+\.[0-9]+\.[0-9]+(?:-[a-zA-Z0-9]+)*)' , daemon_output).group(1 )
430462
@@ -572,7 +604,8 @@ setup skip_prerequisites="no":
572604 # Try common locations
573605 home = str(Path.home())
574606 possible_paths = [
575- os .path.join (home, ' .bun' , ' bin' , ' bun' ),
607+ os .path.join (home, ' .bun' , ' bin' , ' bun' ), # Unix
608+ os .path.join (home, ' .bun' , ' bin' , ' bun.exe' ), # Windows
576609 os .path.join (home, ' AppData' , ' Local' , ' bun' , ' bun.exe' ) # Windows
577610 ]
578611
0 commit comments