diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/build-managers/cmake')
8 files changed, 907 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/2.8.nix b/nixpkgs/pkgs/development/tools/build-managers/cmake/2.8.nix new file mode 100644 index 000000000000..ac438080b9ab --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/2.8.nix @@ -0,0 +1,88 @@ +{ stdenv, fetchurl, fetchpatch, curl, expat, zlib, bzip2 +, useNcurses ? false, ncurses, useQt4 ? false, qt4, ps +}: + +with stdenv.lib; + +assert stdenv ? cc; +assert stdenv.cc ? libc; + +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 https://www.cmake.org/Bug/view.php?id=13959 + name = "FindFreetype-2.5.patch"; + url = "https://public.kitware.com/Bug/file/4660/0001-Support-finding-freetype2-using-pkg-config.patch"; + sha256 = "136z63ff83hnwd247cq4m8m8164pklzyl5i2csf5h6wd8p01pdkj"; + })] ++ + # Don't search in non-Nix locations such as /usr, but do search in our libc. + [ ./search-path-2.8.patch ] ++ + optional (stdenv.hostPlatform != stdenv.buildPlatform) (fetchurl { + name = "fix-darwin-cross-compile.patch"; + url = "https://public.kitware.com/Bug/file_download.php?" + + "file_id=4981&type=bug"; + sha256 = "16acmdr27adma7gs9rs0dxdiqppm15vl3vv3agy7y8s94wyh4ybv"; + }); + + postPatch = '' + substituteInPlace Utilities/cmlibarchive/CMakeLists.txt \ + --replace '"-framework CoreServices"' '""' + ''; + + buildInputs = [ curl expat zlib bzip2 ] + ++ optional useNcurses ncurses + ++ optional useQt4 qt4; + + propagatedBuildInputs = [ ps ]; + + CMAKE_PREFIX_PATH = concatStringsSep ":" + (concatMap (p: [ (p.dev or p) (p.out or p) ]) buildInputs); + + configureFlags = [ + "--docdir=/share/doc/${name}" + "--mandir=/share/man" + "--system-libs" + "--no-system-libarchive" + ] ++ stdenv.lib.optional useQt4 "--qt-gui"; + + setupHook = ./setup-hook.sh; + + dontUseCmakeConfigure = true; + + preConfigure = with stdenv; '' + source $setupHook + fixCmakeFiles . + substituteInPlace Modules/Platform/UnixPaths.cmake \ + --subst-var-by libc_bin ${getBin cc.libc} \ + --subst-var-by libc_dev ${getDev cc.libc} \ + --subst-var-by libc_lib ${getLib cc.libc} + configureFlags="--parallel=''${NIX_BUILD_CORES:-1} $configureFlags" + ''; + + hardeningDisable = [ "format" ]; + + meta = { + homepage = https://cmake.org; + description = "Cross-Platform Makefile Generator"; + platforms = if useQt4 then qt4.meta.platforms else stdenv.lib.platforms.unix; + maintainers = with stdenv.lib.maintainers; [ ]; + license = stdenv.lib.licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/3.2.2-cygwin.patch b/nixpkgs/pkgs/development/tools/build-managers/cmake/3.2.2-cygwin.patch new file mode 100644 index 000000000000..982aba17e874 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/3.2.2-cygwin.patch @@ -0,0 +1,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. diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/application-services.patch b/nixpkgs/pkgs/development/tools/build-managers/cmake/application-services.patch new file mode 100644 index 000000000000..2107dcdfbc66 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/application-services.patch @@ -0,0 +1,49 @@ +diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt +index 8aff8f6..af1852d 100644 +--- a/Source/CMakeLists.txt ++++ b/Source/CMakeLists.txt +@@ -791,12 +791,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc" + endif() + endif() + + # On Apple we need CoreFoundation and CoreServices + if(APPLE) + target_link_libraries(CMakeLib "-framework CoreFoundation") +- target_link_libraries(CMakeLib "-framework CoreServices") + endif() + + if(WIN32 AND NOT UNIX) + # We need the rpcrt4 library on Windows. + # We need the crypt32 library on Windows for crypto/cert APIs. +diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx +index e353a37..b06f842 100644 +--- a/Source/cmGlobalXCodeGenerator.cxx ++++ b/Source/cmGlobalXCodeGenerator.cxx +@@ -35,11 +35,6 @@ + + struct cmLinkImplementation; + +-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(__APPLE__) +-# define HAVE_APPLICATION_SERVICES +-# include <ApplicationServices/ApplicationServices.h> +-#endif +- + #if defined(CMAKE_BUILD_WITH_CMAKE) + # include "cmXMLParser.h" + +diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt +index d7af6e2..d4808fc 100644 +--- a/Utilities/cmlibarchive/CMakeLists.txt ++++ b/Utilities/cmlibarchive/CMakeLists.txt +@@ -1662,11 +1662,6 @@ IF(MSVC) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) + ENDIF(MSVC) + +-# We need CoreServices on Mac OS. +-IF(APPLE) +- LIST(APPEND ADDITIONAL_LIBS "-framework CoreServices") +-ENDIF(APPLE) +- + add_subdirectory(libarchive) + + install(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmlibarchive) diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/default.nix b/nixpkgs/pkgs/development/tools/build-managers/cmake/default.nix new file mode 100644 index 000000000000..721015f0c7c4 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/default.nix @@ -0,0 +1,118 @@ +{ stdenv, fetchurl, fetchpatch, pkgconfig +, bzip2, curl, expat, libarchive, xz, zlib, libuv, rhash +, buildPackages +# darwin attributes +, ps +, isBootstrap ? false +, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin) +, useNcurses ? false, ncurses +, useQt4 ? false, qt4 +, withQt5 ? false, qtbase +}: + +assert withQt5 -> useQt4 == false; +assert useQt4 -> withQt5 == false; + +with stdenv.lib; + +let + os = stdenv.lib.optionalString; + majorVersion = "3.13"; + minorVersion = "4"; + # from https://cmake.org/files/v3.13/cmake-3.13.4-SHA-256.txt for cmake-3.13.4.tar.gz + sha256 = "fdd928fee35f472920071d1c7f1a6a2b72c9b25e04f7a37b409349aef3f20e9b"; + version = "${majorVersion}.${minorVersion}"; +in + +stdenv.mkDerivation rec { + name = "cmake-${os isBootstrap "boot-"}${os useNcurses "cursesUI-"}${os withQt5 "qt5UI-"}${os useQt4 "qt4UI-"}${version}"; + + inherit majorVersion; + + src = fetchurl { + url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz"; + inherit sha256; + }; + + patches = [ + # Don't search in non-Nix locations such as /usr, but do search in our libc. + ./search-path.patch + + # Don't depend on frameworks. + ./application-services.patch + + # Derived from https://github.com/libuv/libuv/commit/1a5d4f08238dd532c3718e210078de1186a5920d + ./libuv-application-services.patch + ] ++ optional stdenv.isCygwin ./3.2.2-cygwin.patch; + + outputs = [ "out" ]; + setOutputFlags = false; + + setupHook = ./setup-hook.sh; + + buildInputs = + [ setupHook pkgconfig ] + ++ optionals useSharedLibraries [ bzip2 curl expat libarchive xz zlib libuv rhash ] + ++ optional useNcurses ncurses + ++ optional useQt4 qt4 + ++ optional withQt5 qtbase; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + propagatedBuildInputs = optional stdenv.isDarwin ps; + + preConfigure = '' + fixCmakeFiles . + substituteInPlace Modules/Platform/UnixPaths.cmake \ + --subst-var-by libc_bin ${getBin stdenv.cc.libc} \ + --subst-var-by libc_dev ${getDev stdenv.cc.libc} \ + --subst-var-by libc_lib ${getLib stdenv.cc.libc} + substituteInPlace Modules/FindCxxTest.cmake \ + --replace "$""{PYTHON_EXECUTABLE}" ${stdenv.shell} + # BUILD_CC and BUILD_CXX are used to bootstrap cmake + configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$BUILD_CC CXX=$BUILD_CXX $configureFlags" + ''; + + configureFlags = [ + "--docdir=share/doc/${name}" + ] ++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup + ++ optional (useQt4 || withQt5) "--qt-gui" + ++ [ + "--" + # We should set the proper `CMAKE_SYSTEM_NAME`. + # http://www.cmake.org/Wiki/CMake_Cross_Compiling + # + # Unfortunately cmake seems to expect absolute paths for ar, ranlib, and + # strip. Otherwise they are taken to be relative to the source root of the + # package being built. + "-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}c++" + "-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}cc" + "-DCMAKE_AR=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar" + "-DCMAKE_RANLIB=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib" + "-DCMAKE_STRIP=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip" + ] + # Avoid depending on frameworks. + ++ optional (!useNcurses) "-DBUILD_CursesDialog=OFF"; + + # make install attempts to use the just-built cmake + preInstall = optional (stdenv.hostPlatform != stdenv.buildPlatform) '' + sed -i 's|bin/cmake|${buildPackages.cmake}/bin/cmake|g' Makefile + ''; + + dontUseCmakeConfigure = true; + enableParallelBuilding = true; + + # This isn't an autoconf configure script; triples are passed via + # CMAKE_SYSTEM_NAME, etc. + configurePlatforms = [ ]; + + doCheck = false; # fails + + meta = with stdenv.lib; { + homepage = http://www.cmake.org/; + description = "Cross-Platform Makefile Generator"; + platforms = if useQt4 then qt4.meta.platforms else platforms.all; + maintainers = with maintainers; [ ttuegel lnl7 ]; + license = licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/libuv-application-services.patch b/nixpkgs/pkgs/development/tools/build-managers/cmake/libuv-application-services.patch new file mode 100644 index 000000000000..08899f5c241f --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/libuv-application-services.patch @@ -0,0 +1,83 @@ +diff -ur cmake-3.12.1/Utilities/cmlibuv/CMakeLists.txt cmake-3.12.1-patched/Utilities/cmlibuv/CMakeLists.txt +--- cmake-3.12.1/Utilities/cmlibuv/CMakeLists.txt 2018-08-09 21:14:08.000000000 +0900 ++++ cmake-3.12.1-patched/Utilities/cmlibuv/CMakeLists.txt 2018-08-13 10:14:53.000000000 +0900 +@@ -173,6 +173,22 @@ + src/unix/kqueue.c + src/unix/proctitle.c + ) ++ ++ include(CheckIncludeFile) ++ ++ check_include_file("ApplicationServices/ApplicationServices.h" HAVE_ApplicationServices) ++ if (HAVE_ApplicationServices) ++ list(APPEND uv_defines ++ HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H=1 ++ ) ++ endif() ++ ++ check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices) ++ if (HAVE_CoreServices) ++ list(APPEND uv_defines ++ HAVE_CORESERVICES_CORESERVICES_H=1 ++ ) ++ endif() + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") +diff -ur cmake-3.12.1/Utilities/cmlibuv/src/unix/darwin-proctitle.c cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/darwin-proctitle.c +--- cmake-3.12.1/Utilities/cmlibuv/src/unix/darwin-proctitle.c 2018-08-09 21:14:08.000000000 +0900 ++++ cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/darwin-proctitle.c 2018-08-13 10:01:29.000000000 +0900 +@@ -26,9 +26,7 @@ + #include <stdlib.h> + #include <string.h> + +-#include <TargetConditionals.h> +- +-#if !TARGET_OS_IPHONE ++#if HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H + # include <CoreFoundation/CoreFoundation.h> + # include <ApplicationServices/ApplicationServices.h> + #endif +@@ -58,7 +56,7 @@ + + + int uv__set_process_title(const char* title) { +-#if TARGET_OS_IPHONE ++#if !HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H + return uv__pthread_setname_np(title); + #else + CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, +@@ -205,5 +203,5 @@ + dlclose(application_services_handle); + + return err; +-#endif /* !TARGET_OS_IPHONE */ ++#endif /* HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H */ + } +diff -ur cmake-3.12.1/Utilities/cmlibuv/src/unix/fsevents.c cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/fsevents.c +--- cmake-3.12.1/Utilities/cmlibuv/src/unix/fsevents.c 2018-08-09 21:14:08.000000000 +0900 ++++ cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/fsevents.c 2018-08-13 10:01:29.000000000 +0900 +@@ -21,7 +21,7 @@ + #include "uv.h" + #include "internal.h" + +-#if TARGET_OS_IPHONE ++#if !HAVE_CORESERVICES_CORESERVICES_H + + /* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */ + +@@ -38,7 +38,7 @@ + void uv__fsevents_loop_delete(uv_loop_t* loop) { + } + +-#else /* TARGET_OS_IPHONE */ ++#else /* !HAVE_CORESERVICES_CORESERVICES_H */ + + #include <dlfcn.h> + #include <assert.h> +@@ -916,4 +916,4 @@ + return 0; + } + +-#endif /* TARGET_OS_IPHONE */ ++#endif /* !HAVE_CORESERVICES_CORESERVICES_H */ diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/search-path-2.8.patch b/nixpkgs/pkgs/development/tools/build-managers/cmake/search-path-2.8.patch new file mode 100644 index 000000000000..9fc949661686 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/search-path-2.8.patch @@ -0,0 +1,92 @@ +diff -ru3 cmake-2.8.12.2/Modules/Platform/Linux.cmake cmake-2.8.12.2-new/Modules/Platform/Linux.cmake +--- cmake-2.8.12.2/Modules/Platform/Linux.cmake 2014-01-16 21:15:08.000000000 +0400 ++++ cmake-2.8.12.2-new/Modules/Platform/Linux.cmake 2016-04-13 22:00:32.928575740 +0300 +@@ -36,22 +36,11 @@ + # 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() +- set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL +- "Install .so files without execute permission.") +- endif() ++ set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL ++ "Install .so files without execute permission.") + endif() + + # Match multiarch library directory names. + set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*") + + 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() +diff -ru3 cmake-2.8.12.2/Modules/Platform/UnixPaths.cmake cmake-2.8.12.2-new/Modules/Platform/UnixPaths.cmake +--- cmake-2.8.12.2/Modules/Platform/UnixPaths.cmake 2014-01-16 21:15:08.000000000 +0400 ++++ cmake-2.8.12.2-new/Modules/Platform/UnixPaths.cmake 2016-04-14 00:09:10.106362636 +0300 +@@ -32,9 +32,6 @@ + # List common installation prefixes. These will be used for all + # search types. + list(APPEND CMAKE_SYSTEM_PREFIX_PATH +- # Standard +- /usr/local /usr / +- + # CMake install location + "${_CMAKE_INSTALL_DIR}" + +@@ -44,44 +41,26 @@ + + # 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 ++ @libc_dev@/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 ++ @libc_lib@/lib + ) + + list(APPEND CMAKE_SYSTEM_PROGRAM_PATH +- /usr/pkg/bin ++ @libc_bin@/bin + ) + + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES +- /lib /usr/lib /usr/lib32 /usr/lib64 ++ @libc_lib@/lib + ) + + list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES +- /usr/include ++ @libc_dev@/include + ) + list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES +- /usr/include ++ @libc_dev@/include + ) + + # Enable use of lib64 search path variants by default. diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/search-path.patch b/nixpkgs/pkgs/development/tools/build-managers/cmake/search-path.patch new file mode 100644 index 000000000000..6213138402b1 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/search-path.patch @@ -0,0 +1,62 @@ +diff -ur cmake-3.9.1/Modules/Platform/UnixPaths.cmake cmake-3.9.1-mod/Modules/Platform/UnixPaths.cmake +--- cmake-3.9.1/Modules/Platform/UnixPaths.cmake 2017-08-10 13:36:32.000000000 +0000 ++++ cmake-3.9.1-mod/Modules/Platform/UnixPaths.cmake 2017-09-03 01:24:31.901473539 +0000 +@@ -22,9 +22,6 @@ + # List common installation prefixes. These will be used for all + # search types. + list(APPEND CMAKE_SYSTEM_PREFIX_PATH +- # Standard +- /usr/local /usr / +- + # CMake install location + "${_CMAKE_INSTALL_DIR}" + ) +@@ -43,31 +40,26 @@ + + # Non "standard" but common install prefixes + list(APPEND CMAKE_SYSTEM_PREFIX_PATH +- /usr/X11R6 +- /usr/pkg +- /opt + ) + + # List common include file locations not under the common prefixes. + list(APPEND CMAKE_SYSTEM_INCLUDE_PATH +- # X11 +- /usr/include/X11 ++ @libc_dev@/include + ) + + list(APPEND CMAKE_SYSTEM_LIBRARY_PATH +- # X11 +- /usr/lib/X11 ++ @libc_lib@/lib + ) + + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES +- /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64 ++ @libc_lib@/lib + ) + + list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES +- /usr/include ++ @libc_dev@/include + ) + list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES +- /usr/include ++ @libc_dev@/include + ) + + # Enable use of lib32 and lib64 search path variants by default. +diff -ur cmake-3.9.1/Modules/Platform/WindowsPaths.cmake cmake-3.9.1-mod/Modules/Platform/WindowsPaths.cmake +--- cmake-3.9.1/Modules/Platform/WindowsPaths.cmake 2017-08-10 13:36:32.000000000 +0000 ++++ cmake-3.9.1-mod/Modules/Platform/WindowsPaths.cmake 2017-09-03 01:19:32.808355986 +0000 +@@ -66,7 +66,7 @@ + + if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set) +- list(APPEND CMAKE_SYSTEM_PREFIX_PATH /) ++ # list(APPEND CMAKE_SYSTEM_PREFIX_PATH /) + endif() + + list(APPEND CMAKE_SYSTEM_INCLUDE_PATH diff --git a/nixpkgs/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/nixpkgs/pkgs/development/tools/build-managers/cmake/setup-hook.sh new file mode 100755 index 000000000000..8c6b11bd73e7 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/cmake/setup-hook.sh @@ -0,0 +1,141 @@ +addCMakeParams() { + addToSearchPath CMAKE_PREFIX_PATH $1 +} + +fixCmakeFiles() { + # Replace occurences of /usr and /opt by /var/empty. + echo "fixing cmake files..." + find "$1" \( -type f -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print | + while read fn; do + sed -e 's^/usr\([ /]\|$\)^/var/empty\1^g' -e 's^/opt\([ /]\|$\)^/var/empty\1^g' < "$fn" > "$fn.tmp" + mv "$fn.tmp" "$fn" + done +} + +cmakeConfigurePhase() { + runHook preConfigure + + export CTEST_OUTPUT_ON_FAILURE=1 + if [ -n "${enableParallelChecking-1}" ]; then + export CTEST_PARALLEL_LEVEL=$NIX_BUILD_CORES + fi + + if [ -z "$dontFixCmake" ]; then + fixCmakeFiles . + fi + + if [ -z "$dontUseCmakeBuildDir" ]; then + mkdir -p build + cd build + cmakeDir=${cmakeDir:-..} + fi + + if [ -z "$dontAddPrefix" ]; then + cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags" + fi + + # We should set the proper `CMAKE_SYSTEM_NAME`. + # http://www.cmake.org/Wiki/CMake_Cross_Compiling + # + # Unfortunately cmake seems to expect absolute paths for ar, ranlib, and + # strip. Otherwise they are taken to be relative to the source root of the + # package being built. + cmakeFlags="-DCMAKE_CXX_COMPILER=$CXX $cmakeFlags" + cmakeFlags="-DCMAKE_C_COMPILER=$CC $cmakeFlags" + cmakeFlags="-DCMAKE_AR=$(command -v $AR) $cmakeFlags" + cmakeFlags="-DCMAKE_RANLIB=$(command -v $RANLIB) $cmakeFlags" + cmakeFlags="-DCMAKE_STRIP=$(command -v $STRIP) $cmakeFlags" + + # on macOS we want to prefer Unix-style headers to Frameworks + # because we usually do not package the framework + cmakeFlags="-DCMAKE_FIND_FRAMEWORK=last $cmakeFlags" + + # we never want to use the global macOS SDK + cmakeFlags="-DCMAKE_OSX_SYSROOT= $cmakeFlags" + + # disable OSX deployment target + # we don't want our binaries to have a "minimum" OSX version + cmakeFlags="-DCMAKE_OSX_DEPLOYMENT_TARGET= $cmakeFlags" + + # correctly detect our clang compiler + cmakeFlags="-DCMAKE_POLICY_DEFAULT_CMP0025=NEW $cmakeFlags" + + # This installs shared libraries with a fully-specified install + # name. By default, cmake installs shared libraries with just the + # basename as the install name, which means that, on Darwin, they + # can only be found by an executable at runtime if the shared + # libraries are in a system path or in the same directory as the + # executable. This flag makes the shared library accessible from its + # nix/store directory. + cmakeFlags="-DCMAKE_INSTALL_NAME_DIR=${!outputLib}/lib $cmakeFlags" + cmakeFlags="-DCMAKE_INSTALL_LIBDIR=${!outputLib}/lib $cmakeFlags" + cmakeFlags="-DCMAKE_INSTALL_INCLUDEDIR=${!outputDev}/include $cmakeFlags" + + # Don’t build tests when doCheck = false + if [ -z "$doCheck" ]; then + cmakeFlags="-DBUILD_TESTING=OFF $cmakeFlags" + fi + + # Avoid cmake resetting the rpath of binaries, on make install + # And build always Release, to ensure optimisation flags + cmakeFlags="-DCMAKE_BUILD_TYPE=${cmakeBuildType:-Release} -DCMAKE_SKIP_BUILD_RPATH=ON $cmakeFlags" + + # Disable user package registry to avoid potential side effects + # and unecessary attempts to access non-existent home folder + # https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#disabling-the-package-registry + cmakeFlags="-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON $cmakeFlags" + cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON $cmakeFlags" + cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON $cmakeFlags" + + if [ "$buildPhase" = ninjaBuildPhase ]; then + cmakeFlags="-GNinja $cmakeFlags" + fi + + echo "cmake flags: $cmakeFlags ${cmakeFlagsArray[@]}" + + cmake ${cmakeDir:-.} $cmakeFlags "${cmakeFlagsArray[@]}" + + if ! [[ -v enableParallelBuilding ]]; then + enableParallelBuilding=1 + echo "cmake: enabled parallel building" + fi + + runHook postConfigure +} + +if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then + setOutputFlags= + configurePhase=cmakeConfigurePhase +fi + +addEnvHooks "$targetOffset" addCMakeParams + +makeCmakeFindLibs(){ + isystem_seen= + for flag in $NIX_CFLAGS_COMPILE $NIX_LDFLAGS; do + if test -n "$isystem_seen" && test -d "$flag"; then + isystem_seen= + export CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH${CMAKE_INCLUDE_PATH:+:}${flag}" + else + isystem_seen= + case $flag in + -I*) + export CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH${CMAKE_INCLUDE_PATH:+:}${flag:2}" + ;; + -L*) + export CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH${CMAKE_LIBRARY_PATH:+:}${flag:2}" + ;; + -F*) + export CMAKE_FRAMEWORK_PATH="$CMAKE_FRAMEWORK_PATH${CMAKE_FRAMEWORK_PATH:+:}${flag:2}" + ;; + -isystem) + isystem_seen=1 + ;; + esac + fi + done +} + +# not using setupHook, because it could be a setupHook adding additional +# include flags to NIX_CFLAGS_COMPILE +postHooks+=(makeCmakeFindLibs) |