From 17c3d4b04c2b02c790829bdd23ad1f2e646eea73 Mon Sep 17 00:00:00 2001 From: bbahnsen Date: Wed, 22 Nov 2006 18:45:04 +0000 Subject: [PATCH] Add a script to build a mingw64 compiler. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1997 6f19259b-4bc3-4df7-8a09-765794883524 --- Tools/gcc/mingw64-gcc-build | 163 +++++++++++++++++++++++++++++++++++ Tools/gcc/tianoCross-gcc-4.1 | 18 ++-- 2 files changed, 172 insertions(+), 9 deletions(-) create mode 100755 Tools/gcc/mingw64-gcc-build diff --git a/Tools/gcc/mingw64-gcc-build b/Tools/gcc/mingw64-gcc-build new file mode 100755 index 0000000000..9045080914 --- /dev/null +++ b/Tools/gcc/mingw64-gcc-build @@ -0,0 +1,163 @@ +#!/bin/bash + +# +# Build a mingw64 compiler for doing x64 compiles. +# + +### +### CYGWIN :: Make sure that cygwin is mouting its file systems in binmode. +### + +# +# Specify the architectures for which the tools are to be built +# +TARGS="${TARGS:-x86_64-pc-mingw64 }" + +# Let's be nice +renice 10 -p $$ + +# If any thing goes wrong, we'll bail out. +set -e + +# +# Specify the versions +# +GCC=gcc-4.1.1 +BINUTILS=binutils-2.17 +W32API=w32api-3.6 +# BINUTILS=binutils-2.16.91-20060119-1 +CYGWIN_SNAP=20060403 # You may need to find a more recent one. +export PATH=/bin:/usr/bin:/usr/local/bin + +# +# Where to install +# +# PREFIX="${PREFIX:-~/tiano/}" +PREFIX="${PREFIX:-/opt/tiano/}" + +# +# Where to get the GNU tools +# +BINUTILS_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/binutils/${BINUTILS}.tar.bz2 +GCC_URL=ftp://mirrors.kernel.org/gnu/gcc/$GCC/$GCC.tar.bz2 +CYG_LOC=http://cygwin.com/snapshots/cygwin-src-${CYGWIN_SNAP}.tar.bz2 +W32API_LOC=http://superb-west.dl.sourceforge.net/sourceforge/mingw/${W32API}-src.tar.gz +# export http_proxy=http://proxy.dp.intel.com:911 +# export ftp_proxy=http://proxy.dp.intel.com:911 + +# +# Uncomment one of the following depending upon which your system provides +# +#GET_COMMAND="curl --remote-name" +GET_COMMAND="wget -nc --no-directories --retr-symlinks " + +# +# Allow environment to override some programs +# +MAKE="${MAKE:-make}" +export MAKE +SHELL="${SHELL:-/bin/sh}" +export SHELL + +# +# Get the source +# If you don't have curl on your machine, try using +# wget --passive-ftp --no-directories --retr-symlinks <> +# If that doesn't work, try without the --passive-ftp option. +# +getSource() { + ${GET_COMMAND} "${BINUTILS_URL}" & + ${GET_COMMAND} "${GCC_URL}" & + ${GET_COMMAND} "${CYG_LOC}" & + ${GET_COMMAND} "${W32API_LOC}" & + wait +} + +# +# Unpack the source +# +unpackSource() { + (rm -rf "${BINUTILS}" + tar jxf "${BINUTILS}.tar.bz2" + ) & + + (rm -rf "${GCC}" + tar jxf "${GCC}.tar.bz2" + ) & + + (rm -rf cygwin-snapshot-${CYGWIN_SNAP}-1/ + tar jxf cygwin-src-${CYGWIN_SNAP}.tar.bz2 + ) & + + (rm -rf ${W32API} + tar zxf ${W32API}-src.tar.gz + ) & + + wait + + # Apply patches + (cd ${GCC}; patch -p1 < ../gcc_4.1.1.x86_64.061113.diff + ) + + (cd ${BINUTILS}; patch -p1 < ../binutils.diff + ) + + wait +} + +CONF_SHELL="${CONF_SHELL:-/bin/bash}" +# CONF_SHELL="${CONF_SHELL:-echo}" + +# +# Build +# +build() { + for targ in $TARGS + do ( + export pref=${PREFIX}${targ} + export PATH="${pref}/bin:$PATH" + + ( mkdir -p build-binutils-$targ + cd build-binutils-$targ + "${CONF_SHELL}" "../${BINUTILS}/configure" \ + --disable-nls "--target=${targ}" "--prefix=${pref}" + ${MAKE} -j1 -w all + ${MAKE} -w install + ) >> ${targ}.log 2>&1 + + ( + mkdir -p $pref/$targ/sys-include; + cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/newlib/libc/include/* $pref/$targ/sys-include + cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/winsup/cygwin/include/* $pref/$targ/sys-include + ) + + ( + mkdir -p $pref/$targ/include; + cp -fr ${W32API}/include/* $pref/$targ/sys-include; + ) + + ( mkdir -p build-gcc-$targ + cd build-gcc-$targ + "${CONF_SHELL}" "../${GCC}/configure" "--target=${targ}" "--prefix=${pref}" \ + --with-gnu-as --with-gnu-ld --without-headers --with-newlib --verbose \ + --disable-libssp \ + --disable-nls --enable-languages=c + ${MAKE} -j1 -w all + ${MAKE} -w install + ) >> ${targ}.log 2>&1 + ) & + done + + wait +} + + + +# +# Do everything +# +# Comment out any activities you wish to omit +# +getSource +unpackSource +build diff --git a/Tools/gcc/tianoCross-gcc-4.1 b/Tools/gcc/tianoCross-gcc-4.1 index 240c32632d..7dc8e41f9d 100644 --- a/Tools/gcc/tianoCross-gcc-4.1 +++ b/Tools/gcc/tianoCross-gcc-4.1 @@ -12,7 +12,7 @@ # Specify the architectures for which the tools are to be built # To build for single target: ARCHS="m68k" # -ARCHS="${ARCHS:-i386}" +ARCHS="${ARCHS:-x86_64}" # Let's be nice renice 10 -p $$ @@ -23,16 +23,16 @@ set -e # # Specify the versions # -GCC=gcc-4.1.0 -BINUTILS=binutils-2.16.1 +GCC=gcc-4.1.1 +BINUTILS=binutils-2.17 # BINUTILS=binutils-2.16.91-20060119-1 CYGWIN_SNAP=20060403 # You may need to find a more recent one. -export PATH=/bin:/usr/bin +export PATH=/bin:/usr/bin:/usr/local/bin # # Where to install # -PREFIX="${PREFIX:-/opt/tiano/}" +PREFIX="${PREFIX:-~/tiano/}" # # Where to get the GNU tools @@ -98,7 +98,7 @@ CONF_SHELL="${CONF_SHELL:-/bin/bash}" build() { for arch in $ARCHS do ( - export targ=${arch}-tiano-pe + export targ=${arch}-pc-mingw64 export pref=${PREFIX}${targ} export PATH="${pref}/bin:$PATH" @@ -106,7 +106,7 @@ build() { cd build-binutils-$targ "${CONF_SHELL}" "../${BINUTILS}/configure" \ --disable-nls "--target=${targ}" "--prefix=${pref}" - ${MAKE} -j1 -w all + ${MAKE} -j4 -w all ${MAKE} -w install ) >> ${targ}.log 2>&1 && @@ -138,6 +138,6 @@ build() { # # Comment out any activities you wish to omit # -getSource -unpackSource +# getSource +# unpackSource build -- 2.39.2