mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Enable building Emacs 27
Also embed various dylib libraries directly into the application, so they're not required to be installed via Homebrew for the app to work.
This commit is contained in:
92
README.md
92
README.md
@@ -1,63 +1,77 @@
|
||||
# build-emacs-for-osx
|
||||
# build-emacs-for-macos
|
||||
|
||||
Use this script at your own risk. It currently works for me on my own machine,
|
||||
which as of writing is:
|
||||
Use this script at your own risk. As of writing (2020-02-02) it works for me on
|
||||
my own machine to build the `emacs-27` release branch. My machine is a late-2016
|
||||
13-inch Touchbar MacBook Pro runnning macOS 10.15.2 and Xcode 11.3.
|
||||
|
||||
* OS X 10.8.5 (12F45)
|
||||
* Xcode 5.0 (5A1413)
|
||||
Your luck may vary.
|
||||
|
||||
Your luck might vary. Do note that it does not build a universal application.
|
||||
The CPU architecture of the built application will be that of the machine it
|
||||
was built on.
|
||||
The build produced does have some limitations:
|
||||
|
||||
- It is not a universal application. The CPU architecture of the built
|
||||
application will be that of the machine it was built on.
|
||||
- The minimum required macOS version of the built application will be the same
|
||||
as that of the machine it was built on.
|
||||
|
||||
## Why?
|
||||
|
||||
I've been using [Homebrew][] the past few
|
||||
months to build from HEAD. Homebrew comes with a number of patches, including
|
||||
the [sRGB][] patches which I use.
|
||||
- To use new features available from master or pre-release branches, which have
|
||||
not made it into a official stable release yet.
|
||||
- Homebrew builds of Emacs are not self-contained applications, making it very
|
||||
difficult when doing HEAD builds and you need to rollback to a earlier
|
||||
version.
|
||||
- Builds from [emacsformacosx.com](https://emacsformacosx.com/) has had no new
|
||||
nightly builds for two months right now.
|
||||
- Both Homebrew HEAD builds, and nightly builds from emacsformacosx.com are
|
||||
built from the `master` branch. This script allows you to choose any branch
|
||||
you want. I am currently building from the `emacs-27` branch which is the
|
||||
basis of the upcoming Emacs 27 release, meaning it should be more stable than
|
||||
`master` builds.
|
||||
|
||||
[homebrew]: http://mxcl.github.com/homebrew/
|
||||
[srgb]: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402
|
||||
|
||||
Homebrew does not build a self-contained application though, which caused
|
||||
issues for me when I needed to rollback to a specific build. I found the
|
||||
easiest way to build a completely self-contained Emacs.app nightly from a
|
||||
specific date with custom patches was to do it manually.
|
||||
|
||||
So I decided to quickly hack together a script to automate that manual
|
||||
process. The code is a horrible hack, but it (seemingly) works as I'm writing
|
||||
this in Emacs built with it.
|
||||
## Requirements
|
||||
|
||||
- [Xcode](https://apps.apple.com/gb/app/xcode/id497799835?mt=12)
|
||||
- [Homebrew](https://brew.sh/)
|
||||
- All Homebrew formula listed in the `Brewfile`, which can all easily be
|
||||
installed by running:
|
||||
```
|
||||
brew bundle
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Myself I run the following command which will download a tarball of the
|
||||
`master` branch, apply the sRGB patch, and build Emacs.app:
|
||||
Then to download a tarball of the `master` branch, build Emacs.app:
|
||||
|
||||
./build-emacs-for-osx
|
||||
./build-emacs-for-macos
|
||||
|
||||
Or for example if you want to build the `emacs-24.3` tag, run:
|
||||
If you want to build the `emacs-27` git branch, run:
|
||||
|
||||
./build-emacs-for-osx emacs-24.3
|
||||
./build-emacs-for-macos emacs-27
|
||||
|
||||
Resulting applications are saved to the `builds` directory in a bzip2
|
||||
compressed tarball.
|
||||
If you want to build the stable `emacs-26.3` git tag, run:
|
||||
|
||||
./build-emacs-for-macos emacs-26.3
|
||||
|
||||
Resulting applications are saved to the `builds` directory in a bzip2 compressed
|
||||
tarball.
|
||||
|
||||
## Internals
|
||||
|
||||
I decided to pull Emacs' source from a GitHub [mirror][repo] rather than the
|
||||
official Bzr repo cause I'm not familiar with Bzr, and GitHub lets you easily
|
||||
download tarballs of any branch, commit or tag. And the tarballs from GitHub
|
||||
are just over 30MB, compared to ~1GB to pull the offical Bzr repo.
|
||||
The script downloads the source code as a gzipped tar archive from the [GitHub
|
||||
mirror](https://github.com/emacs-mirror/emacs) repository, as it makes it very
|
||||
easy to get a tarball of any given git reference.
|
||||
|
||||
[repo]: https://github.com/mirrors/emacs
|
||||
|
||||
The only option passed in `./configure` is `--with-ns`, meaning the resulting
|
||||
application only supports the CPU architecture of the system is was built on.
|
||||
There might be more side-effects to, but I haven't noticed any.
|
||||
It then runs `./configure` with a various options, partly based on what [David
|
||||
Caldwell](https://github.com/caldwell)'s
|
||||
[build-emacs](https://github.com/caldwell/build-emacs) scripts do, including
|
||||
copying various dynamic libraries into the application itself. So the built
|
||||
application should in theory run on a macOS install that does not have homebrew,
|
||||
or do no have the relevant brew formula installed.
|
||||
|
||||
Code quality, is well, non-existent. The build script started life a super-quick
|
||||
hack back in 2013, and now it's even more of a dirty hack. I might clean it up
|
||||
and add unit tests if I end up relying on this script for a prolonged period of
|
||||
time. For now I plan to use it until Emacs 27 is officially released.
|
||||
|
||||
## License
|
||||
|
||||
@@ -65,7 +79,7 @@ There might be more side-effects to, but I haven't noticed any.
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2013 Jim Myhrberg
|
||||
Copyright (C) 2020 Jim Myhrberg
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
|
||||
Reference in New Issue
Block a user