Browse Source

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>
pull/25/head
Slávek Banko 2 months ago
parent
commit
8a859540c3
Signed by: Slávek Banko <slavek.banko@axis.cz> GPG Key ID: 608F5293A04BE668

+ 12
- 0
CMakeLists.txt View File

@@ -141,6 +141,18 @@ if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
141 141
 endif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
142 142
 
143 143
 
144
+##### get the system's default path for libraries
145
+
146
+tde_save_and_set( CMAKE_INSTALL_PREFIX "/usr" )
147
+include( GNUInstallDirs OPTIONAL )
148
+if( CMAKE_INSTALL_LIBDIR )
149
+  set( SYSTEM_LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
150
+else( )
151
+  set( SYSTEM_LIBDIR "lib${LIB_SUFFIX}" )
152
+endif( )
153
+tde_restore( CMAKE_INSTALL_PREFIX )
154
+
155
+
144 156
 ##### check for compiler capabilities ###########
145 157
 
146 158
 include( CheckCXXCompilerFlag )

+ 1
- 0
config.h.cmake View File

@@ -790,6 +790,7 @@
790 790
 
791 791
 /* Suffix for lib directories */
792 792
 #define KDELIBSUFF "@KDELIBSUFF@"
793
+#define SYSTEM_LIBDIR "@SYSTEM_LIBDIR@"
793 794
 
794 795
 /* The compiled in system configuration prefix */
795 796
 #define KDESYSCONFDIR "@CONFIG_INSTALL_DIR@"

+ 4
- 4
tdecore/ksocks.cpp View File

@@ -254,13 +254,13 @@ KSocks::KSocks(TDEConfigBase *config) : _socksLib(0L), _st(0L) {
254 254
       return;
255 255
 
256 256
    _libPaths << ""
257
-	     << "/usr/lib" KDELIBSUFF "/"
257
+	     << "/usr/" SYSTEM_LIBDIR "/"
258 258
              << "/usr/lib/"
259
-	     << "/usr/local/lib" KDELIBSUFF "/"
259
+	     << "/usr/local/" SYSTEM_LIBDIR "/"
260 260
              << "/usr/local/lib/"
261
-	     << "/usr/local/socks5/lib" KDELIBSUFF "/"
261
+	     << "/usr/local/socks5/" SYSTEM_LIBDIR "/"
262 262
              << "/usr/local/socks5/lib/"
263
-	     << "/opt/socks5/lib" KDELIBSUFF "/"
263
+	     << "/opt/socks5/" SYSTEM_LIBDIR "/"
264 264
              << "/opt/socks5/lib/";
265 265
    _libNames << "libsocks.so"                  // Dante
266 266
              << "libdsocksd.so.0"              // Dante 1.1.14-2 on

+ 8
- 33
tdeio/kssl/kopenssl.cc View File

@@ -28,7 +28,6 @@
28 28
 #include <tdeconfig.h>
29 29
 #include <kstaticdeleter.h>
30 30
 #include <tqregexp.h>
31
-#include <tqdir.h>
32 31
 
33 32
 #include <stdio.h>
34 33
 #include <unistd.h>
@@ -324,7 +323,7 @@ TDEConfig *cfg;
324 323
 
325 324
 #ifdef __OpenBSD__
326 325
    {
327
-   TQString libname = findMostRecentLib("/usr/lib" KDELIBSUFF, "crypto");
326
+   TQString libname = findMostRecentLib("/usr/" SYSTEM_LIBDIR, "crypto");
328 327
    if (!libname.isNull())
329 328
          _cryptoLib = ll->globalLibrary(libname.latin1());
330 329
    }
@@ -349,13 +348,13 @@ TDEConfig *cfg;
349 348
             #ifdef _AIX
350 349
             << "/opt/freeware/lib/"
351 350
 	    #endif
352
-	    << "/usr/lib" KDELIBSUFF "/"
353
-	    << "/usr/ssl/lib" KDELIBSUFF "/"
354
-	    << "/usr/local/lib" KDELIBSUFF "/"
355
-            << "/usr/local/openssl/lib" KDELIBSUFF "/"
356
-            << "/usr/local/ssl/lib" KDELIBSUFF "/"
357
-	    << "/opt/openssl/lib" KDELIBSUFF "/"
358
-	    << "/lib" KDELIBSUFF "/"
351
+	    << "/usr/" SYSTEM_LIBDIR "/"
352
+	    << "/usr/ssl/" SYSTEM_LIBDIR "/"
353
+	    << "/usr/local/" SYSTEM_LIBDIR "/"
354
+	    << "/usr/local/openssl/" SYSTEM_LIBDIR "/"
355
+	    << "/usr/local/ssl/" SYSTEM_LIBDIR "/"
356
+	    << "/opt/openssl/" SYSTEM_LIBDIR "/"
357
+	    << "/" SYSTEM_LIBDIR "/"
359 358
             << "";
360 359
 
361 360
 // FIXME: #define here for the various OS types to optimize
@@ -408,18 +407,6 @@ TDEConfig *cfg;
408 407
 	 tmpStr.replace(TQRegExp("\\(.*\\)"), "");
409 408
 	 if (!access(tmpStr.latin1(), R_OK))
410 409
             _cryptoLib = ll->globalLibrary(alib.latin1());
411
-         if (!_cryptoLib) {
412
-           // Multiarch triplet search
413
-           TQDir madir (*it);
414
-           TQStringList multiarchdirs = madir.entryList("*-*-*", TQDir::Dirs);
415
-           for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) {
416
-             TQString malib = *it + *mait + "/" + *shit;
417
-             TQString tmpStr(malib.latin1());
418
-             tmpStr.replace(TQRegExp("\\(.*\\)"), "");
419
-             if (!access(tmpStr.latin1(), R_OK))
420
-               _cryptoLib = ll->globalLibrary(malib.latin1());
421
-           }
422
-         }
423 410
          if (_cryptoLib) break;
424 411
       }
