Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / by-name / cm / cmake / 004-cygwin.diff
blob982aba17e874d59ada14a316ad0fc003328a1272
1 --- cmake-3.2.2/Source/cmFileCommand.cxx 2015-04-13 19:09:00.000000000 +0200
2 +++ cmake-3.2.2/Source/ccmFileCommand.cxx 2015-06-10 11:02:27.345598700 +0200
3 @@ -1179,7 +1179,7 @@
4 MatchProperties CollectMatchProperties(const char* file)
6 // Match rules are case-insensitive on some platforms.
7 -#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
8 +#if defined(_WIN32) || defined(__APPLE__)
9 std::string lower = cmSystemTools::LowerCase(file);
10 const char* file_to_match = lower.c_str();
11 #else
12 --- cmake-3.2.2/Source/cmInstallCommand.cxx 2015-04-13 19:09:00.000000000 +0200
13 +++ cmake-3.2.2/Source/cmInstallCommand.cxx 2015-06-10 11:04:19.257935200 +0200
14 @@ -1138,7 +1138,7 @@
16 literal_args += " REGEX \"";
17 // Match rules are case-insensitive on some platforms.
18 -#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
19 +#if defined(_WIN32) || defined(__APPLE__)
20 std::string regex = cmSystemTools::LowerCase(args[i]);
21 #else
22 std::string regex = args[i];
23 --- cmake-3.2.2/Source/kwsys/Glob.cxx 2015-04-13 19:09:00.000000000 +0200
24 +++ cmake-3.2.2/Source/kwsys/Glob.cxx 2015-06-10 11:05:51.602674000 +0200
25 @@ -37,7 +37,7 @@
26 #include <string.h>
27 namespace KWSYS_NAMESPACE
29 -#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
30 +#if defined(_WIN32) || defined(__APPLE__)
31 // On Windows and apple, no difference between lower and upper case
32 # define KWSYS_GLOB_CASE_INDEPENDENT
33 #endif
34 --- cmake-3.2.2/Source/kwsys/SystemInformation.cxx 2015-04-13 19:09:00.000000000 +0200
35 +++ cmake-3.2.2/Source/kwsys/SystemInformation.cxx 2015-06-10 11:13:00.308303500 +0200
36 @@ -911,7 +911,7 @@
37 // Hide implementation details in an anonymous namespace.
38 namespace {
39 // *****************************************************************************
40 -#if defined(__linux) || defined(__APPLE__)
41 +#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
42 int LoadLines(
43 FILE *file,
44 kwsys_stl::vector<kwsys_stl::string> &lines)
45 @@ -947,7 +947,7 @@
46 return nRead;
49 -# if defined(__linux)
50 +# if defined(__linux) || defined(__CYGWIN__)
51 // *****************************************************************************
52 int LoadLines(
53 const char *fileName,
54 @@ -986,7 +986,7 @@
56 #endif
58 -#if defined(__linux)
59 +#if defined(__linux) || defined(__CYGWIN__)
60 // ****************************************************************************
61 template<typename T>
62 int GetFieldsFromFile(
63 @@ -3132,7 +3132,6 @@
64 pos = buffer.find("processor\t",pos+1);
67 -#ifdef __linux
68 // Find the largest physical id.
69 int maxId = -1;
70 kwsys_stl::string idc =
71 @@ -3165,14 +3164,6 @@
72 atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str());
75 -#else // __CYGWIN__
76 - // does not have "physical id" entries, neither "cpu cores"
77 - // this has to be fixed for hyper-threading.
78 - kwsys_stl::string cpucount =
79 - this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
80 - this->NumberOfPhysicalCPU=
81 - this->NumberOfLogicalCPU = atoi(cpucount.c_str());
82 -#endif
83 // gotta have one, and if this is 0 then we get a / by 0n
84 // better to have a bad answer than a crash
85 if(this->NumberOfPhysicalCPU <= 0)
86 @@ -3370,7 +3361,7 @@
87 GlobalMemoryStatusEx(&statex);
88 return statex.ullTotalPhys/1024;
89 # endif
90 -#elif defined(__linux)
91 +#elif defined(__linux) || defined(__CYGWIN__)
92 SystemInformation::LongLong memTotal=0;
93 int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal);
94 if (ierr)
95 @@ -3501,7 +3492,7 @@
96 GlobalMemoryStatusEx(&statex);
97 return (statex.ullTotalPhys - statex.ullAvailPhys)/1024;
98 # endif
99 -#elif defined(__linux)
100 +#elif defined(__linux) || defined(__CYGWIN__)
101 const char *names[3]={"MemTotal:","MemFree:",NULL};
102 SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)};
103 int ierr=GetFieldsFromFile("/proc/meminfo",names,values);
104 @@ -3560,7 +3551,7 @@
105 return -2;
107 return pmc.WorkingSetSize/1024;
108 -#elif defined(__linux)
109 +#elif defined(__linux) || defined(__CYGWIN__)
110 SystemInformation::LongLong memUsed=0;
111 int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed);
112 if (ierr)
113 @@ -3612,7 +3603,7 @@
115 #if defined(_WIN32)
116 return GetCurrentProcessId();
117 -#elif defined(__linux) || defined(__APPLE__)
118 +#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
119 return getpid();
120 #else
121 return -1;
122 --- cmake-3.2.2/Source/kwsys/SystemTools.cxx 2015-04-13 19:09:00.000000000 +0200
123 +++ cmake-3.2.2/Source/kwsys/SystemTools.cxx 2015-06-10 11:21:58.980443200 +0200
124 @@ -93,19 +93,12 @@
125 # if defined(_MSC_VER) && _MSC_VER >= 1800
126 # define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
127 # endif
128 -#elif defined (__CYGWIN__)
129 -# include <windows.h>
130 -# undef _WIN32
131 #endif
133 #if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
134 extern char **environ;
135 #endif
137 -#ifdef __CYGWIN__
138 -# include <sys/cygwin.h>
139 -#endif
141 // getpwnam doesn't exist on Windows and Cray Xt3/Catamount
142 // same for TIOCGWINSZ
143 #if defined(_WIN32) || defined (__LIBCATAMOUNT__)
144 @@ -1148,15 +1141,7 @@
146 return false;
148 -#if defined(__CYGWIN__)
149 - // Convert filename to native windows path if possible.
150 - char winpath[MAX_PATH];
151 - if(SystemTools::PathCygwinToWin32(filename.c_str(), winpath))
153 - return (GetFileAttributesA(winpath) != INVALID_FILE_ATTRIBUTES);
155 - return access(filename.c_str(), R_OK) == 0;
156 -#elif defined(_WIN32)
157 +#if defined(_WIN32)
158 return (GetFileAttributesW(
159 SystemTools::ConvertToWindowsExtendedPath(filename).c_str())
160 != INVALID_FILE_ATTRIBUTES);
161 @@ -1190,28 +1175,6 @@
164 //----------------------------------------------------------------------------
165 -#ifdef __CYGWIN__
166 -bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
168 - SystemToolsTranslationMap::iterator i =
169 - SystemTools::Cyg2Win32Map->find(path);
171 - if (i != SystemTools::Cyg2Win32Map->end())
173 - strncpy(win32_path, i->second.c_str(), MAX_PATH);
175 - else
177 - if(cygwin_conv_path(CCP_POSIX_TO_WIN_A, path, win32_path, MAX_PATH) != 0)
179 - win32_path[0] = 0;
181 - SystemToolsTranslationMap::value_type entry(path, win32_path);
182 - SystemTools::Cyg2Win32Map->insert(entry);
184 - return win32_path[0] != 0;
186 -#endif
188 bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
190 @@ -4307,7 +4270,7 @@
192 bool SystemTools::FileIsFullPath(const char* in_name, size_t len)
194 -#if defined(_WIN32) || defined(__CYGWIN__)
195 +#if defined(_WIN32)
196 // On Windows, the name must be at least two characters long.
197 if(len < 2)
199 @@ -5078,9 +5041,6 @@
200 static unsigned int SystemToolsManagerCount;
201 SystemToolsTranslationMap *SystemTools::TranslationMap;
202 SystemToolsTranslationMap *SystemTools::LongPathMap;
203 -#ifdef __CYGWIN__
204 -SystemToolsTranslationMap *SystemTools::Cyg2Win32Map;
205 -#endif
207 // SystemToolsManager manages the SystemTools singleton.
208 // SystemToolsManager should be included in any translation unit
209 @@ -5126,9 +5086,6 @@
210 // Allocate the translation map first.
211 SystemTools::TranslationMap = new SystemToolsTranslationMap;
212 SystemTools::LongPathMap = new SystemToolsTranslationMap;
213 -#ifdef __CYGWIN__
214 - SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap;
215 -#endif
217 // Add some special translation paths for unix. These are not added
218 // for windows because drive letters need to be maintained. Also,
219 @@ -5183,9 +5140,6 @@
221 delete SystemTools::TranslationMap;
222 delete SystemTools::LongPathMap;
223 -#ifdef __CYGWIN__
224 - delete SystemTools::Cyg2Win32Map;
225 -#endif
229 --- cmake-3.2.2/Source/kwsys/SystemTools.hxx.in 2015-04-13 19:09:00.000000000 +0200
230 +++ cmake-3.2.2/Source/kwsys/SystemTools.hxx.in 2015-06-10 11:24:24.271286600 +0200
231 @@ -298,15 +298,6 @@
232 static bool FileExists(const kwsys_stl::string& filename);
235 - * Converts Cygwin path to Win32 path. Uses dictionary container for
236 - * caching and calls to cygwin_conv_to_win32_path from Cygwin dll
237 - * for actual translation. Returns true on success, else false.
238 - */
239 -#ifdef __CYGWIN__
240 - static bool PathCygwinToWin32(const char *path, char *win32_path);
241 -#endif
243 - /**
244 * Return file length
246 static unsigned long FileLength(const kwsys_stl::string& filename);
247 @@ -942,9 +933,6 @@
249 static SystemToolsTranslationMap *TranslationMap;
250 static SystemToolsTranslationMap *LongPathMap;
251 -#ifdef __CYGWIN__
252 - static SystemToolsTranslationMap *Cyg2Win32Map;
253 -#endif
254 friend class SystemToolsManager;
257 --- cmake-3.2.2/Modules/FindCurses.cmake 2015-04-13 19:09:00.000000000 +0200
258 +++ cmake-3.2.2/Modules/FindCurses.cmake 2015-06-10 12:10:19.682030300 +0200
259 @@ -60,15 +60,6 @@
260 if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
261 set(CURSES_USE_NCURSES TRUE)
262 endif()
263 -# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
264 -# cygwin ncurses stopped providing curses.h symlinks see above
265 -# message. Cygwin is an ncurses package, so force ncurses on
266 -# cygwin if the curses.h is missing
267 -if(CYGWIN)
268 - if(NOT EXISTS /usr/include/curses.h)
269 - set(CURSES_USE_NCURSES TRUE)
270 - endif()
271 -endif()
274 # Not sure the logic is correct here.