| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  | addCMakeParams() { | 
					
						
							| 
									
										
										
										
											2010-02-12 21:58:27 +00:00
										 |  |  |     addToSearchPath CMAKE_PREFIX_PATH $1 | 
					
						
							| 
									
										
										
										
											2007-08-05 13:54:42 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  | fixCmakeFiles() { | 
					
						
							| 
									
										
										
										
											2012-01-23 13:16:51 +00:00
										 |  |  |     # Replace occurences of /usr and /opt by /var/empty. | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  |     echo "fixing cmake files..." | 
					
						
							|  |  |  |     find "$1" \( -type f -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print | | 
					
						
							|  |  |  |         while read fn; do | 
					
						
							| 
									
										
										
										
											2012-01-23 13:16:51 +00:00
										 |  |  |             sed -e 's^/usr\([ /]\|$\)^/var/empty\1^g' -e 's^/opt\([ /]\|$\)^/var/empty\1^g' < "$fn" > "$fn.tmp" | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  |             mv "$fn.tmp" "$fn" | 
					
						
							|  |  |  |         done | 
					
						
							| 
									
										
										
										
											2007-08-05 13:54:42 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  | cmakeConfigurePhase() { | 
					
						
							| 
									
										
										
										
											2009-02-13 14:43:01 +00:00
										 |  |  |     eval "$preConfigure" | 
					
						
							| 
									
										
										
										
											2009-04-17 13:48:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  |     if [ -z "$dontFixCmake" ]; then | 
					
						
							| 
									
										
										
										
											2008-02-20 23:02:41 +00:00
										 |  |  |         fixCmakeFiles . | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  |     if [ -z "$dontUseCmakeBuildDir" ]; then | 
					
						
							| 
									
										
										
										
											2009-02-13 14:43:01 +00:00
										 |  |  |         mkdir -p build | 
					
						
							|  |  |  |         cd build | 
					
						
							|  |  |  |         cmakeDir=.. | 
					
						
							| 
									
										
										
										
											2008-02-20 23:02:41 +00:00
										 |  |  |     fi | 
					
						
							| 
									
										
										
										
											2009-02-13 14:43:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  |     if [ -z "$dontAddPrefix" ]; then | 
					
						
							| 
									
										
										
										
											2009-02-13 14:43:01 +00:00
										 |  |  |         cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags" | 
					
						
							| 
									
										
										
										
											2008-02-20 23:02:41 +00:00
										 |  |  |     fi | 
					
						
							| 
									
										
										
										
											2007-08-05 13:54:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  |     if [ -n "$crossConfig" ]; then | 
					
						
							| 
									
										
											  
											
												Big fixes in the cross build:
- Before this changes, cflags and ldflags for the native and the cross compiler
  got mixed. Not all the gcc-wrapper/gcc-cross-wrapper variables are
  independant now, but enough, I think.
- Fixed the generic stdenv expression, which did a big mess on buildInputs and
  buildNativeInputs. Now it distinguishes when there is a stdenvCross or not.
  Maybe we should have a single stdenv and forget about the stdenvCross
  adapter - this could end in a stdenv a bit complex, but simpler than the
  generic stdenv + adapter.
- Added basic support in pkgconfig for cross-builds: a single PKG_CONFIG_PATH
  now works for both the cross and the native compilers, but I think this
  should work well for most cases I can think of.
- I tried to fix the guile expression to cross-biuld; guile is built, but not
  its manual, so the derivation still fails. Guile requires patching to
  cross-build, as far as I understnad.
- Made the glibcCross build to be done through the usage of a
  gcc-cross-wrapper over the gcc-cross-stage-static, instead of using it
  directly.
- Trying to make physfs (a neverball dependency) cross build.
- Updated the gcc expression to support building a cross compiler without getting
  derivation variables mixed with those of the stdenvCross.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18534
											
										 
											2009-11-22 19:51:45 +00:00
										 |  |  |         # By now it supports linux builds only. We should set the proper | 
					
						
							|  |  |  |         # CMAKE_SYSTEM_NAME otherwise. | 
					
						
							|  |  |  |         # http://www.cmake.org/Wiki/CMake_Cross_Compiling | 
					
						
							|  |  |  |         cmakeFlags="-DCMAKE_CXX_COMPILER=$crossConfig-g++ -DCMAKE_C_COMPILER=$crossConfig-gcc $cmakeFlags" | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-10 22:19:52 +00:00
										 |  |  |     # Avoid cmake resetting the rpath of binaries, on make install | 
					
						
							| 
									
										
										
										
											2012-02-26 11:27:45 +00:00
										 |  |  |     # And build always Release, to ensure optimisation flags | 
					
						
							|  |  |  |     cmakeFlags="-DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON $cmakeFlags" | 
					
						
							| 
									
										
										
										
											2009-12-10 22:19:52 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-13 14:43:01 +00:00
										 |  |  |     echo "cmake flags: $cmakeFlags ${cmakeFlagsArray[@]}" | 
					
						
							| 
									
										
										
										
											2009-04-17 13:48:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-12 11:31:58 +01:00
										 |  |  |     cmake ${cmakeDir:-.} $cmakeFlags "${cmakeFlagsArray[@]}" | 
					
						
							| 
									
										
										
										
											2009-04-17 13:48:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-13 14:43:01 +00:00
										 |  |  |     eval "$postConfigure" | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2007-09-20 19:27:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-09 23:14:01 +02:00
										 |  |  | if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then | 
					
						
							| 
									
										
										
										
											2009-02-13 14:43:01 +00:00
										 |  |  |     configurePhase=cmakeConfigurePhase | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2007-08-05 13:54:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-20 15:10:28 +00:00
										 |  |  | if [ -n "$crossConfig" ]; then | 
					
						
							| 
									
										
										
										
											2011-02-09 21:08:53 +00:00
										 |  |  |     crossEnvHooks+=(addCMakeParams) | 
					
						
							| 
									
										
											  
											
												Big fixes in the cross build:
- Before this changes, cflags and ldflags for the native and the cross compiler
  got mixed. Not all the gcc-wrapper/gcc-cross-wrapper variables are
  independant now, but enough, I think.
- Fixed the generic stdenv expression, which did a big mess on buildInputs and
  buildNativeInputs. Now it distinguishes when there is a stdenvCross or not.
  Maybe we should have a single stdenv and forget about the stdenvCross
  adapter - this could end in a stdenv a bit complex, but simpler than the
  generic stdenv + adapter.
- Added basic support in pkgconfig for cross-builds: a single PKG_CONFIG_PATH
  now works for both the cross and the native compilers, but I think this
  should work well for most cases I can think of.
- I tried to fix the guile expression to cross-biuld; guile is built, but not
  its manual, so the derivation still fails. Guile requires patching to
  cross-build, as far as I understnad.
- Made the glibcCross build to be done through the usage of a
  gcc-cross-wrapper over the gcc-cross-stage-static, instead of using it
  directly.
- Trying to make physfs (a neverball dependency) cross build.
- Updated the gcc expression to support building a cross compiler without getting
  derivation variables mixed with those of the stdenvCross.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18534
											
										 
											2009-11-22 19:51:45 +00:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2011-02-09 21:08:53 +00:00
										 |  |  |     envHooks+=(addCMakeParams) | 
					
						
							| 
									
										
											  
											
												Big fixes in the cross build:
- Before this changes, cflags and ldflags for the native and the cross compiler
  got mixed. Not all the gcc-wrapper/gcc-cross-wrapper variables are
  independant now, but enough, I think.
- Fixed the generic stdenv expression, which did a big mess on buildInputs and
  buildNativeInputs. Now it distinguishes when there is a stdenvCross or not.
  Maybe we should have a single stdenv and forget about the stdenvCross
  adapter - this could end in a stdenv a bit complex, but simpler than the
  generic stdenv + adapter.
- Added basic support in pkgconfig for cross-builds: a single PKG_CONFIG_PATH
  now works for both the cross and the native compilers, but I think this
  should work well for most cases I can think of.
- I tried to fix the guile expression to cross-biuld; guile is built, but not
  its manual, so the derivation still fails. Guile requires patching to
  cross-build, as far as I understnad.
- Made the glibcCross build to be done through the usage of a
  gcc-cross-wrapper over the gcc-cross-stage-static, instead of using it
  directly.
- Trying to make physfs (a neverball dependency) cross build.
- Updated the gcc expression to support building a cross compiler without getting
  derivation variables mixed with those of the stdenvCross.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18534
											
										 
											2009-11-22 19:51:45 +00:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2013-06-22 13:58:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-27 16:33:24 +02:00
										 |  |  | makeCmakeFindLibs(){ | 
					
						
							| 
									
										
										
										
											2013-06-22 13:58:30 +02:00
										 |  |  |   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 | 
					
						
							| 
									
										
										
										
											2013-06-27 16:33:24 +02:00
										 |  |  | postHooks+=(makeCmakeFindLibs) |