Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

homebrew_bootsnap: require some developer tools. #10694

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 17 additions & 7 deletions Library/Homebrew/homebrew_bootsnap.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# typed: false
# frozen_string_literal: true

if !ENV["HOMEBREW_NO_BOOTSNAP"] &&
ENV["HOMEBREW_BOOTSNAP"] &&
# portable ruby doesn't play nice with bootsnap
!ENV["HOMEBREW_FORCE_VENDOR_RUBY"] &&
(!ENV["HOMEBREW_MACOS_VERSION"] || ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"]) &&
# Apple Silicon doesn't play nice with bootsnap
(ENV["HOMEBREW_PROCESSOR"] == "Intel")
homebrew_bootsnap_enabled = !ENV["HOMEBREW_NO_BOOTSNAP"] &&
ENV["HOMEBREW_BOOTSNAP"] &&
# portable ruby doesn't play nice with bootsnap
!ENV["HOMEBREW_FORCE_VENDOR_RUBY"] &&
(!ENV["HOMEBREW_MACOS_VERSION"] || ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"]) &&
# Apple Silicon doesn't play nice with bootsnap
(ENV["HOMEBREW_PROCESSOR"] == "Intel")

# we need some development tools to build bootsnap native code
development_tools_installed = if !homebrew_bootsnap_enabled
false
elsif RbConfig::CONFIG["host_os"].include? "darwin"
File.directory?("/Applications/Xcode.app") || File.directory?("/Library/Developer/CommandLineTools")
else
File.executable?("/usr/bin/clang") || File.executable?("/usr/bin/gcc")
end

if homebrew_bootsnap_enabled && development_tools_installed
require "rubygems"

begin
Expand Down