mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
97178bf77a
|
|||
|
591c39e629
|
|||
|
d6c99f8c60
|
|||
|
bcbd01778d
|
14
CHANGELOG.md
14
CHANGELOG.md
@@ -2,6 +2,20 @@
|
||||
|
||||
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.20](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.19...v0.6.20) (2021-10-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **notarization:** explicitly only copy *.c and *.h C source files ([591c39e](https://github.com/jimeh/build-emacs-for-macos/commit/591c39e629c9556adcf296cd5c15dd0b17c4d986))
|
||||
|
||||
### [0.6.19](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.18...v0.6.19) (2021-10-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **patch:** resolve emacs-29 symlink patches to their real URL ([bcbd017](https://github.com/jimeh/build-emacs-for-macos/commit/bcbd01778d416b99205c51f348a543489889f66d))
|
||||
|
||||
### [0.6.18](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.17...v0.6.18) (2021-10-23)
|
||||
|
||||
|
||||
|
||||
@@ -717,7 +717,14 @@ class Build
|
||||
info "Downloading patch: #{patch[:url]}"
|
||||
run_cmd('curl', '-L#', patch[:url], '-o', patch_file)
|
||||
|
||||
apply_patch({ file: patch_file }, target)
|
||||
real_patch_url = detect_github_symlink_patch(patch[:url], patch_file)
|
||||
if real_patch_url
|
||||
FileUtils.rm(patch_file)
|
||||
apply_patch({ url: real_patch_url }, target)
|
||||
else
|
||||
apply_patch({ file: patch_file }, target)
|
||||
end
|
||||
|
||||
elsif patch[:replace]
|
||||
err 'Patch replace input error' unless patch[:replace].size == 3
|
||||
|
||||
@@ -735,6 +742,30 @@ class Build
|
||||
f.close
|
||||
end
|
||||
end
|
||||
|
||||
# When downloading raw files from GitHub, if the target file is a symlink, it
|
||||
# will return the actual target path of the symlink instead of the content of
|
||||
# the target file. Hence we have to check if the patch file we have downloaded
|
||||
# contains one and only one line, and if so, assume it's a symlink.
|
||||
def detect_github_symlink_patch(original_url, patch_file)
|
||||
lines = []
|
||||
|
||||
# read first two lines
|
||||
File.open(patch_file) do |f|
|
||||
lines << f.gets
|
||||
lines << f.gets
|
||||
end
|
||||
|
||||
# if the file contains more than one line of text, it's not a symlink.
|
||||
return unless lines[1].nil?
|
||||
|
||||
symlink_target = lines[0].strip
|
||||
# Assume patch file content is something along the lines of
|
||||
# "../emacs-28/fix-window-role.patch", hence we resolve it relative to the
|
||||
# original url.
|
||||
info "patch is symlink to #{symlink_target}"
|
||||
URI.join(original_url, symlink_target).to_s
|
||||
end
|
||||
end
|
||||
|
||||
class AbstractEmbedder
|
||||
@@ -766,7 +797,10 @@ class AbstractEmbedder
|
||||
end
|
||||
|
||||
class CSourcesEmbedder < AbstractEmbedder
|
||||
PATH_PATCH = '(setq source-directory (expand-file-name ".."))'
|
||||
|
||||
attr_reader :source_dir
|
||||
|
||||
def initialize(app, source_dir)
|
||||
super(app)
|
||||
|
||||
@@ -776,13 +810,18 @@ class CSourcesEmbedder < AbstractEmbedder
|
||||
def embed
|
||||
info 'Embedding C source files into Emacs.app for documentation purposes'
|
||||
|
||||
FileUtils.cp_r(
|
||||
File.join(source_dir, 'src'),
|
||||
File.join(resources_dir, 'src')
|
||||
)
|
||||
src_dir = File.join(source_dir, 'src')
|
||||
Dir[File.join(src_dir, '**', '*.{c,h}')].each do |f|
|
||||
rel = f[src_dir.size + 1..-1]
|
||||
target = File.join(resources_dir, 'src', rel)
|
||||
FileUtils.mkdir_p(File.dirname(target))
|
||||
FileUtils.cp(f, target)
|
||||
end
|
||||
|
||||
return if File.read(subdirs_el_file).include?(PATH_PATCH)
|
||||
|
||||
File.open(subdirs_el_file, 'a') do |f|
|
||||
f.puts("(setq source-directory (expand-file-name \"..\"))\n")
|
||||
f.puts("\n#{PATH_PATCH}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user