From 583f22a360a08bf236ea0e0562e6fd1ddda3b933 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 4 Sep 2020 01:48:50 +0100 Subject: [PATCH] feat(patches): add support for optional no-titlebar and no-refocus-frame patches --- README.md | 2 ++ build-emacs-for-macos | 57 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1d4215e..d797219 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,8 @@ Options: --[no-]native-comp-macos-fixes Enable/disable fix based on feature/native-comp-macos-fixes branch (default: enabled if native-comp supported) --[no-]launcher Enable/disable embedded launcher script (default: enabled if native-comp is enabled) + --no-titlebar Apply no-titlebar patch (default: disabled) + --no-frame-refocus Apply no-frame-refocus patch (default: disabled) ``` Resulting applications are saved to the `builds` directory in a bzip2 compressed diff --git a/build-emacs-for-macos b/build-emacs-for-macos index 3e93ad8..da549ba 100755 --- a/build-emacs-for-macos +++ b/build-emacs-for-macos @@ -301,7 +301,9 @@ class Build '/Library/Application Support/Emacs/${version}/site-lisp:' \ '/Library/Application Support/Emacs/site-lisp' ] - configure_flags << '--with-xwidgets' if supports_xwidgets? + if options[:xwidgets] && supports_xwidgets? + configure_flags << '--with-xwidgets' + end configure_flags << '--with-nativecomp' if options[:native_comp] run_cmd './configure', *configure_flags @@ -441,9 +443,11 @@ class Build def effective_version @effective_version ||= begin case ref + when /^emacs-26.*/ + 'emacs-26' when /^emacs-27.*/ 'emacs-27' - when /^emacs-28.*/, NATIVE_COMP_REF_REGEXP, 'master' + else 'emacs-28' end end @@ -452,22 +456,46 @@ class Build def patches(opts = {}) p = [] - if effective_version - if opts[:xwidgets] && effective_version == 'emacs-27' - p << { - url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \ - "patches/#{effective_version}/xwidgets_webkit_in_cocoa.patch" - } - end - + if %w[emacs-26 emacs-27 emacs-28].include?(effective_version) p << { url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \ "patches/#{effective_version}/fix-window-role.patch" } + end + + if %w[emacs-27 emacs-28].include?(effective_version) p << { url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \ "patches/#{effective_version}/system-appearance.patch" } + + if options[:no_titlebar] + p << { + url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \ + "patches/#{effective_version}/no-titlebar.patch" + } + end + + if options[:no_frame_refocus] + p << { + url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \ + "patches/#{effective_version}/no-frame-refocus-cocoa.patch" + } + end + end + + if effective_version == 'emacs-27' + p << { + url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \ + "patches/#{effective_version}/ligatures-freeze-fix.patch" + } + + if opts[:xwidgets] + p << { + url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \ + "patches/#{effective_version}/xwidgets_webkit_in_cocoa.patch" + } + end end p @@ -813,6 +841,15 @@ if __FILE__ == $PROGRAM_NAME '(default: enabled if native-comp is enabled)') do |v| cli_options[:launcher] = v end + + opts.on('--no-titlebar', 'Apply no-titlebar patch (default: disabled)') do + cli_options[:no_titlebar] = true + end + + opts.on('--no-frame-refocus', + 'Apply no-frame-refocus patch (default: disabled)') do + cli_options[:no_frame_refocus] = true + end end.parse! begin