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 | |
|---|---|---|---|
|
fe3af6c4c9
|
|||
|
7ca3f52819
|
|||
|
0ab94da153
|
|||
|
01d27c0891
|
10
.rubocop.yml
10
.rubocop.yml
@@ -1,5 +1,9 @@
|
|||||||
|
AllCops:
|
||||||
|
TargetRubyVersion: 2.3
|
||||||
|
NewCops: enable
|
||||||
|
|
||||||
|
Layout/LineLength:
|
||||||
|
Max: 80
|
||||||
|
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/LineLength:
|
|
||||||
Max: 80
|
|
||||||
|
|||||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
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.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)
|
### [0.1.1](https://github.com/jimeh/build-emacs-for-macos/compare/0.1.0...0.1.1) (2020-09-19)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
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)
|
- 13-inch MacBook Pro (2020), 10th-gen 2.3 GHz Quad-Core Intel Core i7 (4c/8t)
|
||||||
- macOS 10.15.6 (19G2021)
|
- macOS 10.15.6 (19G2021)
|
||||||
- Xcode 11.6
|
- Xcode 11.7
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
@@ -71,15 +71,16 @@ available here: https://github.com/emacs-mirror/emacs
|
|||||||
Options:
|
Options:
|
||||||
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 8)
|
-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
|
--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-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
|
--[no-]native-comp-macos-fixes
|
||||||
Enable/disable fix based on feature/native-comp-macos-fixes branch (default: enabled if native-comp supported)
|
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)
|
--[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)
|
--rsvg Enable SVG image support via librsvg, can yield a unstable build (default: disabled)
|
||||||
--no-titlebar Apply no-titlebar patch (default: disabled)
|
--no-titlebar Apply no-titlebar patch (default: disabled)
|
||||||
--no-frame-refocus Apply no-frame-refocus 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
|
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
|
./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
|
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
|
lisp files will be dynamically compiled in the background the first time you use
|
||||||
them.
|
them.
|
||||||
|
|
||||||
On my machine it takes around 10-15 minutes to build Emacs.app with
|
On my machine it takes around 10 minutes to build Emacs.app with
|
||||||
`NATIVE_FAST_BOOT` enabled. With it disabled it takes around 25 minutes.
|
`NATIVE_FULL_AOT` disabled. With it enabled it takes around 20-25 minutes.
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
@@ -169,14 +170,16 @@ said directory which have a file size of zero bytes:
|
|||||||
|
|
||||||
```elisp
|
```elisp
|
||||||
(when (boundp 'comp-eln-load-path)
|
(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")))
|
(find-exec (executable-find "find")))
|
||||||
(setcar comp-eln-load-path eln-cache-dir)
|
(setcar comp-eln-load-path eln-cache-dir)
|
||||||
;; Quitting emacs while native compilation in progress can leave zero byte
|
;; Quitting emacs while native compilation in progress can leave zero byte
|
||||||
;; sized *.eln files behind. Hence delete such files during startup.
|
;; sized *.eln files behind. Hence delete such files during startup.
|
||||||
(when find-exec
|
(when find-exec
|
||||||
(call-process find-exec nil nil nil eln-cache-dir
|
(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
|
### Issues
|
||||||
|
|||||||
@@ -256,7 +256,6 @@ class Build
|
|||||||
apply_native_comp_macos_fixes
|
apply_native_comp_macos_fixes
|
||||||
end
|
end
|
||||||
|
|
||||||
ENV['NATIVE_FAST_BOOT'] = '1' if options[:native_fast_boot]
|
|
||||||
ENV['CFLAGS'] = [
|
ENV['CFLAGS'] = [
|
||||||
"-I#{gcc_dir}/include",
|
"-I#{gcc_dir}/include",
|
||||||
'-O2',
|
'-O2',
|
||||||
@@ -321,6 +320,15 @@ class Build
|
|||||||
make_flags = []
|
make_flags = []
|
||||||
make_flags += ['-j', options[:parallel].to_s] if options[:parallel]
|
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]
|
if options[:native_comp]
|
||||||
make_flags << "BYTE_COMPILE_EXTRA_FLAGS=--eval '(setq comp-speed 2)'"
|
make_flags << "BYTE_COMPILE_EXTRA_FLAGS=--eval '(setq comp-speed 2)'"
|
||||||
end
|
end
|
||||||
@@ -795,79 +803,90 @@ end
|
|||||||
if __FILE__ == $PROGRAM_NAME
|
if __FILE__ == $PROGRAM_NAME
|
||||||
cli_options = {
|
cli_options = {
|
||||||
macos_fixes: true,
|
macos_fixes: true,
|
||||||
native_fast_boot: true,
|
native_full_aot: false,
|
||||||
parallel: Etc.nprocessors,
|
parallel: Etc.nprocessors,
|
||||||
rsvg: false,
|
rsvg: false,
|
||||||
xwidgets: true
|
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
|
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
|
Build.new(File.expand_path(__dir__), ARGV.shift, cli_options).build
|
||||||
rescue Error => e
|
rescue Error => e
|
||||||
warn "ERROR: #{e.message}"
|
warn "ERROR: #{e.message}"
|
||||||
|
|||||||
Reference in New Issue
Block a user