diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2019-02-23 16:35:21 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-02-27 20:18:17 +0100 |
commit | 33c3818ac59fda3a00b7cff19fd3b1f09296fe5d (patch) | |
tree | 0d5d3e3353303d875922d428ae28464e9d121930 | |
parent | 89609911f85667e0e46b89e15023081cd6724677 (diff) | |
download | tdelibs-33c3818ac59fda3a00b7cff19fd3b1f09296fe5d.tar.gz tdelibs-33c3818ac59fda3a00b7cff19fd3b1f09296fe5d.zip |
Use system libdir when searching for dynamically loaded libraries.
This prevents finding an incorrect architecture on multi-arch systems.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 8a859540c3cb306844288144a06028dc302408d6)
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | config.h.cmake | 1 | ||||
-rw-r--r-- | tdecore/ksocks.cpp | 8 | ||||
-rw-r--r-- | tdeio/kssl/kopenssl.cc | 41 | ||||
-rw-r--r-- | tdeprint/cups/cupsdconf2/cupsdconf.cpp | 13 | ||||
-rw-r--r-- | tdespell2/plugins/ispell/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tdespell2/plugins/ispell/ispell_checker.cpp | 4 | ||||
-rw-r--r-- | tdeui/ksconfig.cpp | 29 |
8 files changed, 56 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b90edfa94..9cd1fdb55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,6 +137,18 @@ if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) +##### get the system's default path for libraries + +tde_save_and_set( CMAKE_INSTALL_PREFIX "/usr" ) +include( GNUInstallDirs OPTIONAL ) +if( CMAKE_INSTALL_LIBDIR ) + set( SYSTEM_LIBDIR "${CMAKE_INSTALL_LIBDIR}" ) +else( ) + set( SYSTEM_LIBDIR "lib${LIB_SUFFIX}" ) +endif( ) +tde_restore( CMAKE_INSTALL_PREFIX ) + + ##### check for compiler capabilities ########### include( CheckCXXCompilerFlag ) diff --git a/config.h.cmake b/config.h.cmake index 2aa79d4cf..e0153f504 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -781,6 +781,7 @@ /* Suffix for lib directories */ #define KDELIBSUFF "@KDELIBSUFF@" +#define SYSTEM_LIBDIR "@SYSTEM_LIBDIR@" /* The compiled in system configuration prefix */ #define KDESYSCONFDIR "@CONFIG_INSTALL_DIR@" diff --git a/tdecore/ksocks.cpp b/tdecore/ksocks.cpp index a6ecc37d2..6fac3179e 100644 --- a/tdecore/ksocks.cpp +++ b/tdecore/ksocks.cpp @@ -254,13 +254,13 @@ KSocks::KSocks(TDEConfigBase *config) : _socksLib(0L), _st(0L) { return; _libPaths << "" - << "/usr/lib" KDELIBSUFF "/" + << "/usr/" SYSTEM_LIBDIR "/" << "/usr/lib/" - << "/usr/local/lib" KDELIBSUFF "/" + << "/usr/local/" SYSTEM_LIBDIR "/" << "/usr/local/lib/" - << "/usr/local/socks5/lib" KDELIBSUFF "/" + << "/usr/local/socks5/" SYSTEM_LIBDIR "/" << "/usr/local/socks5/lib/" - << "/opt/socks5/lib" KDELIBSUFF "/" + << "/opt/socks5/" SYSTEM_LIBDIR "/" << "/opt/socks5/lib/"; _libNames << "libsocks.so" // Dante << "libdsocksd.so.0" // Dante 1.1.14-2 on diff --git a/tdeio/kssl/kopenssl.cc b/tdeio/kssl/kopenssl.cc index ded836fde..9c6d47ad4 100644 --- a/tdeio/kssl/kopenssl.cc +++ b/tdeio/kssl/kopenssl.cc @@ -28,7 +28,6 @@ #include <tdeconfig.h> #include <kstaticdeleter.h> #include <tqregexp.h> -#include <tqdir.h> #include <stdio.h> #include <unistd.h> @@ -324,7 +323,7 @@ TDEConfig *cfg; #ifdef __OpenBSD__ { - TQString libname = findMostRecentLib("/usr/lib" KDELIBSUFF, "crypto"); + TQString libname = findMostRecentLib("/usr/" SYSTEM_LIBDIR, "crypto"); if (!libname.isNull()) _cryptoLib = ll->globalLibrary(libname.latin1()); } @@ -349,13 +348,13 @@ TDEConfig *cfg; #ifdef _AIX << "/opt/freeware/lib/" #endif - << "/usr/lib" KDELIBSUFF "/" - << "/usr/ssl/lib" KDELIBSUFF "/" - << "/usr/local/lib" KDELIBSUFF "/" - << "/usr/local/openssl/lib" KDELIBSUFF "/" - << "/usr/local/ssl/lib" KDELIBSUFF "/" - << "/opt/openssl/lib" KDELIBSUFF "/" - << "/lib" KDELIBSUFF "/" + << "/usr/" SYSTEM_LIBDIR "/" + << "/usr/ssl/" SYSTEM_LIBDIR "/" + << "/usr/local/" SYSTEM_LIBDIR "/" + << "/usr/local/openssl/" SYSTEM_LIBDIR "/" + << "/usr/local/ssl/" SYSTEM_LIBDIR "/" + << "/opt/openssl/" SYSTEM_LIBDIR "/" + << "/" SYSTEM_LIBDIR "/" << ""; // FIXME: #define here for the various OS types to optimize @@ -408,18 +407,6 @@ TDEConfig *cfg; tmpStr.replace(TQRegExp("\\(.*\\)"), ""); if (!access(tmpStr.latin1(), R_OK)) _cryptoLib = ll->globalLibrary(alib.latin1()); - if (!_cryptoLib) { - // Multiarch triplet search - TQDir madir (*it); - TQStringList multiarchdirs = madir.entryList("*-*-*", TQDir::Dirs); - for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) { - TQString malib = *it + *mait + "/" + *shit; - TQString tmpStr(malib.latin1()); - tmpStr.replace(TQRegExp("\\(.*\\)"), ""); - if (!access(tmpStr.latin1(), R_OK)) - _cryptoLib = ll->globalLibrary(malib.latin1()); - } - } if (_cryptoLib) break; } if (_cryptoLib) break; @@ -611,18 +598,6 @@ TDEConfig *cfg; tmpStr.replace(TQRegExp("\\(.*\\)"), ""); if (!access(tmpStr.latin1(), R_OK)) _sslLib = ll->globalLibrary(alib.latin1()); - if (!_sslLib) { - // Multiarch triplet search - TQDir madir (*it); - TQStringList multiarchdirs = madir.entryList("*-*-*", TQDir::Dirs); - for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) { - TQString malib = *it + *mait + "/" + *shit; - TQString tmpStr(malib.latin1()); - tmpStr.replace(TQRegExp("\\(.*\\)"), ""); - if (!access(tmpStr.latin1(), R_OK)) - _sslLib = ll->globalLibrary(malib.latin1()); - } - } if (_sslLib) break; } if (_sslLib) break; diff --git a/tdeprint/cups/cupsdconf2/cupsdconf.cpp b/tdeprint/cups/cupsdconf2/cupsdconf.cpp index 2c5610411..5cfab057d 100644 --- a/tdeprint/cups/cupsdconf2/cupsdconf.cpp +++ b/tdeprint/cups/cupsdconf2/cupsdconf.cpp @@ -71,10 +71,15 @@ CupsdConf::CupsdConf() //fontpath_ << (datadir_+"/fonts"); requestdir_ = findDir(TQStringList("/var/spool/cups") << "/var/cups"); - serverbin_ = findDir(TQStringList("/usr/lib" KDELIBSUFF "/cups") - << "/usr/local/lib" KDELIBSUFF "/cups" - << "/opt/lib" KDELIBSUFF "/cups" - << "/opt/local/lib" KDELIBSUFF "/cups"); + serverbin_ = findDir(TQStringList() + << "/usr/" SYSTEM_LIBDIR "/cups" + << "/usr/lib/cups" + << "/usr/local/" SYSTEM_LIBDIR "/cups" + << "/usr/local/lib/cups" + << "/opt/" SYSTEM_LIBDIR "/cups" + << "/opt/lib/cups" + << "/opt/local/" SYSTEM_LIBDIR "/cups" + << "/opt/local/lib/cups"); serverfiles_ = findDir(TQStringList("/etc/cups") << "/usr/local/etc/cups"); tmpfiles_ = requestdir_+"/tmp"; diff --git a/tdespell2/plugins/ispell/CMakeLists.txt b/tdespell2/plugins/ispell/CMakeLists.txt index c8e5a4ec6..62b12a1a1 100644 --- a/tdespell2/plugins/ispell/CMakeLists.txt +++ b/tdespell2/plugins/ispell/CMakeLists.txt @@ -12,6 +12,7 @@ include_directories( ${TQT_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdespell2 ${CMAKE_SOURCE_DIR}/tdecore diff --git a/tdespell2/plugins/ispell/ispell_checker.cpp b/tdespell2/plugins/ispell/ispell_checker.cpp index c07d9a55f..387997444 100644 --- a/tdespell2/plugins/ispell/ispell_checker.cpp +++ b/tdespell2/plugins/ispell/ispell_checker.cpp @@ -29,6 +29,8 @@ * do so, delete this exception statement from your version. */ +#include <config.h> + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -53,7 +55,9 @@ typedef struct str_ispell_map } IspellMap; static const char *ispell_dirs [] = { + "/usr/" SYSTEM_LIBDIR "/ispell", "/usr/lib/ispell", + "/usr/local/" SYSTEM_LIBDIR "/ispell", "/usr/local/lib/ispell", "/usr/local/share/ispell", "/usr/share/ispell", diff --git a/tdeui/ksconfig.cpp b/tdeui/ksconfig.cpp index 234882939..6ae9e3d5f 100644 --- a/tdeui/ksconfig.cpp +++ b/tdeui/ksconfig.cpp @@ -444,20 +444,25 @@ void KSpellConfig::getAvailDictsIspell () { dictcombo->insertItem( i18n("ISpell Default") ); // dictionary path - TQFileInfo dir ("/usr/lib" KDELIBSUFF "/ispell"); - if (!dir.exists() || !dir.isDir()) - dir.setFile ("/usr/local/lib" KDELIBSUFF "/ispell"); - if (!dir.exists() || !dir.isDir()) - dir.setFile ("/usr/local/share/ispell"); - if (!dir.exists() || !dir.isDir()) - dir.setFile ("/usr/share/ispell"); - if (!dir.exists() || !dir.isDir()) - dir.setFile ("/usr/pkg/lib"); + TQFileInfo dir; + TQStringList dirs; + dirs + << "/usr/" SYSTEM_LIBDIR "/ispell" + << "/usr/lib/ispell" + << "/usr/local/" SYSTEM_LIBDIR "/ispell" + << "/usr/local/lib/ispell" + << "/usr/local/share/ispell" + << "/usr/share/ispell" + << "/usr/pkg/lib"; + for (TQStringList::ConstIterator it=dirs.begin(); it != dirs.end(); ++it) { + dir.setFile(*it); + if (dir.exists() && dir.isDir()) { + break; + } + } /* TODO get them all instead of just one of them. * If /usr/local/lib exists, it skips the rest - if (!dir.exists() || !dir.isDir()) - dir.setFile ("/usr/local/lib"); - */ + */ if (!dir.exists() || !dir.isDir()) return; kdDebug(750) << "KSpellConfig::getAvailDictsIspell " |