Skip to content

Commit 1973a64

Browse files
committed
feat(patches/alpha-background): add experimental alpha-background patch
1 parent d396165 commit 1973a64

File tree

3 files changed

+533
-21
lines changed

3 files changed

+533
-21
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ Options:
131131
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 16)
132132
--git-sha SHA Override detected git SHA of specified branch allowing builds of old commits
133133
--[no-]use-nix Use Nix instead of Homebrew to find dependencies (default: enabled if IN_NIX_SHELL is set)
134-
--[no-]xwidgets Enable/disable XWidgets if supported (default: enabled)
135134
--[no-]tree-sitter Enable/disable tree-sitter if supported (default: enabled)
136135
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
137136
--optimize Shorthand for --native-march --native-mtune --fomit-frame-pointer (default: disabled)
@@ -142,10 +141,12 @@ Options:
142141
--[no-]relink-eln-files Enable/disable re-linking shared libraries in bundled *.eln files (default: enabled)
143142
--[no-]rsvg Enable/disable SVG image support via librsvg (default: enabled)
144143
--[no-]dbus Enable/disable dbus support (default: enabled)
145-
--no-titlebar Apply no-titlebar patch (default: disabled)
146-
--posix-spawn Apply posix-spawn patch (deprecated)
147-
--no-frame-refocus Apply no-frame-refocus patch (default: disabled)
144+
--[no-]alpha-background Enable/disable experimental alpha-background patch when building Emacs 30.x - 31.x (default: disabled)
145+
--no-frame-refocus Apply no-frame-refocus patch when building Emacs 27.x - 31.x (default: disabled)
146+
--no-titlebar Apply no-titlebar patch when building Emacs 27.x - 28.x (default: disabled)
147+
--[no-]xwidgets Enable/disable XWidgets when building Emacs 27.x (default: disabled)
148148
--[no-]poll Apply poll patch (deprecated)
149+
--posix-spawn Apply posix-spawn patch (deprecated)
149150
-p, --patch=URL Specify a custom patch file or URL to apply to the Emacs source (can be used multiple times)
150151
--[no-]fd-setsize SIZE Set an file descriptor (max open files) limit (default: 10000)
151152
--github-src-repo REPO Specify a GitHub repo to download source tarballs from (default: emacs-mirror/emacs)

build-emacs-for-macos

+41-17
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class Build
218218
end
219219

220220
tarball = download_tarball(meta[:sha])
221-
@source_dir = extract_tarball(tarball, patches(options))
221+
@source_dir = extract_tarball(tarball, build_patches)
222222

223223
autogen
224224
detect_native_comp if options[:native_comp].nil?
@@ -1052,7 +1052,7 @@ class Build
10521052
end
10531053
end
10541054

1055-
def patches(opts = {})
1055+
def build_patches
10561056
p = []
10571057

10581058
# Enabled by default patches.
@@ -1129,14 +1129,30 @@ class Build
11291129
}
11301130
end
11311131

1132-
if opts[:xwidgets] && effective_version == 27
1132+
if options[:xwidgets] && effective_version == 27
11331133
p << {
11341134
url:
11351135
'https://github.com./d12frosted/homebrew-emacs-plus/raw/master/' \
11361136
"patches/emacs-#{effective_version}/xwidgets_webkit_in_cocoa.patch"
11371137
}
11381138
end
11391139

1140+
if options[:alpha_background]
1141+
if effective_version == 29
1142+
p << {
1143+
file: File.join(
1144+
__dir__, 'patches', 'emacs-29', 'ns-alpha-background.patch'
1145+
)
1146+
}
1147+
elsif (30..31).include?(effective_version)
1148+
p << {
1149+
url:
1150+
"https://github.com./emacs-mirror/emacs/compare/#{meta[:sha]}" \
1151+
'...jonrubens:emacs:ns-alpha-background.patch'
1152+
}
1153+
end
1154+
end
1155+
11401156
# Custom patches.
11411157
options[:patches].each do |patch_str|
11421158
patch = {}
@@ -1940,12 +1956,6 @@ class CLIOptions
19401956
'(default: enabled if IN_NIX_SHELL is set)'
19411957
) { |v| options[:use_nix] = v }
19421958

1943-
opts.on(
1944-
'--[no-]xwidgets',
1945-
'Enable/disable XWidgets if supported ' \
1946-
'(default: enabled)'
1947-
) { |v| options[:xwidgets] = v }
1948-
19491959
opts.on(
19501960
'--[no-]tree-sitter',
19511961
'Enable/disable tree-sitter if supported ' \
@@ -2010,23 +2020,37 @@ class CLIOptions
20102020
) { |v| options[:dbus] = v }
20112021

20122022
opts.on(
2013-
'--no-titlebar',
2014-
'Apply no-titlebar patch (default: disabled)'
2015-
) { options[:no_titlebar] = true }
2016-
2017-
opts.on('--posix-spawn', 'Apply posix-spawn patch (deprecated)') do
2018-
warn '==> WARN: posix-spawn patch is deprecated and has no effect.'
2019-
end
2023+
'--alpha-background',
2024+
'Apply experimental alpha-background patch when building Emacs ' \
2025+
'30.x - 31.x (default: disabled)'
2026+
) { |v| options[:alpha_background] = v }
20202027

20212028
opts.on(
20222029
'--no-frame-refocus',
2023-
'Apply no-frame-refocus patch (default: disabled)'
2030+
'Apply no-frame-refocus patch when building Emacs 27.x - 31.x ' \
2031+
'(default: disabled)'
20242032
) { options[:no_frame_refocus] = true }
20252033

2034+
opts.on(
2035+
'--no-titlebar',
2036+
'Apply no-titlebar patch when building Emacs 27.x - 28.x ' \
2037+
'(default: disabled)'
2038+
) { options[:no_titlebar] = true }
2039+
2040+
opts.on(
2041+
'--[no-]xwidgets',
2042+
'Enable/disable XWidgets when building Emacs 27.x ' \
2043+
'(default: disabled)'
2044+
) { |v| options[:xwidgets] = v }
2045+
20262046
opts.on('--[no-]poll', 'Apply poll patch (deprecated)') do
20272047
warn '==> WARN: poll patch is deprecated and has no effect.'
20282048
end
20292049

2050+
opts.on('--posix-spawn', 'Apply posix-spawn patch (deprecated)') do
2051+
warn '==> WARN: posix-spawn patch is deprecated and has no effect.'
2052+
end
2053+
20302054
opts.on(
20312055
'-p=URL', '--patch=URL',
20322056
'Specify a custom patch file or URL to apply to the Emacs source ' \

0 commit comments

Comments
 (0)