(libPkg *packageFS)
| 94 | } |
| 95 | |
| 96 | func (p *libPatcher) prependRPATH(libPkg *packageFS) { |
| 97 | glob := "lib*/*.so*" |
| 98 | matches, _ := fs.Glob(libPkg, glob) |
| 99 | if len(matches) == 0 { |
| 100 | slog.Debug("not prepending package to RPATH because no shared libraries were found", "pkg", libPkg.storePath) |
| 101 | return |
| 102 | } |
| 103 | for i := range matches { |
| 104 | matches[i] = path.Dir(matches[i]) |
| 105 | } |
| 106 | slices.Sort(matches) |
| 107 | matches = slices.Compact(matches) |
| 108 | for i := range matches { |
| 109 | var err error |
| 110 | matches[i], err = libPkg.OSPath(matches[i]) |
| 111 | if err != nil { |
| 112 | continue |
| 113 | } |
| 114 | } |
| 115 | p.rpath = append(p.rpath, matches...) |
| 116 | slog.Debug("prepended package lib dirs to RPATH", "pkg", libPkg.storePath, "dirs", matches) |
| 117 | } |
| 118 | |
| 119 | // patch applies glibc patches to a binary and writes the patched result to |
| 120 | // outPath. It does not modify the original binary in-place. |
no test coverage detected