about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/cmake
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-01 20:08:43 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-01 20:08:43 +0200
commit553abf71ba454a724d072a650a9cb09e360b375a (patch)
tree7f483e613f6ef62f9e3dbf51ba930e80f7cf813d /pkgs/development/tools/build-managers/cmake
parent592d4af9cf0e81907919cf954c1d0ad3089ae772 (diff)
parent3aee39bb83337b586d0be702eb5dababc5f7ef29 (diff)
downloadnixlib-553abf71ba454a724d072a650a9cb09e360b375a.tar
nixlib-553abf71ba454a724d072a650a9cb09e360b375a.tar.gz
nixlib-553abf71ba454a724d072a650a9cb09e360b375a.tar.bz2
nixlib-553abf71ba454a724d072a650a9cb09e360b375a.tar.lz
nixlib-553abf71ba454a724d072a650a9cb09e360b375a.tar.xz
nixlib-553abf71ba454a724d072a650a9cb09e360b375a.tar.zst
nixlib-553abf71ba454a724d072a650a9cb09e360b375a.zip
Merge remote-tracking branch 'origin/staging' into gcc-4.9
Conflicts:
	pkgs/build-support/cc-wrapper/default.nix
	pkgs/development/libraries/wayland/default.nix
	pkgs/development/tools/build-managers/cmake/default.nix
	pkgs/top-level/all-packages.nix
