I can confirm that the patch of Emacs 27.0.50 for bug#38648 applied to Emacs 26.2
works.
This is macOS Catalina (10.15.2). Emacs 26.2 is the version currently installed on my Macbook by brew/cask.
brew update
brew upgrade
Install
https://www.java.com/en/download/mac_download.jsp (if not
already installed)
Install xcode command line tools, if not already present:
xcode-select --install
Downloaded emacs sources from
https://emacsformacosx.com/builds Expand the emacs sources (double click in Finder)
Download build tools from
https://github.com/caldwell/build-emacs Expand the build tools (double click in Finder)
cd build-emacs-master
Move the expanded emacs sources folder into the build-emacs-master folder
Patch the code you want to change in emacs sources
For instance, to patch lisp/progmodes/compile.el
cd emacs-source/lisp/progmodes
Create your patch file ("patch.diff") here
Copy patch contents from Internet patch file to patch.diff
In the patch.diff file, edit the --- and +++ lines to simplify thus:
--- compile.el
+++ compile.el
patch -p0 <patch.diff
(This will rename old compile.el to compile.el.orig, create new compile.el)
cd ../../..
(Back to build-emacs-master folder)
tar the emacs sources back up again:
tar -cvjSf emacs-<XX.Y>.tar.bz2 emacs-<XX.Y>
(substitute in real emacs sources version number)
Per the build tools' github page:
To fix the build issue (Catalina fix), do as follows:
If not installed already:
brew install libxml2
Then:
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
./build-emacs-from-tar -v -j 4 emacs-<XX.Y>.tar.bz2 release
(Substitute in the correct emacs sources version number)
(Note: The build will take a long time)
./combine-and-package -v Emacs-<XX.Y>-<
AA.BB>-x86_64.tar.bz2
(Substitute in emacs sources version for XX.Y; substitute in macos
version - 10.15 for Catalina - for
AA.BB)
On success, Emacs-<XX.Y>-universal.dmg is created
Double click Emacs-<XX.Y>-universal.dmg in Finder to install