forked from mirrors/nixpkgs
Making gcc-4.5 cross-build to mingw32 too (set by the proper config and libc = "msvcrt"
in the crossSystem) svn path=/nixpkgs/trunk/; revision=21630
This commit is contained in:
parent
3b2d0133f3
commit
c548c084bb
|
@ -56,7 +56,7 @@ if test "$noSysDirs" = "1"; then
|
|||
# gcj in.
|
||||
unset LIBRARY_PATH
|
||||
unset CPATH
|
||||
if test -z "$crossStageStatic"; then
|
||||
if test -z "$crossStageStatic" -o -n "$crossMingw"; then
|
||||
EXTRA_FLAGS_TARGET="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include"
|
||||
EXTRA_LDFLAGS_TARGET="-Wl,-L${libcCross}/lib"
|
||||
fi
|
||||
|
@ -123,6 +123,13 @@ preConfigure() {
|
|||
rm -Rf zlib
|
||||
fi
|
||||
|
||||
if test -n "$crossMingw" -a -n "$crossStageStatic"; then
|
||||
mkdir -p ../mingw
|
||||
# --with-build-sysroot expects that:
|
||||
cp -R $libcCross/include ../mingw
|
||||
configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
|
||||
fi
|
||||
|
||||
# Perform the build in a different directory.
|
||||
mkdir ../build
|
||||
cd ../build
|
||||
|
|
|
@ -68,13 +68,26 @@ let version = "4.5.0";
|
|||
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
|
||||
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
|
||||
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
|
||||
crossMingw = (cross != null && cross.libc == "msvcrt");
|
||||
|
||||
crossConfigureFlags =
|
||||
"--target=${cross.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
(if crossStageStatic then
|
||||
(if (crossMingw && crossStageStatic) then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
" --with-gnu-as" +
|
||||
" --with-gnu-ld" +
|
||||
" --with-gnu-ld" +
|
||||
" --disable-shared" +
|
||||
" --disable-nls" +
|
||||
" --disable-debug" +
|
||||
" --enable-sjlj-exceptions" +
|
||||
" --enable-threads=win32" +
|
||||
" --disable-win32-registry"
|
||||
else if crossStageStatic then
|
||||
" --disable-libssp --disable-nls" +
|
||||
" --without-headers" +
|
||||
" --disable-threads " +
|
||||
|
@ -86,9 +99,18 @@ let version = "4.5.0";
|
|||
" --with-headers=${libcCross}/include" +
|
||||
" --enable-__cxa_atexit" +
|
||||
" --enable-long-long" +
|
||||
" --enable-threads=posix" +
|
||||
" --enable-nls" +
|
||||
" --disable-decimal-float" # No final libdecnumber (it may work only in 386)
|
||||
(if crossMingw then
|
||||
" --enable-threads=win32" +
|
||||
" --enable-sjlj-exceptions" +
|
||||
" --enable-hash-synchronization" +
|
||||
" --enable-version-specific-runtime-libs" +
|
||||
" --disable-libssp" +
|
||||
" --disable-nls" +
|
||||
" --with-dwarf2"
|
||||
else
|
||||
" --enable-threads=posix" +
|
||||
" --enable-nls" +
|
||||
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
|
||||
);
|
||||
stageNameAddon = if (crossStageStatic) then "-stage-static" else
|
||||
"-stage-final";
|
||||
|
@ -110,7 +132,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
|
||||
patches =
|
||||
[ ]
|
||||
[ ./libstdc++-target.patch ]
|
||||
++ optional noSysDirs ./no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
|
@ -119,7 +141,7 @@ stdenv.mkDerivation ({
|
|||
++ optional (cross != null && cross.arch == "sparc64") ./pr41818.patch;
|
||||
|
||||
inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic
|
||||
libcCross;
|
||||
libcCross crossMingw;
|
||||
|
||||
buildInputs = [ texinfo gmp mpfr mpc libelf gettext which ]
|
||||
++ (optional (ppl != null) ppl)
|
||||
|
@ -227,6 +249,10 @@ stdenv.mkDerivation ({
|
|||
platforms = stdenv.lib.platforms.linux ++ optionals (langAda == false) [ "i686-darwin" ];
|
||||
};
|
||||
}
|
||||
// (if cross != null && cross.libc == "msvcrt" && crossStageStatic then rec {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
} else {})
|
||||
// (if langVhdl then rec {
|
||||
name = "ghdl-0.29";
|
||||
|
||||
|
|
32
pkgs/development/compilers/gcc-4.5/libstdc++-target.patch
Normal file
32
pkgs/development/compilers/gcc-4.5/libstdc++-target.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
Patch to make the target libraries 'configure' scripts find the proper CPP.
|
||||
I noticed that building the mingw32 cross compiler.
|
||||
Looking at the build script for mingw in archlinux, I think that only nixos
|
||||
needs this patch. I don't know why.
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 93f66b6..d691917 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \
|
||||
AR="$(AR_FOR_TARGET)"; export AR; \
|
||||
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
|
||||
CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
|
||||
+ CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \
|
||||
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
|
||||
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
|
||||
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
|
||||
@@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \
|
||||
RAW_CXX_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
|
||||
- CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
NORMAL_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
- CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
# Where to find GMP
|
||||
HOST_GMPLIBS = @gmplibs@
|
13
pkgs/os-specific/windows/mingw-headers/default.nix
Normal file
13
pkgs/os-specific/windows/mingw-headers/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{stdenv, mingw_runtime_headers, w32api_headers}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "mingw-headers";
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
|
||||
installPhase = ''
|
||||
ensureDir $out/include
|
||||
cp -R ${mingw_runtime_headers}/include/* $out/include
|
||||
cp -R ${w32api_headers}/include/* $out/include
|
||||
'';
|
||||
}
|
29
pkgs/os-specific/windows/mingwrt/default.nix
Normal file
29
pkgs/os-specific/windows/mingwrt/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}:
|
||||
|
||||
let
|
||||
name = "mingwrt-3.18";
|
||||
in
|
||||
stdenv.mkDerivation (rec {
|
||||
inherit name;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/mingw/${name}-mingw32-src.tar.gz";
|
||||
sha256 = "0hmxgkxnf6an70g07gmyik46sw1qm204izh6sp923szddvypjjfy";
|
||||
};
|
||||
|
||||
} //
|
||||
(if onlyHeaders then {
|
||||
name = name + "-headers";
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
installPhase = ''
|
||||
ensureDir $out
|
||||
cp -R include $out
|
||||
'';
|
||||
} else {
|
||||
buildInputs = [ gccCross binutilsCross ];
|
||||
|
||||
crossConfig = gccCross.crossConfig;
|
||||
|
||||
dontStrip = true;
|
||||
})
|
||||
)
|
29
pkgs/os-specific/windows/w32api/default.nix
Normal file
29
pkgs/os-specific/windows/w32api/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}:
|
||||
|
||||
let
|
||||
name = "w32api-3.14";
|
||||
in
|
||||
stdenv.mkDerivation ({
|
||||
inherit name;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/mingw/${name}-mingw32-src.tar.gz";
|
||||
sha256 = "128ax8a4dlspxsi5fi7bi1aslppqx3kczr1ibzj1z1az48bvwp21";
|
||||
};
|
||||
|
||||
} //
|
||||
(if onlyHeaders then {
|
||||
name = name + "-headers";
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
installPhase = ''
|
||||
ensureDir $out
|
||||
cp -R include $out
|
||||
'';
|
||||
} else {
|
||||
buildInputs = [ gccCross binutilsCross ];
|
||||
|
||||
crossConfig = gccCross.crossConfig;
|
||||
|
||||
dontStrip = true;
|
||||
})
|
||||
)
|
|
@ -2066,17 +2066,29 @@ let
|
|||
cross = assert crossSystem != null; crossSystem;
|
||||
});
|
||||
|
||||
gcc_realCross = gcc44_realCross;
|
||||
gcc_realCross = gcc45_realCross;
|
||||
|
||||
gccCrossStageStatic = wrapGCCCross {
|
||||
gcc = forceBuildDrv (lib.addMetaAttrs { platforms = []; } (
|
||||
gcc_realCross.override {
|
||||
crossStageStatic = true;
|
||||
langCC = false;
|
||||
libcCross = null;
|
||||
enableShared = true;
|
||||
}));
|
||||
libc = null;
|
||||
gccCrossStageStatic = let
|
||||
isMingw = (stdenv.cross.libc == "msvcrt");
|
||||
libcCross1 = if isMingw then mingw_headers1 else null;
|
||||
in
|
||||
wrapGCCCross {
|
||||
gcc = forceBuildDrv (lib.addMetaAttrs { platforms = []; } (
|
||||
gcc_realCross.override {
|
||||
crossStageStatic = true;
|
||||
langCC = false;
|
||||
libcCross = libcCross1;
|
||||
enableShared = false;
|
||||
}));
|
||||
libc = libcCross1;
|
||||
binutils = binutilsCross;
|
||||
cross = assert crossSystem != null; crossSystem;
|
||||
};
|
||||
|
||||
# Only needed for mingw builds
|
||||
gccCrossMingw2 = wrapGCCCross {
|
||||
gcc = gccCrossStageStatic.gcc;
|
||||
libc = mingw_headers2;
|
||||
binutils = binutilsCross;
|
||||
cross = assert crossSystem != null; crossSystem;
|
||||
};
|
||||
|
@ -3884,6 +3896,7 @@ let
|
|||
# We can choose:
|
||||
libcCrossChooser = name : if (name == "glibc") then glibcCross
|
||||
else if (name == "uclibc") then uclibcCross
|
||||
else if (name == "msvcrt") then mingw_headers3
|
||||
else throw "Unknown libc";
|
||||
|
||||
libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc;
|
||||
|
@ -6690,6 +6703,41 @@ let
|
|||
inherit ncurses;
|
||||
};
|
||||
|
||||
w32api = makeOverridable (import ../os-specific/windows/w32api) {
|
||||
inherit fetchurl stdenv;
|
||||
gccCross = gccCrossStageStatic;
|
||||
binutilsCross = binutilsCross;
|
||||
};
|
||||
|
||||
w32api_headers = w32api.override {
|
||||
onlyHeaders = true;
|
||||
};
|
||||
|
||||
mingw_runtime = makeOverridable (import ../os-specific/windows/mingwrt) {
|
||||
inherit fetchurl stdenv;
|
||||
gccCross = gccCrossMingw2;
|
||||
binutilsCross = binutilsCross;
|
||||
};
|
||||
|
||||
mingw_runtime_headers = mingw_runtime.override {
|
||||
onlyHeaders = true;
|
||||
};
|
||||
|
||||
mingw_headers1 = buildEnv {
|
||||
name = "mingw-headers-1";
|
||||
paths = [ w32api_headers mingw_runtime_headers ];
|
||||
};
|
||||
|
||||
mingw_headers2 = buildEnv {
|
||||
name = "mingw-headers-2";
|
||||
paths = [ w32api mingw_runtime_headers ];
|
||||
};
|
||||
|
||||
mingw_headers3 = buildEnv {
|
||||
name = "mingw-headers-3";
|
||||
paths = [ w32api mingw_runtime ];
|
||||
};
|
||||
|
||||
wesnoth = import ../games/wesnoth {
|
||||
inherit fetchurl stdenv SDL SDL_image SDL_mixer SDL_net SDL_ttf
|
||||
gettext zlib boost freetype libpng pkgconfig;
|
||||
|
|
Loading…
Reference in a new issue