diff options
author | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2009-11-22 19:51:45 +0000 |
---|---|---|
committer | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2009-11-22 19:51:45 +0000 |
commit | 585ba8c27f766a15abcab22c232170f6ae1cc0a9 (patch) | |
tree | 6b2411a130c9683b6696a63da584e56137029caf /pkgs/development | |
parent | 9dcff09187d5e41ed9bf4d841243a4bf6082c719 (diff) | |
download | nixlib-585ba8c27f766a15abcab22c232170f6ae1cc0a9.tar nixlib-585ba8c27f766a15abcab22c232170f6ae1cc0a9.tar.gz nixlib-585ba8c27f766a15abcab22c232170f6ae1cc0a9.tar.bz2 nixlib-585ba8c27f766a15abcab22c232170f6ae1cc0a9.tar.lz nixlib-585ba8c27f766a15abcab22c232170f6ae1cc0a9.tar.xz nixlib-585ba8c27f766a15abcab22c232170f6ae1cc0a9.tar.zst nixlib-585ba8c27f766a15abcab22c232170f6ae1cc0a9.zip |
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
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/compilers/gcc-4.3/builder.sh | 8 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc-4.3/default.nix | 2 | ||||
-rw-r--r-- | pkgs/development/interpreters/guile/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/libraries/glibc-2.9/default.nix | 9 | ||||
-rw-r--r-- | pkgs/development/libraries/physfs/default.nix | 2 | ||||
-rwxr-xr-x | pkgs/development/tools/build-managers/cmake/setup-hook.sh | 13 | ||||
-rw-r--r-- | pkgs/development/tools/misc/pkgconfig/setup-hook.sh | 6 |
7 files changed, 38 insertions, 17 deletions
diff --git a/pkgs/development/compilers/gcc-4.3/builder.sh b/pkgs/development/compilers/gcc-4.3/builder.sh index 69e2a0b137ea..6c3671bf7cbd 100644 --- a/pkgs/development/compilers/gcc-4.3/builder.sh +++ b/pkgs/development/compilers/gcc-4.3/builder.sh @@ -40,7 +40,7 @@ if test "$noSysDirs" = "1"; then export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i" done - if test -n "$crossConfig"; then + if test -n "$targetConfig"; then if test -z "$crossStageStatic"; then extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include" extraXLDFlags="-L${glibcCross}/lib" @@ -71,7 +71,7 @@ if test "$noSysDirs" = "1"; then ) fi - if test -n "$crossConfig" -a "$crossStageStatic" == 1; then + if test -n "$targetConfig" -a "$crossStageStatic" == 1; then # We don't want the gcc build to assume there will be a libc providing # limits.h in this stagae makeFlagsArray=( \ @@ -86,7 +86,7 @@ if test "$noSysDirs" = "1"; then fi fi -if test -n "$crossConfig"; then +if test -n "$targetConfig"; then # The host strip will destroy everything in the target binaries otherwise dontStrip=1 fi @@ -127,7 +127,7 @@ postInstall() { } -if test -z "$crossConfig"; then +if test -z "$targetConfig"; then if test -z "$profiledCompiler"; then buildFlags="bootstrap $buildFlags" else diff --git a/pkgs/development/compilers/gcc-4.3/default.nix b/pkgs/development/compilers/gcc-4.3/default.nix index 898d9b0b478a..efd058756b33 100644 --- a/pkgs/development/compilers/gcc-4.3/default.nix +++ b/pkgs/development/compilers/gcc-4.3/default.nix @@ -78,7 +78,7 @@ stdenv.mkDerivation ({ inherit noSysDirs profiledCompiler staticCompiler crossStageStatic binutilsCross glibcCross; - crossConfig = if (cross != null) then cross.config else null; + targetConfig = if (cross != null) then cross.config else null; buildInputs = [texinfo gmp mpfr] ++ (optionals langTreelang [bison flex]) diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix index 5be39a20f5a5..905e475aba27 100644 --- a/pkgs/development/interpreters/guile/default.nix +++ b/pkgs/development/interpreters/guile/default.nix @@ -9,19 +9,26 @@ stdenv.mkDerivation rec { }; buildNativeInputs = [ makeWrapper ]; - propagatedBuildInputs = [ libtool gmp ]; - propagatedBuildNativeInputs = [readline gawk]; + buildInputs = [ libtool ]; + propagatedBuildInputs = [ readline gmp libtool ]; + propagatedBuildNativeInputs = [ gawk ]; postInstall = '' wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" ''; - NIX_DEBUG=1; - preBuild = '' sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c ''; + # Guile needs patching to preset results for the configure tests + # about pthreads, which work only in native builds. + preConfigure = '' + if test -n "$crossConfig"; then + configureFlags="--with-threads=no $configureFlags" + fi + ''; + doCheck = true; setupHook = ./setup-hook.sh; diff --git a/pkgs/development/libraries/glibc-2.9/default.nix b/pkgs/development/libraries/glibc-2.9/default.nix index 98e281c19180..50dc51bdcb71 100644 --- a/pkgs/development/libraries/glibc-2.9/default.nix +++ b/pkgs/development/libraries/glibc-2.9/default.nix @@ -1,10 +1,11 @@ { stdenv, fetchurl, kernelHeaders , installLocales ? true , profilingLibraries ? false -, cross ? null , gccCross ? null }: - +let + cross = if gccCross != null then gccCross.target else null; +in stdenv.mkDerivation rec { name = "glibc-2.9" + stdenv.lib.optionalString (cross != null) "-${cross.config}"; @@ -67,8 +68,6 @@ stdenv.mkDerivation rec { "--with-headers=${kernelHeaders}/include" (if profilingLibraries then "--enable-profile" else "--disable-profile") ] ++ stdenv.lib.optionals (cross != null) [ - "--host=${cross.config}" - "--build=${stdenv.system}" "--with-tls" "--enable-kernel=2.6.0" "--without-fp" @@ -79,7 +78,7 @@ stdenv.mkDerivation rec { "--without-fp" ] else []); - buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ]; + buildNativeInputs = stdenv.lib.optionals (cross != null) [ gccCross ]; preInstall = '' ensureDir $out/lib diff --git a/pkgs/development/libraries/physfs/default.nix b/pkgs/development/libraries/physfs/default.nix index 3eb9a980c819..79ddf9cfe11a 100644 --- a/pkgs/development/libraries/physfs/default.nix +++ b/pkgs/development/libraries/physfs/default.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { sha256 = "072hqprni4vf4ax6b659s2xxrbz0y6iziarsczawbhi69m4azpyb"; }; - buildInputs = [ cmake ]; + buildNativeInputs = [ cmake ]; meta = { homepage = http://icculus.org/physfs/; diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh index 835b9000c68d..5fdd66aaace0 100755 --- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh +++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh @@ -32,6 +32,13 @@ cmakeConfigurePhase() cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags" fi + if test -n "$crossConfig"; then + # 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 + echo "cmake flags: $cmakeFlags ${cmakeFlagsArray[@]}" cmake ${cmakeDir:-.} $cmakeFlags ${cmakeFlagsArray[@]} @@ -43,4 +50,8 @@ if test -z "$dontUseCmakeConfigure"; then configurePhase=cmakeConfigurePhase fi -envHooks=(${envHooks[@]} addCMakeParams) +if test -n "$crossConfig"; then + crossEnvHooks=(${crossEnvHooks[@]} addCMakeParams) +else + envHooks=(${envHooks[@]} addCMakeParams) +fi diff --git a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh index ea592b36d11e..77a69fb18781 100644 --- a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh +++ b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh @@ -3,4 +3,8 @@ addPkgConfigPath () { addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig } -envHooks=(${envHooks[@]} addPkgConfigPath) +if test -n "$crossConfig"; then + crossEnvHooks=(${crossEnvHooks[@]} addPkgConfigPath) +else + envHooks=(${envHooks[@]} addPkgConfigPath) +fi |