summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hyprpm/src/core/PluginManager.cpp21
-rw-r--r--hyprpm/src/core/PluginManager.hpp2
2 files changed, 20 insertions, 3 deletions
diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp
index ebf28c65..4205e94e 100644
--- a/hyprpm/src/core/PluginManager.cpp
+++ b/hyprpm/src/core/PluginManager.cpp
@@ -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;
+}
diff --git a/hyprpm/src/core/PluginManager.hpp b/hyprpm/src/core/PluginManager.hpp
index 10a71469..95177e3e 100644
--- a/hyprpm/src/core/PluginManager.hpp
+++ b/hyprpm/src/core/PluginManager.hpp
@@ -65,6 +65,8 @@ class CPluginManager {
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
+ const std::string& getPkgConfigPath();
+
bool hasDeps();
bool m_bVerbose = false;