425 412
       if (_cryptoLib) break;
@@ -611,18 +598,6 @@ TDEConfig *cfg;
611 598
 	 tmpStr.replace(TQRegExp("\\(.*\\)"), "");
612 599
 	 if (!access(tmpStr.latin1(), R_OK))
613 600
          	_sslLib = ll->globalLibrary(alib.latin1());
614
-         if (!_sslLib) {
615
-           // Multiarch triplet search
616
-           TQDir madir (*it);
617
-           TQStringList multiarchdirs = madir.entryList("*-*-*", TQDir::Dirs);
618
-           for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) {
619
-             TQString malib = *it + *mait + "/" + *shit;
620
-             TQString tmpStr(malib.latin1());
621
-             tmpStr.replace(TQRegExp("\\(.*\\)"), "");
622
-             if (!access(tmpStr.latin1(), R_OK))
623
-               _sslLib = ll->globalLibrary(malib.latin1());
624
-           }
625
-         }
626 601
          if (_sslLib) break;
627 602
       }
628 603
       if (_sslLib) break;

+ 9
- 4
tdeprint/cups/cupsdconf2/cupsdconf.cpp View File

@@ -71,10 +71,15 @@ CupsdConf::CupsdConf()
71 71
 	//fontpath_ << (datadir_+"/fonts");
72 72
 	requestdir_ = findDir(TQStringList("/var/spool/cups")
73 73
 			<< "/var/cups");
74
-	serverbin_ = findDir(TQStringList("/usr/lib" KDELIBSUFF "/cups")
75
-			<< "/usr/local/lib" KDELIBSUFF "/cups"
76
-			<< "/opt/lib" KDELIBSUFF "/cups"
77
-			<< "/opt/local/lib" KDELIBSUFF "/cups");
74
+	serverbin_ = findDir(TQStringList()
75
+			<< "/usr/" SYSTEM_LIBDIR "/cups"
76
+			<< "/usr/lib/cups"
77
+			<< "/usr/local/" SYSTEM_LIBDIR "/cups"
78
+			<< "/usr/local/lib/cups"
79
+			<< "/opt/" SYSTEM_LIBDIR "/cups"
80
+			<< "/opt/lib/cups"
81
+			<< "/opt/local/" SYSTEM_LIBDIR "/cups"
82
+			<< "/opt/local/lib/cups");
78 83
 	serverfiles_ = findDir(TQStringList("/etc/cups")
79 84
 			<< "/usr/local/etc/cups");
