mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 06:06:40 +00:00
feat(bundle): move bundled shared libraries to Contents/Frameworks
The Frameworks folder is the recommended location to store shared libraries within macOS application bundles. Previously we stored them in Contents/MacOS/lib. Latest nightly builds already store all *.eln files under the Frameworks folder, so it seemed like a good time to make the change with the library bundler/embedder too.
This commit is contained in:
@@ -11,6 +11,7 @@ require 'net/http'
|
||||
require 'optparse'
|
||||
require 'pathname'
|
||||
require 'time'
|
||||
require 'tmpdir'
|
||||
require 'uri'
|
||||
require 'yaml'
|
||||
|
||||
@@ -735,8 +736,6 @@ class AbstractEmbedder
|
||||
@app = app
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def invocation_dir
|
||||
File.join(app, 'Contents', 'MacOS')
|
||||
end
|
||||
@@ -746,7 +745,7 @@ class AbstractEmbedder
|
||||
end
|
||||
|
||||
def lib_dir
|
||||
File.join(invocation_dir, 'lib')
|
||||
File.join(app, 'Contents', 'Frameworks')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -902,15 +901,15 @@ class GccLibEmbedder < AbstractEmbedder
|
||||
end
|
||||
|
||||
def target_dir
|
||||
File.join(invocation_dir, gcc_info.relative_lib_dir)
|
||||
File.join(lib_dir, gcc_info.relative_lib_dir)
|
||||
end
|
||||
|
||||
def source_darwin_dir
|
||||
File.join(invocation_dir, gcc_info.relative_darwin_lib_dir)
|
||||
File.join(lib_dir, gcc_info.relative_darwin_lib_dir)
|
||||
end
|
||||
|
||||
def target_darwin_dir
|
||||
File.join(invocation_dir, gcc_info.sanitized_relative_darwin_lib_dir)
|
||||
File.join(lib_dir, gcc_info.sanitized_relative_darwin_lib_dir)
|
||||
end
|
||||
|
||||
def source_dir
|
||||
@@ -966,7 +965,21 @@ class GccInfo
|
||||
def sanitized_relative_darwin_lib_dir
|
||||
@sanitized_relative_darwin_lib_dir ||= File.join(
|
||||
File.dirname(relative_darwin_lib_dir),
|
||||
File.basename(relative_darwin_lib_dir).split('.').first
|
||||
File.basename(relative_darwin_lib_dir).gsub('.', '_')
|
||||
)
|
||||
end
|
||||
|
||||
def app_bundle_relative_lib_dir
|
||||
@app_bundle_relative_lib_dir ||= relative_dir(
|
||||
File.join(embedder.lib_dir, relative_lib_dir),
|
||||
embedder.invocation_dir
|
||||
)
|
||||
end
|
||||
|
||||
def app_bundle_relative_darwin_lib_dir
|
||||
@app_bundle_relative_darwin_lib_dir ||= relative_dir(
|
||||
File.join(embedder.lib_dir, sanitized_relative_darwin_lib_dir),
|
||||
embedder.invocation_dir
|
||||
)
|
||||
end
|
||||
|
||||
@@ -1013,6 +1026,10 @@ class GccInfo
|
||||
|
||||
private
|
||||
|
||||
def embedder
|
||||
@embedder ||= AbstractEmbedder.new(Dir.mktmpdir(['Emacs', '.app']))
|
||||
end
|
||||
|
||||
def relative_dir(path, root)
|
||||
Pathname.new(path).relative_path_from(Pathname.new(root)).to_s
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
|
||||
index 8c638312b0..87af889ef4 100644
|
||||
index 638d4b274c..2599211936 100644
|
||||
--- a/lisp/emacs-lisp/comp.el
|
||||
+++ b/lisp/emacs-lisp/comp.el
|
||||
@@ -4215,6 +4215,52 @@ native-compile-async
|
||||
@@ -4224,6 +4224,52 @@ native-compile-async
|
||||
(let ((load (not (not load))))
|
||||
(native--compile-async files recursively load selector)))
|
||||
|
||||
@@ -16,10 +16,10 @@ index 8c638312b0..87af889ef4 100644
|
||||
+ (devtools-dir
|
||||
+ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib")
|
||||
+ (gcc-dir (expand-file-name
|
||||
+ "<%= relative_lib_dir %>"
|
||||
+ "<%= app_bundle_relative_lib_dir %>"
|
||||
+ invocation-directory))
|
||||
+ (darwin-dir (expand-file-name
|
||||
+ "<%= sanitized_relative_darwin_lib_dir %>"
|
||||
+ "<%= app_bundle_relative_darwin_lib_dir %>"
|
||||
+ invocation-directory))
|
||||
+ (lib-paths (list)))
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user