前言

上一篇文章写了通过设置参数来禁用 Emacs-plus native compile,但是 Emacs-Plus 是默认支持的。

换句话说也就是在编译 Emacs Plus 的时候就已经有部分代码已经编译成 eln 了。

所以即便使用上一篇的方法还是不能彻底的禁止。

所以要想彻底的禁止就需要把编译选项都去掉。

禁用编译

经过我一番摸索终于彻底的把 native compile 给去掉了

改动文件如下

@@ -42,8 +42,6 @@ class EmacsPlusAT32 < EmacsBase
   depends_on "dbus" => :optional
   depends_on "mailutils" => :optional
   # `libgccjit` and `gcc` are required when Emacs compiles `*.elc` files asynchronously (JIT)
-  depends_on "libgccjit"
-  depends_on "gcc"

   depends_on "gmp" => :build
   depends_on "libjpeg" => :build
@@ -89,7 +87,6 @@ class EmacsPlusAT32 < EmacsBase
       --enable-locallisppath=#{HOMEBREW_PREFIX}/share/emacs/site-lisp
       --infodir=#{info}/emacs
       --prefix=#{prefix}
-      --with-native-compilation=aot
     ]

     args << "--with-xml2"
@@ -111,13 +108,9 @@ class EmacsPlusAT32 < EmacsBase
     cflags << "-DFD_SETSIZE=10000"
     cflags << "-DDARWIN_UNLIMITED_SELECT"
     cflags << "-I#{Formula["sqlite"].include}"
-    cflags << "-I#{Formula["gcc"].include}"
-    cflags << "-I#{Formula["libgccjit"].include}"
     args << "CFLAGS=#{cflags.join(" ")}"

     ENV.append "LDFLAGS", "-L#{Utils::Path.formula_opt_lib("sqlite")}"
-    ENV.append "LDFLAGS", "-L#{gcc_lib}"
-    ENV.append "LDFLAGS", "-Wl,-rpath,#{gcc_lib}"

     args <<
       if build.with? "dbus"
@@ -173,7 +166,6 @@ class EmacsPlusAT32 < EmacsBase

       # (prefix/"share/emacs/#{version}").install "lisp"
       prefix.install "nextstep/Emacs.app"
-      (prefix/"Emacs.app/Contents").install "native-lisp"
       prefix.install "nextstep/Emacs Client.app"

       # inject Emacs Plus site-lisp with ns-emacs-plus-version

你可以使用 brew edit emacs-plus@32 来打开对应的文件,对照 diff 进行修改