mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
2a9707ec89
|
|||
|
1fc7faac1f
|
|||
|
786d253df6
|
|||
|
228ae0939c
|
|||
|
ac943c430c
|
|||
|
bc3923c9ca
|
|||
|
e6b1e5a554
|
|||
|
94625fce38
|
|||
|
b03343f506
|
|||
|
b1896d4a4f
|
|||
|
9d32509c61
|
|||
|
1c2745cd36
|
|||
|
80a0d55b24
|
|||
|
fd0ec4d772
|
|||
|
c0c809a86a
|
|||
|
cb63806262
|
47
CHANGELOG.md
47
CHANGELOG.md
@@ -2,6 +2,53 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.6.14](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.13...v0.6.14) (2021-08-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** silly typo ([1fc7faa](https://github.com/jimeh/build-emacs-for-macos/commit/1fc7faac1f040466fa4474a873d2290273780ee2))
|
||||
|
||||
### [0.6.13](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.12...v0.6.13) (2021-08-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **native_comp:** add option to enable/disable relinking *.eln files ([ac943c4](https://github.com/jimeh/build-emacs-for-macos/commit/ac943c430c58e0761ac44e8d25d4d55a461d01a2))
|
||||
|
||||
### [0.6.12](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.11...v0.6.12) (2021-08-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **sign:** resolve signing issue caused by re-linking shared lib in *.eln files ([e6b1e5a](https://github.com/jimeh/build-emacs-for-macos/commit/e6b1e5a554fd0f776bd01c17cfb1ebbbdf7a7831))
|
||||
|
||||
### [0.6.11](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.10...v0.6.11) (2021-07-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **native-comp:** fix re-linking and signing issue with *.eln files ([b03343f](https://github.com/jimeh/build-emacs-for-macos/commit/b03343f506aa3ceabdfa03f8a2916b2db4873f3f))
|
||||
|
||||
### [0.6.10](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.9...v0.6.10) (2021-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **native-comp:** *.eln files were not being found during shared lib embedding ([9d32509](https://github.com/jimeh/build-emacs-for-macos/commit/9d32509c615076618957cc47c82f6e9d8f972fe7))
|
||||
|
||||
### [0.6.9](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.8...v0.6.9) (2021-07-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **release:** add bulk edit command to quickly change multiple GitHub releases ([cb63806](https://github.com/jimeh/build-emacs-for-macos/commit/cb638062625d9bc3eee12515067fb09e05a08414))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **plan:** correctly parse --test-release-type flag ([fd0ec4d](https://github.com/jimeh/build-emacs-for-macos/commit/fd0ec4d772dd3da93afc234fb3024220b2099c88))
|
||||
|
||||
### [0.6.8](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.7...v0.6.8) (2021-07-02)
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ The build produced does have some limitations:
|
||||
that built the application will yield warnings. If you want to make a signed
|
||||
Emacs.app, google is you friend for finding signing instructions.
|
||||
|
||||
## Binary Builds
|
||||
|
||||
Nightly and stable binary builds produced with this build script are available
|
||||
from [jimeh/emacs-builds](https://github.com/jimeh/emacs-builds).
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Xcode](https://apps.apple.com/gb/app/xcode/id497799835?mt=12)
|
||||
|
||||
@@ -107,7 +107,7 @@ class Build
|
||||
handle_native_lisp(app)
|
||||
add_cli_helper(app)
|
||||
|
||||
LibEmbedder.new(app, brew_dir, extra_libs).embed
|
||||
LibEmbedder.new(app, brew_dir, extra_libs, options[:relink_eln]).embed
|
||||
GccLibEmbedder.new(app, gcc_info).embed if options[:native_comp]
|
||||
|
||||
archive_build(build_dir) if options[:archive]
|
||||
@@ -133,10 +133,6 @@ class Build
|
||||
@archive_filename = plan.dig('output', 'archive')
|
||||
end
|
||||
|
||||
if plan.dig('output', 'disk_image') || !plan.dig('output', 'archive')
|
||||
options[:archive] = false
|
||||
end
|
||||
|
||||
@build_name = plan.dig('build', 'name') if plan.dig('build', 'name')
|
||||
end
|
||||
|
||||
@@ -157,11 +153,22 @@ class Build
|
||||
end
|
||||
|
||||
def extra_libs
|
||||
@extra_libs ||= [
|
||||
return @extra_libs if @extra_libs
|
||||
|
||||
libs = [
|
||||
File.join(brew_dir, 'opt/expat/lib/libexpat.1.dylib'),
|
||||
File.join(brew_dir, 'opt/libiconv/lib/libiconv.2.dylib'),
|
||||
File.join(brew_dir, 'opt/zlib/lib/libz.1.dylib')
|
||||
]
|
||||
|
||||
if options[:native_comp]
|
||||
libgcc_s = File.join(
|
||||
brew_dir, 'lib', 'gcc', gcc_info.major_version, 'libgcc_s.1.dylib'
|
||||
)
|
||||
libs << libgcc_s if File.exist?(libgcc_s)
|
||||
end
|
||||
|
||||
@extra_libs = libs
|
||||
end
|
||||
|
||||
def download_tarball(sha)
|
||||
@@ -294,6 +301,8 @@ class Build
|
||||
"-L#{gcc_info.libgccjit_lib_dir}",
|
||||
"-I#{File.join(gcc_info.root_dir, 'include')}",
|
||||
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}",
|
||||
# Ensure library re-linking and code signing will work after building.
|
||||
'-Wl,-headerpad_max_install_names',
|
||||
ENV['LDFLAGS']
|
||||
].compact.join(' ')
|
||||
|
||||
@@ -745,7 +754,7 @@ class AbstractEmbedder
|
||||
end
|
||||
|
||||
def lib_dir
|
||||
File.join(app, 'Contents', 'Frameworks')
|
||||
File.join(invocation_dir, 'lib')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -753,7 +762,7 @@ class LibEmbedder < AbstractEmbedder
|
||||
attr_reader :lib_source
|
||||
attr_reader :extra_libs
|
||||
|
||||
def initialize(app, lib_source, extra_libs = [])
|
||||
def initialize(app, lib_source, extra_libs = [], embed_eln_files = true)
|
||||
super(app)
|
||||
|
||||
@lib_source = lib_source
|
||||
@@ -775,7 +784,7 @@ class LibEmbedder < AbstractEmbedder
|
||||
rel_path = Pathname.new(lib_dir).relative_path_from(
|
||||
Pathname.new(File.dirname(binary))
|
||||
).to_s
|
||||
eln_files.each { |f| copy_libs(f, rel_path) }
|
||||
eln_files.each { |f| copy_libs(f, rel_path) } if embed_eln_files
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -783,19 +792,7 @@ class LibEmbedder < AbstractEmbedder
|
||||
private
|
||||
|
||||
def eln_files
|
||||
@eln_files ||= Dir[
|
||||
File.join(
|
||||
app, 'Contents', 'Resources', 'native-lisp', '**', '*.eln'
|
||||
),
|
||||
File.join(
|
||||
app, 'Contents', 'MacOS', 'lib', 'emacs', '**',
|
||||
'native-lisp', '**', '*.eln'
|
||||
),
|
||||
File.join(
|
||||
app, 'Contents', 'MacOS', 'libexec', 'emacs', '**',
|
||||
'eln-cache', '**', '*.eln'
|
||||
)
|
||||
]
|
||||
@eln_files ||= Dir[File.join(app, 'Contents', '**', '*.eln')]
|
||||
end
|
||||
|
||||
def copy_libs(exe, rel_path = nil)
|
||||
@@ -1096,6 +1093,12 @@ if __FILE__ == $PROGRAM_NAME
|
||||
cli_options[:native_full_aot] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]relink-eln-files',
|
||||
'Enable/disable re-linking shared libraries in bundled *.eln ' \
|
||||
'files (default: enabled)') do |v|
|
||||
cli_options[:relink_eln] = v
|
||||
end
|
||||
|
||||
opts.on('--[no-]rsvg',
|
||||
'Enable/disable SVG image support via librsvg ' \
|
||||
'(default: enabled)') do |v|
|
||||
|
||||
@@ -89,7 +89,7 @@ func planAction(c *cli2.Context, opts *Options) error {
|
||||
GithubToken: c.String("github-token"),
|
||||
}
|
||||
|
||||
if c.String("test-build-type") == "draft" {
|
||||
if c.String("test-release-type") == "draft" {
|
||||
planOpts.TestBuildType = plan.Draft
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -60,6 +61,7 @@ func releaseCmd() *cli2.Command {
|
||||
Subcommands: []*cli2.Command{
|
||||
releaseCheckCmd(),
|
||||
releasePublishCmd(),
|
||||
releaseBulkCmd(),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -206,3 +208,56 @@ func releasePublishAction(
|
||||
|
||||
return release.Publish(c.Context, rlsOpts)
|
||||
}
|
||||
|
||||
func releaseBulkCmd() *cli2.Command {
|
||||
return &cli2.Command{
|
||||
Name: "bulk",
|
||||
Usage: "bulk modify GitHub releases",
|
||||
ArgsUsage: "",
|
||||
Flags: []cli2.Flag{
|
||||
&cli2.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "regexp pattern matching release names to modify",
|
||||
},
|
||||
&cli2.StringFlag{
|
||||
Name: "prerelease",
|
||||
Usage: "change prerelease flag, must be \"true\" or " +
|
||||
"\"false\", otherwise prerelease value is not changed",
|
||||
},
|
||||
&cli2.BoolFlag{
|
||||
Name: "dry-run",
|
||||
Usage: "do not perform any changes",
|
||||
},
|
||||
},
|
||||
Action: releaseActionWrapper(releaseBulkAction),
|
||||
}
|
||||
}
|
||||
|
||||
func releaseBulkAction(
|
||||
c *cli2.Context,
|
||||
opts *Options,
|
||||
rOpts *releaseOptions,
|
||||
) error {
|
||||
bulkOpts := &release.BulkOptions{
|
||||
Repository: rOpts.Repository,
|
||||
NamePattern: c.String("name"),
|
||||
DryRun: c.Bool("dry-run"),
|
||||
GithubToken: rOpts.GithubToken,
|
||||
}
|
||||
|
||||
switch c.String("prerelease") {
|
||||
case "true":
|
||||
v := true
|
||||
bulkOpts.Prerelease = &v
|
||||
case "false":
|
||||
v := false
|
||||
bulkOpts.Prerelease = &v
|
||||
case "":
|
||||
default:
|
||||
return errors.New(
|
||||
"--prerelease by me \"true\" or \"false\" when specified",
|
||||
)
|
||||
}
|
||||
|
||||
return release.Bulk(c.Context, bulkOpts)
|
||||
}
|
||||
|
||||
@@ -120,10 +120,12 @@ func Create(ctx context.Context, opts *Options) (*Plan, error) {
|
||||
plan.Build.Name += ".test." + testName
|
||||
plan.Release.Title = "Test Builds"
|
||||
plan.Release.Name = "test-builds"
|
||||
|
||||
plan.Release.Prerelease = true
|
||||
plan.Release.Draft = false
|
||||
if opts.TestBuildType == Draft {
|
||||
plan.Release.Prerelease = false
|
||||
plan.Release.Draft = true
|
||||
} else {
|
||||
plan.Release.Prerelease = true
|
||||
}
|
||||
|
||||
index := strings.LastIndex(diskImage, ".")
|
||||
|
||||
84
pkg/release/bulk.go
Normal file
84
pkg/release/bulk.go
Normal file
@@ -0,0 +1,84 @@
|
||||
package release
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
|
||||
"github.com/google/go-github/v35/github"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/jimeh/build-emacs-for-macos/pkg/gh"
|
||||
"github.com/jimeh/build-emacs-for-macos/pkg/repository"
|
||||
)
|
||||
|
||||
type BulkOptions struct {
|
||||
Repository *repository.Repository
|
||||
NamePattern string
|
||||
Prerelease *bool
|
||||
DryRun bool
|
||||
GithubToken string
|
||||
}
|
||||
|
||||
func Bulk(ctx context.Context, opts *BulkOptions) error {
|
||||
logger := hclog.FromContext(ctx).Named("release")
|
||||
gh := gh.New(ctx, opts.GithubToken)
|
||||
|
||||
nameMatcher, err := regexp.Compile(opts.NamePattern)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nextPage := 1
|
||||
lastPage := 1
|
||||
|
||||
for nextPage <= lastPage {
|
||||
releases, resp, err := gh.Repositories.ListReleases(
|
||||
ctx, opts.Repository.Owner(), opts.Repository.Name(),
|
||||
&github.ListOptions{
|
||||
Page: nextPage,
|
||||
PerPage: 100,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nextPage = resp.NextPage
|
||||
lastPage = resp.LastPage
|
||||
|
||||
for _, r := range releases {
|
||||
if !nameMatcher.MatchString(r.GetName()) {
|
||||
continue
|
||||
}
|
||||
|
||||
logger.Info("match found", "release", r.GetName())
|
||||
|
||||
var changes []interface{}
|
||||
if opts.Prerelease != nil && r.GetPrerelease() != *opts.Prerelease {
|
||||
changes = append(changes, "prerelease", *opts.Prerelease)
|
||||
r.Prerelease = opts.Prerelease
|
||||
}
|
||||
|
||||
if len(changes) > 0 {
|
||||
changes = append(
|
||||
[]interface{}{"release", r.GetName()}, changes...,
|
||||
)
|
||||
logger.Info("modifying", changes...)
|
||||
if !opts.DryRun {
|
||||
_, _, err = gh.Repositories.EditRelease(
|
||||
ctx, opts.Repository.Owner(), opts.Repository.Name(),
|
||||
r.GetID(), r,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if nextPage == 0 || lastPage == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user