mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
1a34a9504a
|
|||
| 8513521d29 | |||
|
88bbefadc6
|
|||
|
f1bf1d93b8
|
|||
|
8a467b0d43
|
|||
|
9c29f721b4
|
|||
|
4ac71ddf39
|
|||
|
d338c136db
|
|||
|
d054a17fc7
|
|||
|
4030ceb9ca
|
|||
|
ad1a7dd62c
|
|||
| 665e6addec | |||
|
7f2aba0e4e
|
|||
|
be326b22aa
|
|||
|
ef4f2ad930
|
|||
|
2293c87fc9
|
|||
|
97178bf77a
|
|||
|
591c39e629
|
32
CHANGELOG.md
32
CHANGELOG.md
@@ -2,6 +2,38 @@
|
||||
|
||||
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.25](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.24...v0.6.25) (2021-11-25)
|
||||
|
||||
### [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)
|
||||
|
||||
|
||||
|
||||
@@ -81,8 +81,10 @@ Options:
|
||||
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
|
||||
--[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-]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-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-]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
|
||||
@@ -90,7 +92,8 @@ Options:
|
||||
--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)
|
||||
--[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
|
||||
```
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ module Output
|
||||
if newline
|
||||
warn "==> #{msg}"
|
||||
else
|
||||
STDERR.print "==> #{msg}"
|
||||
$stderr.print "==> #{msg}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,6 +35,19 @@ module Output
|
||||
end
|
||||
end
|
||||
|
||||
module System
|
||||
include Output
|
||||
|
||||
def run_cmd(*args)
|
||||
out("CMD: #{args.join(' ')}")
|
||||
cmd(*args)
|
||||
end
|
||||
|
||||
def cmd(*args)
|
||||
system(*args) || err("Exit code: #{$CHILD_STATUS.exitstatus}")
|
||||
end
|
||||
end
|
||||
|
||||
class OS
|
||||
def self.version
|
||||
@version ||= OSVersion.new
|
||||
@@ -71,6 +84,7 @@ end
|
||||
|
||||
class Build
|
||||
include Output
|
||||
include System
|
||||
|
||||
EMACS_MIRROR_REPO = 'emacs-mirror/emacs'
|
||||
DOWNLOAD_URL = 'https://github.com/emacs-mirror/emacs/tarball/%s'
|
||||
@@ -105,8 +119,8 @@ class Build
|
||||
build_dir, app = create_build_dir(app)
|
||||
|
||||
handle_native_lisp(app)
|
||||
add_cli_helper(app)
|
||||
|
||||
CLIHelperEmbedder.new(app).embed
|
||||
CSourcesEmbedder.new(app, @source_dir).embed
|
||||
LibEmbedder.new(app, brew_dir, extra_libs, options[:relink_eln]).embed
|
||||
GccLibEmbedder.new(app, gcc_info).embed if options[:native_comp]
|
||||
@@ -286,8 +300,6 @@ class Build
|
||||
verify_native_comp
|
||||
gcc_info.verify_libgccjit
|
||||
|
||||
apply_native_comp_env_setup_patch(source)
|
||||
|
||||
ENV['CFLAGS'] = [
|
||||
"-I#{File.join(gcc_info.root_dir, 'include')}",
|
||||
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}",
|
||||
@@ -402,13 +414,13 @@ class Build
|
||||
info "Copying \"#{app_name}\" to: #{target_dir}"
|
||||
|
||||
FileUtils.mkdir_p(target_dir)
|
||||
FileUtils.cp_r(app, target_dir)
|
||||
cmd('cp', '-a', app, target_dir)
|
||||
|
||||
options[:dist_include]&.each do |filename|
|
||||
src = File.join(source_dir, filename)
|
||||
if File.exist?(src)
|
||||
info "Copying \"#{filename}\" to: #{target_dir}"
|
||||
FileUtils.cp_r(src, target_dir)
|
||||
cmd('cp', '-pRL', src, target_dir)
|
||||
else
|
||||
info "Warning: #{filename} does not exist in #{source_dir}"
|
||||
end
|
||||
@@ -433,7 +445,7 @@ class Build
|
||||
info 'Creating symlinks within Emacs.app needed for native-comp'
|
||||
|
||||
if !File.exist?('lisp') && File.exist?('Resources/lisp')
|
||||
FileUtils.ln_s('Resources/lisp', 'lisp')
|
||||
run_cmd('ln', '-s', 'Resources/lisp', 'lisp')
|
||||
end
|
||||
|
||||
# Check for folder name containing two dots (.), as this causes Apple's
|
||||
@@ -455,7 +467,7 @@ class Build
|
||||
new_name = File.join(parent, base.gsub(/\.(.+)\./, '-\\1-'))
|
||||
|
||||
info "Renaming: #{old_name} --> #{new_name}"
|
||||
FileUtils.mv(old_name, new_name)
|
||||
cmd('mv', old_name, new_name)
|
||||
end
|
||||
|
||||
base = File.basename(parent)
|
||||
@@ -479,7 +491,7 @@ class Build
|
||||
end
|
||||
|
||||
target = File.basename(source)
|
||||
FileUtils.ln_s(source, target) unless File.exist?(target)
|
||||
run_cmd('ln', '-s', source, target) unless File.exist?(target)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -506,18 +518,6 @@ class Build
|
||||
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
|
||||
return @build_name if @build_name
|
||||
return @build_name = options[:build_name] if options[:build_name]
|
||||
@@ -614,26 +614,6 @@ class Build
|
||||
response.body
|
||||
end
|
||||
|
||||
def run_cmd(*args)
|
||||
out "CMD: #{args.join(' ')}"
|
||||
system(*args) || err("Exit code: #{$CHILD_STATUS.exitstatus}")
|
||||
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
|
||||
@effective_version ||= begin
|
||||
case ref
|
||||
@@ -680,6 +660,15 @@ class Build
|
||||
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'
|
||||
p << {
|
||||
url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
|
||||
@@ -770,6 +759,7 @@ end
|
||||
|
||||
class AbstractEmbedder
|
||||
include Output
|
||||
include System
|
||||
|
||||
attr_reader :app
|
||||
|
||||
@@ -787,6 +777,10 @@ class AbstractEmbedder
|
||||
File.join(invocation_dir, 'Emacs')
|
||||
end
|
||||
|
||||
def bin_dir
|
||||
File.join(invocation_dir, 'bin')
|
||||
end
|
||||
|
||||
def lib_dir
|
||||
File.join(invocation_dir, 'lib')
|
||||
end
|
||||
@@ -796,8 +790,28 @@ class AbstractEmbedder
|
||||
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 Emacs.app'
|
||||
|
||||
FileUtils.mkdir_p(dir)
|
||||
run_cmd('cp', '-pRL', source, target)
|
||||
run_cmd('chmod', '+w', target)
|
||||
end
|
||||
end
|
||||
|
||||
class CSourcesEmbedder < AbstractEmbedder
|
||||
PATH_PATCH = <<~ELISP
|
||||
;; Allow Emacs to find bundled C sources.
|
||||
(setq source-directory (expand-file-name ".."))
|
||||
ELISP
|
||||
|
||||
attr_reader :source_dir
|
||||
|
||||
def initialize(app, source_dir)
|
||||
super(app)
|
||||
|
||||
@@ -807,20 +821,26 @@ 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))
|
||||
cmd('cp', '-pRL', f, target)
|
||||
end
|
||||
|
||||
File.open(subdirs_el_file, 'a') do |f|
|
||||
f.puts("(setq source-directory (expand-file-name \"..\"))\n")
|
||||
return if File.exist?(site_start_el_file) &&
|
||||
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
|
||||
|
||||
private
|
||||
|
||||
def subdirs_el_file
|
||||
@subdirs_el_file ||= File.join(resources_dir, 'lisp', 'subdirs.el')
|
||||
def site_start_el_file
|
||||
@site_start_el_file ||= File.join(resources_dir, 'lisp', 'site-start.el')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -896,7 +916,7 @@ class LibEmbedder < AbstractEmbedder
|
||||
next if match[2] == exe_file || File.exist?(File.join(lib_dir, match[2]))
|
||||
|
||||
FileUtils.mkdir_p(lib_dir)
|
||||
FileUtils.cp(match[1], lib_dir)
|
||||
cmd('cp', '-pRL', match[1], lib_dir)
|
||||
copy_libs(File.join(lib_dir, match[2].to_s), rel_path)
|
||||
end
|
||||
end
|
||||
@@ -911,7 +931,7 @@ class LibEmbedder < AbstractEmbedder
|
||||
target = "#{lib_dir}/#{lib_file}"
|
||||
unless File.exist?(target)
|
||||
FileUtils.mkdir_p(lib_dir)
|
||||
FileUtils.cp(lib, lib_dir)
|
||||
cmd('cp', '-pRL', lib, lib_dir)
|
||||
end
|
||||
|
||||
while_writable(target) do
|
||||
@@ -928,7 +948,7 @@ class LibEmbedder < AbstractEmbedder
|
||||
File.chmod(0o775, file)
|
||||
yield
|
||||
ensure
|
||||
File.chmod(mode, file)
|
||||
File.chmod(mode, file) if File.exist?(file)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -953,14 +973,51 @@ class GccLibEmbedder < AbstractEmbedder
|
||||
end
|
||||
|
||||
FileUtils.mkdir_p(File.dirname(target_dir))
|
||||
FileUtils.cp_r(source_dir, target_dir)
|
||||
run_cmd('cp', '-pRL', source_dir, target_dir)
|
||||
FileUtils.rm(Dir[File.join(target_dir, '**', '.DS_Store')], force: true)
|
||||
FileUtils.chmod_R('u+w', target_dir)
|
||||
FileUtils.mv(source_darwin_dir, target_darwin_dir)
|
||||
run_cmd('chmod', '-R', 'u+w', target_dir)
|
||||
if source_darwin_dir != target_darwin_dir
|
||||
run_cmd('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
|
||||
|
||||
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?
|
||||
Dir[File.join(target_dir, 'libgcc*')].any?
|
||||
end
|
||||
@@ -984,6 +1041,10 @@ class GccLibEmbedder < AbstractEmbedder
|
||||
def relative_dir(path, root)
|
||||
Pathname.new(path).relative_path_from(Pathname.new(root)).to_s
|
||||
end
|
||||
|
||||
def site_start_el_file
|
||||
@site_start_el_file ||= File.join(resources_dir, 'lisp', 'site-start.el')
|
||||
end
|
||||
end
|
||||
|
||||
class GccInfo
|
||||
@@ -1104,7 +1165,7 @@ if __FILE__ == $PROGRAM_NAME
|
||||
cli_options = {
|
||||
work_dir: File.expand_path(__dir__),
|
||||
native_full_aot: false,
|
||||
relink_eln: true,
|
||||
relink_eln: false,
|
||||
native_march: false,
|
||||
parallel: Etc.nprocessors,
|
||||
rsvg: true,
|
||||
@@ -1164,7 +1225,7 @@ if __FILE__ == $PROGRAM_NAME
|
||||
|
||||
opts.on('--[no-]relink-eln-files',
|
||||
'Enable/disable re-linking shared libraries in bundled *.eln ' \
|
||||
'files (default: enabled)') do |v|
|
||||
'files (default: disabled)') do |v|
|
||||
cli_options[:relink_eln] = v
|
||||
end
|
||||
|
||||
@@ -1178,6 +1239,10 @@ if __FILE__ == $PROGRAM_NAME
|
||||
cli_options[:no_titlebar] = true
|
||||
end
|
||||
|
||||
opts.on('--posix-spawn', 'Apply posix-spawn patch (default: disabled)') do
|
||||
cli_options[:posix_spawn] = true
|
||||
end
|
||||
|
||||
opts.on('--no-frame-refocus',
|
||||
'Apply no-frame-refocus patch (default: disabled)') do
|
||||
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{
|
||||
planCmd(),
|
||||
signCmd(),
|
||||
signFilesCmd(),
|
||||
notarizeCmd(),
|
||||
packageCmd(),
|
||||
releaseCmd(),
|
||||
|
||||
@@ -112,3 +112,49 @@ func signAction(c *cli2.Context, opts *Options) error {
|
||||
|
||||
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