experimental/cmake-improvement

set CMAKE_LIBRARY_PATH, CMAKE_INCLUDE_PATH based on NIX_CFLAGS_COMPILE and
NIX_LDFLAGS so that cmake's find_library like functions find all the libraries
gcc knows about thanks to the gcc wrapper

This is particular useful with myEnvFun which then also sets those CMAKE_* env
variables.`

Because setup.sh has to change this causes many rebuilds - thus it should be
included in a stdenv-update like branch

Also cmake builds in parallel perfectly fine

update cmake to latest minor number, I didn't change the patches,
just reapplied them manually recordin a new patch
This commit is contained in:
Marc Weber 2013-05-28 16:22:45 +02:00
parent a22f94b4f2
commit f7ef08e5cd
4 changed files with 62 additions and 37 deletions
pkgs
development/tools/build-managers/cmake
stdenv/generic

View File

@ -7,7 +7,7 @@ with stdenv.lib;
let let
os = stdenv.lib.optionalString; os = stdenv.lib.optionalString;
majorVersion = "2.8"; majorVersion = "2.8";
minorVersion = "9"; minorVersion = "11";
version = "${majorVersion}.${minorVersion}"; version = "${majorVersion}.${minorVersion}";
in in
@ -18,9 +18,11 @@ stdenv.mkDerivation rec {
src = fetchurl { src = fetchurl {
url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz"; url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz";
sha256 = "1yg68ng732cfm5c0h91chqwhg06zdh45bybm353kd1myk5rwqgfw"; sha256 = "1rgfgzigmc0b2z5330r3ncf003k4bhqwfxbskv0q5ylp2xkd7l10";
}; };
enableParallelBuilding = true;
patches = patches =
# 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
# Nixpkgs' Glibc. # Nixpkgs' Glibc.

View File

@ -1,41 +1,43 @@
diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/Linux.cmake cmake-2.8.5/Modules/Platform/Linux.cmake diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
--- cmake-2.8.5-orig/Modules/Platform/Linux.cmake 2011-07-08 14:21:44.000000000 +0200 index fe8e003..378512c 100644
+++ cmake-2.8.5/Modules/Platform/Linux.cmake 2011-07-21 19:45:00.000000000 +0200 --- a/Modules/Platform/Linux.cmake
@@ -36,13 +36,13 @@ +++ b/Modules/Platform/Linux.cmake
@@ -36,13 +36,13 @@ else()
# checking the platform every time. This option is advanced enough # checking the platform every time. This option is advanced enough
# that only package maintainers should need to adjust it. They are # that only package maintainers should need to adjust it. They are
# capable of providing a setting on the command line. # capable of providing a setting on the command line.
- IF(EXISTS "/etc/debian_version") - if(EXISTS "/etc/debian_version")
- SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL - set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
- "Install .so files without execute permission.") - "Install .so files without execute permission.")
- ELSE(EXISTS "/etc/debian_version") - else()
+ #IF(EXISTS "/etc/debian_version") + # if(EXISTS "/etc/debian_version")
+ # SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL + # set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
+ # "Install .so files without execute permission.") + # "Install .so files without execute permission.")
+ #ELSE(EXISTS "/etc/debian_version") + # else()
SET(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
"Install .so files without execute permission.") "Install .so files without execute permission.")
- ENDIF(EXISTS "/etc/debian_version") - endif()
+ #ENDIF(EXISTS "/etc/debian_version") + # endif()
ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE) endif()
# Match multiarch library directory names. # Match multiarch library directory names.
@@ -52,6 +52,6 @@ @@ -52,6 +52,6 @@ include(Platform/UnixPaths)
# Debian has lib64 paths only for compatibility so they should not be # Debian has lib64 paths only for compatibility so they should not be
# searched. # searched.
-IF(EXISTS "/etc/debian_version") -if(EXISTS "/etc/debian_version")
- SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) - set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
-ENDIF(EXISTS "/etc/debian_version") -endif()
+#IF(EXISTS "/etc/debian_version") +# if(EXISTS "/etc/debian_version")
+# SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) +# set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+#ENDIF(EXISTS "/etc/debian_version") +#endif()
diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/Modules/Platform/UnixPaths.cmake diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
--- cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake 2011-07-08 14:21:44.000000000 +0200 index ccb2663..39834e6 100644
+++ cmake-2.8.5/Modules/Platform/UnixPaths.cmake 2011-07-21 19:50:52.000000000 +0200 --- a/Modules/Platform/UnixPaths.cmake
@@ -33,55 +33,18 @@ +++ b/Modules/Platform/UnixPaths.cmake
@@ -33,55 +33,18 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
# search types. # search types.
LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# Standard # Standard
- /usr/local /usr / - /usr/local /usr /
- -
@ -47,7 +49,7 @@ diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/M
- ) - )
- -
-# List common include file locations not under the common prefixes. -# List common include file locations not under the common prefixes.
-LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH -list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
- # Windows API on Cygwin - # Windows API on Cygwin
- /usr/include/w32api - /usr/include/w32api
- -
@ -60,7 +62,7 @@ diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/M
- /usr/openwin/include - /usr/openwin/include
- ) - )
- -
-LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH -list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
- # Windows API on Cygwin - # Windows API on Cygwin
- /usr/lib/w32api - /usr/lib/w32api
- -
@ -73,21 +75,21 @@ diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/M
- /usr/openwin/lib - /usr/openwin/lib
- ) - )
- -
-LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH -list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
- /usr/pkg/bin - /usr/pkg/bin
+ "@glibc@" + "@glibc@"
) )
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" + "@glibc@/lib"
) )
LIST(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include - /usr/include
+ "@glibc@/include" + "@glibc@/include"
) )
LIST(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include - /usr/include
+ "@glibc@/include" + "@glibc@/include"
) )

View File

@ -56,3 +56,20 @@ if [ -n "$crossConfig" ]; then
else else
envHooks+=(addCMakeParams) envHooks+=(addCMakeParams)
fi fi
make_cmake_find_libs(){
for flag in $NIX_CFLAGS_COMPILE $NIX_LDFLAGS; do
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}"
;;
esac
done
}
# not using setupHook, because it could be a setupHook adding additional
# include flags to NIX_CFLAGS_COMPILE
postHooks+=(make_cmake_find_libs)

View File

@ -862,6 +862,10 @@ genericBuild() {
stopNest stopNest
} }
for i in "${postHooks[@]}"; do
$i
done
# Execute the post-hook. # Execute the post-hook.
runHook postHook runHook postHook