build(macOS): change full library paths to @rpath

This commit is contained in:
Aofei Sheng
2024-07-16 08:09:57 +08:00
parent 2935ae7bf1
commit 74012d4869
2 changed files with 35 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ type Change struct {
// Change changes dependent shared library install name.
func (p *Cmd) Change(target string, chgs ...Change) error {
args := make([]string, len(chgs)*3+1)
args := make([]string, 0, len(chgs)*3+1)
for _, chg := range chgs {
args = append(args, "-change", chg.Old, chg.New)
}
@@ -64,7 +64,7 @@ func (p *Cmd) Change(target string, chgs ...Change) error {
// ChangeToRpath changes dependent shared library install name to @rpath.
func (p *Cmd) ChangeToRpath(target string, dylibDeps ...string) error {
args := make([]string, len(dylibDeps)*3+1)
args := make([]string, 0, len(dylibDeps)*3+1)
for _, dep := range dylibDeps {
args = append(args, "-change", dep, "@rpath/"+filepath.Base(dep))
}