diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-04-29 01:28:24 -0500 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-04-29 01:28:24 -0500 |
| commit | 7635739e9ba79a932e5b0e1e708d92eb6ce1ba16 (patch) | |
| tree | 95584b453d35f812534ff40ab17009b9a5e0c89e /libs | |
| parent | e0f6eb0d84411fc93fba84ed5ecb38f78513e67b (diff) | |
Finalize Linux build cleanup
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/7zip/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | libs/archive/README.md | 17 | ||||
| -rw-r--r-- | libs/archive/src/archive.cpp | 2 | ||||
| -rw-r--r-- | libs/archive/src/library.h | 18 |
4 files changed, 20 insertions, 21 deletions
diff --git a/libs/7zip/CMakeLists.txt b/libs/7zip/CMakeLists.txt index 5db6f0a..82d7e5c 100644 --- a/libs/7zip/CMakeLists.txt +++ b/libs/7zip/CMakeLists.txt @@ -448,7 +448,7 @@ target_compile_options(7z PRIVATE target_link_libraries(7z PRIVATE pthread dl) -# Install 7z.so next to the organizer binary (in dlls/ subdirectory) -install(TARGETS 7z LIBRARY DESTINATION dlls) +# Install 7z.so with the organizer's Linux libraries. +install(TARGETS 7z LIBRARY DESTINATION lib) # Also install to the bin root so dlopen can find it easily install(TARGETS 7z LIBRARY DESTINATION bin) diff --git a/libs/archive/README.md b/libs/archive/README.md index e389081..2ffde28 100644 --- a/libs/archive/README.md +++ b/libs/archive/README.md @@ -2,15 +2,15 @@ # modorganizer-archive -This module provides a wrapper round the 7zip `7z.dll` allowing easy(ish) access to the contents of an archive. +This module provides a wrapper around the 7zip `7z.so` runtime, allowing access to the contents of an archive. ## How to build? If you want to build this as par of ModOrganizer2, simply use ModOrganizer2 build system. -If you want to build this as a standalone DLL, you can run the following (requires `cmake >= 3.16`): +If you want to build this as a standalone shared library, you can run the following (requires `cmake >= 3.16`): -```batch +```sh mkdir build cd build cmake .. @@ -18,11 +18,10 @@ cmake --build . --config Release ``` This will download the two required dependencies (7z sources and [`fmtlib`](https://github.com/fmtlib/fmt)), and -build the DLL under `build/src/Release`. +build the shared library under `build/src/Release`. -In order to use the DLL, you need to have the `7z.dll` available in your path, otherwize `CreateArchive()` will -always fail. You can get the `7z.dll` by installing `7z.exe` or by building 7z yourself (building `archive` does -not build `7z`). +In order to use the library, you need to have `7z.so` available in the runtime library path, otherwise +`CreateArchive()` will always fail. You can get `7z.so` from p7zip or by building the bundled 7z target. ## The `Archive` class @@ -43,7 +42,7 @@ of the available methods: /** * @brief Check if this Archive wrapper is in a valid state. * - * A non-valid Archive instance usually means that the 7z DLLs could not be loaded properly. Failures + * A non-valid Archive instance usually means that the 7z runtime could not be loaded properly. Failures * to open or extract archives do not invalidate the Archive, so this should only be used to check * if the Archive object has been initialized properly. * @@ -52,7 +51,7 @@ of the available methods: bool Archive::isValid() const; ``` -If this returns `false`, this probably means the system cannot find `7z.dll` or it is corrupt, very old (or possibly too new). +If this returns `false`, this probably means the system cannot find `7z.so` or it is corrupt, very old (or possibly too new). **You should check this before calling `open`.** ```cpp diff --git a/libs/archive/src/archive.cpp b/libs/archive/src/archive.cpp index 6d35366..ca3aa03 100644 --- a/libs/archive/src/archive.cpp +++ b/libs/archive/src/archive.cpp @@ -269,7 +269,7 @@ HRESULT ArchiveImpl::loadFormats() } ArchiveImpl::ArchiveImpl() - : m_Valid(false), m_LastError(Error::ERROR_NONE), m_Library("dlls/7zip.dll"), + : m_Valid(false), m_LastError(Error::ERROR_NONE), m_Library("lib/7z.so"), m_PasswordCallback{} { // Reset the log callback: diff --git a/libs/archive/src/library.h b/libs/archive/src/library.h index 9fec56d..a0656f2 100644 --- a/libs/archive/src/library.h +++ b/libs/archive/src/library.h @@ -94,22 +94,22 @@ private: exeDir = exeDir.substr(0, slash); } - // AppImage: check MO2_DLLS_DIR env var first (writable dir next to AppImage) - std::string envDlls; - const char* envVal = std::getenv("MO2_DLLS_DIR"); + // AppImage: check MO2_LIBS_DIR env var first (writable dir next to AppImage) + std::string envLibs; + const char* envVal = std::getenv("MO2_LIBS_DIR"); if (envVal && envVal[0] != '\0') { - envDlls = envVal; + envLibs = envVal; } - // Try bundled 7z.so locations first (env override, exe dir, dlls/ subdir) + // Try bundled 7z.so locations first (env override, exe dir, lib/ subdir) std::vector<std::string> tryPaths; - if (!envDlls.empty()) { - tryPaths.push_back(envDlls + "/7z.so"); + if (!envLibs.empty()) { + tryPaths.push_back(envLibs + "/7z.so"); } tryPaths.push_back(exeDir + "/7z.so"); - tryPaths.push_back(exeDir + "/dlls/7z.so"); + tryPaths.push_back(exeDir + "/lib/7z.so"); tryPaths.push_back("7z.so"); - tryPaths.push_back("dlls/7z.so"); + tryPaths.push_back("lib/7z.so"); tryPaths.push_back("/usr/lib/p7zip/7z.so"); tryPaths.push_back("/usr/lib64/p7zip/7z.so"); tryPaths.push_back("/usr/libexec/p7zip/7z.so"); |
