mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f1bf1d93b8
|
|||
|
8a467b0d43
|
|||
|
9c29f721b4
|
|||
|
4ac71ddf39
|
|||
|
d338c136db
|
|||
|
d054a17fc7
|
|||
|
4030ceb9ca
|
|||
|
ad1a7dd62c
|
|||
| 665e6addec | |||
|
7f2aba0e4e
|
|||
|
be326b22aa
|
|||
|
ef4f2ad930
|
|||
|
2293c87fc9
|
|||
|
97178bf77a
|
|||
|
591c39e629
|
30
CHANGELOG.md
30
CHANGELOG.md
@@ -2,6 +2,36 @@
|
|||||||
|
|
||||||
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.24](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.23...v0.6.24) (2021-11-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **embedding:** embedding GCC fails when paths do not require sanitizing ([8a467b0](https://github.com/jimeh/build-emacs-for-macos/commit/8a467b0d43140f6956d53c27e2319ae1b572868c))
|
||||||
|
|
||||||
|
### [0.6.23](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.22...v0.6.23) (2021-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **build:** do not re-link eln files by default ([d338c13](https://github.com/jimeh/build-emacs-for-macos/commit/d338c136db8acc4378154cf66ed7db5462787602)), closes [#60](https://github.com/jimeh/build-emacs-for-macos/issues/60)
|
||||||
|
|
||||||
|
### [0.6.22](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.21...v0.6.22) (2021-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **patch:** add support for posix-spawn patch from emacs-plus ([4030ceb](https://github.com/jimeh/build-emacs-for-macos/commit/4030ceb9cab6749af3c28161ac97caec90a8aed0))
|
||||||
|
|
||||||
|
### [0.6.21](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.20...v0.6.21) (2021-10-27)
|
||||||
|
|
||||||
|
### [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)
|
### [0.6.19](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.18...v0.6.19) (2021-10-23)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,8 +81,10 @@ Options:
|
|||||||
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
|
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
|
||||||
--[no-]native-march Enable/disable -march=native CFLAG(default: disabled)
|
--[no-]native-march Enable/disable -march=native CFLAG(default: disabled)
|
||||||
--[no-]native-full-aot Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation (default: disabled)
|
--[no-]native-full-aot Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation (default: disabled)
|
||||||
|
--[no-]relink-eln-files Enable/disable re-linking shared libraries in bundled *.eln files (default: disabled)
|
||||||
--[no-]rsvg Enable/disable SVG image support via librsvg (default: enabled)
|
--[no-]rsvg Enable/disable SVG image support via librsvg (default: enabled)
|
||||||
--no-titlebar Apply no-titlebar patch (default: disabled)
|
--no-titlebar Apply no-titlebar patch (default: disabled)
|
||||||
|
--posix-spawn Apply posix-spawn patch (default: disabled)
|
||||||
--no-frame-refocus Apply no-frame-refocus patch (default: disabled)
|
--no-frame-refocus Apply no-frame-refocus patch (default: disabled)
|
||||||
--[no-]github-auth Make authenticated GitHub API requests if GITHUB_TOKEN environment variable is set.(default: enabled)
|
--[no-]github-auth Make authenticated GitHub API requests if GITHUB_TOKEN environment variable is set.(default: enabled)
|
||||||
--work-dir DIR Specify a working directory where tarballs, sources, and builds will be stored and worked with
|
--work-dir DIR Specify a working directory where tarballs, sources, and builds will be stored and worked with
|
||||||
@@ -90,7 +92,8 @@ Options:
|
|||||||
--build-name NAME Override generated build name
|
--build-name NAME Override generated build name
|
||||||
--dist-include x,y,z List of extra files to copy from Emacs source into build folder/archive (default: COPYING)
|
--dist-include x,y,z List of extra files to copy from Emacs source into build folder/archive (default: COPYING)
|
||||||
--[no-]archive Enable/disable creating *.tbz archive (default: enabled)
|
--[no-]archive Enable/disable creating *.tbz archive (default: enabled)
|
||||||
--[no-]archive-keep Enable/disable keeping source folder for archive (default: disabled)
|
--[no-]archive-keep-build-dir
|
||||||
|
Enable/disable keeping source folder for archive (default: disabled)
|
||||||
--plan FILE Follow given plan file, instead of using given git ref/sha
|
--plan FILE Follow given plan file, instead of using given git ref/sha
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ class Build
|
|||||||
build_dir, app = create_build_dir(app)
|
build_dir, app = create_build_dir(app)
|
||||||
|
|
||||||
handle_native_lisp(app)
|
handle_native_lisp(app)
|
||||||
add_cli_helper(app)
|
|
||||||
|
|
||||||
|
CLIHelperEmbedder.new(app).embed
|
||||||
CSourcesEmbedder.new(app, @source_dir).embed
|
CSourcesEmbedder.new(app, @source_dir).embed
|
||||||
LibEmbedder.new(app, brew_dir, extra_libs, options[:relink_eln]).embed
|
LibEmbedder.new(app, brew_dir, extra_libs, options[:relink_eln]).embed
|
||||||
GccLibEmbedder.new(app, gcc_info).embed if options[:native_comp]
|
GccLibEmbedder.new(app, gcc_info).embed if options[:native_comp]
|
||||||
@@ -286,8 +286,6 @@ class Build
|
|||||||
verify_native_comp
|
verify_native_comp
|
||||||
gcc_info.verify_libgccjit
|
gcc_info.verify_libgccjit
|
||||||
|
|
||||||
apply_native_comp_env_setup_patch(source)
|
|
||||||
|
|
||||||
ENV['CFLAGS'] = [
|
ENV['CFLAGS'] = [
|
||||||
"-I#{File.join(gcc_info.root_dir, 'include')}",
|
"-I#{File.join(gcc_info.root_dir, 'include')}",
|
||||||
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}",
|
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}",
|
||||||
@@ -506,18 +504,6 @@ class Build
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_cli_helper(app)
|
|
||||||
source = File.join(__dir__, 'helper', 'emacs-cli.bash')
|
|
||||||
target = File.join(app, 'Contents', 'MacOS', 'bin', 'emacs')
|
|
||||||
dir = File.dirname(target)
|
|
||||||
|
|
||||||
info "Adding \"emacs\" CLI helper to #{dir}"
|
|
||||||
|
|
||||||
FileUtils.mkdir_p(dir)
|
|
||||||
FileUtils.cp(source, target)
|
|
||||||
FileUtils.chmod('+w', target)
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_name
|
def build_name
|
||||||
return @build_name if @build_name
|
return @build_name if @build_name
|
||||||
return @build_name = options[:build_name] if options[:build_name]
|
return @build_name = options[:build_name] if options[:build_name]
|
||||||
@@ -619,21 +605,6 @@ class Build
|
|||||||
system(*args) || err("Exit code: #{$CHILD_STATUS.exitstatus}")
|
system(*args) || err("Exit code: #{$CHILD_STATUS.exitstatus}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_native_comp_env_setup_patch(source)
|
|
||||||
term = 'native-compile-setup-environment-variables'
|
|
||||||
file = 'lisp/emacs-lisp/comp.el'
|
|
||||||
return if `grep '#{term}' '#{file}'`.strip.size.positive?
|
|
||||||
|
|
||||||
template = File.read(
|
|
||||||
File.join(__dir__, 'patches/native-comp-env-setup.diff.erb')
|
|
||||||
)
|
|
||||||
patch = ERB.new(template).result(gcc_info.get_binding)
|
|
||||||
patch_file = File.join(source, 'macos_patches/native-comp-env-setup.diff')
|
|
||||||
|
|
||||||
File.write(patch_file, patch)
|
|
||||||
apply_patch({ file: patch_file }, source)
|
|
||||||
end
|
|
||||||
|
|
||||||
def effective_version
|
def effective_version
|
||||||
@effective_version ||= begin
|
@effective_version ||= begin
|
||||||
case ref
|
case ref
|
||||||
@@ -680,6 +651,15 @@ class Build
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if %w[emacs-28 emacs-29].include?(effective_version)
|
||||||
|
if options[:posix_spawn]
|
||||||
|
p << {
|
||||||
|
url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
|
||||||
|
"patches/#{effective_version}/posix-spawn.patch"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if effective_version == 'emacs-27'
|
if effective_version == 'emacs-27'
|
||||||
p << {
|
p << {
|
||||||
url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
|
url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
|
||||||
@@ -787,6 +767,10 @@ class AbstractEmbedder
|
|||||||
File.join(invocation_dir, 'Emacs')
|
File.join(invocation_dir, 'Emacs')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bin_dir
|
||||||
|
File.join(invocation_dir, 'bin')
|
||||||
|
end
|
||||||
|
|
||||||
def lib_dir
|
def lib_dir
|
||||||
File.join(invocation_dir, 'lib')
|
File.join(invocation_dir, 'lib')
|
||||||
end
|
end
|
||||||
@@ -796,8 +780,28 @@ class AbstractEmbedder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class CLIHelperEmbedder < AbstractEmbedder
|
||||||
|
def embed
|
||||||
|
source = File.join(__dir__, 'helper', 'emacs-cli.bash')
|
||||||
|
target = File.join(bin_dir, 'emacs')
|
||||||
|
dir = File.dirname(target)
|
||||||
|
|
||||||
|
info "Adding \"emacs\" CLI helper to #{dir}"
|
||||||
|
|
||||||
|
FileUtils.mkdir_p(dir)
|
||||||
|
FileUtils.cp(source, target)
|
||||||
|
FileUtils.chmod('+w', target)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class CSourcesEmbedder < AbstractEmbedder
|
class CSourcesEmbedder < AbstractEmbedder
|
||||||
|
PATH_PATCH = <<~ELISP
|
||||||
|
;; Allow Emacs to find bundled C sources.
|
||||||
|
(setq source-directory (expand-file-name ".."))
|
||||||
|
ELISP
|
||||||
|
|
||||||
attr_reader :source_dir
|
attr_reader :source_dir
|
||||||
|
|
||||||
def initialize(app, source_dir)
|
def initialize(app, source_dir)
|
||||||
super(app)
|
super(app)
|
||||||
|
|
||||||
@@ -807,20 +811,26 @@ class CSourcesEmbedder < AbstractEmbedder
|
|||||||
def embed
|
def embed
|
||||||
info 'Embedding C source files into Emacs.app for documentation purposes'
|
info 'Embedding C source files into Emacs.app for documentation purposes'
|
||||||
|
|
||||||
FileUtils.cp_r(
|
src_dir = File.join(source_dir, 'src')
|
||||||
File.join(source_dir, 'src'),
|
Dir[File.join(src_dir, '**', '*.{c,h}')].each do |f|
|
||||||
File.join(resources_dir, 'src')
|
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
|
||||||
|
|
||||||
File.open(subdirs_el_file, 'a') do |f|
|
return if File.exist?(site_start_el_file) &&
|
||||||
f.puts("(setq source-directory (expand-file-name \"..\"))\n")
|
File.read(site_start_el_file).include?(PATH_PATCH)
|
||||||
|
|
||||||
|
File.open(site_start_el_file, 'a') do |f|
|
||||||
|
f.puts("\n#{PATH_PATCH}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def subdirs_el_file
|
def site_start_el_file
|
||||||
@subdirs_el_file ||= File.join(resources_dir, 'lisp', 'subdirs.el')
|
@site_start_el_file ||= File.join(resources_dir, 'lisp', 'site-start.el')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -956,11 +966,48 @@ class GccLibEmbedder < AbstractEmbedder
|
|||||||
FileUtils.cp_r(source_dir, target_dir)
|
FileUtils.cp_r(source_dir, target_dir)
|
||||||
FileUtils.rm(Dir[File.join(target_dir, '**', '.DS_Store')], force: true)
|
FileUtils.rm(Dir[File.join(target_dir, '**', '.DS_Store')], force: true)
|
||||||
FileUtils.chmod_R('u+w', target_dir)
|
FileUtils.chmod_R('u+w', target_dir)
|
||||||
FileUtils.mv(source_darwin_dir, target_darwin_dir)
|
if source_darwin_dir != target_darwin_dir
|
||||||
|
FileUtils.mv(source_darwin_dir, target_darwin_dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
env_setup = ERB.new(NATIVE_COMP_ENV_VAR_TPL).result(gcc_info.get_binding)
|
||||||
|
return if File.exist?(site_start_el_file) &&
|
||||||
|
File.read(site_start_el_file).include?(env_setup)
|
||||||
|
|
||||||
|
File.open(site_start_el_file, 'a') do |f|
|
||||||
|
f.puts("\n#{env_setup}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
NATIVE_COMP_ENV_VAR_TPL = <<~ELISP
|
||||||
|
;; Set LIBRARY_PATH to point at bundled GCC and Xcode Command Line Tools to
|
||||||
|
;; ensure native-comp works.
|
||||||
|
(when (and (eq system-type 'darwin)
|
||||||
|
(string-match-p "\\.app\\/Contents\\/MacOS\\/?$"
|
||||||
|
invocation-directory))
|
||||||
|
(let* ((library-path-env (getenv "LIBRARY_PATH"))
|
||||||
|
(devtools-dir
|
||||||
|
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib")
|
||||||
|
(gcc-dir (expand-file-name
|
||||||
|
"<%= app_bundle_relative_lib_dir %>"
|
||||||
|
invocation-directory))
|
||||||
|
(darwin-dir (expand-file-name
|
||||||
|
"<%= app_bundle_relative_darwin_lib_dir %>"
|
||||||
|
invocation-directory))
|
||||||
|
(lib-paths (list)))
|
||||||
|
|
||||||
|
(if library-path-env
|
||||||
|
(push library-path-env lib-paths))
|
||||||
|
(if (file-directory-p devtools-dir)
|
||||||
|
(push devtools-dir lib-paths))
|
||||||
|
(push darwin-dir lib-paths)
|
||||||
|
(push gcc-dir lib-paths)
|
||||||
|
|
||||||
|
(setenv "LIBRARY_PATH" (mapconcat 'identity lib-paths ":"))))
|
||||||
|
ELISP
|
||||||
|
|
||||||
def embedded?
|
def embedded?
|
||||||
Dir[File.join(target_dir, 'libgcc*')].any?
|
Dir[File.join(target_dir, 'libgcc*')].any?
|
||||||
end
|
end
|
||||||
@@ -984,6 +1031,10 @@ class GccLibEmbedder < AbstractEmbedder
|
|||||||
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
|
||||||
|
|
||||||
|
def site_start_el_file
|
||||||
|
@site_start_el_file ||= File.join(resources_dir, 'lisp', 'site-start.el')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class GccInfo
|
class GccInfo
|
||||||
@@ -1104,7 +1155,7 @@ if __FILE__ == $PROGRAM_NAME
|
|||||||
cli_options = {
|
cli_options = {
|
||||||
work_dir: File.expand_path(__dir__),
|
work_dir: File.expand_path(__dir__),
|
||||||
native_full_aot: false,
|
native_full_aot: false,
|
||||||
relink_eln: true,
|
relink_eln: false,
|
||||||
native_march: false,
|
native_march: false,
|
||||||
parallel: Etc.nprocessors,
|
parallel: Etc.nprocessors,
|
||||||
rsvg: true,
|
rsvg: true,
|
||||||
@@ -1164,7 +1215,7 @@ if __FILE__ == $PROGRAM_NAME
|
|||||||
|
|
||||||
opts.on('--[no-]relink-eln-files',
|
opts.on('--[no-]relink-eln-files',
|
||||||
'Enable/disable re-linking shared libraries in bundled *.eln ' \
|
'Enable/disable re-linking shared libraries in bundled *.eln ' \
|
||||||
'files (default: enabled)') do |v|
|
'files (default: disabled)') do |v|
|
||||||
cli_options[:relink_eln] = v
|
cli_options[:relink_eln] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1178,6 +1229,10 @@ if __FILE__ == $PROGRAM_NAME
|
|||||||
cli_options[:no_titlebar] = true
|
cli_options[:no_titlebar] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on('--posix-spawn', 'Apply posix-spawn patch (default: disabled)') do
|
||||||
|
cli_options[:posix_spawn] = true
|
||||||
|
end
|
||||||
|
|
||||||
opts.on('--no-frame-refocus',
|
opts.on('--no-frame-refocus',
|
||||||
'Apply no-frame-refocus patch (default: disabled)') do
|
'Apply no-frame-refocus patch (default: disabled)') do
|
||||||
cli_options[:no_frame_refocus] = true
|
cli_options[:no_frame_refocus] = true
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
|
|
||||||
index 638d4b274c..2599211936 100644
|
|
||||||
--- a/lisp/emacs-lisp/comp.el
|
|
||||||
+++ b/lisp/emacs-lisp/comp.el
|
|
||||||
@@ -4224,6 +4224,52 @@ native-compile-async
|
|
||||||
(let ((load (not (not load))))
|
|
||||||
(native--compile-async files recursively load selector)))
|
|
||||||
|
|
||||||
+;;;###autoload
|
|
||||||
+(defun native-compile-setup-environment-variables (&rest _args)
|
|
||||||
+ "Ensure LIBRARY_PATH is set correctly when libgccjit is bundled."
|
|
||||||
+ (when (and (eq system-type 'darwin)
|
|
||||||
+ (string-match-p "\.app\/Contents\/MacOS\/?$"
|
|
||||||
+ invocation-directory))
|
|
||||||
+ (let* ((library-path-env (getenv "LIBRARY_PATH"))
|
|
||||||
+ (devtools-dir
|
|
||||||
+ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib")
|
|
||||||
+ (gcc-dir (expand-file-name
|
|
||||||
+ "<%= app_bundle_relative_lib_dir %>"
|
|
||||||
+ invocation-directory))
|
|
||||||
+ (darwin-dir (expand-file-name
|
|
||||||
+ "<%= app_bundle_relative_darwin_lib_dir %>"
|
|
||||||
+ invocation-directory))
|
|
||||||
+ (lib-paths (list)))
|
|
||||||
+
|
|
||||||
+ (if library-path-env
|
|
||||||
+ (push library-path-env lib-paths))
|
|
||||||
+ (if (file-directory-p devtools-dir)
|
|
||||||
+ (push devtools-dir lib-paths))
|
|
||||||
+ (push darwin-dir lib-paths)
|
|
||||||
+ (push gcc-dir lib-paths)
|
|
||||||
+
|
|
||||||
+ (setenv "LIBRARY_PATH" (mapconcat 'identity lib-paths ":"))))
|
|
||||||
+
|
|
||||||
+ ;; Remove advice, as it only needs to run once.
|
|
||||||
+ (advice-remove 'native-compile
|
|
||||||
+ 'native-compile-setup-environment-variables)
|
|
||||||
+ (advice-remove 'comp--native-compile
|
|
||||||
+ 'native-compile-setup-environment-variables)
|
|
||||||
+ (advice-remove 'native-compile-async
|
|
||||||
+ 'native-compile-setup-environment-variables)
|
|
||||||
+ (advice-remove 'native--compile-async
|
|
||||||
+ 'native-compile-setup-environment-variables))
|
|
||||||
+
|
|
||||||
+;; Ensure environment setup runs before any native compilation.
|
|
||||||
+(advice-add 'native-compile :before
|
|
||||||
+ 'native-compile-setup-environment-variables)
|
|
||||||
+(advice-add 'comp--native-compile :before
|
|
||||||
+ 'native-compile-setup-environment-variables)
|
|
||||||
+(advice-add 'native-compile-async :before
|
|
||||||
+ 'native-compile-setup-environment-variables)
|
|
||||||
+(advice-add 'native--compile-async :before
|
|
||||||
+ 'native-compile-setup-environment-variables)
|
|
||||||
+
|
|
||||||
(provide 'comp)
|
|
||||||
|
|
||||||
;; LocalWords: limplified limplified limplification limplify Limple LIMPLE libgccjit elc eln
|
|
||||||
@@ -46,6 +46,7 @@ func New(version, commit, date string) *CLI {
|
|||||||
Commands: []*cli2.Command{
|
Commands: []*cli2.Command{
|
||||||
planCmd(),
|
planCmd(),
|
||||||
signCmd(),
|
signCmd(),
|
||||||
|
signFilesCmd(),
|
||||||
notarizeCmd(),
|
notarizeCmd(),
|
||||||
packageCmd(),
|
packageCmd(),
|
||||||
releaseCmd(),
|
releaseCmd(),
|
||||||
|
|||||||
@@ -112,3 +112,49 @@ func signAction(c *cli2.Context, opts *Options) error {
|
|||||||
|
|
||||||
return sign.Emacs(c.Context, app, signOpts)
|
return sign.Emacs(c.Context, app, signOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func signFilesCmd() *cli2.Command {
|
||||||
|
signCmd := signCmd()
|
||||||
|
|
||||||
|
var flags []cli2.Flag
|
||||||
|
for _, f := range signCmd.Flags {
|
||||||
|
n := f.Names()
|
||||||
|
if len(n) > 0 && n[0] == "plan" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
flags = append(flags, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &cli2.Command{
|
||||||
|
Name: "sign-files",
|
||||||
|
Usage: "sign files with codesign",
|
||||||
|
ArgsUsage: "<file> [<file>...]",
|
||||||
|
Hidden: true,
|
||||||
|
Flags: flags,
|
||||||
|
Action: actionWrapper(signFilesAction),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func signFilesAction(c *cli2.Context, opts *Options) error {
|
||||||
|
signOpts := &sign.Options{
|
||||||
|
Identity: c.String("sign"),
|
||||||
|
Options: c.StringSlice("options"),
|
||||||
|
Deep: c.Bool("deep"),
|
||||||
|
Timestamp: c.Bool("timestamp"),
|
||||||
|
Force: c.Bool("force"),
|
||||||
|
Verbose: c.Bool("verbose"),
|
||||||
|
CodeSignCmd: c.String("codesign"),
|
||||||
|
}
|
||||||
|
|
||||||
|
if v := c.StringSlice("entitlements"); len(v) > 0 {
|
||||||
|
e := sign.Entitlements(v)
|
||||||
|
signOpts.Entitlements = &e
|
||||||
|
}
|
||||||
|
|
||||||
|
if !opts.quiet {
|
||||||
|
signOpts.Output = os.Stdout
|
||||||
|
}
|
||||||
|
|
||||||
|
return sign.Files(c.Context, c.Args().Slice(), signOpts)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user