diff options
Diffstat (limited to 'meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch')
-rw-r--r-- | meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch b/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch deleted file mode 100644 index 5e83e92725..0000000000 --- a/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | From b88a98348b3841f0b702e314631883d46f9f362d Mon Sep 17 00:00:00 2001 | ||
2 | From: "NODA, Kai" <nodakai@gmail.com> | ||
3 | Date: Sun, 22 Apr 2012 17:01:02 +0900 | ||
4 | Subject: [PATCH] Use /proc/self/exe for "swig -swiglib" on non-Win32 | ||
5 | platforms. | ||
6 | |||
7 | If it wasn't found, then fall back to a fixed string just as before. | ||
8 | |||
9 | Upstream-Status: Submitted | ||
10 | http://sourceforge.net/mailarchive/message.php?msg_id=29179733 | ||
11 | --- | ||
12 | Source/Modules/main.cxx | 24 ++++++++++++++++++++++-- | ||
13 | 1 file changed, 22 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx | ||
16 | index 76b4f9d..de0a512 100644 | ||
17 | --- a/Source/Modules/main.cxx | ||
18 | +++ b/Source/Modules/main.cxx | ||
19 | @@ -25,6 +25,11 @@ | ||
20 | #include <ctype.h> | ||
21 | #include <errno.h> | ||
22 | #include <limits.h> // for INT_MAX | ||
23 | +#ifndef _WIN32 | ||
24 | +#include <cstddef> | ||
25 | +#include <unistd.h> // for readlink | ||
26 | +#include <sys/stat.h> // for stat | ||
27 | +#endif | ||
28 | |||
29 | // Global variables | ||
30 | |||
31 | @@ -895,9 +900,9 @@ int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) { | ||
32 | |||
33 | // Check for SWIG_LIB environment variable | ||
34 | if ((c = getenv("SWIG_LIB")) == (char *) 0) { | ||
35 | + char *p; | ||
36 | #if defined(_WIN32) | ||
37 | char buf[MAX_PATH]; | ||
38 | - char *p; | ||
39 | if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) { | ||
40 | *(p + 1) = '\0'; | ||
41 | SwigLib = NewStringf("%sLib", buf); // Native windows installation path | ||
42 | @@ -907,7 +912,22 @@ int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) { | ||
43 | if (Len(SWIG_LIB_WIN_UNIX) > 0) | ||
44 | SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw) | ||
45 | #else | ||
46 | - SwigLib = NewString(SWIG_LIB); | ||
47 | + char buf[PATH_MAX]; | ||
48 | + if (0 < ::readlink("/proc/self/exe", buf, sizeof(buf)) && | ||
49 | + (p = ::strstr(buf, "/bin/swig"))) { | ||
50 | + int major, minor, patch; | ||
51 | + const int ret = ::sscanf(VERSION, "%d.%d.%d", &major, &minor, &patch); | ||
52 | + if (3 == ret) { | ||
53 | + const ::ptrdiff_t dir_part_len = p - buf; | ||
54 | + ::snprintf(p, PATH_MAX - dir_part_len, "/share/swig/%d.%d.%d", major, minor, patch); | ||
55 | + struct ::stat stat_res; | ||
56 | + if (0 == ::stat(buf, &stat_res) && S_ISDIR(stat_res.st_mode)) { | ||
57 | + SwigLib = NewString(buf); | ||
58 | + } | ||
59 | + } | ||
60 | + } | ||
61 | + if (NULL == SwigLib) | ||
62 | + SwigLib = NewString(SWIG_LIB); | ||
63 | #endif | ||
64 | } else { | ||
65 | SwigLib = NewString(c); | ||