Diffstat (limited to 'pkgs/development/tools/build-managers/cmake')
-rw-r--r--pkgs/development/tools/build-managers/cmake/2.8.11-cygwin.patch237
-rw-r--r--pkgs/development/tools/build-managers/cmake/2.8.nix73
-rw-r--r--pkgs/development/tools/build-managers/cmake/default.nix12
-rw-r--r--pkgs/development/tools/build-managers/cmake/search-path.patch97
4 files changed, 413 insertions, 6 deletions
diff --git a/pkgs/development/tools/build-managers/cmake/2.8.11-cygwin.patch b/pkgs/development/tools/build-managers/cmake/2.8.11-cygwin.patch
new file mode 100644
index 000000000000..e16dab32632f
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cmake/2.8.11-cygwin.patch
@@ -0,0 +1,237 @@
+--- cmake-2.8.10/Source/cmFileCommand.cxx	2012-10-31 10:32:06.000000000 -0500
++++ cmake-2.8.10/Source/cmFileCommand.cxx	2013-03-16 22:55:11.306681100 -0500
+@@ -1002,7 +1002,7 @@ protected:
+   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-2.8.10/Source/cmInstallCommand.cxx	2012-10-31 10:32:06.000000000 -0500
++++ cmake-2.8.10/Source/cmInstallCommand.cxx	2013-03-16 22:56:21.008667800 -0500
+@@ -1090,7 +1090,7 @@ cmInstallCommand::HandleDirectoryMode(st
+       {
+       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-2.8.10/Source/kwsys/Glob.cxx	2012-10-31 10:32:06.000000000 -0500
++++ cmake-2.8.10/Source/kwsys/Glob.cxx	2013-03-16 22:58:54.192429400 -0500
+@@ -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-2.8.11/Source/kwsys/SystemInformation.cxx	2013-05-15 12:38:13.000000000 -0500
++++ cmake-2.8.11/Source/kwsys/SystemInformation.cxx	2013-07-08 01:57:31.216321800 -0500
+@@ -888,7 +888,7 @@ void SystemInformation::RunMemoryCheck()
+ // 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)
+@@ -918,7 +918,7 @@ int LoadLines(
+   return nRead;
+ }
+ 
+-# if defined(__linux)
++# if defined(__linux) || defined(__CYGWIN__)
+ // *****************************************************************************
+ int LoadLines(
+       const char *fileName,
+@@ -957,7 +957,7 @@ int NameValue(
+ }
+ #endif
+ 
+-#if defined(__linux)
++#if defined(__linux) || defined(__CYGWIN__)
+ // ****************************************************************************
+ template<typename T>
+ int GetFieldsFromFile(
+@@ -2869,7 +2869,6 @@ bool SystemInformationImplementation::Re
+     pos = buffer.find("processor\t",pos+1);
+     }
+ 
+-#ifdef __linux
+   // Find the largest physical id.
+   int maxId = -1;
+   kwsys_stl::string idc =
+@@ -2893,14 +2892,6 @@ bool SystemInformationImplementation::Re
+   this->NumberOfPhysicalCPU=static_cast<unsigned int>(
+     numberOfCoresPerCPU*(maxId+1));
+ 
+-#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)
+@@ -3086,7 +3077,7 @@ SystemInformationImplementation::GetHost
+   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)
+@@ -3217,7 +3208,7 @@ SystemInformationImplementation::GetHost
+   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);
+@@ -3276,7 +3267,7 @@ SystemInformationImplementation::GetProc
+     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)
+@@ -3328,7 +3319,7 @@ SystemInformationImplementation::GetProc
+ {
+ #if defined(_WIN32)
+   return GetCurrentProcessId();
+-#elif defined(__linux) || defined(__APPLE__)
++#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
+   return getpid();
+ #else
+   return -1;
+--- cmake-2.8.10/Source/kwsys/SystemTools.cxx	2012-10-31 10:32:06.000000000 -0500
++++ cmake-2.8.10/Source/kwsys/SystemTools.cxx	2013-03-16 22:52:11.830415600 -0500
+@@ -75,19 +75,12 @@
+ // Windows API.
+ #if defined(_WIN32)
+ # include <windows.h>
+-#elif defined (__CYGWIN__)
+-# include <windows.h>
+-# undef _WIN32
+ #endif
+ 
+ #if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
+ extern char **environ;
+ #endif
+ 
+-#ifdef __CYGWIN__
+-extern "C" void cygwin_conv_to_win32_path(const char *path, char *win32_path);
+-#endif
+-
+ // getpwnam doesn't exist on Windows and Cray Xt3/Catamount
+ // same for TIOCGWINSZ
+ #if defined(_WIN32) || defined (__LIBCATAMOUNT__)
+@@ -1068,7 +1061,7 @@ bool SystemTools::SameFile(const char* f
+ }
+ 
+ //----------------------------------------------------------------------------
+-#if defined(_WIN32) || defined(__CYGWIN__)
++#if defined(_WIN32)
+ static bool WindowsFileExists(const char* filename)
+ {
+   WIN32_FILE_ATTRIBUTE_DATA fd;
+@@ -1083,7 +1076,7 @@ bool SystemTools::FileExists(const char*
+     {
+     return false;
+     }
+-#if defined(__CYGWIN__)
++#if 0
+   // Convert filename to native windows path if possible.
+   char winpath[MAX_PATH];
+   if(SystemTools::PathCygwinToWin32(filename, winpath))
+@@ -1111,7 +1104,7 @@ bool SystemTools::FileExists(const char*
+ }
+ 
+ //----------------------------------------------------------------------------
+-#ifdef __CYGWIN__
++#if 0
+ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
+ {
+   SystemToolsTranslationMap::iterator i =
+@@ -3894,7 +3887,7 @@ bool SystemTools::LocateFileInDir(const
+ bool SystemTools::FileIsFullPath(const char* in_name)
+ {
+   kwsys_stl::string name = in_name;
+-#if defined(_WIN32) || defined(__CYGWIN__)
++#if defined(_WIN32)
+   // On Windows, the name must be at least two characters long.
+   if(name.length() < 2)
+     {
+@@ -4712,9 +4705,6 @@ bool SystemTools::ParseURL( const kwsys_
+ 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
+@@ -4760,9 +4750,6 @@ void SystemTools::ClassInitialize()
+   // 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,
+@@ -4817,9 +4804,6 @@ void SystemTools::ClassFinalize()
+ {
+   delete SystemTools::TranslationMap;
+   delete SystemTools::LongPathMap;
+-#ifdef __CYGWIN__
+-  delete SystemTools::Cyg2Win32Map;
+-#endif
+ }
+ 
+ 
+--- cmake-2.8.10/Source/kwsys/SystemTools.hxx.in	2012-10-31 10:32:06.000000000 -0500
++++ cmake-2.8.10/Source/kwsys/SystemTools.hxx.in	2013-03-16 23:10:30.185237900 -0500
+@@ -277,15 +277,6 @@ public:
+   static bool FileExists(const char* 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 char *filename);
+@@ -887,9 +878,6 @@ private:
+    */
+   static SystemToolsTranslationMap *TranslationMap;
+   static SystemToolsTranslationMap *LongPathMap;
+-#ifdef __CYGWIN__
+-  static SystemToolsTranslationMap *Cyg2Win32Map;
+-#endif
+   friend class SystemToolsManager;
+ };
+ 
diff --git a/pkgs/development/tools/build-managers/cmake/2.8.nix b/pkgs/development/tools/build-managers/cmake/2.8.nix
new file mode 100644
index 000000000000..60a941a66375
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cmake/2.8.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchurl, fetchpatch, replace, curl, expat, zlib, bzip2, libarchive
+, useNcurses ? false, ncurses, useQt4 ? false, qt4, wantPS ? false, ps ? null
+}:
+
+with stdenv.lib;
+
+assert wantPS -> (ps != null);
+
+let
+  os = stdenv.lib.optionalString;
+  majorVersion = "2.8";
+  minorVersion = "12.2";
+  version = "${majorVersion}.${minorVersion}";
+in
+
+stdenv.mkDerivation rec {
+  name = "cmake-${os useNcurses "cursesUI-"}${os useQt4 "qt4UI-"}${version}";
+
+  inherit majorVersion;
+
+  src = fetchurl {
+    url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz";
+    sha256 = "0phf295a9cby0v7zqdswr238v5aiy3rb2fs6dz39zjxbmzlp8rcc";
+  };
+
+  enableParallelBuilding = true;
+
+  patches =
+    [(fetchpatch { # see http://www.cmake.org/Bug/view.php?id=13959
+      name = "FindFreetype-2.5.patch";
+      url = "http://www.cmake.org/Bug/file_download.php?file_id=4660&type=bug";
+      sha256 = "136z63ff83hnwd247cq4m8m8164pklzyl5i2csf5h6wd8p01pdkj";
+    })] ++
+    # Don't search in non-Nix locations such as /usr, but do search in
+    # Nixpkgs' Glibc. 
+    optional (stdenv ? glibc) ./search-path.patch ++
+    optional (stdenv ? cross) (fetchurl {
+      name = "fix-darwin-cross-compile.patch";
+      url = "http://public.kitware.com/Bug/file_download.php?"
+          + "file_id=4981&type=bug";
+      sha256 = "16acmdr27adma7gs9rs0dxdiqppm15vl3vv3agy7y8s94wyh4ybv";
+    });
+
+  buildInputs = [ curl expat zlib bzip2 libarchive ]
+    ++ optional useNcurses ncurses
+    ++ optional useQt4 qt4;
+
+  propagatedBuildInputs = optional wantPS ps;
+
+  CMAKE_PREFIX_PATH = stdenv.lib.concatStringsSep ":" buildInputs;
+  
+  configureFlags =
+    "--docdir=/share/doc/${name} --mandir=/share/man --system-libs"
+    + stdenv.lib.optionalString useQt4 " --qt-gui";
+
+  setupHook = ./setup-hook.sh;
+
+  dontUseCmakeConfigure = true;
+
+  preConfigure = optionalString (stdenv ? glibc)
+    ''
+      source $setupHook
+      fixCmakeFiles .
+      substituteInPlace Modules/Platform/UnixPaths.cmake --subst-var-by glibc ${stdenv.glibc}
+    '';
+
+  meta = {
+    homepage = http://www.cmake.org/;
+    description = "Cross-Platform Makefile Generator";
+    platforms = if useQt4 then qt4.meta.platforms else stdenv.lib.platforms.all;
+    maintainers = with stdenv.lib.maintainers; [ urkud mornfall ];
+  };
+}
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index 77863c4532d0..02847c749bff 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
       url = "http://public.kitware.com/Bug/file_download.php?"
           + "file_id=4981&type=bug";
       sha256 = "16acmdr27adma7gs9rs0dxdiqppm15vl3vv3agy7y8s94wyh4ybv";
-    });
+    }) ++ stdenv.lib.optional stdenv.isCygwin ./2.8.11-cygwin.patch;
 
   buildInputs =
     [ bzip2 curl expat libarchive xz zlib ]
@@ -48,13 +48,13 @@ stdenv.mkDerivation rec {
   CMAKE_PREFIX_PATH = stdenv.lib.concatStringsSep ":" buildInputs;
 
   configureFlags =
-    [
-      "--docdir=/share/doc/${name}"
+    [ "--docdir=/share/doc/${name}"
       "--mandir=/share/man"
-      "--system-libs"
       "--no-system-jsoncpp"
-    ]
-    ++ optional useQt4 "--qt-gui";
+    ++ optional (!stdenv.isCygwin) "--system-libs"
+    ++ optional useQt4 "--qt-gui"
+    ++ ["--"]
+    ++ optional (!useNcurses) "-DBUILD_CursesDialog=OFF";
 
   setupHook = ./setup-hook.sh;
 
diff --git a/pkgs/development/tools/build-managers/cmake/search-path.patch b/pkgs/development/tools/build-managers/cmake/search-path.patch
new file mode 100644
index 000000000000..31c85d6f5220
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cmake/search-path.patch
@@ -0,0 +1,97 @@
+diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
+index fe8e003..378512c 100644
+--- a/Modules/Platform/Linux.cmake
++++ b/Modules/Platform/Linux.cmake
+@@ -36,13 +36,13 @@ else()
+   # checking the platform every time.  This option is advanced enough
+   # that only package maintainers should need to adjust it.  They are
+   # capable of providing a setting on the command line.
+-  if(EXISTS "/etc/debian_version")
+-    set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
+-      "Install .so files without execute permission.")
+-  else()
++  # if(EXISTS "/etc/debian_version")
++  #   set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
++  #     "Install .so files without execute permission.")
++  # else()
+     set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
+       "Install .so files without execute permission.")
+-  endif()
++  # endif()
+ endif()
+ 
+ # Match multiarch library directory names.
+@@ -52,6 +52,6 @@ include(Platform/UnixPaths)
+ 
+ # Debian has lib64 paths only for compatibility so they should not be
+ # searched.
+-if(EXISTS "/etc/debian_version")
+-  set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+-endif()
++# if(EXISTS "/etc/debian_version")
++#  set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
++#endif()
+diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
+index ccb2663..39834e6 100644
+--- a/Modules/Platform/UnixPaths.cmake
++++ b/Modules/Platform/UnixPaths.cmake
+@@ -33,55 +33,18 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
+ # search types.
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+   # Standard
+-  /usr/local /usr /
+-
+-  # CMake install location
+-  "${_CMAKE_INSTALL_DIR}"
+-
+-  # Project install destination.
+-  "${CMAKE_INSTALL_PREFIX}"
+-  )
+-
+-# List common include file locations not under the common prefixes.
+-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+-  # Windows API on Cygwin
+-  /usr/include/w32api
+-
+-  # X11
+-  /usr/X11R6/include /usr/include/X11
+-
+-  # Other
+-  /usr/pkg/include
+-  /opt/csw/include /opt/include
+-  /usr/openwin/include
+-  )
+-
+-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+-  # Windows API on Cygwin
+-  /usr/lib/w32api
+-
+-  # X11
+-  /usr/X11R6/lib /usr/lib/X11
+-
+-  # Other
+-  /usr/pkg/lib
+-  /opt/csw/lib /opt/lib
+-  /usr/openwin/lib
+-  )
+-
+-list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
+-  /usr/pkg/bin
++  "@glibc@"
+   )
+ 
+ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+-  /lib /usr/lib /usr/lib32 /usr/lib64
++  "@glibc@/lib"
+   )
+ 
+ list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
+-  /usr/include
++  "@glibc@/include"
+   )
+ list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
+-  /usr/include
++  "@glibc@/include"
+   )
+ 
+ # Enable use of lib64 search path variants by default.