summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorVeselin Dobrev <v-dobrev@users.noreply.github.com>2024-05-23 18:17:38 -0700
committerGitHub <noreply@github.com>2024-05-23 18:17:38 -0700
commit35ad6f52c183f2564d3b09263c7982740a733e34 (patch)
treee3b53de26847747f6978672ba91be5c57c671514 /var
parentb61bae7640c694fc82238f9bc0dc86947f837d57 (diff)
downloadspack-35ad6f52c183f2564d3b09263c7982740a733e34.tar.gz
spack-35ad6f52c183f2564d3b09263c7982740a733e34.tar.bz2
spack-35ad6f52c183f2564d3b09263c7982740a733e34.tar.xz
spack-35ad6f52c183f2564d3b09263c7982740a733e34.zip
Better Emacs build on Mac OS (#37294)
* [emacs] When installing on Mac OS, build and install the native Emacs.app along with the standard executables. * [emacs] Make the GUI build on Mac optional by adding "gui" variant * Apply reviewer suggestion Co-authored-by: Alec Scott <hi@alecbcs.com> * Add emacs version 29.3 --------- Co-authored-by: Alec Scott <hi@alecbcs.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/emacs/package.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/emacs/package.py b/var/spack/repos/builtin/packages/emacs/package.py
index 0604475073..7b5c0493d2 100644
--- a/var/spack/repos/builtin/packages/emacs/package.py
+++ b/var/spack/repos/builtin/packages/emacs/package.py
@@ -43,6 +43,7 @@ class Emacs(AutotoolsPackage, GNUMirrorPackage):
values=("gtk", "athena"),
description="Select an X toolkit (gtk, athena)",
)
+ variant("gui", default=False, description="Enable GUI build on Mac")
variant("tls", default=True, description="Build Emacs with gnutls")
variant("native", default=False, when="@28:", description="enable native compilation of elisp")
variant("treesitter", default=False, when="@29:", description="Build with tree-sitter support")
@@ -91,10 +92,13 @@ class Emacs(AutotoolsPackage, GNUMirrorPackage):
else:
args = ["--without-x"]
- # On OS X/macOS, do not build "nextstep/Emacs.app", because
- # doing so throws an error at build-time
if sys.platform == "darwin":
- args.append("--without-ns")
+ if spec.satisfies("+gui"):
+ # Do not build the self-contained "nextstep/Emacs.app"
+ args.append("--disable-ns-self-contained")
+ else:
+ # Do not build "nextstep/Emacs.app" at all
+ args.append("--without-ns")
args += self.with_or_without("native-compilation", variant="native")
args += self.with_or_without("gnutls", variant="tls")
@@ -103,6 +107,15 @@ class Emacs(AutotoolsPackage, GNUMirrorPackage):
return args
+ @run_after("install")
+ def move_macos_app(self):
+ """Move the Emacs.app build on MacOS to <prefix>/Applications.
+ From there users can move it or link it in ~/Applications."""
+ if sys.platform == "darwin" and "+gui" in self.spec:
+ apps_dir = join_path(self.prefix, "Applications")
+ mkdir(apps_dir)
+ move("nextstep/Emacs.app", apps_dir)
+
def run_version_check(self, bin):
"""Runs and checks output of the installed binary."""
exe_path = join_path(self.prefix.bin, bin)