80 85
 	tmpfiles_ = requestdir_+"/tmp";

+ 1
- 0
tdespell2/plugins/ispell/CMakeLists.txt View File

@@ -12,6 +12,7 @@
12 12
 include_directories(
13 13
   ${TQT_INCLUDE_DIRS}
14 14
   ${CMAKE_CURRENT_BINARY_DIR}
15
+  ${CMAKE_BINARY_DIR}
15 16
   ${CMAKE_BINARY_DIR}/tdecore
16 17
   ${CMAKE_SOURCE_DIR}/tdespell2
17 18
   ${CMAKE_SOURCE_DIR}/tdecore

+ 4
- 0
tdespell2/plugins/ispell/ispell_checker.cpp View File

@@ -29,6 +29,8 @@
29 29
  * do so, delete this exception statement from your version.
30 30
  */
31 31
 
32
+#include <config.h>
33
+
32 34
 #include <stdio.h>
33 35
 #include <stdlib.h>
34 36
 #include <string.h>
@@ -53,7 +55,9 @@ typedef struct str_ispell_map
53 55
 } IspellMap;
54 56
 
55 57
 static const char *ispell_dirs [] = {
58
+	"/usr/" SYSTEM_LIBDIR "/ispell",
56 59
 	"/usr/lib/ispell",
60
+	"/usr/local/" SYSTEM_LIBDIR "/ispell",
57 61
 	"/usr/local/lib/ispell",
58 62
 	"/usr/local/share/ispell",
59 63
 	"/usr/share/ispell",

+ 17
- 12
tdeui/ksconfig.cpp View File

@@ -444,20 +444,25 @@ void KSpellConfig::getAvailDictsIspell () {
444 444
   dictcombo->insertItem( i18n("ISpell Default") );
445 445
 
446 446
   // dictionary path
447
-  TQFileInfo dir ("/usr/lib" KDELIBSUFF "/ispell");
448
-  if (!dir.exists() || !dir.isDir())
449
-    dir.setFile ("/usr/local/lib" KDELIBSUFF "/ispell");
450
-  if (!dir.exists() || !dir.isDir())
451
-    dir.setFile ("/usr/local/share/ispell");
452
-  if (!dir.exists() || !dir.isDir())
453
-    dir.setFile ("/usr/share/ispell");
454
-  if (!dir.exists() || !dir.isDir())
455
-    dir.setFile ("/usr/pkg/lib");
447
+  TQFileInfo dir;
448
+  TQStringList dirs;
449
+  dirs
450
+    << "/usr/" SYSTEM_LIBDIR "/ispell"
451
+    << "/usr/lib/ispell"
452
+    << "/usr/local/" SYSTEM_LIBDIR "/ispell"
453
+    << "/usr/local/lib/ispell"
454
+    << "/usr/local/share/ispell"
455
+    << "/usr/share/ispell"
456
+    << "/usr/pkg/lib";
457
+  for (TQStringList::ConstIterator it=dirs.begin(); it != dirs.end(); ++it) {
458
+    dir.setFile(*it);
459
+    if (dir.exists() && dir.isDir()) {
460
+      break;
461
+    }
462
+  }
456 463
   /* TODO get them all instead of just one of them.
457 464
    * If /usr/local/lib exists, it skips the rest
458
-  if (!dir.exists() || !dir.isDir())
459
-    dir.setFile ("/usr/local/lib");
460
-  */
465
+   */
461 466
   if (!dir.exists() || !dir.isDir()) return;
462 467
 
463 468
   kdDebug(750) << "KSpellConfig::getAvailDictsIspell "

Loading…
Cancel
Save