Compare commits

..

4 Commits
0.1.1 ... 0.2.0

Author SHA1 Message Date
fe3af6c4c9 chore(release): 0.2.0 2020-09-20 14:31:54 +01:00
7ca3f52819 chore: add Makefile with new_version target 2020-09-20 14:31:12 +01:00
0ab94da153 feat(native_comp)!: add support for NATIVE_FULL_AOT, replacing NATIVE_FAST_BOOT
The feature/native-comp branch no longer supports the use of the
NATIVE_FAST_BOOT environment variable. It has been replaced by
NATIVE_FULL_AOT (Ahead of Time compilation).

As the new environment variable's value is opposite of the old one, it
is disabled by default.

Under the hood, the --[no-]native-full-aot option still sets the
NATIVE_FAST_BOOT environment variable as needed to ensure it works as
expected when producing builds against older commits, and also newer
ones.

BREAKING CHANGE: Deprecate `--[no-]native-fast-boot` option in favor of `--[no-]native-full-aot`
2020-09-20 14:27:50 +01:00
01d27c0891 chore(rubocop): update .rubocop.yml 2020-09-20 14:04:49 +01:00
5 changed files with 125 additions and 79 deletions

View File

@@ -1,5 +1,9 @@
AllCops:
TargetRubyVersion: 2.3
NewCops: enable
Layout/LineLength:
Max: 80
Style/Documentation:
Enabled: false
Style/LineLength:
Max: 80

View File

@@ -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.
## [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)

9
Makefile Normal file
View 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

View File

@@ -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

View File

@@ -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
@@ -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}"