mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
3f1059940d
|
|||
|
5c722e36c5
|
|||
|
f52dd8dc6d
|
|||
|
4cdbaf1ec0
|
|||
|
f3a289b11c
|
|||
|
9019e73d60
|
|||
|
28930381a8
|
|||
|
df25e54ef7
|
|||
|
6d21d1bef4
|
|||
|
99aa76b398
|
25
CHANGELOG.md
25
CHANGELOG.md
@@ -2,6 +2,31 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.6.7](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.6...v0.6.7) (2021-07-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **bundle:** move bundled shared libraries to Contents/Frameworks ([5c722e3](https://github.com/jimeh/build-emacs-for-macos/commit/5c722e36c571aa7bf558b7f210c011f12d8d8a1c))
|
||||||
|
|
||||||
|
### [0.6.6](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.5...v0.6.6) (2021-07-01)
|
||||||
|
|
||||||
|
### [0.6.5](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.4...v0.6.5) (2021-07-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **native_comp:** improve handling of *.eln files in .app bundle ([9019e73](https://github.com/jimeh/build-emacs-for-macos/commit/9019e73d606f0379f988f46d6008770f8f3f7a51))
|
||||||
|
|
||||||
|
### [0.6.4](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.3...v0.6.4) (2021-06-30)
|
||||||
|
|
||||||
|
### [0.6.3](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.2...v0.6.3) (2021-06-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **patches:** correctly set ref when loading a build plan YAML ([99aa76b](https://github.com/jimeh/build-emacs-for-macos/commit/99aa76b3985195c310a20bafa19a8c7a4c8558fd))
|
||||||
|
|
||||||
### [0.6.2](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.1...v0.6.2) (2021-06-29)
|
### [0.6.2](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.1...v0.6.2) (2021-06-29)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ require 'net/http'
|
|||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'time'
|
require 'time'
|
||||||
|
require 'tmpdir'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
||||||
@@ -117,9 +118,10 @@ class Build
|
|||||||
def load_plan(filename)
|
def load_plan(filename)
|
||||||
plan = YAML.safe_load(File.read(filename), [:Time])
|
plan = YAML.safe_load(File.read(filename), [:Time])
|
||||||
|
|
||||||
|
@ref = plan.dig('source', 'ref')
|
||||||
@meta = {
|
@meta = {
|
||||||
sha: plan.dig('source', 'commit', 'sha'),
|
sha: plan.dig('source', 'commit', 'sha'),
|
||||||
ref: plan.dig('source', 'ref'),
|
ref: @ref,
|
||||||
date: plan.dig('source', 'commit', 'date')
|
date: plan.dig('source', 'commit', 'date')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,20 +413,17 @@ class Build
|
|||||||
contents_dir = File.join(app, 'Contents')
|
contents_dir = File.join(app, 'Contents')
|
||||||
|
|
||||||
FileUtils.cd(contents_dir) do
|
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',
|
source = Dir['MacOS/libexec/emacs/**/eln-cache',
|
||||||
'MacOS/lib/emacs/**/native-lisp'].first
|
'MacOS/lib/emacs/**/native-lisp'].first
|
||||||
|
|
||||||
if source.nil?
|
# Skip creation of symlinks if *.eln files are not located in a location
|
||||||
err 'Failed to find native-lisp cache directory for symlink creation.'
|
# 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
|
end
|
||||||
|
|
||||||
# Check for folder name containing two dots (.), as this causes Apple's
|
# Check for folder name containing two dots (.), as this causes Apple's
|
||||||
@@ -434,10 +433,9 @@ class Build
|
|||||||
# The workaround for now is to rename the folder replacing the dots with
|
# The workaround for now is to rename the folder replacing the dots with
|
||||||
# hyphens (-), and create the native-lisp symlink pointing to the new
|
# hyphens (-), and create the native-lisp symlink pointing to the new
|
||||||
# location.
|
# location.
|
||||||
if source.match(%r{/.+\..+\..+/})
|
eln_dir = File.dirname(Dir[File.join(source, '**', '*.eln')].first)
|
||||||
# Dig deeper into native-lisp directory
|
|
||||||
eln_dir = File.dirname(Dir[File.join(source, '**', '*.eln')].first)
|
|
||||||
|
|
||||||
|
if eln_dir.match(%r{/.+\..+\..+/})
|
||||||
base = File.basename(eln_dir)
|
base = File.basename(eln_dir)
|
||||||
parent = File.dirname(eln_dir)
|
parent = File.dirname(eln_dir)
|
||||||
|
|
||||||
@@ -738,8 +736,6 @@ class AbstractEmbedder
|
|||||||
@app = app
|
@app = app
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def invocation_dir
|
def invocation_dir
|
||||||
File.join(app, 'Contents', 'MacOS')
|
File.join(app, 'Contents', 'MacOS')
|
||||||
end
|
end
|
||||||
@@ -749,7 +745,7 @@ class AbstractEmbedder
|
|||||||
end
|
end
|
||||||
|
|
||||||
def lib_dir
|
def lib_dir
|
||||||
File.join(invocation_dir, 'lib')
|
File.join(app, 'Contents', 'Frameworks')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -905,15 +901,15 @@ class GccLibEmbedder < AbstractEmbedder
|
|||||||
end
|
end
|
||||||
|
|
||||||
def target_dir
|
def target_dir
|
||||||
File.join(invocation_dir, gcc_info.relative_lib_dir)
|
File.join(lib_dir, gcc_info.relative_lib_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_darwin_dir
|
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
|
end
|
||||||
|
|
||||||
def target_darwin_dir
|
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
|
end
|
||||||
|
|
||||||
def source_dir
|
def source_dir
|
||||||
@@ -969,7 +965,21 @@ class GccInfo
|
|||||||
def sanitized_relative_darwin_lib_dir
|
def sanitized_relative_darwin_lib_dir
|
||||||
@sanitized_relative_darwin_lib_dir ||= File.join(
|
@sanitized_relative_darwin_lib_dir ||= File.join(
|
||||||
File.dirname(relative_darwin_lib_dir),
|
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
|
end
|
||||||
|
|
||||||
@@ -1016,6 +1026,10 @@ class GccInfo
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def embedder
|
||||||
|
@embedder ||= AbstractEmbedder.new(Dir.mktmpdir(['Emacs', '.app']))
|
||||||
|
end
|
||||||
|
|
||||||
def relative_dir(path, root)
|
def relative_dir(path, root)
|
||||||
Pathname.new(path).relative_path_from(Pathname.new(root)).to_s
|
Pathname.new(path).relative_path_from(Pathname.new(root)).to_s
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
|
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
|
--- a/lisp/emacs-lisp/comp.el
|
||||||
+++ b/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))))
|
(let ((load (not (not load))))
|
||||||
(native--compile-async files recursively load selector)))
|
(native--compile-async files recursively load selector)))
|
||||||
|
|
||||||
@@ -16,10 +16,10 @@ index 8c638312b0..87af889ef4 100644
|
|||||||
+ (devtools-dir
|
+ (devtools-dir
|
||||||
+ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib")
|
+ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib")
|
||||||
+ (gcc-dir (expand-file-name
|
+ (gcc-dir (expand-file-name
|
||||||
+ "<%= relative_lib_dir %>"
|
+ "<%= app_bundle_relative_lib_dir %>"
|
||||||
+ invocation-directory))
|
+ invocation-directory))
|
||||||
+ (darwin-dir (expand-file-name
|
+ (darwin-dir (expand-file-name
|
||||||
+ "<%= sanitized_relative_darwin_lib_dir %>"
|
+ "<%= app_bundle_relative_darwin_lib_dir %>"
|
||||||
+ invocation-directory))
|
+ invocation-directory))
|
||||||
+ (lib-paths (list)))
|
+ (lib-paths (list)))
|
||||||
+
|
+
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ type UpdateOptions struct {
|
|||||||
// BuildsRepo is the GitHub repository containing binary releases.
|
// BuildsRepo is the GitHub repository containing binary releases.
|
||||||
BuildsRepo *repository.Repository
|
BuildsRepo *repository.Repository
|
||||||
|
|
||||||
// TapRepo is the GitHub repository to update the cask formula in.
|
// TapRepo is the GitHub repository to update the casks in.
|
||||||
TapRepo *repository.Repository
|
TapRepo *repository.Repository
|
||||||
|
|
||||||
// Ref is the git ref to apply cask formula updates on top of. Default
|
// Ref is the git ref to apply cask updates on top of. Default branch will
|
||||||
// branch will be used if empty.
|
// be used if empty.
|
||||||
Ref string
|
Ref string
|
||||||
|
|
||||||
// OutputDir specifies a directory to write cask files to. When set, tap
|
// OutputDir specifies a directory to write cask files to. When set, tap
|
||||||
@@ -56,10 +56,10 @@ type UpdateOptions struct {
|
|||||||
|
|
||||||
// Force update will ignore the outdated live check flag, and process all
|
// Force update will ignore the outdated live check flag, and process all
|
||||||
// casks regardless. But it will only update the cask in question if the
|
// casks regardless. But it will only update the cask in question if the
|
||||||
// resulting output cask formula is different.
|
// resulting output cask is different.
|
||||||
Force bool
|
Force bool
|
||||||
|
|
||||||
// TemplatesDir is the directory where cask formula templates are located.
|
// TemplatesDir is the directory where cask templates are located.
|
||||||
TemplatesDir string
|
TemplatesDir string
|
||||||
|
|
||||||
LiveChecks []*LiveCheck
|
LiveChecks []*LiveCheck
|
||||||
@@ -150,7 +150,7 @@ func (s *Updater) putFile(
|
|||||||
content []byte,
|
content []byte,
|
||||||
) (bool, error) {
|
) (bool, error) {
|
||||||
parent := filepath.Dir(filename)
|
parent := filepath.Dir(filename)
|
||||||
s.logger.Info("processing formula update",
|
s.logger.Info("processing cask update",
|
||||||
"output-directory", parent, "cask", chk.Cask, "file", filename,
|
"output-directory", parent, "cask", chk.Cask, "file", filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -164,18 +164,18 @@ func (s *Updater) putFile(
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
infoMsg := "creating formula"
|
infoMsg := "creating cask"
|
||||||
|
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
infoMsg = "updating formula"
|
infoMsg = "updating cask"
|
||||||
if bytes.Equal(existingContent, content) {
|
if bytes.Equal(existingContent, content) {
|
||||||
s.logger.Info(
|
s.logger.Info(
|
||||||
"skip update: no change to cask formula content",
|
"skip update: no change to cask content",
|
||||||
"cask", chk.Cask, "file", filename,
|
"cask", chk.Cask, "file", filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
s.logger.Debug(
|
s.logger.Debug(
|
||||||
"formula content",
|
"cask content",
|
||||||
"file", filename, "content", string(content),
|
"file", filename, "content", string(content),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ func (s *Updater) putFile(
|
|||||||
)
|
)
|
||||||
|
|
||||||
s.logger.Debug(
|
s.logger.Debug(
|
||||||
"formula content",
|
"cask content",
|
||||||
"file", filename, "content", string(content),
|
"file", filename, "content", string(content),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ func (s *Updater) putRepoFile(
|
|||||||
filename string,
|
filename string,
|
||||||
content []byte,
|
content []byte,
|
||||||
) (bool, error) {
|
) (bool, error) {
|
||||||
s.logger.Info("processing formula update",
|
s.logger.Info("processing cask update",
|
||||||
"tap-repo", repo.Source, "cask", chk.Cask, "file", filename,
|
"tap-repo", repo.Source, "cask", chk.Cask, "file", filename,
|
||||||
)
|
)
|
||||||
repoContent, _, resp, err := s.gh.Repositories.GetContents(
|
repoContent, _, resp, err := s.gh.Repositories.GetContents(
|
||||||
@@ -264,12 +264,12 @@ func (s *Updater) createRepoFile(
|
|||||||
diff := fmt.Sprint(gotextdiff.ToUnified(filename, filename, "", edits))
|
diff := fmt.Sprint(gotextdiff.ToUnified(filename, filename, "", edits))
|
||||||
|
|
||||||
s.logger.Info(
|
s.logger.Info(
|
||||||
"creating formula",
|
"creating cask",
|
||||||
"cask", chk.Cask, "version", chk.Version.Latest, "file", filename,
|
"cask", chk.Cask, "version", chk.Version.Latest, "file", filename,
|
||||||
"diff", diff,
|
"diff", diff,
|
||||||
)
|
)
|
||||||
s.logger.Debug(
|
s.logger.Debug(
|
||||||
"formula content",
|
"cask content",
|
||||||
"file", filename, "content", string(content),
|
"file", filename, "content", string(content),
|
||||||
)
|
)
|
||||||
contResp, _, err := s.gh.Repositories.CreateFile(
|
contResp, _, err := s.gh.Repositories.CreateFile(
|
||||||
@@ -307,7 +307,7 @@ func (s *Updater) updateRepoFile(
|
|||||||
|
|
||||||
if existingContent == string(content) {
|
if existingContent == string(content) {
|
||||||
s.logger.Info(
|
s.logger.Info(
|
||||||
"skip update: no change to formula content",
|
"skip update: no change to cask content",
|
||||||
"cask", chk.Cask, "file", filename,
|
"cask", chk.Cask, "file", filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -329,12 +329,12 @@ func (s *Updater) updateRepoFile(
|
|||||||
))
|
))
|
||||||
|
|
||||||
s.logger.Info(
|
s.logger.Info(
|
||||||
"updating formula",
|
"updating cask",
|
||||||
"cask", chk.Cask, "version", chk.Version.Latest, "file", filename,
|
"cask", chk.Cask, "version", chk.Version.Latest, "file", filename,
|
||||||
"diff", diff,
|
"diff", diff,
|
||||||
)
|
)
|
||||||
s.logger.Debug(
|
s.logger.Debug(
|
||||||
"formula content",
|
"cask content",
|
||||||
"file", filename, "content", string(content),
|
"file", filename, "content", string(content),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func caskCmd() *cli2.Command {
|
|||||||
|
|
||||||
return &cli2.Command{
|
return &cli2.Command{
|
||||||
Name: "cask",
|
Name: "cask",
|
||||||
Usage: "manage Homebrew Cask formula",
|
Usage: "manage Homebrew Casks",
|
||||||
Flags: []cli2.Flag{
|
Flags: []cli2.Flag{
|
||||||
&cli2.StringFlag{
|
&cli2.StringFlag{
|
||||||
Name: "builds-repository",
|
Name: "builds-repository",
|
||||||
@@ -101,7 +101,7 @@ func caskUpdateCmd() *cli2.Command {
|
|||||||
Name: "force",
|
Name: "force",
|
||||||
Aliases: []string{"f"},
|
Aliases: []string{"f"},
|
||||||
Usage: "force update file even if livecheck has it marked " +
|
Usage: "force update file even if livecheck has it marked " +
|
||||||
"as not outdated (does not force update if formula " +
|
"as not outdated (does not force update if cask " +
|
||||||
"content is unchanged)",
|
"content is unchanged)",
|
||||||
Value: false,
|
Value: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -117,42 +117,24 @@ func signCLIHelper(ctx context.Context, appBundle string, opts *Options) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// elnFiles finds all native-compilation *.eln files within a Emacs.app bundle,
|
// 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) {
|
func elnFiles(emacsApp string) ([]string, error) {
|
||||||
dirs := []string{
|
|
||||||
// Current *.eln location.
|
|
||||||
filepath.Join(emacsApp, "Contents", "Resources", "native-lisp"),
|
|
||||||
// Legacy *.eln location.
|
|
||||||
filepath.Join(emacsApp, "Contents", "MacOS", "lib", "emacs"),
|
|
||||||
}
|
|
||||||
|
|
||||||
var files []string
|
var files []string
|
||||||
walkDirFunc := func(path string, _d fs.DirEntry, _err error) error {
|
walkDirFunc := func(path string, d fs.DirEntry, _err error) error {
|
||||||
if strings.HasSuffix(path, ".eln") {
|
if d.Type().IsRegular() && strings.HasSuffix(path, ".eln") &&
|
||||||
|
!strings.Contains(path, ".app/Contents/Frameworks/") {
|
||||||
files = append(files, path)
|
files = append(files, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, dir := range dirs {
|
err := filepath.WalkDir(filepath.Join(emacsApp, "Contents"), walkDirFunc)
|
||||||
fi, err := os.Stat(dir)
|
if err != nil {
|
||||||
if err != nil {
|
return nil, err
|
||||||
if os.IsNotExist(err) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !fi.IsDir() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
err = filepath.WalkDir(dir, walkDirFunc)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return files, nil
|
return files, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user