hyprpm: use provided pkgconf env if available
this is required for hyprpm to work under nix develop
This commit is contained in:
parent
82de66a030
commit
64db62d7e2
2 changed files with 20 additions and 3 deletions
|
|
@ -302,7 +302,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
|||
progress.printMessageAbove(infoString("Building {}", p.name));
|
||||
|
||||
for (auto const& bs : p.buildSteps) {
|
||||
const std::string& cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
||||
const std::string& cmd = std::format("cd {} && PKG_CONFIG_PATH='{}' '{}'", m_szWorkingPluginDirectory, getPkgConfigPath(), bs);
|
||||
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
||||
}
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ eHeadersErrors CPluginManager::headersValid() {
|
|||
return HEADERS_MISSING;
|
||||
|
||||
// find headers commit
|
||||
const std::string& cmd = std::format("PKG_CONFIG_PATH=\"{}/share/pkgconfig\" pkgconf --cflags --keep-system-cflags hyprland", DataState::getHeadersPath());
|
||||
const std::string& cmd = std::format("PKG_CONFIG_PATH='{}' pkgconf --cflags --keep-system-cflags hyprland", getPkgConfigPath());
|
||||
auto headers = execAndGet(cmd);
|
||||
|
||||
if (!headers.contains("-I/"))
|
||||
|
|
@ -740,7 +740,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
|||
progress.printMessageAbove(infoString("Building {}", p.name));
|
||||
|
||||
for (auto const& bs : p.buildSteps) {
|
||||
const std::string& cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
||||
const std::string& cmd = std::format("cd {} && PKG_CONFIG_PATH='{}' {}", m_szWorkingPluginDirectory, getPkgConfigPath(), bs);
|
||||
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
||||
}
|
||||
|
||||
|
|
@ -998,3 +998,18 @@ bool CPluginManager::hasDeps() {
|
|||
|
||||
return hasAllDeps;
|
||||
}
|
||||
|
||||
const std::string& CPluginManager::getPkgConfigPath() {
|
||||
static bool once = true;
|
||||
static std::string res;
|
||||
if (once) {
|
||||
once = false;
|
||||
|
||||
if (const auto E = getenv("PKG_CONFIG_PATH"); E && E[0])
|
||||
res = std::format("{}/share/pkgconfig:{}", DataState::getHeadersPath(), E);
|
||||
else
|
||||
res = std::format("{}/share/pkgconfig", DataState::getHeadersPath());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue