Skip to content

Add support for bottling Portable Ruby for ARM64 Linux #19111

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

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/extend/os/linux/extend/ENV/super.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def homebrew_extra_paths

def homebrew_extra_isystem_paths
paths = []
# Add paths for GCC headers when building against glibc@2.13 because we have to use -nostdinc.
if deps.any? { |d| d.name == "glibc@2.13" }
# Add paths for GCC headers when building against versioned glibc because we have to use -nostdinc.
if deps.any? { |d| d.name.match?(/^glibc@.+$/) }
gcc_include_dir = Utils.safe_popen_read(cc, "--print-file-name=include").chomp
gcc_include_fixed_dir = Utils.safe_popen_read(cc, "--print-file-name=include-fixed").chomp
paths << gcc_include_dir << gcc_include_fixed_dir
Expand Down
13 changes: 7 additions & 6 deletions Library/Homebrew/shims/super/cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ class Cmd
def cppflags
args = []
args += path_flags("-isystem", isystem_paths) + path_flags("-I", include_paths)
# Add -nostdinc when building against glibc@2.13 to avoid mixing system and brewed glibc headers.
args << "-nostdinc" if @deps.include?("glibc@2.13")
# Add -nostdinc when building against versioned glibc to avoid mixing system and brewed glibc headers.
args << "-nostdinc" if @deps.any? { |dep| dep.match?(/^glibc@.+$/) }
# Ideally this would be -ffile-prefix-map, but that requires a minimum of GCC 8, LLVM Clang 10 or Apple Clang 12
# and detecting the version dynamically based on what `HOMEBREW_CC` may have been rewritten to point to is awkward
args << "-fdebug-prefix-map=#{formula_buildpath}=." if formula_buildpath && !debug_symbols?
Expand All @@ -353,19 +353,20 @@ class Cmd
end

def ldflags_linux(args)
versioned_glibc_dep = @deps.find { |dep| dep.match?(/^glibc@.+$/) }
unless mode == :ld
wl = "-Wl,"
if @deps.include?("[email protected]")
args << "-B#{@opt}/[email protected]/lib"
if versioned_glibc_dep
args << "-B#{@opt}/#{versioned_glibc_dep}/lib"
else
args << "-B#{@opt}/glibc/lib"
end
end
args += rpath_flags("#{wl}-rpath=", rpath_paths)
args += ["#{wl}--dynamic-linker=#{dynamic_linker_path}"] if dynamic_linker_path
# Use -rpath-link to make sure linker uses glibc@2.13 rather than the system glibc for indirect
# Use -rpath-link to make sure linker uses versioned glibc rather than the system glibc for indirect
# dependencies because -L will only handle direct dependencies.
args << "#{wl}-rpath-link=#{@opt}/[email protected]/lib" if @deps.include?("[email protected]")
args << "#{wl}-rpath-link=#{@opt}/#{versioned_glibc_dep}/lib" if versioned_glibc_dep
args
end

Expand Down
Loading