Class: Everywhere::Commands::Build

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/everywhere/commands/build.rb

Overview

Press the app into a single-file binary and make it runnable on this Mac.

Encodes the Xcode 26 / macOS 26 workarounds discovered in the Phase 0 spike:

1. CXX compiler shim (fmt consteval + folly __compressed_pair fixes)
2. BUNDLE_FORCE_RUBY_PLATFORM so native gems compile from source
 (tebako's strip corrupts precompiled gems' signatures -> SIGKILL)
3. Homebrew bison on PATH + LG_VADDR for tebako itself
4. Post-press ad-hoc re-sign (macOS 26 rejects the pressed signature)

Constant Summary collapse

SHIM =
File.expand_path("~/.tebako-shims/clang++")

Instance Method Summary collapse

Instance Method Details

#call(root: ".", output: nil, ruby: "4.0.6", entry: "native_boot.rb", app_name: nil, shell_dir: nil, skip_press: false) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/everywhere/commands/build.rb', line 33

def call(root: ".", output: nil, ruby: "4.0.6", entry: "native_boot.rb",
         app_name: nil, shell_dir: nil, skip_press: false, **)
  root_path = File.expand_path(root)
  config = Everywhere::Config.load(root_path)
  app_name ||= config.name

  # Remote mode: thin shell around an already-deployed app. No Rails app
  # required locally, nothing to press — just shell + config in a bundle.
  if config.remote?
    UI.step("#{UI.bold("remote")} mode → #{UI.cyan(config.remote_url)} #{UI.dim("(no local server packaged)")}")
    app_dir = bundle_app(nil, app_name, shell_dir, config, dist_dir: File.expand_path("dist", root_path))
    return
  end

  framework = Framework.detect(root)
  output ||= File.join("dist", File.basename(framework.root))
  output_path = File.expand_path(output)
  entry_path = File.join(framework.root, entry)

  unless File.exist?(entry_path)
    UI.die!("#{entry} not found in #{framework.root} — the app needs a packaged-boot entry point")
  end

  UI.step("#{UI.bold(framework.name)} app at #{framework.root}")

  if skip_press
    UI.die!("--skip-press given but #{output} doesn't exist") unless File.exist?(output_path)
    UI.step("reusing pressed binary #{output}")
  else
    press!(framework, entry, ruby, output_path)
  end

  bundle_app(output_path, app_name, shell_dir, config) if RUBY_PLATFORM.include?("darwin")

  UI.success("built #{output} (#{(File.size(output_path) / 1024.0 / 1024.0).round}MB)")
end