From 1000999eb2673dc207a390ff3f902b9987b99173 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 8 Apr 2021 11:54:01 +0100 Subject: [PATCH] fix(native_comp): skip symlink creation for recent builds which do not need symlinks Recent builds places the native-lisp cache folder within Contents/Resources on macOS, and correctly deals with finding them. This means the Contents/lisp and Contents/native-lisp symlinks are no longer needed. Hence we skip their creation altogether if we find any Contents/Resources/native-lisp/**/*.eln files. --- build-emacs-for-macos | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build-emacs-for-macos b/build-emacs-for-macos index 68c941c..c917f5c 100755 --- a/build-emacs-for-macos +++ b/build-emacs-for-macos @@ -339,13 +339,20 @@ class Build def symlink_internals(app) return unless options[:native_comp] - info 'Creating symlinks within Emacs.app needed for native-comp' - FileUtils.cd(File.join(app, 'Contents')) do + # Skip creation of symlinks if *.eln files are located under + # Resources/native-lisp. Emacs is capable of finding lisp sources and + # *.eln cache files without symlinks. + return if Dir['Resources/native-lisp/**/*.eln'].any? + + info 'Creating symlinks within Emacs.app needed for native-comp' + FileUtils.ln_s('Resources/lisp', 'lisp') unless File.exist?('lisp') source = Dir['MacOS/libexec/emacs/**/eln-cache', 'MacOS/lib/emacs/**/native-lisp'].first + err 'Failed to find native-lisp cache directory for symlink creation.' + target = File.basename(source) FileUtils.ln_s(source, target) unless File.exist?(target) end