Author: cfinck
Date: Tue Nov 3 23:51:09 2009
New Revision: 43943
URL:
http://svn.reactos.org/svn/reactos?rev=43943&view=rev
Log:
- Rename the toolchain packages for RosBE-Windows to the more appropriate names
"rosbe_1.4" and "rosbe_1.5".
Packages for them can be downloaded from
http://svn.reactos.org/RosBE-Sources.
- Use "setuplibrary.sh" for the current "buildtoolchain.sh" script and
share as much code as possible between this file and RosBE-Unix'
"RosBE-Builder.sh".
- Add a new parameter to this script for specifying the work/output directory.
- Add the cpucount tool to speed up the build process.
Added:
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.4/
- copied from r43940, trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/gcc_4.1.3/
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/
- copied from r43940, trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/gcc_4.4.2/
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/scripts/ (with props)
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/scripts/setuplibrary.sh
- copied unchanged from r43940,
trunk/tools/RosBE/RosBE-Unix/Base-i386/scripts/setuplibrary.sh
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/tools/
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/tools/cpucount.c
- copied unchanged from r43895, trunk/tools/RosBE/Tools/cpucount.c
Removed:
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/gcc_4.1.3/
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/gcc_4.4.2/
Modified:
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.4/buildtoolchain.sh
trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/buildtoolchain.sh
Modified: trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.4/buildtoolchain.sh
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Buildtoo…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.4/buildtoolchain.sh
[iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.4/buildtoolchain.sh
[iso-8859-1] Tue Nov 3 23:51:09 2009
@@ -7,6 +7,8 @@
# Released under GNU GPL v2 or any later version.
##################################################################################
+# Package "rosbe_1.4"
+#
# This script was built for the following toolchain versions:
# - binutils v2.19.51-20090127 (snapshot)
# patched with:
@@ -20,7 +22,7 @@
# - w32api 3.10
#
# These versions are used in RosBE-Windows 1.4.2-1.4.5 and RosBE-Unix 1.4-1.4.2.
-# Get the toolchain packages from one of these RosBE-Unix versions.
+# Get the toolchain packages from
http://svn.reactos.org/RosBE-Sources/rosbe_1.4
##################################################################################
#
@@ -80,7 +82,7 @@
# Entry point
#
echo "buildtoolchain - Build a binutils/GCC/mingw-runtime/w32api toolchain for
Windows"
-echo "Script for gcc_4.1.3 (see script header for details)"
+echo "Script for rosbe_1.4 (see script header for details)"
echo "by Colin Finck <colin(a)reactos.org>"
echo
Modified: trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/buildtoolchain.sh
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Buildtoo…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/buildtoolchain.sh
[iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/buildtoolchain.sh
[iso-8859-1] Tue Nov 3 23:51:09 2009
@@ -7,6 +7,8 @@
# Released under GNU GPL v2 or any later version.
########################################################################################################################
+# Package "rosbe_1.5"
+#
# This script was built for the following toolchain versions:
# - binutils 2.20.51-20091017 (snapshot)
# - gcc 4.4.2
@@ -17,121 +19,39 @@
# - mpfr 2.4.2-rc1
# - w32api 3.13
#
-# These tools were compiled under MSYS with "gcc version 3.4.5 (mingw-vista special
r3)"
+# These tools have to be compiled under MSYS with "gcc version 3.4.5 (mingw-vista
special r3)"
#
# These versions are used in RosBE-Windows 1.5 and RosBE-Unix 1.5.
-# Get the toolchain packages from this RosBE-Unix version.
+# Get the toolchain packages from
http://svn.reactos.org/RosBE-Sources/rosbe_1.5
########################################################################################################################
-#
-# Constants
-#
-WORKDIR="/c/buildtoolchain"
-
-HOST_CFLAGS="-pipe -fno-common -O3 -march=pentium3 -mfpmath=sse"
+# RosBE Setup Variables
+rs_host_cflags="-pipe -fno-common -O3 -march=pentium3 -mfpmath=sse"
+rs_needed_tools="bison flex gcc g++ grep makeinfo" # GNU Make has a
special check
+rs_target="mingw32"
+rs_target_cflags="-pipe -gstabs+ -O3 -march=pentium -mtune=i686"
+
+# Get the absolute path to the script directory
+cd `dirname $0`
+rs_scriptdir="$PWD"
+
+# buildtoolchain Constants
HOST_GCC_VERSION="gcc version 3.4.5 (mingw-vista special r3)"
-INSTALLDIR="$WORKDIR/mingw"
-NEEDED_TOOLS="bison flex gcc g++ grep make makeinfo"
-SUPPORTDIR="$WORKDIR/support"
+MODULES="w32api mingw_runtime gmp mpfr binutils gcc"
SYSHEADERDIR="/mingw/include"
-TARGET="mingw32"
-TARGET_CFLAGS="-pipe -gstabs+ -O3 -march=pentium -mtune=i686"
-
-
-#
-# Functions
-#
-boldmsg()
-{
- echo -e $2 "\e[1m$1\e[0m"
-}
-
-greenmsg()
-{
- echo -e $2 "\e[32m$1\e[0m"
-}
-
-redmsg()
-{
- echo -e $2 "\e[31m$1\e[0m"
-}
-
-check_run()
-{
- if [ $? -ne 0 ]; then
- redmsg "FAILED"
- echo "Please take a look at the log file \"$WORKDIR/build.log\""
- echo "Aborted!"
- exit 1
- else
- greenmsg "OK"
- rm "$WORKDIR/build.log"
- fi
-}
-
-mkdir_if_not_exists()
-{
- if ! [ -d "$1" ]; then
- mkdir -p "$1"
- fi
-}
-
-mkdir_empty()
-{
- if [ -d "$1" ]; then
- rm -rf "$1"
- fi
-
- mkdir -p "$1"
-}
-
-prepare_module()
-{
- # Check if the module shall be built and extract it then
- process_it=$1
- module=$2
-
- if [ "$process_it" = "0" ]; then
- return 1
- fi
-
- cd "$WORKDIR"
- rm -rf "$module"
- rm -rf "$module-build"
-
- echo -n "Extracting $module... "
- tar -xjf "$source_path/$module.tar.bz2" >& build.log
- check_run
-
- mkdir "$module-build"
- cd "$module-build"
-
- return 0
-}
-
-do_command()
-{
- echo -n "Running \"$*\"... "
- $* >& "$WORKDIR/build.log"
- check_run
-}
-
-clean_module()
-{
- echo "Cleaning up $1..."
- cd "$WORKDIR"
- rm -rf "$1-build"
- rm -rf "$1"
-}
-
-
-#
-# Entry point
-#
-echo "buildtoolchain - Build a binutils/GCC/mingw-runtime/w32api toolchain for
Windows"
-echo "Script for gcc_4.4.2 (see script header for details)"
-echo "by Colin Finck <colin(a)reactos.org>"
+
+source "$rs_scriptdir/scripts/setuplibrary.sh"
+
+
+echo
"*******************************************************************************"
+echo "* Buildtoolchain script for the ReactOS Build Environment for Windows
*"
+echo "* Package \"rosbe_1.5\"
*"
+echo "* by Colin Finck <colin(a)reactos.org>
*"
+echo
"*******************************************************************************"
+
+echo
+echo "This script builds a binutils/GCC/mingw-runtime/w32api toolchain for
Windows."
echo
if [ "`uname -o`" != "Msys" ]; then
@@ -140,10 +60,18 @@
fi
# We don't want too less parameters
-if [ "$1" == "" ]; then
- echo "Syntax: ./buildtoolchain.sh <sources> [w32api] [mingw-runtime] [gmp]
[mpfr] [binutils] [gcc]"
+if [ "$2" == "" ]; then
+ echo -n "Syntax: ./buildtoolchain.sh <sources> <workdir>"
+
+ for module in $MODULES; do
+ echo -n " [$module]"
+ done
+
+ echo
echo
echo " sources - Path to the directory containing RosBE-Unix toolchain packages
(.tar.bz2 files)"
+ echo " workdir - Path to the directory used for building. Will contain the final
executables and"
+ echo " temporary files."
echo
echo "The rest of the arguments are optional. You specify them if you want to
prevent a component"
echo "from being (re)built. Do this by passing 0 as the argument of the appropriate
component."
@@ -152,48 +80,16 @@
exit 1
fi
-# Get the absolute path to the script directory
-cd `dirname $0`
-SCRIPTDIR="$PWD"
-
-# Find out whether the script directory contains spaces
-case "$SCRIPTDIR" in
-*" "*)
- redmsg "The script directory \"$SCRIPTDIR\" contains spaces!"
- redmsg "Therefore some build tools cannot be compiled properly."
- echo
- redmsg "Please move \"$SCRIPTDIR\" to a directory, which does not contain
spaces."
-
- exit 1;;
-esac
-
-# Check if all necessary tools exist
-boldmsg "Checking for the needed tools..."
-
-toolmissing=false
-for tool in $NEEDED_TOOLS; do
- echo -n "Checking for $tool... "
-
- if which "$tool" >& /dev/null; then
- greenmsg "OK"
- else
- redmsg "MISSING"
- toolmissing=true
- fi
-done
+rs_check_requirements
# Check for the correct GCC version
echo -n "Checking for the correct GCC version... "
if gcc -v 2>&1 | grep "$HOST_GCC_VERSION" >& /dev/null; then
- greenmsg "OK"
+ rs_greenmsg "OK"
else
- redmsg "MISSING"
- toolmissing=true
-fi
-
-if $toolmissing; then
- echo "At least one needed tool is missing, aborted!"
+ rs_redmsg "MISSING"
+ echo "Correct GCC version is missing, aborted!"
exit 1
fi
@@ -201,93 +97,111 @@
# Get the absolute path to the source directory
cd "$1"
-source_path="$PWD"
-
-# Create all necessary directories
-mkdir_if_not_exists "$INSTALLDIR/$TARGET"
-mkdir_empty "$SYSHEADERDIR"
-mkdir_if_not_exists "$SUPPORTDIR"
-
-# Process each module
-boldmsg "Building..."
-
-
-if [ "$2" != "0" ]; then
- echo -n "Extracting w32api... "
-
- cd "$INSTALLDIR/$TARGET"
- tar -xjf "$source_path/w32api.tar.bz2" >&
"$WORKDIR/build.log"
- check_run
-fi
-
-if prepare_module "$3" "mingw-runtime"; then
- export CFLAGS="$TARGET_CFLAGS"
- export C_INCLUDE_PATH="$INSTALLDIR/$TARGET/include"
-
- do_command ../mingw-runtime/configure --prefix="$INSTALLDIR/$TARGET"
--host="$TARGET" --build="$TARGET"
- do_command make
- do_command make install
+rs_sourcedir="$PWD"
+shift
+
+# As the work directory might not yet exist, we cannot "cd" here
+rs_workdir="$1"
+shift
+
+rs_prefixdir="$rs_workdir/mingw"
+rs_supportprefixdir="$rs_workdir/support"
+
+# Set the rs_process_* variables based on the parameters
+for module in $MODULES; do
+ if [ "$1" = "0" ]; then
+ eval "rs_process_$module=false"
+ else
+ eval "rs_process_$module=true"
+ fi
+
+ shift
+done
+
+rs_mkdir_empty "$SYSHEADERDIR"
+
+
+##### BEGIN almost shared buildtoolchain/RosBE-Unix building part #############
+rs_boldmsg "Building..."
+
+rs_mkdir_if_not_exists "$rs_prefixdir/$rs_target"
+rs_mkdir_if_not_exists "$rs_supportprefixdir"
+
+rs_extract_module "w32api" "$rs_prefixdir/$rs_target"
+
+rs_do_command gcc -s -o "$rs_supportprefixdir/cpucount.exe"
"$rs_scriptdir/tools/cpucount.c"
+rs_cpucount=`$rs_supportprefixdir/cpucount.exe -x1`
+
+if rs_prepare_module "mingw_runtime"; then
+ export CFLAGS="$rs_target_cflags"
+ export C_INCLUDE_PATH="$rs_prefixdir/$rs_target/include"
+
+ rs_do_command ../mingw_runtime/configure --prefix="$rs_prefixdir/$rs_target"
--host="$rs_target" --build="$rs_target"
+ rs_do_command $rs_makecmd -j $rs_cpucount
+ rs_do_command $rs_makecmd install
# libmingwex.a of the MinGW Runtime 3.15 and later references to _get_output_format,
which is exported by msvcr80.dll and later.
# For older Runtime DLLs (such as the msvcrt.dll we primarily use for ReactOS), MinGW
adds a _get_output_format function returning 0 to libmsvcrt.a.
# As we use MinGW's libmingwex.a, but our own libmsvcrt.a, linking to MinGW's
libmingwex.a will fail by default. Therefore we have to create an archive for the
compiled
# _get_output_format stub, copy it to our "lib" directory and include it when
linking to libmingwex.a.
ar r ofmt_stub.a ofmt_stub.o >& /dev/null
- cp ofmt_stub.a "$INSTALLDIR/$TARGET/lib"
-
- clean_module mingw-runtime
-
+ cp ofmt_stub.a "$rs_prefixdir/$rs_target/lib"
+
+ rs_clean_module "mingw_runtime"
+
+ # The "mingw_runtime_dev" package needed for RosBE-Unix is manually created
from the result of this build.
+
export CFLAGS=""
export C_INCLUDE_PATH=""
fi
-if prepare_module "$4" "gmp"; then
- export CFLAGS="$HOST_CFLAGS"
-
- do_command ../gmp/configure ABI=32 --prefix="$SUPPORTDIR"
--host="$TARGET" --build="$TARGET" --disable-shared
- do_command make
- do_command make check
- do_command make install
- clean_module gmp
-
- export CFLAGS=""
-fi
-
-if prepare_module "$5" "mpfr"; then
- export CFLAGS="$HOST_CFLAGS"
-
- do_command ../mpfr/configure --prefix="$SUPPORTDIR" --host="$TARGET"
--build="$TARGET" --with-gmp="$SUPPORTDIR" --disable-shared
- do_command make
- do_command make check
- do_command make install
- clean_module mpfr
-
- export CFLAGS=""
-fi
-
-if prepare_module "$6" "binutils"; then
- export CFLAGS="$HOST_CFLAGS"
-
- do_command ../binutils/configure --prefix="$INSTALLDIR"
--host="$TARGET" --build="$TARGET" --target="$TARGET"
--disable-nls
- do_command make
- do_command make install
- clean_module binutils
-
- export CFLAGS=""
-fi
-
-if prepare_module "$7" "gcc"; then
- export STAGE1_CFLAGS="$HOST_CFLAGS"
- export BOOT_CFLAGS="$HOST_CFLAGS"
- export CFLAGS_FOR_TARGET="$TARGET_CFLAGS"
- export CXXFLAGS_FOR_TARGET="$TARGET_CFLAGS"
- export C_INCLUDE_PATH="$INSTALLDIR/$TARGET/include"
- export LIBRARY_PATH="$INSTALLDIR/$TARGET/lib"
-
- do_command ../gcc/configure --prefix="$INSTALLDIR" --host="$TARGET"
--build="$TARGET" --target="$TARGET"
--with-gmp="$SUPPORTDIR" --with-mpfr="$SUPPORTDIR"
--enable-languages=c,c++ --enable-checking=release --enable-version-specific-runtime-libs
--enable-threads=win32 --disable-win32-registry --disable-shared --disable-nls
- do_command make profiledbootstrap
- do_command make install
- clean_module gcc
+if rs_prepare_module "gmp"; then
+ export CFLAGS="$rs_host_cflags"
+
+ rs_do_command ../gmp/configure ABI=32 --prefix="$rs_supportprefixdir"
--host="$rs_target" --build="$rs_target" --disable-shared
+ rs_do_command $rs_makecmd -j $rs_cpucount
+ rs_do_command $rs_makecmd check
+ rs_do_command $rs_makecmd install
+ rs_clean_module "gmp"
+
+ export CFLAGS=""
+fi
+
+if rs_prepare_module "mpfr"; then
+ export CFLAGS="$rs_host_cflags"
+
+ rs_do_command ../mpfr/configure --prefix="$rs_supportprefixdir"
--host="$rs_target" --build="$rs_target"
--with-gmp="$rs_supportprefixdir" --disable-shared
+ rs_do_command $rs_makecmd -j $rs_cpucount
+ rs_do_command $rs_makecmd check
+ rs_do_command $rs_makecmd install
+ rs_clean_module "mpfr"
+
+ export CFLAGS=""
+fi
+
+if rs_prepare_module "binutils"; then
+ export CFLAGS="$rs_host_cflags"
+
+ rs_do_command ../binutils/configure --prefix="$rs_prefixdir"
--host="$rs_target" --build="$rs_target"
--target="$rs_target" --disable-nls
+ rs_do_command $rs_makecmd -j $rs_cpucount
+ rs_do_command $rs_makecmd install
+ rs_clean_module "binutils"
+
+ export CFLAGS=""
+fi
+
+if rs_prepare_module "gcc"; then
+ export STAGE1_CFLAGS="$rs_host_cflags"
+ export BOOT_CFLAGS="$rs_host_cflags"
+ export CFLAGS_FOR_TARGET="$rs_target_cflags"
+ export CXXFLAGS_FOR_TARGET="$rs_target_cflags"
+ export C_INCLUDE_PATH="$rs_prefixdir/$rs_target/include"
+ export LIBRARY_PATH="$rs_prefixdir/$rs_target/lib"
+
+ rs_do_command ../gcc/configure --prefix="$rs_prefixdir"
--host="$rs_target" --build="$rs_target"
--target="$rs_target" --with-gmp="$rs_supportprefixdir"
--with-mpfr="$rs_supportprefixdir" --enable-languages=c,c++
--enable-checking=release --enable-version-specific-runtime-libs --enable-threads=win32
--disable-win32-registry --disable-shared --disable-nls
+ rs_do_command $rs_makecmd profiledbootstrap
+ rs_do_command $rs_makecmd install
+ rs_clean_module "gcc"
export STAGE1_CFLAGS=""
export BOOT_CFLAGS=""
@@ -297,20 +211,21 @@
export LIBRARY_PATH=""
fi
-
# Final actions
echo
-boldmsg "Final actions"
-cd "$INSTALLDIR"
+rs_boldmsg "Final actions"
+cd "$rs_prefixdir"
echo "Removing unneeded files..."
-rm -rf $TARGET/bin $TARGET/doc $TARGET/share include info man share
+rm -rf $rs_target/bin $rs_target/doc $rs_target/share include info man share
rm -f lib/* >& /dev/null
-rm -f bin/c++.exe bin/gccbug bin/$TARGET-*
+rm -f bin/c++.exe bin/gccbug bin/$rs_target-*
echo "Removing debugging symbols..."
-find -name "*.exe" -type f -exec strip -s {} ";"
+find -executable -type f -exec strip -s {} ";" >& /dev/null
find -name "*.a" -type f -exec strip -d {} ";"
find -name "*.o" -type f -exec strip -d {} ";"
+##### END almost shared buildtoolchain/RosBE-Unix building part ###############
+
echo "Finished!"
Propchange: trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/scripts/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Tue Nov 3 23:51:09 2009
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/scripts/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/tools/RosBE/RosBE-Windows/Buildtoolchain/rosbe_1.5/scripts/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%