mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
28930381a8
|
|||
|
df25e54ef7
|
|||
|
6d21d1bef4
|
|||
|
99aa76b398
|
|||
|
b60ca528f8
|
|||
|
23b8236e0a
|
|||
|
56d0364099
|
|||
|
6af597b427
|
23
CHANGELOG.md
23
CHANGELOG.md
@@ -2,6 +2,29 @@
|
||||
|
||||
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.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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **native_comp:** patch Emacs.pdmp for customized native-lisp paths ([23b8236](https://github.com/jimeh/build-emacs-for-macos/commit/23b8236e0a66fb09810e8422bedf02f7192a53e4))
|
||||
|
||||
### [0.6.1](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.0...v0.6.1) (2021-06-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cask:** add missing --force flag to cask update command ([6af597b](https://github.com/jimeh/build-emacs-for-macos/commit/6af597b4271341f9796c3d9c356de9918e0f6f85))
|
||||
|
||||
## [0.6.0](https://github.com/jimeh/build-emacs-for-macos/compare/v0.5.2...v0.6.0) (2021-06-28)
|
||||
|
||||
|
||||
|
||||
@@ -117,9 +117,10 @@ class Build
|
||||
def load_plan(filename)
|
||||
plan = YAML.safe_load(File.read(filename), [:Time])
|
||||
|
||||
@ref = plan.dig('source', 'ref')
|
||||
@meta = {
|
||||
sha: plan.dig('source', 'commit', 'sha'),
|
||||
ref: plan.dig('source', 'ref'),
|
||||
ref: @ref,
|
||||
date: plan.dig('source', 'commit', 'date')
|
||||
}
|
||||
|
||||
@@ -454,6 +455,13 @@ class Build
|
||||
parent = File.dirname(parent)
|
||||
end
|
||||
|
||||
eln_parts = eln_dir.match(
|
||||
%r{/(\d+\.\d+\.\d+)/native-lisp/(\d+\.\d+\.\d+-\w+)(?:/.+)?$}i
|
||||
)
|
||||
if eln_parts
|
||||
patch_dump_native_lisp_paths(app, eln_parts[1], eln_parts[2])
|
||||
end
|
||||
|
||||
# Find native-lisp directory again after it has been renamed.
|
||||
source = Dir['MacOS/libexec/emacs/**/eln-cache',
|
||||
'MacOS/lib/emacs/**/native-lisp'].first
|
||||
@@ -468,6 +476,29 @@ class Build
|
||||
end
|
||||
end
|
||||
|
||||
def patch_dump_native_lisp_paths(app, emacs_version, eln_version)
|
||||
sanitized_emacs_version = emacs_version.gsub('.', '-')
|
||||
sanitized_eln_version = eln_version.gsub('.', '-')
|
||||
|
||||
contents_dir = File.join(app, 'Contents')
|
||||
FileUtils.cd(contents_dir) do
|
||||
filename = Dir['MacOS/Emacs.pdmp', 'MacOS/libexec/Emacs.pdmp'].first
|
||||
err "no Emacs.pdmp file found in #{app}" unless filename
|
||||
info 'patching Emacs.pdmp to point at new native-lisp paths'
|
||||
|
||||
content = File.read(filename, mode: 'rb').gsub(
|
||||
"lib/emacs/#{emacs_version}/native-lisp/#{eln_version}/",
|
||||
"lib/emacs/#{sanitized_emacs_version}/" \
|
||||
"native-lisp/#{sanitized_eln_version}/"
|
||||
).gsub(
|
||||
"../native-lisp/#{eln_version}/",
|
||||
"../native-lisp/#{sanitized_eln_version}/"
|
||||
)
|
||||
|
||||
File.open(filename, 'w') { |f| f.write(content) }
|
||||
end
|
||||
end
|
||||
|
||||
def add_cli_helper(app)
|
||||
source = File.join(__dir__, 'helper', 'emacs-cli.bash')
|
||||
target = File.join(app, 'Contents', 'MacOS', 'bin', 'emacs')
|
||||
|
||||
@@ -97,6 +97,14 @@ func caskUpdateCmd() *cli2.Command {
|
||||
EnvVars: []string{"CASK_TEMPLATE_DIR"},
|
||||
Required: true,
|
||||
},
|
||||
&cli2.BoolFlag{
|
||||
Name: "force",
|
||||
Aliases: []string{"f"},
|
||||
Usage: "force update file even if livecheck has it marked " +
|
||||
"as not outdated (does not force update if formula " +
|
||||
"content is unchanged)",
|
||||
Value: false,
|
||||
},
|
||||
},
|
||||
Action: caskActionWrapper(caskUpdateAction),
|
||||
}
|
||||
@@ -112,6 +120,7 @@ func caskUpdateAction(
|
||||
GithubToken: cOpts.GithubToken,
|
||||
Ref: c.String("ref"),
|
||||
OutputDir: c.String("output"),
|
||||
Force: c.Bool("force"),
|
||||
TemplatesDir: c.String("templates-dir"),
|
||||
}
|
||||
|
||||
|
||||
@@ -119,40 +119,18 @@ 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.
|
||||
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
|
||||
walkDirFunc := func(path string, _d fs.DirEntry, _err error) error {
|
||||
if strings.HasSuffix(path, ".eln") {
|
||||
walkDirFunc := func(path string, d fs.DirEntry, _err error) error {
|
||||
if d.Type().IsRegular() && strings.HasSuffix(path, ".eln") {
|
||||
files = append(files, path)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, dir := range dirs {
|
||||
fi, err := os.Stat(dir)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !fi.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
err = filepath.WalkDir(dir, walkDirFunc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err := filepath.WalkDir(filepath.Join(emacsApp, "Contents"), walkDirFunc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return files, nil
|
||||
|
||||
Reference in New Issue
Block a user