-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathstager_unix.go
44 lines (35 loc) · 931 Bytes
/
stager_unix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// +build !windows
package libbuildpack
import (
"os"
"path/filepath"
)
const (
envPathSeparator = ":"
depsDirEnvVar = "$DEPS_DIR"
scriptName = "000_multi-supply.sh"
scriptLineTemplate = `export %[1]s=%[2]s$([[ ! -z "${%[1]s:-}" ]] && echo ":$%[1]s")`
)
var stagingEnvVarDirs = map[string]string{
"PATH": "bin",
"LD_LIBRARY_PATH": "lib",
"LIBRARY_PATH": "lib",
"CPATH": "include",
"PKG_CONFIG_PATH": "pkgconfig",
}
var launchEnvVarDirs = map[string]string{
"PATH": "bin",
"LD_LIBRARY_PATH": "lib",
"LIBRARY_PATH": "lib",
}
func (s *Stager) AddBinDependencyLink(destPath, sourceName string) error {
binDir := filepath.Join(s.DepDir(), "bin")
if err := os.MkdirAll(binDir, 0755); err != nil {
return err
}
relPath, err := filepath.Rel(binDir, destPath)
if err != nil {
return err
}
return os.Symlink(relPath, filepath.Join(binDir, sourceName))
}