1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00

Merge #19514: cmake: improve if without glibc

and bootstrap in parallel.
This commit is contained in:
Vladimír Čunát 2016-10-29 17:04:34 +02:00
commit 135a914ded
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA
4 changed files with 36 additions and 32 deletions

View file

@ -5,6 +5,8 @@
with stdenv.lib; with stdenv.lib;
assert wantPS -> (ps != null); assert wantPS -> (ps != null);
assert stdenv ? cc;
assert stdenv.cc ? libc;
let let
os = stdenv.lib.optionalString; os = stdenv.lib.optionalString;
@ -31,9 +33,8 @@ stdenv.mkDerivation rec {
url = "http://www.cmake.org/Bug/file_download.php?file_id=4660&type=bug"; url = "http://www.cmake.org/Bug/file_download.php?file_id=4660&type=bug";
sha256 = "136z63ff83hnwd247cq4m8m8164pklzyl5i2csf5h6wd8p01pdkj"; sha256 = "136z63ff83hnwd247cq4m8m8164pklzyl5i2csf5h6wd8p01pdkj";
})] ++ })] ++
# Don't search in non-Nix locations such as /usr, but do search in # Don't search in non-Nix locations such as /usr, but do search in our libc.
# Nixpkgs' Glibc. [ ./search-path.patch ] ++
optional (stdenv ? glibc) ./search-path.patch ++
optional (stdenv ? cross) (fetchurl { optional (stdenv ? cross) (fetchurl {
name = "fix-darwin-cross-compile.patch"; name = "fix-darwin-cross-compile.patch";
url = "http://public.kitware.com/Bug/file_download.php?" url = "http://public.kitware.com/Bug/file_download.php?"
@ -50,22 +51,25 @@ stdenv.mkDerivation rec {
CMAKE_PREFIX_PATH = concatStringsSep ":" CMAKE_PREFIX_PATH = concatStringsSep ":"
(concatMap (p: [ (p.dev or p) (p.out or p) ]) buildInputs); (concatMap (p: [ (p.dev or p) (p.out or p) ]) buildInputs);
configureFlags = configureFlags = [
"--docdir=/share/doc/${name} --mandir=/share/man --system-libs --no-system-libarchive" "--docdir=/share/doc/${name}"
+ stdenv.lib.optionalString useQt4 " --qt-gui"; "--mandir=/share/man"
"--system-libs"
"--no-system-libarchive"
] ++ stdenv.lib.optional useQt4 "--qt-gui";
setupHook = ./setup-hook.sh; setupHook = ./setup-hook.sh;
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
preConfigure = with stdenv; optionalString (stdenv ? glibc) preConfigure = with stdenv; ''
''
source $setupHook source $setupHook
fixCmakeFiles . fixCmakeFiles .
substituteInPlace Modules/Platform/UnixPaths.cmake \ substituteInPlace Modules/Platform/UnixPaths.cmake \
--subst-var-by glibc_bin ${getBin glibc} \ --subst-var-by libc_bin ${getBin cc.libc} \
--subst-var-by glibc_dev ${getDev glibc} \ --subst-var-by libc_dev ${getDev cc.libc} \
--subst-var-by glibc_lib ${getLib glibc} --subst-var-by libc_lib ${getLib cc.libc}
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} $configureFlags"
''; '';
meta = { meta = {

View file

@ -7,6 +7,8 @@
with stdenv.lib; with stdenv.lib;
assert wantPS -> (ps != null); assert wantPS -> (ps != null);
assert stdenv ? cc;
assert stdenv.cc ? libc;
let let
os = stdenv.lib.optionalString; os = stdenv.lib.optionalString;
@ -25,10 +27,8 @@ stdenv.mkDerivation rec {
sha256 = "0w3n2i02jpbgai4dxsigm1c1i1qb5v70wyxckzwrxvs0ri0fs1gx"; sha256 = "0w3n2i02jpbgai4dxsigm1c1i1qb5v70wyxckzwrxvs0ri0fs1gx";
}; };
patches = # Don't search in non-Nix locations such as /usr, but do search in our libc.
# Don't search in non-Nix locations such as /usr, but do search in patches = [ ./search-path-3.2.patch ]
# Nixpkgs' Glibc.
optional (stdenv ? glibc) ./search-path-3.2.patch
++ optional stdenv.isCygwin ./3.2.2-cygwin.patch; ++ optional stdenv.isCygwin ./3.2.2-cygwin.patch;
outputs = [ "out" ]; outputs = [ "out" ];
@ -43,15 +43,15 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = optional wantPS ps; propagatedBuildInputs = optional wantPS ps;
preConfigure = with stdenv; optionalString (stdenv ? glibc) preConfigure = with stdenv; ''
''
fixCmakeFiles . fixCmakeFiles .
substituteInPlace Modules/Platform/UnixPaths.cmake \ substituteInPlace Modules/Platform/UnixPaths.cmake \
--subst-var-by glibc_bin ${getBin glibc} \ --subst-var-by libc_bin ${getBin cc.libc} \
--subst-var-by glibc_dev ${getDev glibc} \ --subst-var-by libc_dev ${getDev cc.libc} \
--subst-var-by glibc_lib ${getLib glibc} --subst-var-by libc_lib ${getLib cc.libc}
substituteInPlace Modules/FindCxxTest.cmake \ substituteInPlace Modules/FindCxxTest.cmake \
--replace "$""{PYTHON_EXECUTABLE}" ${stdenv.shell} --replace "$""{PYTHON_EXECUTABLE}" ${stdenv.shell}
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} $configureFlags"
''; '';
configureFlags = configureFlags =
[ "--docdir=share/doc/${name}" [ "--docdir=share/doc/${name}"

View file

@ -25,7 +25,7 @@ diff -ru3 cmake-3.4.3/Modules/Platform/UnixPaths.cmake cmake-3.4.3-new/Modules/P
- /usr/pkg/include - /usr/pkg/include
- /opt/csw/include /opt/include - /opt/csw/include /opt/include
- /usr/openwin/include - /usr/openwin/include
+ @glibc_dev@/include + @libc_dev@/include
) )
- -
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
@ -39,26 +39,26 @@ diff -ru3 cmake-3.4.3/Modules/Platform/UnixPaths.cmake cmake-3.4.3-new/Modules/P
- /usr/pkg/lib - /usr/pkg/lib
- /opt/csw/lib /opt/lib - /opt/csw/lib /opt/lib
- /usr/openwin/lib - /usr/openwin/lib
+ @glibc_lib@/lib + @libc_lib@/lib
) )
list(APPEND CMAKE_SYSTEM_PROGRAM_PATH list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
- /usr/pkg/bin - /usr/pkg/bin
+ @glibc_bin@/bin + @libc_bin@/bin
) )
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
- /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64 - /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
+ @glibc_lib@/lib + @libc_lib@/lib
) )
list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include - /usr/include
+ @glibc_dev@/include + @libc_dev@/include
) )
list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include - /usr/include
+ @glibc_dev@/include + @libc_dev@/include
) )
# Enable use of lib64 search path variants by default. # Enable use of lib64 search path variants by default.

