MCPcopy Create free account
hub / github.com/celer-pkg/celer / setupPkgConfig

Method setupPkgConfig

buildsystems/buildconfig_envs.go:153–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151}
152
153func (b BuildConfig) setupPkgConfig() {
154 var (
155 configPaths []string
156 configLibDirs []string
157 pathDivider string
158 sysrootDir string
159 )
160
161 rootfs := b.Ctx.Platform().GetRootFS()
162 tmpDepsDir := filepath.Join(dirs.TmpDepsDir, b.PortConfig.LibraryDir)
163 hostBuild := b.DevDep || b.HostDev
164
165 switch runtime.GOOS {
166 case "windows":
167 if b.buildSystem.Name() == "meson" || b.buildSystem.Name() == "b2" {
168 // For meson in windows, we use windows version pkgconf,
169 // so we need to provider with windows format path.
170 configPaths = []string{
171 filepath.Join(tmpDepsDir, "lib", "pkgconfig"),
172 filepath.Join(tmpDepsDir, "share", "pkgconfig"),
173 }
174
175 sysrootDir = tmpDepsDir
176 pathDivider = ";"
177 } else {
178 configPaths = []string{
179 fileio.ToCygpath(filepath.Join(tmpDepsDir, "lib", "pkgconfig")),
180 fileio.ToCygpath(filepath.Join(tmpDepsDir, "share", "pkgconfig")),
181 }
182
183 sysrootDir = fileio.ToCygpath(tmpDepsDir)
184 pathDivider = ":"
185 }
186
187 case "linux":
188 // Pkg config paths and sysroot dir.
189 if rootfs != nil && !hostBuild {
190 sysrootDir = rootfs.GetAbsDir()
191
192 // PKG_CONFIG related.
193 for _, configPath := range rootfs.GetPkgConfigPath() {
194 configLibDirs = append(configLibDirs, filepath.Join(sysrootDir, configPath))
195 }
196
197 pathDivider = ":"
198
199 // Use actual tmpDepsDir path (not sysroot symlink) for pkgconfig to ensure correct library paths
200 tmpDepsDir := filepath.Join(dirs.TmpDepsDir, b.PortConfig.LibraryDir)
201
202 // Prepend pkgconfig with actual tmp/deps directory (not sysroot symlink) to prioritize it.
203 configPaths = append([]string{
204 filepath.Join(tmpDepsDir, "lib", "pkgconfig"),
205 filepath.Join(tmpDepsDir, "share", "pkgconfig"),
206 }, configPaths...)
207 } else {
208 configPaths = []string{
209 filepath.Join(tmpDepsDir, "lib", "pkgconfig"),
210 filepath.Join(tmpDepsDir, "share", "pkgconfig"),

Callers 1

setupEnvsMethod · 0.95

Calls 8

ToCygpathFunction · 0.92
IfFunction · 0.92
setenvMethod · 0.80
GetRootFSMethod · 0.65
PlatformMethod · 0.65
NameMethod · 0.65
GetAbsDirMethod · 0.65
GetPkgConfigPathMethod · 0.65

Tested by

no test coverage detected