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