View file

@ -53,7 +53,7 @@ diff -ru3 cmake-2.8.12.2/Modules/Platform/UnixPaths.cmake cmake-2.8.12.2-new/Mod
- /usr/pkg/include - /usr/pkg/include
- /opt/csw/include /opt/include - /opt/csw/include /opt/include
- /usr/openwin/include - /usr/openwin/include
+ @glibc_dev@/include + @libc_dev@/include
) )
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
@ -67,26 +67,26 @@ diff -ru3 cmake-2.8.12.2/Modules/Platform/UnixPaths.cmake cmake-2.8.12.2-new/Mod
- /usr/pkg/lib - /usr/pkg/lib
- /opt/csw/lib /opt/lib - /opt/csw/lib /opt/lib
- /usr/openwin/lib - /usr/openwin/lib
+ @glibc_lib@/lib + @libc_lib@/lib
) )
list(APPEND CMAKE_SYSTEM_PROGRAM_PATH list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
- /usr/pkg/bin - /usr/pkg/bin
+ @glibc_bin@/bin + @libc_bin@/bin
) )
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
- /lib /usr/lib /usr/lib32 /usr/lib64 - /lib /usr/lib /usr/lib32 /usr/lib64
+ @glibc_lib@/lib + @libc_lib@/lib
) )
list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include - /usr/include
+ @glibc_dev@/include + @libc_dev@/include
) )
list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include - /usr/include
+ @glibc_dev@/include + @libc_dev@/include
) )
# Enable use of lib64 search path variants by default. # Enable use of lib64 search path variants by default.