Compare commits

..

18 Commits

Author SHA1 Message Date
github-actions[bot]
2758cc93cb chore(master): release 0.6.49 (#114)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-03 18:03:26 +00:00
dependabot[bot]
970cb68701 chore(deps): bump google.golang.org/protobuf from 1.31.0 to 1.33.0 (#99)
Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-03 01:43:51 +00:00
dependabot[bot]
a95a3c1c9a chore(deps): bump golang.org/x/crypto from 0.15.0 to 0.17.0 (#96)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-03 01:02:10 +00:00
thynus
533dde85b1 docs(readme) fix typo (#110)
should be respectively not respectfully in Native-Comp section
2024-11-03 00:52:52 +00:00
ca8951ccd3 fix(compile-options): increase runtime max open files limit (#115)
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
2024-11-03 00:52:01 +00:00
cfc5155199 fix(patches): tidy up patches, deprecate optional poll patch
Some much needed tidying of the patches method, along with
double-checking that all patches only apply to relevant emacs versions
correctly.

Along those lines, the optional poll patch is now deprecated, as the
upstream patch file has been removed from emacs-plus due to reports of
it never working correctly.
2024-11-02 23:47:13 +00:00
github-actions[bot]
78db99ea2d chore(master): release 0.6.48 (#109)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-09 09:11:12 +01:00
8a1ae4df1c fix(local-lisp-path): add Apple Silicon homebrew lisp-site 2024-08-09 09:09:58 +01:00
İsmail Efe
5e2aaceb84 docs(readme): mention make bootstrap (#105)
There are some dependencies that should be install by gem, but the README does not mention it.
2024-06-20 20:27:59 +01:00
github-actions[bot]
bcfdeacf95 chore(master): release 0.6.47 (#104)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-13 01:30:35 +01:00
2f0babae99 fix(bootstrap): remove --no-upgrade option from brew bundle
It can easily lead to issues where certain packages are not compatible
due to an older version already being installed. Hence we instead prefer
to just update all deps to the latest version
2024-05-13 01:28:04 +01:00
github-actions[bot]
6c32cebf96 chore(master): release 0.6.46 (#101)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-04-03 09:38:12 +01:00
1743035a6d fix(emacs-builder): resolve issues with notarizing Emacs app (#100)
By updating gon, and switching to a maintained fork, notarization works
again.
2024-04-03 09:37:18 +01:00
c38075ee8c chore(deps): upgrade golangci-lint used in Makefile 2023-11-22 09:07:02 +00:00
05d4d86743 style(go): fix linting complaint 2023-11-22 09:06:46 +00:00
8f2c9f9d42 docs(readme): minor status section and minor tweaks elsewhere 2023-11-22 08:54:13 +00:00
github-actions[bot]
06ec20fabf chore(master): release 0.6.45 (#95)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-20 02:28:21 +00:00
97f77f3b10 feat(builder/cask): support shared helpers template 2023-11-20 02:27:36 +00:00
11 changed files with 360 additions and 281 deletions

View File

@@ -1,3 +1,3 @@
{
".": "0.6.44"
".": "0.6.49"
}

View File

@@ -1,5 +1,41 @@
# Changelog
## [0.6.49](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.48...v0.6.49) (2024-11-03)
### Bug Fixes
* **compile-options:** increase runtime max open files limit ([#115](https://github.com/jimeh/build-emacs-for-macos/issues/115)) ([ca8951c](https://github.com/jimeh/build-emacs-for-macos/commit/ca8951ccd350ecee5ad6c637caae0af1831a9eb5)), closes [#106](https://github.com/jimeh/build-emacs-for-macos/issues/106)
* **patches:** tidy up patches, deprecate optional poll patch ([cfc5155](https://github.com/jimeh/build-emacs-for-macos/commit/cfc5155199486c4e3fae7edbc7262299b3c9955c))
## [0.6.48](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.47...v0.6.48) (2024-08-09)
### Bug Fixes
* **local-lisp-path:** add Apple Silicon homebrew lisp-site ([8a1ae4d](https://github.com/jimeh/build-emacs-for-macos/commit/8a1ae4df1ca37a851f9936fcf2081536837e4c67))
## [0.6.47](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.46...v0.6.47) (2024-05-13)
### Bug Fixes
* **bootstrap:** remove --no-upgrade option from brew bundle ([2f0baba](https://github.com/jimeh/build-emacs-for-macos/commit/2f0babae990f908d706f5f60dc4a11573918c23d))
## [0.6.46](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.45...v0.6.46) (2024-04-03)
### Bug Fixes
* **emacs-builder:** resolve issues with notarizing Emacs app ([#100](https://github.com/jimeh/build-emacs-for-macos/issues/100)) ([1743035](https://github.com/jimeh/build-emacs-for-macos/commit/1743035a6d5d8c07a2c1da3f76cafe156e4ec31d))
## [0.6.45](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.44...v0.6.45) (2023-11-20)
### Features
* **builder/cask:** support shared helpers template ([97f77f3](https://github.com/jimeh/build-emacs-for-macos/commit/97f77f3b1043b66da6ec737e5db91605ec961d08))
## [0.6.44](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.43...v0.6.44) (2023-11-19)

View File

@@ -51,7 +51,7 @@ bootstrap-ruby:
bundle install
bootstrap-brew:
brew bundle --verbose --no-upgrade
brew bundle --verbose
bootstrap-pip:
$(PIP) install -r requirements-ci.txt
@@ -69,7 +69,7 @@ $(TOOLDIR)/$(1): Makefile
endef
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.40))
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55))
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
.PHONY: tools

View File

@@ -38,37 +38,36 @@ The build produced does have some limitations:
- [Xcode](https://apps.apple.com/gb/app/xcode/id497799835?mt=12)
- [Homebrew](https://brew.sh/)
- All Homebrew formula listed in the `Brewfile`, which can all easily be
installed by running:
```
brew bundle
```
- Ruby 2.3.0 or later is needed to execute the build script itself. macOS comes
with Ruby, check your version with `ruby --version`. If it's too old, you can
install a newer version with:
```
brew install ruby
```
- All dependencies can all easily be installed by running:
```
make bootstrap
```
## Status
As of writing (2021-11-27) it works for me on my machine and for the nightly
As of writing (2023-11-20) it works for me on my machine and for the nightly
builds in [jimeh/emacs-builds](https://github.com/jimeh/emacs-builds). Your luck
may vary.
I have successfully built:
- `emacs-28` release branch
- `master` branch (Emacs 29.x)
- `emacs-29.1` release tag.
- `master` branch (Emacs 30.x).
For reference, my machine is:
- 13-inch MacBook Pro (2020), 10th-gen 2.3 GHz Quad-Core Intel Core i7 (4c/8t)
- macOS Monterey 12.0.1 (21A559)
- Xcode 13.1 (13A1030d)
- 14-inch MacBook Pro (2023), Apple M3 Pro (11-cores)
- macOS Sonoma 14.1.1 (23B2082)
- Xcode 15.0.1 (15A507)
Nightly builds are built with GitHub Actions on GitHub-hosted runners, using
`macos-10.15`.
`macos-12` for Intel builds, and `macos-13-xlarge` for Apple Silicon builds.
## Usage
@@ -79,25 +78,32 @@ Branch, tag, and SHA are from the emacs-mirror/emacs/emacs Github repo,
available here: https://github.com/emacs-mirror/emacs
Options:
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 8)
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 16)
--git-sha SHA Override detected git SHA of specified branch allowing builds of old commits
--[no-]xwidgets Enable/disable XWidgets if supported (default: enabled)
--[no-]tree-sitter Enable/disable tree-sitter if supported (default: enabled)
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
--[no-]native-march Enable/disable -march=native CFLAG(default: disabled)
--[no-]native-full-aot Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation (default: disabled)
--[no-]relink-eln-files Enable/disable re-linking shared libraries in bundled *.eln files (default: enabled)
--[no-]rsvg Enable/disable SVG image support via librsvg (default: enabled)
--[no-]dbus Enable/disable dbus support (default: enabled)
--no-titlebar Apply no-titlebar patch (default: disabled)
--posix-spawn Apply posix-spawn patch (default: disabled)
--posix-spawn Apply posix-spawn patch (deprecated)
--no-frame-refocus Apply no-frame-refocus patch (default: disabled)
--[no-]poll Apply poll patch (deprecated)
--[no-]fd-setsize SIZE Set an file descriptor (max open files) limit (default: 10000)
--github-src-repo REPO Specify a GitHub repo to download source tarballs from (default: emacs-mirror/emacs)
--[no-]github-auth Make authenticated GitHub API requests if GITHUB_TOKEN environment variable is set.(default: enabled)
--work-dir DIR Specify a working directory where tarballs, sources, and builds will be stored and worked with
-o, --output DIR Output directory for finished builds (default: <work-dir>/builds)
--build-name NAME Override generated build name
--dist-include x,y,z List of extra files to copy from Emacs source into build folder/archive (default: COPYING)
--[no-]self-sign Enable/disable self-signing of Emacs.app (default: enabled)
--[no-]archive Enable/disable creating *.tbz archive (default: enabled)
--[no-]archive-keep-build-dir
Enable/disable keeping source folder for archive (default: disabled)
--log-level LEVEL Build script log level (default: info)
--plan FILE Follow given plan file, instead of using given git ref/sha
```
@@ -119,10 +125,10 @@ as of writing) and build Emacs.app from it:
./build-emacs-for-macos
```
To build the stable `emacs-27.1` release git tag run:
To build the stable `emacs-29.1` release git tag run:
```
./build-emacs-for-macos emacs-27.1
./build-emacs-for-macos emacs-29.1
```
All sources as downloaded as tarballs from the
@@ -155,14 +161,10 @@ use the alias from the above example.
## Native-Comp
_Note: On 2021-04-25 the `feature/native-comp` branch was
[merged](http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=289000eee729689b0cf362a21baa40ac7f9506f6)
into `master`._
The build script will automatically detect if the source tree being built
supports native-compilation, and enable it if available. You can override the
auto-detection logic to force enable or force disable native-compilation by
passing `--native-comp` or `--no-native-comp` respectfully.
passing `--native-comp` or `--no-native-comp` respectively.
By default `NATIVE_FULL_AOT` is disabled which ensures a fast build by native
compiling as few elisp source files as possible to build Emacs itself. Any

View File

@@ -210,7 +210,7 @@ class Build
end
def output_dir
@output_dir ||= (options[:output] || File.join(root_dir, 'builds'))
@output_dir ||= options[:output] || File.join(root_dir, 'builds')
end
def github_src_repo
@@ -412,6 +412,14 @@ class Build
].compact.join(':')
end
if options[:fd_setsize].respond_to?(:>=) && options[:fd_setsize] >= 1024
ENV['CFLAGS'] = [
"-DFD_SETSIZE=#{options[:fd_setsize]}",
'-DDARWIN_UNLIMITED_SELECT',
ENV.fetch('CFLAGS', nil)
].compact.join(' ')
end
ENV['CC'] = 'clang'
ENV['PKG_CONFIG_PATH'] = [
File.join(brew_dir, 'lib/pkgconfig'),
@@ -442,13 +450,18 @@ class Build
'/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib'
].compact.join(':')
local_lisp_path = [
ENV.fetch('EMACS_LOCAL_LISP_PATH', '').split(':'),
'/Library/Application Support/Emacs/${version}/site-lisp',
'/Library/Application Support/Emacs/site-lisp',
'/usr/local/share/emacs/site-lisp',
'/opt/homebrew/share/emacs/site-lisp'
].flatten.join(':')
configure_flags = [
'--with-ns',
'--with-modules',
'--enable-locallisppath=' \
'/Library/Application Support/Emacs/${version}/site-lisp:' \
'/Library/Application Support/Emacs/site-lisp:' \
'/usr/local/share/emacs/site-lisp'
"--enable-locallisppath=#{local_lisp_path}"
]
if options[:xwidgets] && supports_xwidgets?
configure_flags << '--with-xwidgets'
@@ -731,71 +744,58 @@ class Build
@effective_version ||=
case ref
when /^emacs-26.*/
'emacs-26'
26
when /^emacs-27.*/
'emacs-27'
27
when /^emacs-28.*/
'emacs-28'
28
when /^emacs-29.*/
'emacs-29'
29
when /^emacs-30.*/
30
else
'emacs-30'
31
end
end
def patches(opts = {})
p = []
if %w[emacs-26 emacs-27 emacs-28 emacs-29 emacs-30].include?(
effective_version
)
# Enabled by default patches.
if (26..31).include?(effective_version)
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/#{effective_version}/fix-window-role.patch"
"patches/emacs-#{effective_version}/fix-window-role.patch"
}
end
if %w[emacs-27 emacs-28 emacs-29 emacs-30].include?(effective_version)
if (27..31).include?(effective_version)
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/#{effective_version}/system-appearance.patch"
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/emacs-#{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 %w[emacs-29 emacs-30].include?(effective_version)
if (29..31).include?(effective_version)
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/#{effective_version}/round-undecorated-frame.patch"
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/emacs-#{effective_version}/round-undecorated-frame.patch"
}
if options[:poll]
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/#{effective_version}/poll.patch"
}
end
end
if effective_version == 'emacs-28'
if effective_version == 27
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/emacs-#{effective_version}/ligatures-freeze-fix.patch"
}
end
if effective_version == 28
p << {
replace: [
'configure.ac',
@@ -806,7 +806,7 @@ class Build
}
end
if %w[emacs-28 emacs-29].include?(effective_version)
if (28..29).include?(effective_version)
p << {
replace: [
'configure.ac',
@@ -817,23 +817,33 @@ class Build
}
end
if effective_version == 'emacs-27'
# Optional patches.
if options[:no_frame_refocus] && (27..31).include?(effective_version)
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/#{effective_version}/ligatures-freeze-fix.patch"
"patches/emacs-#{effective_version}/no-frame-refocus-cocoa.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
if options[:no_titlebar] && (27..28).include?(effective_version)
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/emacs-#{effective_version}/no-titlebar.patch"
}
end
if opts[:xwidgets] && effective_version == 27
p << {
url:
'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
"patches/emacs-#{effective_version}/xwidgets_webkit_in_cocoa.patch"
}
end
p.uniq
end
def apply_patch(patch, target)
@@ -1472,6 +1482,7 @@ if __FILE__ == $PROGRAM_NAME
dbus: true,
xwidgets: true,
tree_sitter: true,
fd_setsize: 10_000,
github_src_repo: nil,
github_auth: true,
dist_include: ['COPYING'],
@@ -1481,162 +1492,164 @@ if __FILE__ == $PROGRAM_NAME
log_level: 'info'
}
parser = OptionParser.new do |opts|
opts.banner = <<~DOC
Usage: ./build-emacs-for-macos [options] <branch/tag/sha>
Branch, tag, and SHA are from the emacs-mirror/emacs/emacs Github repo,
available here: https://github.com/emacs-mirror/emacs
Options:
DOC
opts.on(
'-j',
'--parallel COUNT',
'Compile using COUNT parallel processes ' \
"(detected: #{cli_options[:parallel]})"
) { |v| cli_options[:parallel] = v }
opts.on(
'--git-sha SHA',
'Override detected git SHA of specified ' \
'branch allowing builds of old commits'
) { |v| cli_options[:git_sha] = v }
opts.on(
'--[no-]xwidgets',
'Enable/disable XWidgets if supported ' \
'(default: enabled)'
) { |v| cli_options[:xwidgets] = v }
opts.on(
'--[no-]tree-sitter',
'Enable/disable tree-sitter if supported ' \
'(default: enabled)'
) { |v| cli_options[:tree_sitter] = v }
opts.on(
'--[no-]native-comp',
'Enable/disable native-comp ' \
'(default: enabled if supported)'
) { |v| cli_options[:native_comp] = v }
opts.on(
'--[no-]native-march',
'Enable/disable -march=native CFLAG' \
'(default: disabled)'
) { |v| cli_options[:native_march] = v }
opts.on(
'--[no-]native-full-aot',
'Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation ' \
'(default: disabled)'
) { |v| cli_options[:native_full_aot] = v }
opts.on(
'--[no-]relink-eln-files',
'Enable/disable re-linking shared libraries in bundled *.eln ' \
'files (default: enabled)'
) { |v| cli_options[:relink_eln] = v }
opts.on(
'--[no-]rsvg',
'Enable/disable SVG image support via librsvg ' \
'(default: enabled)'
) { |v| cli_options[:rsvg] = v }
opts.on(
'--[no-]dbus',
'Enable/disable dbus support (default: enabled)'
) { |v| cli_options[:dbus] = v }
opts.on(
'--no-titlebar',
'Apply no-titlebar patch (default: disabled)'
) { cli_options[:no_titlebar] = true }
opts.on('--posix-spawn', 'Apply posix-spawn patch (deprecated)') do
warn '==> WARN: posix-spawn patch is deprecated and has no effect.'
end
opts.on(
'--no-frame-refocus',
'Apply no-frame-refocus patch (default: disabled)'
) { cli_options[:no_frame_refocus] = true }
opts.on('--[no-]poll', 'Apply poll patch (deprecated)') do
warn '==> WARN: poll patch is deprecated and has no effect.'
end
opts.on(
'--[no-]fd-setsize SIZE',
'Set an file descriptor (max open files) limit (default: 10000)'
) { |v| cli_options[:fd_setsize] = v.respond_to?(:to_i) ? v.to_i : 0 }
opts.on(
'--github-src-repo REPO',
'Specify a GitHub repo to download source tarballs from ' \
'(default: emacs-mirror/emacs)'
) { |v| cli_options[:github_src_repo] = v }
opts.on(
'--[no-]github-auth',
'Make authenticated GitHub API requests if GITHUB_TOKEN ' \
'environment variable is set.' \
'(default: enabled)'
) { |v| cli_options[:github_auth] = v }
opts.on(
'--work-dir DIR',
'Specify a working directory where tarballs, sources, and ' \
'builds will be stored and worked with'
) { |v| cli_options[:work_dir] = v }
opts.on(
'-o DIR',
'--output DIR',
'Output directory for finished builds ' \
'(default: <work-dir>/builds)'
) { |v| cli_options[:output] = v }
opts.on('--build-name NAME', 'Override generated build name') do |v|
cli_options[:build_name] = v
end
opts.on(
'--dist-include x,y,z',
'List of extra files to copy from Emacs source into build ' \
'folder/archive (default: COPYING)'
) { |v| cli_options[:dist_include] = v }
opts.on(
'--[no-]self-sign',
'Enable/disable self-signing of Emacs.app (default: enabled)'
) { |v| cli_options[:self_sign] = v }
opts.on(
'--[no-]archive',
'Enable/disable creating *.tbz archive (default: enabled)'
) { |v| cli_options[:archive] = v }
opts.on(
'--[no-]archive-keep-build-dir',
'Enable/disable keeping source folder for archive ' \
'(default: disabled)'
) { |v| cli_options[:archive_keep] = v }
opts.on(
'--log-level LEVEL',
'Build script log level (default: info)'
) { |v| cli_options[:log_level] = v }
opts.on(
'--plan FILE',
'Follow given plan file, instead of using given git ref/sha'
) { |v| cli_options[:plan] = v }
end
begin
OptionParser
.new do |opts|
opts.banner = <<~DOC
Usage: ./build-emacs-for-macos [options] <branch/tag/sha>
Branch, tag, and SHA are from the emacs-mirror/emacs/emacs Github repo,
available here: https://github.com/emacs-mirror/emacs
Options:
DOC
opts.on(
'-j',
'--parallel COUNT',
'Compile using COUNT parallel processes ' \
"(detected: #{cli_options[:parallel]})"
) { |v| cli_options[:parallel] = v }
opts.on(
'--git-sha SHA',
'Override detected git SHA of specified ' \
'branch allowing builds of old commits'
) { |v| cli_options[:git_sha] = v }
opts.on(
'--[no-]xwidgets',
'Enable/disable XWidgets if supported ' \
'(default: enabled)'
) { |v| cli_options[:xwidgets] = v }
opts.on(
'--[no-]tree-sitter',
'Enable/disable tree-sitter if supported' \
'(default: enabled)'
) { |v| cli_options[:tree_sitter] = v }
opts.on(
'--[no-]native-comp',
'Enable/disable native-comp ' \
'(default: enabled if supported)'
) { |v| cli_options[:native_comp] = v }
opts.on(
'--[no-]native-march',
'Enable/disable -march=native CFLAG' \
'(default: disabled)'
) { |v| cli_options[:native_march] = v }
opts.on(
'--[no-]native-full-aot',
'Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation ' \
'(default: disabled)'
) { |v| cli_options[:native_full_aot] = v }
opts.on(
'--[no-]relink-eln-files',
'Enable/disable re-linking shared libraries in bundled *.eln ' \
'files (default: enabled)'
) { |v| cli_options[:relink_eln] = v }
opts.on(
'--[no-]rsvg',
'Enable/disable SVG image support via librsvg ' \
'(default: enabled)'
) { |v| cli_options[:rsvg] = v }
opts.on(
'--[no-]dbus',
'Enable/disable dbus support (default: enabled)'
) { |v| cli_options[:dbus] = v }
opts.on(
'--no-titlebar',
'Apply no-titlebar patch (default: disabled)'
) { cli_options[:no_titlebar] = true }
opts.on('--posix-spawn', 'Apply posix-spawn patch (deprecated)') do
warn '==> WARN: posix-spawn patch is deprecated as has no effect.'
end
opts.on(
'--no-frame-refocus',
'Apply no-frame-refocus patch (default: disabled)'
) { cli_options[:no_frame_refocus] = true }
opts.on(
'--[no-]poll',
'Enable/disable experimental use of poll() instead of select() ' \
'to support > 1024 file descriptors ' \
'(default: disabled)'
) { |v| cli_options[:poll] = v }
opts.on(
'--github-src-repo REPO',
'Specify a GitHub repo to download source tarballs from ' \
'(default: emacs-mirror/emacs)'
) { |v| cli_options[:github_src_repo] = v }
opts.on(
'--[no-]github-auth',
'Make authenticated GitHub API requests if GITHUB_TOKEN ' \
'environment variable is set.' \
'(default: enabled)'
) { |v| cli_options[:github_auth] = v }
opts.on(
'--work-dir DIR',
'Specify a working directory where tarballs, sources, and ' \
'builds will be stored and worked with'
) { |v| cli_options[:work_dir] = v }
opts.on(
'-o DIR',
'--output DIR',
'Output directory for finished builds ' \
'(default: <work-dir>/builds)'
) { |v| cli_options[:output] = v }
opts.on('--build-name NAME', 'Override generated build name') do |v|
cli_options[:build_name] = v
end
opts.on(
'--dist-include x,y,z',
'List of extra files to copy from Emacs source into build ' \
'folder/archive (default: COPYING)'
) { |v| cli_options[:dist_include] = v }
opts.on(
'--[no-]self-sign',
'Enable/disable self-signing of Emacs.app (default: enabled)'
) { |v| cli_options[:self_sign] = v }
opts.on(
'--[no-]archive',
'Enable/disable creating *.tbz archive (default: enabled)'
) { |v| cli_options[:archive] = v }
opts.on(
'--[no-]archive-keep-build-dir',
'Enable/disable keeping source folder for archive ' \
'(default: disabled)'
) { |v| cli_options[:archive_keep] = v }
opts.on(
'--log-level LEVEL',
'Build script log level (default: info)'
) { |v| cli_options[:log_level] = v }
opts.on(
'--plan FILE',
'Follow given plan file, instead of using given git ref/sha'
) { |v| cli_options[:plan] = v }
end
.parse!
parser.parse!
Output.log_level = cli_options[:log_level]
work_dir = cli_options.delete(:work_dir)

10
go.mod
View File

@@ -3,11 +3,11 @@ module github.com/jimeh/build-emacs-for-macos
go 1.20
require (
github.com/bearer/gon v0.0.36
github.com/google/go-github/v35 v35.3.0
github.com/hashicorp/go-hclog v1.5.0
github.com/hexops/gotextdiff v1.0.3
github.com/jimeh/undent v1.1.0
github.com/mitchellh/gon v0.2.5
github.com/stretchr/testify v1.7.2
github.com/urfave/cli/v2 v2.25.7
golang.org/x/oauth2 v0.14.0
@@ -21,17 +21,15 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
howett.net/plist v1.0.0 // indirect
)

24
go.sum
View File

@@ -1,6 +1,8 @@
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
github.com/bearer/gon v0.0.36 h1:IswEKy8WbBPx7ZxCs4T7mHN6Rj8CbLpS/0u8wka6fO8=
github.com/bearer/gon v0.0.36/go.mod h1:jiD3TC2OA5lR2oADhe83a/FLxNS7/ra+58QUT9sQveg=
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -30,19 +32,12 @@ github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.9.3-0.20191025211905-234833755cb2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-retryablehttp v0.6.3/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M=
github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
@@ -68,15 +63,12 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/gon v0.2.5 h1:mVWtqTzV03W0avJqmqjk9M0qls3TDUXfc9ETJaPIOWY=
github.com/mitchellh/gon v0.2.5/go.mod h1:Ua18ZhqjZHg8VyqZo8kNHAY331ntV6nNJ9mT3s2mIo8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rhysd/go-fakeio v1.0.0 h1:+TjiKCOs32dONY7DaoVz/VPOdvRkPfBkEyUDIpM8FQY=
github.com/rhysd/go-fakeio v1.0.0/go.mod h1:joYxF906trVwp2JLrE4jlN7A0z6wrz8O6o1UjarbFzE=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sebdah/goldie v1.0.0 h1:9GNhIat69MSlz/ndaBg48vl9dF5fI+NBB6kfOxgfkMc=
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
@@ -96,8 +88,8 @@ github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLE
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -127,8 +119,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -146,8 +138,8 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@@ -360,6 +360,7 @@ func (s *Updater) updateRepoFile(
return true, nil
}
//nolint:funlen
func (s *Updater) renderCask(
ctx context.Context,
chk *LiveCheck,
@@ -433,12 +434,24 @@ func (s *Updater) renderCask(
}
}
templateFile := filepath.Join(s.TemplatesDir, chk.Cask+".rb.tpl")
tplContent, err := os.ReadFile(templateFile)
tplContent, err := os.ReadFile(
filepath.Join(s.TemplatesDir, chk.Cask+".rb.tpl"),
)
if err != nil {
return nil, err
}
helperContent, err := os.ReadFile(
filepath.Join(s.TemplatesDir, "_helpers.tpl"),
)
if err != nil && !os.IsNotExist(err) {
return nil, err
}
if len(helperContent) > 0 {
tplContent = append(helperContent, tplContent...)
}
tpl, err := template.New(chk.Cask).Parse(string(tplContent))
if err != nil {
return nil, err

View File

@@ -25,9 +25,9 @@ func notarizeCmd() *cli2.Command {
EnvVars: []string{"AC_USERNAME"},
},
&cli2.StringFlag{
Name: "ac-password",
Usage: "Apple Connect password",
Value: "@env:AC_PASSWORD",
Name: "ac-password",
Usage: "Apple Connect password",
EnvVars: []string{"AC_PASSWORD"},
},
&cli2.StringFlag{
Name: "ac-provider",

View File

@@ -76,9 +76,9 @@ func packageCmd() *cli2.Command {
EnvVars: []string{"AC_USERNAME"},
},
&cli2.StringFlag{
Name: "ac-password",
Usage: "(with --sign) Apple Connect password",
Value: "@env:AC_PASSWORD",
Name: "ac-password",
Usage: "(with --sign) Apple Connect password",
EnvVars: []string{"AC_PASSWORD"},
},
&cli2.StringFlag{
Name: "ac-provider",

View File

@@ -7,9 +7,9 @@ import (
"sync"
"time"
"github.com/bearer/gon/notarize"
"github.com/bearer/gon/staple"
"github.com/hashicorp/go-hclog"
"github.com/mitchellh/gon/notarize"
"github.com/mitchellh/gon/staple"
)
type Options struct {
@@ -25,21 +25,23 @@ func Notarize(ctx context.Context, opts *Options) error {
logger := hclog.FromContext(ctx).Named("notarize")
notarizeOpts := &notarize.Options{
File: opts.File,
BundleId: opts.BundleID,
Username: opts.Username,
Password: opts.Password,
Provider: opts.Provider,
BaseCmd: exec.CommandContext(ctx, ""),
File: opts.File,
DeveloperId: opts.Username,
Password: opts.Password,
Provider: opts.Provider,
BaseCmd: exec.CommandContext(ctx, ""),
Status: &status{
Lock: &sync.Mutex{},
Logger: logger,
},
// Ensure we don't log anything from the notarize package, as it will
// log the password. We'll handle logging ourselves.
Logger: hclog.NewNullLogger(),
}
logger.Info("notarizing", "file", filepath.Base(opts.File))
info, err := notarize.Notarize(ctx, notarizeOpts)
info, _, err := notarize.Notarize(ctx, notarizeOpts)
if err != nil {
return err
}
@@ -68,9 +70,15 @@ type status struct {
Lock *sync.Mutex
Logger hclog.Logger
lastStatusTime time.Time
lastinfoStatus string
lastInfoStatusTime time.Time
lastLogStatus string
lastLogStatusTime time.Time
}
var _ notarize.Status = (*status)(nil)
func (s *status) Submitting() {
s.Lock.Lock()
defer s.Lock.Unlock()
@@ -82,17 +90,34 @@ func (s *status) Submitted(uuid string) {
s.Lock.Lock()
defer s.Lock.Unlock()
s.Logger.Info("submitted")
s.Logger.Debug("request", "uuid", uuid)
s.Logger.Info("waiting for result from Apple...")
msg := "submitted, waiting for result from Apple"
if s.Logger.IsDebug() {
s.Logger.Debug(msg, "uuid", uuid)
} else {
s.Logger.Info(msg)
}
}
func (s *status) Status(info notarize.Info) {
func (s *status) InfoStatus(info notarize.Info) {
s.Lock.Lock()
defer s.Lock.Unlock()
if time.Now().After(s.lastStatusTime.Add(60 * time.Second)) {
s.lastStatusTime = time.Now()
if s.lastinfoStatus != info.Status ||
time.Now().After(s.lastInfoStatusTime.Add(60*time.Second)) {
s.lastinfoStatus = info.Status
s.lastInfoStatusTime = time.Now()
s.Logger.Info("status update", "status", info.Status)
}
}
func (s *status) LogStatus(log notarize.Log) {
s.Lock.Lock()
defer s.Lock.Unlock()
if s.lastLogStatus != log.Status ||
time.Now().After(s.lastLogStatusTime.Add(60*time.Second)) {
s.lastLogStatus = log.Status
s.lastLogStatusTime = time.Now()
s.Logger.Info("log status update", "status", log.Status)
}
}