mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
c55bf68e61
|
|||
| 26ce446226 | |||
|
ca2d4c38f6
|
|||
|
bd81870659
|
|||
|
5cd9d1c5fa
|
|||
| 6ae14b597c | |||
|
deda28e5ad
|
|||
|
3d6caac962
|
|||
| 11de27358d | |||
|
8237aa9272
|
|||
|
3ffe83c94e
|
|||
|
9f6ec5954f
|
|||
| 9ea79670d8 | |||
|
72e40248e1
|
|||
|
7259111478
|
|||
|
bb45cda023
|
|||
|
ab872202df
|
|||
|
2d1c5d47d9
|
|||
| 30a71c423e | |||
|
5c48445397
|
|||
|
bf7c4d5deb
|
|||
|
3ffeb4854c
|
|||
|
0a22d8393c
|
|||
|
ac8348323d
|
|||
| 59f52b65ee | |||
|
81a96f4d60
|
|||
|
1df39fafe6
|
|||
|
14a8d1aaaf
|
|||
|
272a3000a1
|
|||
|
d684cf560f
|
|||
| ea189a6713 | |||
|
63289216d7
|
|||
|
2054c8c0aa
|
|||
|
ca09d1a95f
|
|||
|
f1e60e31d9
|
|||
|
8d197aea73
|
|||
|
844df73c8f
|
|||
|
f1fc68c8f5
|
|||
|
e19a6a7bc2
|
|||
|
1000999eb2
|
|||
|
a75047fb3a
|
|||
|
a1641946e4
|
|||
|
581594da3c
|
|||
|
bdad382e7f
|
|||
|
e25ceaa7e2
|
|||
|
03ae8750b8
|
|||
|
269dbdb1dd
|
|||
| 713c970da4 | |||
|
dca023daec
|
|||
|
e56c26d06f
|
|||
|
b2860f22c3
|
|||
|
d1c5e7afb1
|
|||
|
ab55f5421c
|
|||
|
eb09d5fa49
|
|||
|
a47d3e0c6a
|
|||
|
5a61a72a73
|
|||
| 9cdf67e71b | |||
|
946856e9c2
|
|||
|
|
2247158051
|
||
|
4a7c507858
|
|||
|
884f1607f6
|
|||
|
c7daa1350b
|
|||
|
9223ff8e28
|
|||
|
70bf6b05d5
|
|||
|
8936f4762a
|
|||
|
be8e04e7a5
|
|||
| aadf32cbbe | |||
|
d8bbcb72b3
|
|||
|
d6f11b5459
|
|||
|
09e67381cb
|
|||
|
d21ccad3e4
|
|||
| 036d2a82d9 | |||
|
111cb64993
|
|||
|
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:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/LineLength:
|
|
||||||
Max: 80
|
|
||||||
|
|||||||
3
Brewfile
3
Brewfile
@@ -1,13 +1,16 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
brew 'autoconf'
|
||||||
brew 'coreutils'
|
brew 'coreutils'
|
||||||
brew 'curl'
|
brew 'curl'
|
||||||
brew 'expat'
|
brew 'expat'
|
||||||
|
brew 'gcc'
|
||||||
brew 'gmp'
|
brew 'gmp'
|
||||||
brew 'gnu-sed'
|
brew 'gnu-sed'
|
||||||
brew 'gnutls'
|
brew 'gnutls'
|
||||||
brew 'jansson'
|
brew 'jansson'
|
||||||
brew 'libffi'
|
brew 'libffi'
|
||||||
|
brew 'libgccjit'
|
||||||
brew 'libiconv'
|
brew 'libiconv'
|
||||||
brew 'librsvg'
|
brew 'librsvg'
|
||||||
brew 'libtasn1'
|
brew 'libtasn1'
|
||||||
|
|||||||
164
CHANGELOG.md
164
CHANGELOG.md
@@ -2,6 +2,170 @@
|
|||||||
|
|
||||||
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.4.16](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.15...0.4.16) (2021-06-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **compiling:** improve portability of builds ([ca2d4c3](https://github.com/jimeh/build-emacs-for-macos/commit/ca2d4c38f69c434c77c266594104bfbf34ad5221))
|
||||||
|
* **native_comp:** crash on launch when gcc homebrew package was not installed ([bd81870](https://github.com/jimeh/build-emacs-for-macos/commit/bd8187065928b9f79de8b14222c98f8dc34bfe5f))
|
||||||
|
|
||||||
|
### [0.4.15](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.14...0.4.15) (2021-05-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **github:** perform authenticated GitHub API requests when GITHUB_TOKEN env var is set ([deda28e](https://github.com/jimeh/build-emacs-for-macos/commit/deda28e5aded2817bcc7956f377378576372816f))
|
||||||
|
|
||||||
|
### [0.4.14](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.13...0.4.14) (2021-05-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **cli:** add "emacs" CLI launcher script to Emacs.app/Conents/MacOS/bin ([8237aa9](https://github.com/jimeh/build-emacs-for-macos/commit/8237aa9272ce1d13a412b2495cbaa90df38d928b)), closes [#41](https://github.com/jimeh/build-emacs-for-macos/issues/41)
|
||||||
|
|
||||||
|
### [0.4.13](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.12...0.4.13) (2021-05-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **codesign:** prevent "bundle format unrecognized" error from codesign ([7259111](https://github.com/jimeh/build-emacs-for-macos/commit/7259111478ecb838dea9c8f50ea39eafdf47ed5a))
|
||||||
|
* **embed:** avoid potential error caused by trying to set duplicate rpath ([bb45cda](https://github.com/jimeh/build-emacs-for-macos/commit/bb45cda0231e99618571dc835348cf5c3345e277))
|
||||||
|
|
||||||
|
### [0.4.12](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.11...0.4.12) (2021-05-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **shared-libraries:** stop aggressive dylib re-linking ([0a22d83](https://github.com/jimeh/build-emacs-for-macos/commit/0a22d8393c53305354c4c6d8e784e7d59caa039a)), closes [#12](https://github.com/jimeh/build-emacs-for-macos/issues/12)
|
||||||
|
* **svg:** enable SVG by default via librsvg ([bf7c4d5](https://github.com/jimeh/build-emacs-for-macos/commit/bf7c4d5debf32980dbbabc1ea99b58b266390011))
|
||||||
|
|
||||||
|
### [0.4.11](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.10...0.4.11) (2021-05-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **builds:** update build script for new plan.yml format ([1df39fa](https://github.com/jimeh/build-emacs-for-macos/commit/1df39fafe62ada385aa1d92e6b7f591c16c0a80c))
|
||||||
|
* **release:** initial attempt at providing automatic builds ([6328921](https://github.com/jimeh/build-emacs-for-macos/commit/63289216d70e496d664a7e3078dea5a82eb8f65d))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **release:** attempt to fix issue with talking to GitHub API ([272a300](https://github.com/jimeh/build-emacs-for-macos/commit/272a3000a1f96d8f131e684736127b923513a205))
|
||||||
|
|
||||||
|
### [0.4.10](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.9...0.4.10) (2021-04-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** correctly default to master branch if no git ref is given ([844df73](https://github.com/jimeh/build-emacs-for-macos/commit/844df73c8fa8440e657f7900ec89cdedb7c4c312))
|
||||||
|
|
||||||
|
### [0.4.9](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.8...0.4.9) (2021-04-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** default to "master" if no git ref is given ([e19a6a7](https://github.com/jimeh/build-emacs-for-macos/commit/e19a6a7bc24379292ee06ae4c805b8c5365f2d97)), closes [#35](https://github.com/jimeh/build-emacs-for-macos/issues/35)
|
||||||
|
* **native_comp:** skip symlink creation for recent builds which do not need symlinks ([1000999](https://github.com/jimeh/build-emacs-for-macos/commit/1000999eb2673dc207a390ff3f902b9987b99173))
|
||||||
|
|
||||||
|
### [0.4.8](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.7...0.4.8) (2021-02-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **native_comp:** add support for new --with-native-compilation flag ([581594d](https://github.com/jimeh/build-emacs-for-macos/commit/581594da3cfbf1dd2fa28e91710b767e21ff75d2))
|
||||||
|
|
||||||
|
### [0.4.7](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.6...0.4.7) (2021-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **native_comp:** add libgccjit include dir during build stage ([e25ceaa](https://github.com/jimeh/build-emacs-for-macos/commit/e25ceaa7e25b0e1b9947401597845b5ba43e6cd1)), closes [#20](https://github.com/jimeh/build-emacs-for-macos/issues/20)
|
||||||
|
|
||||||
|
### [0.4.6](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.5...0.4.6) (2021-02-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **native_comp:** improve env setup patch fixing potential issues ([dca023d](https://github.com/jimeh/build-emacs-for-macos/commit/dca023daecd8704f197cbc391380aa194bc47d62))
|
||||||
|
|
||||||
|
### [0.4.5](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.4...0.4.5) (2021-01-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** remove defunct --[no-]native-comp-macos-fixes option ([ab55f54](https://github.com/jimeh/build-emacs-for-macos/commit/ab55f5421c81dc629e487bf4b8bb402657cb1bc4))
|
||||||
|
|
||||||
|
### [0.4.4](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.3...0.4.4) (2021-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **deps:** add autoconf to Brewfile ([a47d3e0](https://github.com/jimeh/build-emacs-for-macos/commit/a47d3e0c6a8ea8161a3bad0eafdac2401cf53129))
|
||||||
|
|
||||||
|
### [0.4.3](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.2...0.4.3) (2020-12-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **big-sur:** add Xcode CLI tools lib directory to runtime LIBRARY_PATH ([946856e](https://github.com/jimeh/build-emacs-for-macos/commit/946856e9c242d4a6fb5f839d8cae0acfafecdfc6))
|
||||||
|
* **big-sur:** added support for building on Big Sur ([2247158](https://github.com/jimeh/build-emacs-for-macos/commit/2247158051d0f59933569b6974b2b5269f13c79e))
|
||||||
|
|
||||||
|
### [0.4.2](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.1...0.4.2) (2020-12-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** avoid error if --git-sha is used without a branch/tag/sha argument ([884f160](https://github.com/jimeh/build-emacs-for-macos/commit/884f1607f6707ca187b1abfb0ce562757d872230)), closes [#21](https://github.com/jimeh/build-emacs-for-macos/issues/21)
|
||||||
|
* **native_comp:** update env setup patch for recent changes to comp.el ([c7daa13](https://github.com/jimeh/build-emacs-for-macos/commit/c7daa1350bd69df172ce6484c54189d2cee8d97e))
|
||||||
|
|
||||||
|
### [0.4.1](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.0...0.4.1) (2020-10-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **native_comp:** remove patch based on feature/native-comp-macos-fixes branch ([70bf6b0](https://github.com/jimeh/build-emacs-for-macos/commit/70bf6b05d584976632b2fd2947c0bf692f5b6421))
|
||||||
|
|
||||||
|
## [0.4.0](https://github.com/jimeh/build-emacs-for-macos/compare/0.3.0...0.4.0) (2020-10-04)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* **native_comp:** Standard Homewbrew `gcc` and `libgccjit` formula are now required for native-comp, instead of the custom patched gcc formula.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **native_comp:** use new libgccjit Homebrew formula ([d8bbcb7](https://github.com/jimeh/build-emacs-for-macos/commit/d8bbcb72b33f6bde8678c9d37548217ffdf3d641))
|
||||||
|
|
||||||
|
## [0.3.0](https://github.com/jimeh/build-emacs-for-macos/compare/0.2.0...0.3.0) (2020-09-22)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* **native_comp:** `--[no-]launcher` option is deprecated, as launcher script is no longer used.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **native_comp:** use elisp patch instead of launcher script to set LIBRARY_PATH ([111cb64](https://github.com/jimeh/build-emacs-for-macos/commit/111cb6499368d14853a5927d38a43fc5e2f759f4)), closes [#14](https://github.com/jimeh/build-emacs-for-macos/issues/14)
|
||||||
|
|
||||||
|
## [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)
|
## 0.1.0 (2020-09-05)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
diff --git a/Formula/gcc.rb b/Formula/gcc.rb
|
|
||||||
index 1bd636d496..03ad124218 100644
|
|
||||||
--- a/Formula/gcc.rb
|
|
||||||
+++ b/Formula/gcc.rb
|
|
||||||
@@ -53,7 +53,7 @@ class Gcc < Formula
|
|
||||||
# - Ada, which requires a pre-existing GCC Ada compiler to bootstrap
|
|
||||||
# - Go, currently not supported on macOS
|
|
||||||
# - BRIG
|
|
||||||
- languages = %w[c c++ objc obj-c++ fortran]
|
|
||||||
+ languages = %w[c c++ objc obj-c++ fortran jit]
|
|
||||||
|
|
||||||
osmajor = `uname -r`.split(".").first
|
|
||||||
pkgversion = "Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip
|
|
||||||
@@ -73,6 +73,7 @@ class Gcc < Formula
|
|
||||||
--with-system-zlib
|
|
||||||
--with-pkgversion=#{pkgversion}
|
|
||||||
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
|
|
||||||
+ --enable-host-shared
|
|
||||||
]
|
|
||||||
|
|
||||||
# Xcode 10 dropped 32-bit support
|
|
||||||
2
Gemfile
2
Gemfile
@@ -5,4 +5,6 @@ source 'http://rubygems.org/'
|
|||||||
group :development do
|
group :development do
|
||||||
gem 'byebug'
|
gem 'byebug'
|
||||||
gem 'rubocop'
|
gem 'rubocop'
|
||||||
|
gem 'rubocop-daemon'
|
||||||
|
gem 'solargraph', '~> 0.39.17'
|
||||||
end
|
end
|
||||||
|
|||||||
12
Makefile
Normal file
12
Makefile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
.PHONY: new-version
|
||||||
|
new-version: check-npx
|
||||||
|
npx standard-version
|
||||||
|
|
||||||
|
.PHONY: next-version
|
||||||
|
next-version: check-npx
|
||||||
|
npx standard-version --dry-run
|
||||||
|
|
||||||
|
.PHONY: check-npx
|
||||||
|
check-npx:
|
||||||
|
$(if $(shell which npx),,\
|
||||||
|
$(error No npx execuable found in PATH, please install NodeJS))
|
||||||
138
README.md
138
README.md
@@ -1,7 +1,8 @@
|
|||||||
# build-emacs-for-macos
|
# build-emacs-for-macos
|
||||||
|
|
||||||
My personal hacked together script for building a completely self-contained
|
My personal hacked together script for building a completely self-contained
|
||||||
Emacs.app application on macOS, from any git branch, tag, or ref.
|
Emacs.app application on macOS, from any git branch, tag, or ref. With support
|
||||||
|
for native-compilation.
|
||||||
|
|
||||||
Use this script at your own risk.
|
Use this script at your own risk.
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ Use this script at your own risk.
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
As of writing (2020-08-19) it works for me on my machine. Your luck may vary.
|
As of writing (2021-04-25) it works for me on my machine. Your luck may vary.
|
||||||
|
|
||||||
I have successfully built:
|
I have successfully built:
|
||||||
|
|
||||||
@@ -29,8 +30,8 @@ I have successfully built:
|
|||||||
For reference, my machine is:
|
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 Big Sur 11.2.3 (20D91)
|
||||||
- Xcode 11.6
|
- Xcode 12.4 (12D4e)
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
@@ -71,15 +72,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 if supported (default: enabled)
|
||||||
--[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-march Enable/disable -march=native CFLAG(default: disabled)
|
||||||
--[no-]native-comp-macos-fixes
|
--[no-]native-full-aot Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation (default: disabled)
|
||||||
Enable/disable fix based on feature/native-comp-macos-fixes branch (default: enabled if native-comp supported)
|
--[no-]rsvg Enable/disable SVG image support via librsvg (default: 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)
|
|
||||||
--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-]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
|
||||||
|
--plan FILE Follow given plan file, instead of using given git ref/sha
|
||||||
```
|
```
|
||||||
|
|
||||||
Resulting applications are saved to the `builds` directory in a bzip2 compressed
|
Resulting applications are saved to the `builds` directory in a bzip2 compressed
|
||||||
@@ -88,10 +90,13 @@ tarball.
|
|||||||
If you don't want the build process to eat all your CPU cores, pass in a `-j`
|
If you don't want the build process to eat all your CPU cores, pass in a `-j`
|
||||||
value of how many CPU cores you want it to use.
|
value of how many CPU cores you want it to use.
|
||||||
|
|
||||||
|
Re-building the same Git SHA again can yield weird results unless you first
|
||||||
|
trash the corresponding directory from the `sources` directory.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
To download a tarball of the `master` branch (Emacs 28.x as of writing) and
|
To download a tarball of the `master` branch (Emacs 28.x with native-compilation
|
||||||
build Emacs.app from it:
|
as of writing) and build Emacs.app from it:
|
||||||
|
|
||||||
```
|
```
|
||||||
./build-emacs-for-macos
|
./build-emacs-for-macos
|
||||||
@@ -108,75 +113,74 @@ All sources as downloaded as tarballs from the
|
|||||||
to get a list of tags/branches available to install, simply check said
|
to get a list of tags/branches available to install, simply check said
|
||||||
repository.
|
repository.
|
||||||
|
|
||||||
|
## Use Emacs.app as `emacs` CLI Tool
|
||||||
|
|
||||||
|
Builds come with a custom `emacs` shell script launcher for use from the command
|
||||||
|
line. It makes sure to use the main `Emacs.app/Contents/MacOS/Emacs` executable
|
||||||
|
from the correct path, ensuring it finds all the relevant dependencies within
|
||||||
|
the Emacs.app bundle.
|
||||||
|
|
||||||
|
To use it, simply add `Emacs.app/Contents/MacOS/bin` to your `PATH`. For
|
||||||
|
example, if you place Emacs.app in `/Applications`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -d "/Applications/Emacs.app/Contents/MacOS/bin" ]; then
|
||||||
|
export PATH="/Applications/Emacs.app/Contents/MacOS/bin:$PATH"
|
||||||
|
alias emacs="emacs -nw" # Always launch "emacs" in terminal mode.
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want `emacs` in your terminal to launch a GUI instance of Emacs, don't
|
||||||
|
use the alias from the above example.
|
||||||
|
|
||||||
## Native-Comp
|
## Native-Comp
|
||||||
|
|
||||||
To build a Emacs.app with native-comp support
|
_Note: On 2021-04-25 the `feature/native-comp` branch was
|
||||||
([gccemacs](https://akrl.sdf.org/gccemacs.html)) from the `feature/native-comp`
|
[merged](http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=289000eee729689b0cf362a21baa40ac7f9506f6)
|
||||||
branch, you will need to install a patched version of Homebrew's `gcc` formula
|
into `master`._
|
||||||
that includes libgccjit.
|
|
||||||
|
|
||||||
The patch itself is in `./Formula/gcc.rb.patch`, and comes from
|
The build script will automatically detect if the source tree being built
|
||||||
[this](https://gist.github.com/mikroskeem/0a5c909c1880408adf732ceba6d3f9ab#1-gcc-with-libgccjit-enabled)
|
supports native-compilation, and enable it if available. You can override the
|
||||||
gist.
|
auto-detection logic to force enable or force disable native-compilation by
|
||||||
|
passing `--native-comp` or `--no-native-comp` respectfully.
|
||||||
|
|
||||||
You can install the patched formula by running the helper script:
|
By default `NATIVE_FULL_AOT` is disabled which ensures a fast build by native
|
||||||
|
compiling as few elisp source files as possible to build Emacs itself. Any
|
||||||
|
remaining elisp files will be dynamically compiled in the background the first
|
||||||
|
time they are used.
|
||||||
|
|
||||||
```
|
To enable native full Ahead-of-Time compilation, pass in the `--native-full-aot`
|
||||||
./install-patched-gcc
|
option, which will native-compile all of Emacs' elisp at built-time. On my
|
||||||
```
|
machine it takes around 10 minutes to build Emacs.app with `NATIVE_FULL_AOT`
|
||||||
|
disabled, and around 20-25 minutes with it enabled.
|
||||||
The helper script will copy your local `gcc.rb` Forumla from Homebrew to
|
|
||||||
`./Formula`, and apply the `./Formula/gcc.rb.patch` to it. After which it then
|
|
||||||
proceed to install the patched gcc formula which includes libgccjit.
|
|
||||||
|
|
||||||
As it requires installing and compiling GCC from source, it can take anywhere
|
|
||||||
between 30-60 minutes or more depending on your machine.
|
|
||||||
|
|
||||||
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
|
|
||||||
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.
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
Add the following near the top of your `early-init.el` or `init.el`:
|
#### Native-Lisp Cache Directory
|
||||||
|
|
||||||
```elisp
|
|
||||||
(setq comp-speed 2)
|
|
||||||
```
|
|
||||||
|
|
||||||
By default natively compiled `*.eln` files will be cached in
|
By default natively compiled `*.eln` files will be cached in
|
||||||
`~/.emacs.d/eln-cache/`. If you want to customize that, simply set a new path as
|
`~/.emacs.d/eln-cache/`. If you want to customize that, simply set a new path as
|
||||||
the first element of the `comp-eln-load-path` variable. The path string must end
|
the first element of the `native-comp-eln-load-path` variable. The path string
|
||||||
with a `/`.
|
must end with a `/`.
|
||||||
|
|
||||||
Also it seems somewhat common that some `*.eln` files are left behind with a
|
|
||||||
zero-byte file size if Emacs is quit while async native compilation is in
|
|
||||||
progress. Such empty files causes errors on startup, and needs to be deleted.
|
|
||||||
|
|
||||||
Below is an example which stores all compiled `*.eln` files in `cache/eln-cache`
|
Below is an example which stores all compiled `*.eln` files in `cache/eln-cache`
|
||||||
within your Emacs configuration directory, and also deletes any `*.eln` files in
|
within your Emacs configuration directory:
|
||||||
said directory which have a file size of zero bytes:
|
|
||||||
|
|
||||||
```elisp
|
```elisp
|
||||||
(when (boundp 'comp-eln-load-path)
|
(when (boundp 'native-comp-eln-load-path)
|
||||||
(let ((eln-cache-dir (expand-file-name "cache/eln-cache/" user-emacs-directory))
|
(setcar native-comp-eln-load-path
|
||||||
(find-exec (executable-find "find")))
|
(expand-file-name "cache/eln-cache/" user-emacs-directory)))
|
||||||
(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.
|
#### Compilation Warnings
|
||||||
(when find-exec
|
|
||||||
(call-process find-exec nil nil nil eln-cache-dir
|
By default any warnings encountered during async native compilation will pop up
|
||||||
"-name" "*.eln" "-size" "0" "-delete"))))
|
a warnings buffer. As this tends to happen rather frequently with a lot of
|
||||||
|
packages, it can get annoying. You can disable showing these warnings by setting
|
||||||
|
`native-comp-async-report-warnings-errors` to `nil`:
|
||||||
|
|
||||||
|
```elisp
|
||||||
|
(setq native-comp-async-report-warnings-errors nil)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Issues
|
### Issues
|
||||||
@@ -189,7 +193,7 @@ types of issues and or behavior you can expect.
|
|||||||
### Known Good Commits/Builds
|
### Known Good Commits/Builds
|
||||||
|
|
||||||
A list of known "good" commits which produce working builds is tracked in:
|
A list of known "good" commits which produce working builds is tracked in:
|
||||||
[#6 Known good commits of feature/native-comp branch](https://github.com/jimeh/build-emacs-for-macos/issues/6)
|
[#6 Known good commits for native-comp](https://github.com/jimeh/build-emacs-for-macos/issues/6)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
23
helper/emacs-cli.bash
Executable file
23
helper/emacs-cli.bash
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
resolve_link() {
|
||||||
|
"$(type -p greadlink readlink | head -1)" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
abs_dirname() {
|
||||||
|
local path="$1"
|
||||||
|
local name
|
||||||
|
local cwd
|
||||||
|
cwd="$(pwd)"
|
||||||
|
|
||||||
|
while [ -n "$path" ]; do
|
||||||
|
cd "${path%/*}" || exit 1
|
||||||
|
name="${path##*/}"
|
||||||
|
path="$(resolve_link "$name" || true)"
|
||||||
|
done
|
||||||
|
|
||||||
|
pwd
|
||||||
|
cd "$cwd" || exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
exec "$(dirname "$(abs_dirname "$0")")/Emacs" "$@"
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#! /usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
brewdir="$(brew --prefix)"
|
|
||||||
formula="${brewdir}/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gcc.rb"
|
|
||||||
|
|
||||||
if [ ! -f "$formula" ]; then
|
|
||||||
echo "ERROR: ${formula} does not exist." 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
gnubins=(
|
|
||||||
"${brewdir}/opt/coreutils/libexec/gnubin"
|
|
||||||
"${brewdir}/opt/make/libexec/gnubin"
|
|
||||||
"${brewdir}/opt/gnu-sed/libexec/gnubin"
|
|
||||||
)
|
|
||||||
|
|
||||||
for gnubin in "${gnubins[@]}"; do
|
|
||||||
if [ -d "$gnubin" ]; then
|
|
||||||
export PATH="${gnubin}:$PATH"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
cp "$formula" ./Formula/
|
|
||||||
|
|
||||||
patch -f -p1 -i ./Formula/gcc.rb.patch
|
|
||||||
brew install ./Formula/gcc.rb --build-from-source --force
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# This launcher script is not part of Emacs proper. It is from the
|
|
||||||
# build-emacs-for-macos project (https://github.com/jimeh/build-emacs-for-macos)
|
|
||||||
# and helps facilitate proper startup of Emacs with environment varibales set as
|
|
||||||
# needed.
|
|
||||||
#
|
|
||||||
# Licensed under CC0 1.0 Universal:
|
|
||||||
# https://creativecommons.org/publicdomain/zero/1.0/
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
resolve_link() {
|
|
||||||
local file="$1"
|
|
||||||
|
|
||||||
while [ -L "$file" ]; do
|
|
||||||
file="$(readlink "$file")"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$file"
|
|
||||||
}
|
|
||||||
|
|
||||||
realname() {
|
|
||||||
local path="$1"
|
|
||||||
local resolved
|
|
||||||
local cwd
|
|
||||||
|
|
||||||
cwd="$(pwd)"
|
|
||||||
resolved="$(resolve_link "$path")"
|
|
||||||
cd "$(dirname "$resolved")"
|
|
||||||
echo "$(pwd)/$(basename "$resolved")"
|
|
||||||
cd "$cwd"
|
|
||||||
}
|
|
||||||
|
|
||||||
join() {
|
|
||||||
local IFS="$1"
|
|
||||||
local parts=()
|
|
||||||
shift
|
|
||||||
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ "$arg" != "" ]; then
|
|
||||||
parts+=("$arg")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "${parts[*]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
DIR="$(dirname "$(realname "$0")")"
|
|
||||||
BIN="${DIR}/Emacs<%= bin_suffix %>"
|
|
||||||
|
|
||||||
export PATH="${DIR}/bin:${DIR}/libexec:${PATH}"
|
|
||||||
<% if library_paths.any? %>
|
|
||||||
LIB_PATHS=(
|
|
||||||
'<%= library_paths.map { |p| p.gsub('\'', "\"'\"") }.join("'\n '") %>'
|
|
||||||
)
|
|
||||||
for lib in "${LIB_PATHS[@]}"; do
|
|
||||||
if [ -d "${DIR}/<%= lib_dir_name %>/${lib}" ]; then
|
|
||||||
libs="$(join : "$libs" "${DIR}/<%= lib_dir_name %>/${lib}")"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
LIBRARY_PATH="$(join : "$libs" "$LIBRARY_PATH")"
|
|
||||||
export LIBRARY_PATH
|
|
||||||
<% end %>
|
|
||||||
exec "$BIN" "$@"
|
|
||||||
57
patches/native-comp-env-setup.diff.erb
Normal file
57
patches/native-comp-env-setup.diff.erb
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
|
||||||
|
index 8c638312b0..87af889ef4 100644
|
||||||
|
--- a/lisp/emacs-lisp/comp.el
|
||||||
|
+++ b/lisp/emacs-lisp/comp.el
|
||||||
|
@@ -4215,6 +4215,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
|
||||||
|
+ "<%= relative_lib_dir %>"
|
||||||
|
+ invocation-directory))
|
||||||
|
+ (darwin-dir (expand-file-name
|
||||||
|
+ "<%= sanitized_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
|
||||||
Reference in New Issue
Block a user