mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
fe3af6c4c9
|
|||
|
7ca3f52819
|
|||
|
0ab94da153
|
|||
|
01d27c0891
|
|||
|
5341728b41
|
|||
|
f8515ad3a4
|
|||
|
c89d0a0b73
|
10
.rubocop.yml
10
.rubocop.yml
@@ -1,5 +1,9 @@
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.3
|
||||
NewCops: enable
|
||||
|
||||
Layout/LineLength:
|
||||
Max: 80
|
||||
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
Style/LineLength:
|
||||
Max: 80
|
||||
|
||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -2,6 +2,24 @@
|
||||
|
||||
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.2.0](https://github.com/jimeh/build-emacs-for-macos/compare/0.1.1...0.2.0) (2020-09-20)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* **native_comp:** Deprecate `--[no-]native-fast-boot` option in favor of `--[no-]native-full-aot`
|
||||
|
||||
### Features
|
||||
|
||||
* **native_comp:** add support for NATIVE_FULL_AOT, replacing NATIVE_FAST_BOOT ([0ab94da](https://github.com/jimeh/build-emacs-for-macos/commit/0ab94da15309b04978982369bdfa17e03e9b6329))
|
||||
|
||||
### [0.1.1](https://github.com/jimeh/build-emacs-for-macos/compare/0.1.0...0.1.1) (2020-09-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **internal:** improve macOS version detection ([c89d0a0](https://github.com/jimeh/build-emacs-for-macos/commit/c89d0a0b73dfc82d918c326d89b141f8a2fc4de4)), closes [#13](https://github.com/jimeh/build-emacs-for-macos/issues/13)
|
||||
|
||||
## 0.1.0 (2020-09-05)
|
||||
|
||||
|
||||
|
||||
9
Makefile
Normal file
9
Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
.PHONY: new-version
|
||||
new-version:
|
||||
$(if $(shell which npx),,\
|
||||
$(error No npx found in PATH, please install NodeJS))
|
||||
$(if $(shell which standard-version),,\
|
||||
$(error No standard-version found in PATH, install with: \
|
||||
npm install -g standard-version))
|
||||
|
||||
npx standard-version
|
||||
19
README.md
19
README.md
@@ -30,7 +30,7 @@ For reference, my machine is:
|
||||
|
||||
- 13-inch MacBook Pro (2020), 10th-gen 2.3 GHz Quad-Core Intel Core i7 (4c/8t)
|
||||
- macOS 10.15.6 (19G2021)
|
||||
- Xcode 11.6
|
||||
- Xcode 11.7
|
||||
|
||||
## Limitations
|
||||
|
||||
@@ -71,15 +71,16 @@ available here: https://github.com/emacs-mirror/emacs
|
||||
Options:
|
||||
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 8)
|
||||
--git-sha SHA Override detected git SHA of specified branch allowing builds of old commits
|
||||
--[no-]xwidgets Enable/disable XWidgets (default: enabled)
|
||||
--[no-]xwidgets Enable/disable XWidgets (default: enabled if supported)
|
||||
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
|
||||
--[no-]native-fast-boot Enable/disable NATIVE_FAST_BOOT (default: enabled if native-comp supported)
|
||||
--[no-]native-full-aot Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation (default: disabled)
|
||||
--[no-]native-comp-macos-fixes
|
||||
Enable/disable fix based on feature/native-comp-macos-fixes branch (default: enabled if native-comp supported)
|
||||
--[no-]launcher Enable/disable embedded launcher script (default: enabled if native-comp is enabled)
|
||||
--rsvg Enable SVG image support via librsvg, can yield a unstable build (default: disabled)
|
||||
--no-titlebar Apply no-titlebar patch (default: disabled)
|
||||
--no-frame-refocus Apply no-frame-refocus patch (default: disabled)
|
||||
--[no-]native-fast-boot DEPRECATED: use --[no-]native-full-aot instead
|
||||
```
|
||||
|
||||
Resulting applications are saved to the `builds` directory in a bzip2 compressed
|
||||
@@ -138,13 +139,13 @@ And finally to build a Emacs.app with native compilation enabled, run:
|
||||
./build-emacs-for-macos feature/native-comp
|
||||
```
|
||||
|
||||
By default `NATIVE_FAST_BOOT` is enabled which ensures a fast build by native
|
||||
By default `NATIVE_FULL_AOT` is disabled which ensures a fast build by native
|
||||
compiling as few lisp source files as possible to build the app. Any remaining
|
||||
lisp files will be dynamically compiled in the background the first time you use
|
||||
them.
|
||||
|
||||
On my machine it takes around 10-15 minutes to build Emacs.app with
|
||||
`NATIVE_FAST_BOOT` enabled. With it disabled it takes around 25 minutes.
|
||||
On my machine it takes around 10 minutes to build Emacs.app with
|
||||
`NATIVE_FULL_AOT` disabled. With it enabled it takes around 20-25 minutes.
|
||||
|
||||
### Configuration
|
||||
|
||||
@@ -169,14 +170,16 @@ said directory which have a file size of zero bytes:
|
||||
|
||||
```elisp
|
||||
(when (boundp 'comp-eln-load-path)
|
||||
(let ((eln-cache-dir (expand-file-name "cache/eln-cache/" user-emacs-directory))
|
||||
(let ((eln-cache-dir (expand-file-name "cache/eln-cache/"
|
||||
user-emacs-directory))
|
||||
(find-exec (executable-find "find")))
|
||||
(setcar comp-eln-load-path eln-cache-dir)
|
||||
;; Quitting emacs while native compilation in progress can leave zero byte
|
||||
;; sized *.eln files behind. Hence delete such files during startup.
|
||||
(when find-exec
|
||||
(call-process find-exec nil nil nil eln-cache-dir
|
||||
"-name" "*.eln" "-size" "0" "-delete"))))
|
||||
"-name" "*.eln" "-size" "0" "-delete" "-or"
|
||||
"-name" "*.eln.tmp" "-size" "0" "-delete"))))
|
||||
```
|
||||
|
||||
### Issues
|
||||
|
||||
@@ -45,7 +45,7 @@ end
|
||||
class OSVersion
|
||||
def initialize
|
||||
@version = `sw_vers -productVersion`.match(
|
||||
/(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/
|
||||
/(?<major>\d+)(?:\.(?<minor>\d+)(:?\.(?<patch>\d+))?)?/
|
||||
)
|
||||
end
|
||||
|
||||
@@ -54,15 +54,15 @@ class OSVersion
|
||||
end
|
||||
|
||||
def major
|
||||
@major ||= @version[:major].to_i
|
||||
@major ||= @version[:major]&.to_i
|
||||
end
|
||||
|
||||
def minor
|
||||
@minor ||= @version[:minor].to_i
|
||||
@minor ||= @version[:minor]&.to_i
|
||||
end
|
||||
|
||||
def patch
|
||||
@patch ||= @version[:patch].to_i
|
||||
@patch ||= @version[:patch]&.to_i
|
||||
end
|
||||
end
|
||||
|
||||
@@ -256,7 +256,6 @@ class Build
|
||||
apply_native_comp_macos_fixes
|
||||
end
|
||||
|
||||
ENV['NATIVE_FAST_BOOT'] = '1' if options[:native_fast_boot]
|
||||
ENV['CFLAGS'] = [
|
||||
"-I#{gcc_dir}/include",
|
||||
'-O2',
|
||||
@@ -321,6 +320,15 @@ class Build
|
||||
make_flags = []
|
||||
make_flags += ['-j', options[:parallel].to_s] if options[:parallel]
|
||||
|
||||
if options[:native_full_aot]
|
||||
info 'Using NATIVE_FULL_AOT=1'
|
||||
make_flags << 'NATIVE_FULL_AOT=1'
|
||||
ENV.delete('NATIVE_FAST_BOOT')
|
||||
else
|
||||
ENV.delete('NATIVE_FULL_AOT')
|
||||
ENV['NATIVE_FAST_BOOT'] = '1'
|
||||
end
|
||||
|
||||
if options[:native_comp]
|
||||
make_flags << "BYTE_COMPILE_EXTRA_FLAGS=--eval '(setq comp-speed 2)'"
|
||||
end
|
||||
@@ -570,7 +578,7 @@ class AbstractEmbedder
|
||||
end
|
||||
|
||||
def lib_dir_name
|
||||
"lib-#{OS.arch}-#{OS.version}"
|
||||
"lib-#{OS.arch}-#{OS.version.to_s.tr('.', '_')}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -795,79 +803,90 @@ end
|
||||
if __FILE__ == $PROGRAM_NAME
|
||||
cli_options = {
|
||||
macos_fixes: true,
|
||||
native_fast_boot: true,
|
||||
native_full_aot: false,
|
||||
parallel: Etc.nprocessors,
|
||||
rsvg: false,
|
||||
xwidgets: true
|
||||
}
|
||||
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = <<~DOC
|
||||
Usage: ./build-emacs-for-macos [options] <branch/tag/sha>
|
||||
|
||||
Branch, tag, and SHA are from the emacs-mirror/emacs/emacs Github repo,
|
||||
available here: https://github.com/emacs-mirror/emacs
|
||||
|
||||
Options:
|
||||
DOC
|
||||
|
||||
opts.on('-j', '--parallel COUNT',
|
||||
'Compile using COUNT parallel processes ' \
|
||||
"(detected: #{cli_options[:parallel]})") do |v|
|
||||
cli_options[:parallel] = v
|
||||
end
|
||||
|
||||
opts.on('--git-sha SHA', 'Override detected git SHA of specified branch ' \
|
||||
'allowing builds of old commits') do |v|
|
||||
cli_options[:git_sha] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]xwidgets',
|
||||
'Enable/disable XWidgets ' \
|
||||
'(default: enabled)') do |v|
|
||||
cli_options[:xwidgets] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]native-comp',
|
||||
'Enable/disable native-comp ' \
|
||||
'(default: enabled if supported)') do |v|
|
||||
cli_options[:native_comp] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]native-fast-boot',
|
||||
'Enable/disable NATIVE_FAST_BOOT ' \
|
||||
'(default: enabled if native-comp supported)') do |v|
|
||||
cli_options[:native_fast_boot] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]native-comp-macos-fixes',
|
||||
'Enable/disable fix based on feature/native-comp-macos-fixes ' \
|
||||
'branch (default: enabled if native-comp supported)') do |v|
|
||||
cli_options[:macos_fixes] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]launcher',
|
||||
'Enable/disable embedded launcher script ' \
|
||||
'(default: enabled if native-comp is enabled)') do |v|
|
||||
cli_options[:launcher] = v
|
||||
end
|
||||
|
||||
opts.on('--rsvg', 'Enable SVG image support via librsvg, ' \
|
||||
'can yield a unstable build (default: disabled)') do
|
||||
cli_options[:rsvg] = true
|
||||
end
|
||||
|
||||
opts.on('--no-titlebar', 'Apply no-titlebar patch (default: disabled)') do
|
||||
cli_options[:no_titlebar] = true
|
||||
end
|
||||
|
||||
opts.on('--no-frame-refocus',
|
||||
'Apply no-frame-refocus patch (default: disabled)') do
|
||||
cli_options[:no_frame_refocus] = true
|
||||
end
|
||||
end.parse!
|
||||
|
||||
begin
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = <<~DOC
|
||||
Usage: ./build-emacs-for-macos [options] <branch/tag/sha>
|
||||
|
||||
Branch, tag, and SHA are from the emacs-mirror/emacs/emacs Github repo,
|
||||
available here: https://github.com/emacs-mirror/emacs
|
||||
|
||||
Options:
|
||||
DOC
|
||||
|
||||
opts.on('-j', '--parallel COUNT',
|
||||
'Compile using COUNT parallel processes ' \
|
||||
"(detected: #{cli_options[:parallel]})") do |v|
|
||||
cli_options[:parallel] = v
|
||||
end
|
||||
|
||||
opts.on('--git-sha SHA', 'Override detected git SHA of specified ' \
|
||||
'branch allowing builds of old commits') do |v|
|
||||
cli_options[:git_sha] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]xwidgets',
|
||||
'Enable/disable XWidgets ' \
|
||||
'(default: enabled if supported)') do |v|
|
||||
cli_options[:xwidgets] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]native-comp',
|
||||
'Enable/disable native-comp ' \
|
||||
'(default: enabled if supported)') do |v|
|
||||
cli_options[:native_comp] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]native-full-aot',
|
||||
'Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation ' \
|
||||
'(default: disabled)') do |v|
|
||||
cli_options[:native_full_aot] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]native-comp-macos-fixes',
|
||||
'Enable/disable fix based on feature/native-comp-macos-fixes ' \
|
||||
'branch (default: enabled if native-comp supported)') do |v|
|
||||
cli_options[:macos_fixes] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]launcher',
|
||||
'Enable/disable embedded launcher script ' \
|
||||
'(default: enabled if native-comp is enabled)') do |v|
|
||||
cli_options[:launcher] = v
|
||||
end
|
||||
|
||||
opts.on('--rsvg', 'Enable SVG image support via librsvg, ' \
|
||||
'can yield a unstable build (default: disabled)') do
|
||||
cli_options[:rsvg] = true
|
||||
end
|
||||
|
||||
opts.on('--no-titlebar', 'Apply no-titlebar patch (default: disabled)') do
|
||||
cli_options[:no_titlebar] = true
|
||||
end
|
||||
|
||||
opts.on('--no-frame-refocus',
|
||||
'Apply no-frame-refocus patch (default: disabled)') do
|
||||
cli_options[:no_frame_refocus] = true
|
||||
end
|
||||
|
||||
opts.on('--[no-]native-fast-boot',
|
||||
'DEPRECATED: use --[no-]native-full-aot instead') do |v|
|
||||
if v
|
||||
raise Error, '--native-fast-boot option is deprecated, ' \
|
||||
'use --no-native-full-aot instead'
|
||||
else
|
||||
raise Error, '--no-native-fast-boot option is deprecated, ' \
|
||||
'use --native-full-aot instead'
|
||||
end
|
||||
end
|
||||
end.parse!
|
||||
|
||||
Build.new(File.expand_path(__dir__), ARGV.shift, cli_options).build
|
||||
rescue Error => e
|
||||
warn "ERROR: #{e.message}"
|
||||
|
||||
Reference in New Issue
Block a user