mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 07:16:39 +00:00
fix(native_comp): improve handling of *.eln files in .app bundle
Specifically support latest changes in master which places *.eln files within the .app bundle in "Contents/Frameworks".
This commit is contained in:
@@ -412,20 +412,17 @@ class Build
|
||||
contents_dir = File.join(app, 'Contents')
|
||||
|
||||
FileUtils.cd(contents_dir) 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
|
||||
|
||||
if source.nil?
|
||||
err 'Failed to find native-lisp cache directory for symlink creation.'
|
||||
# Skip creation of symlinks if *.eln files are not located in a location
|
||||
# known to be used by builds which need symlinks and other tweaks.
|
||||
return if source.nil?
|
||||
|
||||
info 'Creating symlinks within Emacs.app needed for native-comp'
|
||||
|
||||
if !File.exist?('lisp') && File.exist?('Resources/lisp')
|
||||
FileUtils.ln_s('Resources/lisp', 'lisp')
|
||||
end
|
||||
|
||||
# Check for folder name containing two dots (.), as this causes Apple's
|
||||
@@ -435,10 +432,9 @@ class Build
|
||||
# The workaround for now is to rename the folder replacing the dots with
|
||||
# hyphens (-), and create the native-lisp symlink pointing to the new
|
||||
# location.
|
||||
if source.match(%r{/.+\..+\..+/})
|
||||
# Dig deeper into native-lisp directory
|
||||
eln_dir = File.dirname(Dir[File.join(source, '**', '*.eln')].first)
|
||||
eln_dir = File.dirname(Dir[File.join(source, '**', '*.eln')].first)
|
||||
|
||||
if eln_dir.match(%r{/.+\..+\..+/})
|
||||
base = File.basename(eln_dir)
|
||||
parent = File.dirname(eln_dir)
|
||||
|
||||
|
||||
@@ -117,11 +117,15 @@ func signCLIHelper(ctx context.Context, appBundle string, opts *Options) error {
|
||||
}
|
||||
|
||||
// elnFiles finds all native-compilation *.eln files within a Emacs.app bundle,
|
||||
// based on expected paths they might be stored in.
|
||||
// excluding any *.eln which should be automatically located by codesign when
|
||||
// signing the Emacs.app bundle itself with the --deep flag. Essentially this
|
||||
// only returns *.eln files which must be individually signed before signing the
|
||||
// app bundle itself.
|
||||
func elnFiles(emacsApp string) ([]string, error) {
|
||||
var files []string
|
||||
walkDirFunc := func(path string, d fs.DirEntry, _err error) error {
|
||||
if d.Type().IsRegular() && strings.HasSuffix(path, ".eln") {
|
||||
if d.Type().IsRegular() && strings.HasSuffix(path, ".eln") &&
|
||||
!strings.Contains(path, ".app/Contents/Frameworks/") {
|
||||
files = append(files, path)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user