Switch to unified view

a b/packaging/macports/textproc/recoll/files/patch-rclaspell-dylib.diff
1
diff --git aspell/rclaspell.cpp aspell/rclaspell.cpp-new
2
index 698832df..4fd8b6b8 100644
3
--- aspell/rclaspell.cpp
4
 aspell/rclaspell.cpp-new
5
@@ -71,12 +71,16 @@ static std::mutex o_aapi_mutex;
6
  badnames += #NM + string(" ");                  \
7
     }
8
 
9
-static const char *aspell_lib_suffixes[] = {
10
-  ".so",
11
-  ".so.15",
12
-  ".so.16"
13
static const vector<string> aspell_lib_suffixes {
14
#if defined(__APPLE__) 
15
        ".15.dylib",
16
        ".dylib",
17
#else
18
        ".so",
19
        ".so.15",
20
        ".so.16",
21
#endif
22
 };
23
-static const unsigned int nlibsuffs  = sizeof(aspell_lib_suffixes) / sizeof(char *);
24
 
25
 // Stuff that we don't wish to see in the .h (possible sysdeps, etc.)
26
 class AspellData {
27
@@ -160,16 +164,39 @@ bool Aspell::init(string &reason)
28
  return false;
29
     }
30
 
31
32
    // Don't know what with Apple and (DY)LD_LIBRARY_PATH. Does not work
33
    // So we look in all ../lib in the PATH...
34
#if defined(__APPLE__) 
35
    vector<string> path;
36
    const char *pp = getenv("PATH");
37
    if (pp) {
38
        stringToTokens(pp, path, ":");
39
    }
40
#endif
41
    
42
     reason = "Could not open shared library ";
43
     string libbase("libaspell");
44
     string lib;
45
-    for (unsigned int i = 0; i < nlibsuffs; i++) {
46
-        lib = libbase + aspell_lib_suffixes[i];
47
    for (const auto& suff : aspell_lib_suffixes) {
48
        lib = libbase + suff;
49
         reason += string("[") + lib + "] ";
50
         if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) {
51
             reason.erase();
52
             goto found;
53
         }
54
#if defined(__APPLE__) 
55
        // Above was the normal lookup: let dlopen search the directories.
56
        // Here is for Apple. Also look at all ../lib along the PATH
57
        for (const auto& dir : path) {
58
            string lib1 = path_canon(dir + "/../lib/" + lib);
59
            if ((m_data->m_handle = dlopen(lib1.c_str(), RTLD_LAZY)) != 0) {
60
                reason.erase();
61
                lib=lib1;
62
                goto found;
63
            }
64
        }
65
#endif
66
     }
67
     
68
  found: