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 | |
|---|---|---|---|
|
1a34a9504a
|
|||
| 8513521d29 | |||
|
88bbefadc6
|
|||
|
f1bf1d93b8
|
|||
|
8a467b0d43
|
|||
|
9c29f721b4
|
|||
|
4ac71ddf39
|
|||
|
d338c136db
|
16
CHANGELOG.md
16
CHANGELOG.md
@@ -2,6 +2,22 @@
|
|||||||
|
|
||||||
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.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)
|
### [0.6.22](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.21...v0.6.22) (2021-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ module Output
|
|||||||
if newline
|
if newline
|
||||||
warn "==> #{msg}"
|
warn "==> #{msg}"
|
||||||
else
|
else
|
||||||
STDERR.print "==> #{msg}"
|
$stderr.print "==> #{msg}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -35,6 +35,19 @@ module Output
|
|||||||
end
|
end
|
||||||
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
|
class OS
|
||||||
def self.version
|
def self.version
|
||||||
@version ||= OSVersion.new
|
@version ||= OSVersion.new
|
||||||
@@ -71,6 +84,7 @@ end
|
|||||||
|
|
||||||
class Build
|
class Build
|
||||||
include Output
|
include Output
|
||||||
|
include System
|
||||||
|
|
||||||
EMACS_MIRROR_REPO = 'emacs-mirror/emacs'
|
EMACS_MIRROR_REPO = 'emacs-mirror/emacs'
|
||||||
DOWNLOAD_URL = 'https://github.com/emacs-mirror/emacs/tarball/%s'
|
DOWNLOAD_URL = 'https://github.com/emacs-mirror/emacs/tarball/%s'
|
||||||
@@ -400,13 +414,13 @@ class Build
|
|||||||
info "Copying \"#{app_name}\" to: #{target_dir}"
|
info "Copying \"#{app_name}\" to: #{target_dir}"
|
||||||
|
|
||||||
FileUtils.mkdir_p(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|
|
options[:dist_include]&.each do |filename|
|
||||||
src = File.join(source_dir, filename)
|
src = File.join(source_dir, filename)
|
||||||
if File.exist?(src)
|
if File.exist?(src)
|
||||||
info "Copying \"#{filename}\" to: #{target_dir}"
|
info "Copying \"#{filename}\" to: #{target_dir}"
|
||||||
FileUtils.cp_r(src, target_dir)
|
cmd('cp', '-pRL', src, target_dir)
|
||||||
else
|
else
|
||||||
info "Warning: #{filename} does not exist in #{source_dir}"
|
info "Warning: #{filename} does not exist in #{source_dir}"
|
||||||
end
|
end
|
||||||
@@ -431,7 +445,7 @@ class Build
|
|||||||
info 'Creating symlinks within Emacs.app needed for native-comp'
|
info 'Creating symlinks within Emacs.app needed for native-comp'
|
||||||
|
|
||||||
if !File.exist?('lisp') && File.exist?('Resources/lisp')
|
if !File.exist?('lisp') && File.exist?('Resources/lisp')
|
||||||
FileUtils.ln_s('Resources/lisp', 'lisp')
|
run_cmd('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
|
||||||
@@ -453,7 +467,7 @@ class Build
|
|||||||
new_name = File.join(parent, base.gsub(/\.(.+)\./, '-\\1-'))
|
new_name = File.join(parent, base.gsub(/\.(.+)\./, '-\\1-'))
|
||||||
|
|
||||||
info "Renaming: #{old_name} --> #{new_name}"
|
info "Renaming: #{old_name} --> #{new_name}"
|
||||||
FileUtils.mv(old_name, new_name)
|
cmd('mv', old_name, new_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
base = File.basename(parent)
|
base = File.basename(parent)
|
||||||
@@ -477,7 +491,7 @@ class Build
|
|||||||
end
|
end
|
||||||
|
|
||||||
target = File.basename(source)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -600,11 +614,6 @@ class Build
|
|||||||
response.body
|
response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_cmd(*args)
|
|
||||||
out "CMD: #{args.join(' ')}"
|
|
||||||
system(*args) || err("Exit code: #{$CHILD_STATUS.exitstatus}")
|
|
||||||
end
|
|
||||||
|
|
||||||
def effective_version
|
def effective_version
|
||||||
@effective_version ||= begin
|
@effective_version ||= begin
|
||||||
case ref
|
case ref
|
||||||
@@ -750,6 +759,7 @@ end
|
|||||||
|
|
||||||
class AbstractEmbedder
|
class AbstractEmbedder
|
||||||
include Output
|
include Output
|
||||||
|
include System
|
||||||
|
|
||||||
attr_reader :app
|
attr_reader :app
|
||||||
|
|
||||||
@@ -786,11 +796,11 @@ class CLIHelperEmbedder < AbstractEmbedder
|
|||||||
target = File.join(bin_dir, 'emacs')
|
target = File.join(bin_dir, 'emacs')
|
||||||
dir = File.dirname(target)
|
dir = File.dirname(target)
|
||||||
|
|
||||||
info "Adding \"emacs\" CLI helper to #{dir}"
|
info 'Adding "emacs" CLI helper to Emacs.app'
|
||||||
|
|
||||||
FileUtils.mkdir_p(dir)
|
FileUtils.mkdir_p(dir)
|
||||||
FileUtils.cp(source, target)
|
run_cmd('cp', '-pRL', source, target)
|
||||||
FileUtils.chmod('+w', target)
|
run_cmd('chmod', '+w', target)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -816,7 +826,7 @@ class CSourcesEmbedder < AbstractEmbedder
|
|||||||
rel = f[src_dir.size + 1..-1]
|
rel = f[src_dir.size + 1..-1]
|
||||||
target = File.join(resources_dir, 'src', rel)
|
target = File.join(resources_dir, 'src', rel)
|
||||||
FileUtils.mkdir_p(File.dirname(target))
|
FileUtils.mkdir_p(File.dirname(target))
|
||||||
FileUtils.cp(f, target)
|
cmd('cp', '-pRL', f, target)
|
||||||
end
|
end
|
||||||
|
|
||||||
return if File.exist?(site_start_el_file) &&
|
return if File.exist?(site_start_el_file) &&
|
||||||
@@ -906,7 +916,7 @@ class LibEmbedder < AbstractEmbedder
|
|||||||
next if match[2] == exe_file || File.exist?(File.join(lib_dir, match[2]))
|
next if match[2] == exe_file || File.exist?(File.join(lib_dir, match[2]))
|
||||||
|
|
||||||
FileUtils.mkdir_p(lib_dir)
|
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)
|
copy_libs(File.join(lib_dir, match[2].to_s), rel_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -921,7 +931,7 @@ class LibEmbedder < AbstractEmbedder
|
|||||||
target = "#{lib_dir}/#{lib_file}"
|
target = "#{lib_dir}/#{lib_file}"
|
||||||
unless File.exist?(target)
|
unless File.exist?(target)
|
||||||
FileUtils.mkdir_p(lib_dir)
|
FileUtils.mkdir_p(lib_dir)
|
||||||
FileUtils.cp(lib, lib_dir)
|
cmd('cp', '-pRL', lib, lib_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
while_writable(target) do
|
while_writable(target) do
|
||||||
@@ -938,7 +948,7 @@ class LibEmbedder < AbstractEmbedder
|
|||||||
File.chmod(0o775, file)
|
File.chmod(0o775, file)
|
||||||
yield
|
yield
|
||||||
ensure
|
ensure
|
||||||
File.chmod(mode, file)
|
File.chmod(mode, file) if File.exist?(file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -963,10 +973,12 @@ class GccLibEmbedder < AbstractEmbedder
|
|||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.mkdir_p(File.dirname(target_dir))
|
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.rm(Dir[File.join(target_dir, '**', '.DS_Store')], force: true)
|
||||||
FileUtils.chmod_R('u+w', target_dir)
|
run_cmd('chmod', '-R', 'u+w', target_dir)
|
||||||
FileUtils.mv(source_darwin_dir, target_darwin_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)
|
env_setup = ERB.new(NATIVE_COMP_ENV_VAR_TPL).result(gcc_info.get_binding)
|
||||||
return if File.exist?(site_start_el_file) &&
|
return if File.exist?(site_start_el_file) &&
|
||||||
@@ -1153,7 +1165,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,
|
||||||
@@ -1213,7 +1225,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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user