Skip to content

Commit 34efef5

Browse files
committed
fix(compile-options): increase runtime max open files limit
Increases max open file limit to 10000 the same way as emacs-plus does. This is necessary for some packages like lsp-mode to work properly in some cases. The limit is configurable via the `--fd-setsize` option. The default is `10000`. To disable this feature, use the `--no-fd-setsize` option, or provide `--fd-setsize` with a value that is less than `1024`. Fixes #106
1 parent cfc5155 commit 34efef5

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,32 @@ Branch, tag, and SHA are from the emacs-mirror/emacs/emacs Github repo,
7878
available here: https://github.com/emacs-mirror/emacs
7979
8080
Options:
81-
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 8)
81+
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 16)
8282
--git-sha SHA Override detected git SHA of specified branch allowing builds of old commits
8383
--[no-]xwidgets Enable/disable XWidgets if supported (default: enabled)
84+
--[no-]tree-sitter Enable/disable tree-sitter if supported (default: enabled)
8485
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
8586
--[no-]native-march Enable/disable -march=native CFLAG(default: disabled)
8687
--[no-]native-full-aot Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation (default: disabled)
8788
--[no-]relink-eln-files Enable/disable re-linking shared libraries in bundled *.eln files (default: enabled)
8889
--[no-]rsvg Enable/disable SVG image support via librsvg (default: enabled)
90+
--[no-]dbus Enable/disable dbus support (default: enabled)
8991
--no-titlebar Apply no-titlebar patch (default: disabled)
90-
--posix-spawn Apply posix-spawn patch (default: disabled)
92+
--posix-spawn Apply posix-spawn patch (deprecated)
9193
--no-frame-refocus Apply no-frame-refocus patch (default: disabled)
94+
--[no-]poll Apply poll patch (deprecated)
95+
--[no-]fd-setsize SIZE Set an file descriptor (max open files) limit (default: 10000)
96+
--github-src-repo REPO Specify a GitHub repo to download source tarballs from (default: emacs-mirror/emacs)
9297
--[no-]github-auth Make authenticated GitHub API requests if GITHUB_TOKEN environment variable is set.(default: enabled)
9398
--work-dir DIR Specify a working directory where tarballs, sources, and builds will be stored and worked with
9499
-o, --output DIR Output directory for finished builds (default: <work-dir>/builds)
95100
--build-name NAME Override generated build name
96101
--dist-include x,y,z List of extra files to copy from Emacs source into build folder/archive (default: COPYING)
102+
--[no-]self-sign Enable/disable self-signing of Emacs.app (default: enabled)
97103
--[no-]archive Enable/disable creating *.tbz archive (default: enabled)
98104
--[no-]archive-keep-build-dir
99105
Enable/disable keeping source folder for archive (default: disabled)
106+
--log-level LEVEL Build script log level (default: info)
100107
--plan FILE Follow given plan file, instead of using given git ref/sha
101108
```
102109

build-emacs-for-macos

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,14 @@ class Build
412412
].compact.join(':')
413413
end
414414

415+
if options[:fd_setsize].respond_to?(:>=) && options[:fd_setsize] >= 1024
416+
ENV['CFLAGS'] = [
417+
"-DFD_SETSIZE=#{options[:fd_setsize]}",
418+
'-DDARWIN_UNLIMITED_SELECT',
419+
ENV.fetch('CFLAGS', nil)
420+
].compact.join(' ')
421+
end
422+
415423
ENV['CC'] = 'clang'
416424
ENV['PKG_CONFIG_PATH'] = [
417425
File.join(brew_dir, 'lib/pkgconfig'),
@@ -1474,6 +1482,7 @@ if __FILE__ == $PROGRAM_NAME
14741482
dbus: true,
14751483
xwidgets: true,
14761484
tree_sitter: true,
1485+
fd_setsize: 10_000,
14771486
github_src_repo: nil,
14781487
github_auth: true,
14791488
dist_include: ['COPYING'],
@@ -1514,7 +1523,7 @@ if __FILE__ == $PROGRAM_NAME
15141523

15151524
opts.on(
15161525
'--[no-]tree-sitter',
1517-
'Enable/disable tree-sitter if supported' \
1526+
'Enable/disable tree-sitter if supported ' \
15181527
'(default: enabled)'
15191528
) { |v| cli_options[:tree_sitter] = v }
15201529

@@ -1571,6 +1580,11 @@ if __FILE__ == $PROGRAM_NAME
15711580
warn '==> WARN: poll patch is deprecated and has no effect.'
15721581
end
15731582

1583+
opts.on(
1584+
'--[no-]fd-setsize SIZE',
1585+
'Set an file descriptor (max open files) limit (default: 10000)'
1586+
) { |v| cli_options[:fd_setsize] = v.respond_to?(:to_i) ? v.to_i : 0 }
1587+
15741588
opts.on(
15751589
'--github-src-repo REPO',
15761590
'Specify a GitHub repo to download source tarballs from ' \

0 commit comments

Comments
 (0)