mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 08:26:39 +00:00
fix(native_comp): crash on launch when gcc homebrew package was not installed
It turns out all *.eln files link against the libgcc dylib in homebrew:
/usr/local/lib/gcc/11/libgcc_s.1.dylib
So here we find all *.eln files in all relevant paths they may be
depending on how old of a native-comp source tree we're building, and
copy in any shared libs that resides within the homebrew prefix. Just
like we do for all other binaries that we copy libs for.
This commit is contained in:
@@ -652,11 +652,35 @@ class LibEmbedder < AbstractEmbedder
|
||||
FileUtils.cd(File.dirname(app)) do
|
||||
copy_libs(binary)
|
||||
copy_extra_libs(extra_libs, binary) if extra_libs.any?
|
||||
if eln_files.any?
|
||||
info "Embedding libraries for #{eln_files.size} *.eln files " \
|
||||
'within Emacs.app'
|
||||
rel_path = Pathname.new(lib_dir).relative_path_from(
|
||||
Pathname.new(File.dirname(binary))
|
||||
).to_s
|
||||
eln_files.each { |f| copy_libs(f, rel_path) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def eln_files
|
||||
@eln_files ||= Dir[
|
||||
File.join(
|
||||
app, 'Contents', 'Resources', 'native-lisp', '**', '*.eln'
|
||||
),
|
||||
File.join(
|
||||
app, 'Contents', 'MacOS', 'lib', 'emacs', '**',
|
||||
'native-lisp', '**', '*.eln'
|
||||
),
|
||||
File.join(
|
||||
app, 'Contents', 'MacOS', 'libexec', 'emacs', '**',
|
||||
'eln-cache', '**', '*.eln'
|
||||
)
|
||||
]
|
||||
end
|
||||
|
||||
def copy_libs(exe, rel_path = nil)
|
||||
exe_file = File.basename(exe)
|
||||
rel_path ||= Pathname.new(lib_dir).relative_path_from(
|
||||
|
||||
Reference in New Issue
Block a user