fix(build): cmake

This commit is contained in:
BlackAngelTV committed 2026-08-26 20:49:05 +02:00
1 parent 1242753962
commit 4a773c63ce
17 files changed
+80 -75

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20)
project(PackageManager VERSION 1.0.0 LANGUAGES CXX)
project(PacManager VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+11 -11
View File
@@ -1,4 +1,4 @@
# PackageMapper 📦
# PacManager 📦
Gestionnaire de paquets unifié avec support d'extensions pour Arch Linux.
@@ -70,10 +70,10 @@ sudo make install
```bash
# Depuis le dossier build
./PackageMapper
./PacManager
# Ou depuis /usr/bin après install
PackageMapper
PacManager
```
## Plugin Universal 🌍
@@ -120,7 +120,7 @@ Si aucun paquet n'est trouvé, le plugin :
```bash
# Installer le plugin universal
make universal_plugin
cp plugins/universal/libuniversal.so ~/.local/lib/PackageMapper/plugins/
cp plugins/universal/libuniversal.so ~/.local/lib/PacManager/plugins/
```
## Installation des plugins
@@ -128,9 +128,9 @@ cp plugins/universal/libuniversal.so ~/.local/lib/PackageMapper/plugins/
Les plugins sont des bibliothèques partagées `.so` qui s'auto-chargent.
### Emplacements recherchés (par ordre) :
1. `~/.local/lib/PackageMapper/plugins/`
2. `/usr/lib/PackageMapper/plugins/`
3. `/usr/local/lib/PackageMapper/plugins/`
1. `~/.local/lib/PacManager/plugins/`
2. `/usr/lib/PacManager/plugins/`
3. `/usr/local/lib/PacManager/plugins/`
4. `./plugins/` (relatif à l'exécutable)
### Compiler uniquement les plugins
@@ -146,10 +146,10 @@ make pkg_plugin
```bash
# Pour l'utilisateur courant
mkdir -p ~/.local/lib/PackageMapper/plugins
cp build/plugins/pacman/libpacman.so ~/.local/lib/PackageMapper/plugins/
cp build/plugins/apt/libapt.so ~/.local/lib/PackageMapper/plugins/
cp build/plugins/pkg/libpkg.so ~/.local/lib/PackageMapper/plugins/
mkdir -p ~/.local/lib/PacManager/plugins
cp build/plugins/pacman/libpacman.so ~/.local/lib/PacManager/plugins/
cp build/plugins/apt/libapt.so ~/.local/lib/PacManager/plugins/
cp build/plugins/pkg/libpkg.so ~/.local/lib/PacManager/plugins/
```
## Créer un plugin
+4 -4
View File
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
echo "🔨 Compilation de PackageMapper..."
echo "🔨 Compilation de PacManager..."
# Create build directory
mkdir -p build
@@ -19,12 +19,12 @@ echo ""
echo "✅ Compilation terminée !"
echo ""
echo "📋 Pour lancer :"
echo " ./PackageMapper"
echo " ./PacManager"
echo ""
echo "📋 Pour installer :"
echo " sudo make install"
echo ""
echo "📋 Pour copier les plugins (user mode) :"
echo " mkdir -p ~/.local/lib/PackageMapper/plugins"
echo " cp plugins/*/lib*.so ~/.local/lib/PackageMapper/plugins/"
echo " mkdir -p ~/.local/lib/PacManager/plugins"
echo " cp plugins/*/lib*.so ~/.local/lib/PacManager/plugins/"
echo ""
+4 -4
View File
@@ -1,6 +1,6 @@
@echo off
echo ============================================
echo PackageMapper - Build Windows
echo PacManager - Build Windows
echo ============================================
echo.
@@ -38,7 +38,7 @@ if errorlevel 1 (
echo.
echo [3/4] Copie des DLLs...
"%MSYS2_SHELL%" -defterm -no-start -mingw64 -c "cd /e/dev/gestionnaire/build_windows && ldd PackageManager.exe 2>/dev/null | grep 'mingw64' | awk '{print $3}' | while read dll; do cp \"$dll\" . 2>/dev/null; done"
"%MSYS2_SHELL%" -defterm -no-start -mingw64 -c "cd /e/dev/gestionnaire/build_windows && ldd PacManager.exe 2>/dev/null | grep 'mingw64' | awk '{print $3}' | while read dll; do cp \"$dll\" . 2>/dev/null; done"
echo.
echo [4/4] Copie des DLLs des plugins...
@@ -47,11 +47,11 @@ echo [4/4] Copie des DLLs des plugins...
echo.
echo ============================================
echo BUILD REUSSI !
echo Executable : build_windows\PackageManager.exe
echo Executable : build_windows\PacManager.exe
echo ============================================
echo.
echo Pour lancer :
echo cd build_windows
echo PackageManager.exe
echo PacManager.exe
echo.
pause
+1 -1
View File
@@ -17,7 +17,7 @@ struct HistoryEntry {
class HistoryManager {
public:
HistoryManager(const std::string& historyFile = "~/.local/share/PackageMapper/history.csv");
HistoryManager(const std::string& historyFile = "~/.local/share/PacManager/history.csv");
~HistoryManager();
void record(const HistoryEntry& entry);
+2 -2
View File
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
PLUGIN_DIR="$HOME/.local/lib/PackageMapper/plugins"
PLUGIN_DIR="$HOME/.local/lib/PacManager/plugins"
echo "📦 Installation des plugins..."
@@ -22,4 +22,4 @@ fi
echo ""
echo "📁 Plugins installés dans: $PLUGIN_DIR"
echo "🔄 Redémarrez PackageMapper pour charger les nouveaux plugins."
echo "🔄 Redémarrez PacManager pour charger les nouveaux plugins."
+2 -2
View File
@@ -3,6 +3,6 @@ target_include_directories(apt_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
set_target_properties(apt_plugin PROPERTIES
PREFIX ""
OUTPUT_NAME "apt"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
)
install(TARGETS apt_plugin DESTINATION lib/PackageMapper/plugins)
install(TARGETS apt_plugin DESTINATION lib/PacManager/plugins)
+5 -5
View File
@@ -63,7 +63,7 @@ public:
std::function<void(const std::string&)> progressCallback) override {
if (progressCallback) progressCallback("Installation de " + packageName + "...");
std::string output = exec(("sudo apt install -y " + packageName + " 2>&1").c_str());
std::string output = exec(("pkexec apt install -y " + packageName + " 2>&1").c_str());
if (progressCallback) {
std::istringstream iss(output);
@@ -80,7 +80,7 @@ public:
std::function<void(const std::string&)> progressCallback) override {
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
std::string output = exec(("sudo apt remove -y " + packageName + " 2>&1").c_str());
std::string output = exec(("pkexec apt remove -y " + packageName + " 2>&1").c_str());
if (progressCallback) {
std::istringstream iss(output);
@@ -97,12 +97,12 @@ public:
std::function<void(const std::string&)> progressCallback = nullptr) override {
if (packageName.empty()) {
if (progressCallback) progressCallback("Mise à jour des paquets...");
exec("sudo apt update 2>&1");
exec("sudo apt upgrade -y 2>&1");
exec("pkexec apt update 2>&1");
exec("pkexec apt upgrade -y 2>&1");
return true;
} else {
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
exec(("sudo apt install --only-upgrade -y " + packageName + " 2>&1").c_str());
exec(("pkexec apt install --only-upgrade -y " + packageName + " 2>&1").c_str());
return true;
}
}
+2 -2
View File
@@ -3,6 +3,6 @@ target_include_directories(pacman_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
set_target_properties(pacman_plugin PROPERTIES
PREFIX ""
OUTPUT_NAME "pacman"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
)
install(TARGETS pacman_plugin DESTINATION lib/PackageMapper/plugins)
install(TARGETS pacman_plugin DESTINATION lib/PacManager/plugins)
+4 -4
View File
@@ -89,7 +89,7 @@ public:
std::function<void(const std::string&)> progressCallback) override {
if (progressCallback) progressCallback("Installation de " + packageName + "...");
std::string cmd = "sudo pacman -S --noconfirm " + packageName + " 2>&1";
std::string cmd = "pkexec pacman -S --noconfirm " + packageName + " 2>&1";
std::string output = exec(cmd.c_str());
if (progressCallback) {
@@ -107,7 +107,7 @@ public:
std::function<void(const std::string&)> progressCallback) override {
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
std::string cmd = "sudo pacman -R --noconfirm " + packageName + " 2>&1";
std::string cmd = "pkexec pacman -R --noconfirm " + packageName + " 2>&1";
std::string output = exec(cmd.c_str());
if (progressCallback) {
@@ -125,12 +125,12 @@ public:
std::function<void(const std::string&)> progressCallback = nullptr) override {
if (packageName.empty()) {
if (progressCallback) progressCallback("Mise à jour de tous les paquets...");
std::string cmd = "sudo pacman -Syu --noconfirm 2>&1";
std::string cmd = "pkexec pacman -Syu --noconfirm 2>&1";
exec(cmd.c_str());
return true;
} else {
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
std::string cmd = "sudo pacman -S --noconfirm " + packageName + " 2>&1";
std::string cmd = "pkexec pacman -S --noconfirm " + packageName + " 2>&1";
exec(cmd.c_str());
return true;
}
+2 -2
View File
@@ -3,6 +3,6 @@ target_include_directories(pkg_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
set_target_properties(pkg_plugin PROPERTIES
PREFIX ""
OUTPUT_NAME "pkg"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
)
install(TARGETS pkg_plugin DESTINATION lib/PackageMapper/plugins)
install(TARGETS pkg_plugin DESTINATION lib/PacManager/plugins)
+4 -4
View File
@@ -66,7 +66,7 @@ public:
std::function<void(const std::string&)> progressCallback) override {
if (progressCallback) progressCallback("Installation de " + packageName + "...");
std::string output = exec(("sudo pkg install -y " + packageName + " 2>&1").c_str());
std::string output = exec(("pkexec pkg install -y " + packageName + " 2>&1").c_str());
if (progressCallback) {
std::istringstream iss(output);
@@ -83,7 +83,7 @@ public:
std::function<void(const std::string&)> progressCallback) override {
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
std::string output = exec(("sudo pkg delete -y " + packageName + " 2>&1").c_str());
std::string output = exec(("pkexec pkg delete -y " + packageName + " 2>&1").c_str());
if (progressCallback) {
std::istringstream iss(output);
@@ -100,11 +100,11 @@ public:
std::function<void(const std::string&)> progressCallback = nullptr) override {
if (packageName.empty()) {
if (progressCallback) progressCallback("Mise à jour de tous les paquets...");
exec("sudo pkg upgrade -y 2>&1");
exec("pkexec pkg upgrade -y 2>&1");
return true;
} else {
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
exec(("sudo pkg install -y " + packageName + " 2>&1").c_str());
exec(("pkexec pkg install -y " + packageName + " 2>&1").c_str());
return true;
}
}
+2 -2
View File
@@ -3,6 +3,6 @@ target_include_directories(universal_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
set_target_properties(universal_plugin PROPERTIES
PREFIX ""
OUTPUT_NAME "universal"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
)
install(TARGETS universal_plugin DESTINATION lib/PackageMapper/plugins)
install(TARGETS universal_plugin DESTINATION lib/PacManager/plugins)
+26 -13
View File
@@ -227,7 +227,7 @@ public:
for (auto& mgr : m_managers) {
if (!mgr.available) continue;
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
std::string cmd = "sudo " + mgr.updateCmd + " 2>&1";
std::string cmd = "pkexec sh -c \"" + mgr.updateCmd + "\" 2>&1";
exec(cmd.c_str());
}
// Flatpak
@@ -238,7 +238,7 @@ public:
// Snap
if (m_hasSnap) {
if (progressCallback) progressCallback("🔄 Mise à jour Snap...");
exec("sudo snap refresh 2>&1");
exec("pkexec snap refresh 2>&1");
}
return true;
}
@@ -248,7 +248,7 @@ public:
if (!mgr.available) continue;
if (isInstalledWithManager(mgr, packageName)) {
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
std::string cmd = "sudo " + mgr.installCmd + " " + packageName + " 2>&1";
std::string cmd = "pkexec sh -c \"" + mgr.installCmd + " " + packageName + "\" 2>&1";
exec(cmd.c_str());
return true;
}
@@ -410,7 +410,14 @@ private:
// Parse common formats: "name version - description" or "name version description"
size_t spacePos = line.find(' ');
if (spacePos != std::string::npos) {
pkg.name = line.substr(0, spacePos);
// Strip repository prefix (e.g. "extra/vlc" -> "vlc")
std::string firstToken = line.substr(0, spacePos);
size_t slashPos = firstToken.find('/');
if (slashPos != std::string::npos) {
pkg.name = firstToken.substr(slashPos + 1);
} else {
pkg.name = firstToken;
}
size_t nextSpace = line.find(' ', spacePos + 1);
if (nextSpace != std::string::npos) {
pkg.version = line.substr(spacePos + 1, nextSpace - spacePos - 1);
@@ -430,7 +437,7 @@ private:
bool installWithManager(const DetectedManager& mgr, const std::string& pkg,
std::function<void(const std::string&)> progressCallback) {
std::string cmd = "sudo " + mgr.installCmd + " " + pkg + " 2>&1";
std::string cmd = "pkexec sh -c \"" + mgr.installCmd + " " + pkg + "\" 2>&1";
std::string output = exec(cmd.c_str());
if (progressCallback) {
std::istringstream iss(output);
@@ -444,7 +451,7 @@ private:
bool removeWithManager(const DetectedManager& mgr, const std::string& pkg,
std::function<void(const std::string&)> progressCallback) {
std::string cmd = "sudo " + mgr.removeCmd + " " + pkg + " 2>&1";
std::string cmd = "pkexec sh -c \"" + mgr.removeCmd + " " + pkg + "\" 2>&1";
exec(cmd.c_str());
return !isInstalledWithManager(mgr, pkg);
}
@@ -497,13 +504,19 @@ private:
PackageInfo pkg;
size_t tabPos = line.find('\t');
if (tabPos != std::string::npos) {
pkg.name = line.substr(0, tabPos);
size_t nextTab = line.find('\t', tabPos + 1);
if (nextTab != std::string::npos) {
pkg.description = line.substr(tabPos + 1, nextTab - tabPos - 1);
// Columns: Name, Description, Application ID, Version, Branch, Remote
size_t descTab = line.find('\t', tabPos + 1);
size_t idTab = line.find('\t', descTab + 1);
if (descTab != std::string::npos && idTab != std::string::npos) {
pkg.description = line.substr(tabPos + 1, descTab - tabPos - 1);
pkg.name = line.substr(descTab + 1, idTab - descTab - 1); // App ID
} else {
pkg.name = line.substr(0, tabPos);
}
pkg.installed = isFlatpakInstalled(pkg.name);
results.push_back(pkg);
if (!pkg.name.empty()) {
results.push_back(pkg);
}
}
}
return results;
@@ -583,14 +596,14 @@ private:
bool installSnap(const std::string& pkg,
std::function<void(const std::string&)> progressCallback) {
if (progressCallback) progressCallback("📦 Installation Snap: " + pkg + "...");
exec(("sudo snap install " + pkg + " 2>&1").c_str());
exec(("pkexec snap install " + pkg + " 2>&1").c_str());
return isSnapInstalled(pkg);
}
bool removeSnap(const std::string& pkg,
std::function<void(const std::string&)> progressCallback) {
if (progressCallback) progressCallback("🗑️ Suppression Snap: " + pkg + "...");
exec(("sudo snap remove " + pkg + " 2>&1").c_str());
exec(("pkexec snap remove " + pkg + " 2>&1").c_str());
return !isSnapInstalled(pkg);
}
+4 -12
View File
@@ -328,8 +328,8 @@ void MainWindow::setupMenuBar() {
// Help menu
QMenu* helpMenu = menuBar->addMenu("Aide");
helpMenu->addAction("À propos", [this]() {
QMessageBox::about(this, "PackageMapper",
"<h2>PackageMapper v1.0.0</h2>"
QMessageBox::about(this, "PacManager",
"<h2>PacManager v1.0.0</h2>"
"<p>Gestionnaire de paquets unifié avec support d'extensions.</p>"
"<p>Système de plugins : chargez des gestionnaires supplémentaires "
"pour gérer apt, pkg, et bien d'autres.</p>"
@@ -340,16 +340,8 @@ void MainWindow::setupMenuBar() {
void MainWindow::loadPlugins() {
m_pluginSelector->clear();
// Try to load from default paths
m_pluginManager->loadPluginsFromDirectory("/usr/lib/PackageMapper/plugins");
m_pluginManager->loadPluginsFromDirectory("/usr/local/lib/PackageMapper/plugins");
char* home = getenv("HOME");
if (home) {
std::string userPluginDir = std::string(home) + "/.local/lib/PackageMapper/plugins";
m_pluginManager->loadPluginsFromDirectory(userPluginDir);
}
// The PluginManager constructor already loads plugins from all default
// search paths (~/.local/lib, /usr/lib, /usr/local/lib, ./plugins).
size_t count = m_pluginManager->getPluginCount();
if (count == 0) {
m_pluginSelector->addItem("Aucun plugin chargé");
+4 -4
View File
@@ -10,16 +10,16 @@ PluginManager::PluginManager() {
#ifdef _WIN32
char* appdata = getenv("APPDATA");
if (appdata) {
m_searchPaths.push_back(std::string(appdata) + "\\PackageMapper\\plugins");
m_searchPaths.push_back(std::string(appdata) + "\\PacManager\\plugins");
}
m_searchPaths.push_back(".\\plugins");
#else
char* home = getenv("HOME");
if (home) {
m_searchPaths.push_back(std::string(home) + "/.local/lib/PackageMapper/plugins");
m_searchPaths.push_back(std::string(home) + "/.local/lib/PacManager/plugins");
}
m_searchPaths.push_back("/usr/lib/PackageMapper/plugins");
m_searchPaths.push_back("/usr/local/lib/PackageMapper/plugins");
m_searchPaths.push_back("/usr/lib/PacManager/plugins");
m_searchPaths.push_back("/usr/local/lib/PacManager/plugins");
#endif
m_searchPaths.push_back("./plugins");
+2 -2
View File
@@ -3,12 +3,12 @@
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
app.setApplicationName("PackageMapper");
app.setApplicationName("PacManager");
app.setApplicationVersion("1.0.0");
app.setOrganizationName("Freebuff");
MainWindow window;
window.setWindowTitle("PackageMapper - Gestionnaire de Paquets");
window.setWindowTitle("PacManager - Gestionnaire de Paquets");
window.resize(1000, 700);
window.show();