mirror of
https://github.com/reactos/RosBE.git
synced 2024-10-07 00:43:20 +00:00
[ROSBE-WINDOWS] Sync Buildtoolchain with RosBE-Unix 2.2.1 changes
This commit is contained in:
parent
7e3c5fc15a
commit
6bafd0b433
@ -13,29 +13,30 @@
|
|||||||
# Package "rosbe_2.2"
|
# Package "rosbe_2.2"
|
||||||
#
|
#
|
||||||
# This script was built for the following toolchain versions:
|
# This script was built for the following toolchain versions:
|
||||||
# - Binutils 2.34
|
# * GNU Binutils v2.34
|
||||||
# - Bison 3.5.4
|
# * GCC, The GNU Compiler Collection v8.4.0
|
||||||
|
# * Bison 3.5.4
|
||||||
# patched with:
|
# patched with:
|
||||||
# * https://raw.githubusercontent.com/reactos/RosBE/master/Patches/bison-3.5-reactos-fix-win32-build.patch
|
# - https://raw.githubusercontent.com/reactos/RosBE/e87b00c8f8732ed3fa393b9b05a12093ae5942e8/Patches/bison-3.5-reactos-fix-win32-build.patch
|
||||||
# - CMake 3.17.1
|
# * CMake 3.17.2-ReactOS
|
||||||
# - GCC 8.4.0
|
# (revision 07c58033d74bad5466775fb2dad7d84494a846bd from https://github.com/reactos/CMake/tree/cmake-3.17.2-reactos)
|
||||||
# - GMP 6.2.0
|
# * GMP 6.2.0
|
||||||
# - Mingw-w64 6.0.0
|
# patched with:
|
||||||
# - MPC 1.1.0
|
# * https://raw.githubusercontent.com/reactos/RosBE/e87b00c8f8732ed3fa393b9b05a12093ae5942e8/Patches/GMP-6.2.0-C89-fixes.patch
|
||||||
# - MPFR 4.0.2
|
# * Mingw-w64 6.0.0
|
||||||
# - Ninja 1.10
|
# * MPC 1.1.0
|
||||||
|
# * MPFR 4.0.2
|
||||||
|
# * Ninja 1.10.0
|
||||||
#
|
#
|
||||||
# These tools have to be compiled using
|
# These tools have to be compiled using
|
||||||
# - http://repo.msys2.org/distrib/i686/msys2-i686-20190524.exe
|
# - http://repo.msys2.org/distrib/i686/msys2-i686-20190524.exe
|
||||||
# - https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z
|
# - https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z
|
||||||
#
|
#
|
||||||
# These versions are used in RosBE-Windows 2.2 and RosBE-Unix 2.2.
|
# These versions are used in RosBE-Windows 2.2.1 and RosBE-Unix 2.2.1.
|
||||||
# Get the toolchain packages from http://svn.reactos.org/RosBE-Sources/rosbe_2.2
|
# Get the toolchain packages from http://svn.reactos.org/RosBE-Sources/rosbe_2.2.1
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
# Hardcoded values for buildtoolchain/MSYS2
|
# Hardcoded values for buildtoolchain/MSYS2
|
||||||
CC=gcc
|
|
||||||
CXX=g++
|
|
||||||
rs_makecmd=make
|
rs_makecmd=make
|
||||||
|
|
||||||
# Ensure similar error messages on all platforms, especially when we parse them (e.g. for pacman).
|
# Ensure similar error messages on all platforms, especially when we parse them (e.g. for pacman).
|
||||||
@ -45,9 +46,19 @@ export LANG=C
|
|||||||
export MSYS=winsymlinks:nativestrict
|
export MSYS=winsymlinks:nativestrict
|
||||||
|
|
||||||
# RosBE Setup Variables
|
# RosBE Setup Variables
|
||||||
rs_needed_tools="as bzip2 find $CC $CXX grep help2man m4 makeinfo python re2c tar" # GNU Make has a special check
|
rs_host_cc="gcc"
|
||||||
|
rs_host_cflags="-pipe -O2 -g0 -march=core2"
|
||||||
|
rs_host_cxx="g++"
|
||||||
|
rs_host_cxxflags="$rs_host_cflags"
|
||||||
|
rs_needed_tools="as bzip2 find $CC $CXX grep help2man m4 makeinfo python tar" # GNU Make has a special check
|
||||||
rs_target="i686-w64-mingw32"
|
rs_target="i686-w64-mingw32"
|
||||||
rs_target_cflags="-pipe -O2 -Wl,-S -g0 -march=pentium -mtune=i686"
|
rs_target_cflags="-pipe -O2 -Wl,-S -g0 -march=pentium -mtune=i686"
|
||||||
|
rs_target_cxxflags="$rs_target_cflags"
|
||||||
|
|
||||||
|
export CC="$rs_host_cc"
|
||||||
|
export CFLAGS="$rs_host_cflags"
|
||||||
|
export CXX="$rs_host_cxx"
|
||||||
|
export CXXFLAGS="$rs_host_cxxflags"
|
||||||
|
|
||||||
# Get the absolute path to the script directory
|
# Get the absolute path to the script directory
|
||||||
cd `dirname $0`
|
cd `dirname $0`
|
||||||
@ -64,7 +75,7 @@ source "$rs_scriptdir/scripts/setuplibrary.sh"
|
|||||||
|
|
||||||
echo "*******************************************************************************"
|
echo "*******************************************************************************"
|
||||||
echo "* Buildtoolchain script for the ReactOS Build Environment for Windows *"
|
echo "* Buildtoolchain script for the ReactOS Build Environment for Windows *"
|
||||||
echo "* Package \"rosbe_2.2\" *"
|
echo "* Package \"rosbe_2.2.1\" *"
|
||||||
echo "* MinGW part *"
|
echo "* MinGW part *"
|
||||||
echo "* by Colin Finck <colin@reactos.org> *"
|
echo "* by Colin Finck <colin@reactos.org> *"
|
||||||
echo "*******************************************************************************"
|
echo "*******************************************************************************"
|
||||||
@ -102,7 +113,7 @@ fi
|
|||||||
|
|
||||||
# Install required tools in MSYS2
|
# Install required tools in MSYS2
|
||||||
rs_boldmsg "Running MSYS pacman..."
|
rs_boldmsg "Running MSYS pacman..."
|
||||||
pacman -S --quiet --noconfirm --needed diffutils help2man make msys2-runtime-devel python re2c texinfo tar | tee /tmp/buildtoolchain-pacman.log
|
pacman -S --quiet --noconfirm --needed diffutils help2man make msys2-runtime-devel python texinfo tar | tee /tmp/buildtoolchain-pacman.log
|
||||||
|
|
||||||
if grep installation /tmp/buildtoolchain-pacman.log >& /dev/null; then
|
if grep installation /tmp/buildtoolchain-pacman.log >& /dev/null; then
|
||||||
# See e.g. https://sourceforge.net/p/msys2/tickets/74/
|
# See e.g. https://sourceforge.net/p/msys2/tickets/74/
|
||||||
@ -158,24 +169,23 @@ for module in $MODULES; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rs_process_cpucount=true
|
||||||
|
|
||||||
|
|
||||||
##### BEGIN almost shared buildtoolchain/RosBE-Unix building part #############
|
##### BEGIN almost shared buildtoolchain/RosBE-Unix building part #############
|
||||||
rs_boldmsg "Building..."
|
rs_boldmsg "Building..."
|
||||||
|
|
||||||
rs_mkdir_if_not_exists "$rs_prefixdir/bin"
|
mkdir -p "$rs_prefixdir/bin"
|
||||||
rs_mkdir_if_not_exists "$rs_archprefixdir/$rs_target"
|
mkdir -p "$rs_archprefixdir/$rs_target"
|
||||||
|
|
||||||
CFLAGS="-pipe -O2 -Wl,-S -g0 -march=core2"
|
|
||||||
CXXFLAGS="-pipe -O2 -Wl,-S -g0 -march=core2"
|
|
||||||
|
|
||||||
export CFLAGS
|
|
||||||
export CXXFLAGS
|
|
||||||
echo
|
|
||||||
echo "Using CFLAGS=\"$CFLAGS\""
|
echo "Using CFLAGS=\"$CFLAGS\""
|
||||||
echo "Using CXXFLAGS=\"$CXXFLAGS\""
|
echo "Using CXXFLAGS=\"$CXXFLAGS\""
|
||||||
echo
|
echo
|
||||||
|
|
||||||
rs_do_command $CC -s -o "$rs_prefixdir/bin/cpucount.exe" "$rs_scriptdir/tools/cpucount.c"
|
if $rs_process_cpucount; then
|
||||||
|
rs_do_command $CC -s -o "$rs_prefixdir/bin/cpucount" "$rs_scriptdir/tools/cpucount.c"
|
||||||
|
fi
|
||||||
|
|
||||||
rs_cpucount=`$rs_prefixdir/bin/cpucount -x1`
|
rs_cpucount=`$rs_prefixdir/bin/cpucount -x1`
|
||||||
|
|
||||||
if rs_prepare_module "bison"; then
|
if rs_prepare_module "bison"; then
|
||||||
@ -216,48 +226,54 @@ if rs_prepare_module "gcc"; then
|
|||||||
|
|
||||||
cd ../gcc-build
|
cd ../gcc-build
|
||||||
|
|
||||||
export old_path=$PATH
|
|
||||||
export PATH="$PATH:$rs_archprefixdir/bin"
|
|
||||||
|
|
||||||
export CFLAGS_FOR_TARGET="$rs_target_cflags"
|
export CFLAGS_FOR_TARGET="$rs_target_cflags"
|
||||||
export CXXFLAGS_FOR_TARGET="$rs_target_cflags"
|
export CXXFLAGS_FOR_TARGET="$rs_target_cxxflags"
|
||||||
|
|
||||||
rs_do_command ../gcc/configure --prefix="$rs_archprefixdir" --host="$rs_target" --build="$rs_target" --target="$rs_target" --with-sysroot="$rs_archprefixdir" --with-pkgversion="RosBE-Windows" --enable-languages=c,c++ --enable-fully-dynamic-string --enable-checking=release --enable-version-specific-runtime-libs --enable-plugins --disable-shared --disable-multilib --disable-nls --disable-werror --disable-win32-registry --enable-sjlj-exceptions --disable-libstdcxx-verbose
|
rs_do_command ../gcc/configure --prefix="$rs_archprefixdir" --host="$rs_target" --build="$rs_target" --target="$rs_target" --with-sysroot="$rs_archprefixdir" --with-pkgversion="RosBE-Windows" --enable-languages=c,c++ --enable-fully-dynamic-string --disable-shared --disable-multilib --disable-nls --disable-werror --disable-win32-registry --enable-sjlj-exceptions --disable-libstdcxx-verbose
|
||||||
rs_do_command $rs_makecmd -j $rs_cpucount all-gcc
|
rs_do_command $rs_makecmd -j $rs_cpucount all-gcc
|
||||||
rs_do_command $rs_makecmd install-gcc
|
rs_do_command $rs_makecmd install-gcc
|
||||||
rs_do_command_can_fail $rs_makecmd install-lto-plugin
|
rs_do_command $rs_makecmd install-lto-plugin
|
||||||
|
|
||||||
if rs_prepare_module "mingw_w64"; then
|
if rs_prepare_module "mingw_w64"; then
|
||||||
rs_do_command ../mingw_w64/mingw-w64-crt/configure --prefix="$rs_archprefixdir/$rs_target" --host="$rs_target" --with-sysroot="$rs_archprefixdir/$rs_target"
|
export AR="$rs_archprefixdir/bin/ar"
|
||||||
|
export AS="$rs_archprefixdir/bin/as"
|
||||||
|
export CC="$rs_archprefixdir/bin/gcc"
|
||||||
|
export CFLAGS="$rs_target_cflags"
|
||||||
|
export CXX="$rs_archprefixdir/bin/g++"
|
||||||
|
export CXXFLAGS="$rs_target_cxxflags"
|
||||||
|
export DLLTOOL="$rs_archprefixdir/bin/dlltool"
|
||||||
|
export RANLIB="$rs_archprefixdir/bin/ranlib"
|
||||||
|
export STRIP="$rs_archprefixdir/bin/strip"
|
||||||
|
|
||||||
|
rs_do_command ../mingw_w64/mingw-w64-crt/configure --prefix="$rs_archprefixdir/$rs_target" --host="$rs_target" --with-sysroot="$rs_archprefixdir"
|
||||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||||
rs_do_command $rs_makecmd install
|
rs_do_command $rs_makecmd install
|
||||||
rs_clean_module "mingw_w64"
|
rs_clean_module "mingw_w64"
|
||||||
|
|
||||||
|
unset AR
|
||||||
|
unset AS
|
||||||
|
export CC="$rs_host_cc"
|
||||||
|
export CFLAGS="$rs_host_cflags"
|
||||||
|
export CXX="$rs_host_cxx"
|
||||||
|
export CXXFLAGS="$rs_host_cxxflags"
|
||||||
|
unset DLLTOOL
|
||||||
|
unset RANLIB
|
||||||
|
unset STRIP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$rs_workdir/gcc-build"
|
cd "$rs_workdir/gcc-build"
|
||||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||||
rs_do_command $rs_makecmd install
|
rs_do_command $rs_makecmd install
|
||||||
|
|
||||||
rs_clean_module "gcc"
|
rs_clean_module "gcc"
|
||||||
|
|
||||||
unset CFLAGS_FOR_TARGET
|
unset CFLAGS_FOR_TARGET
|
||||||
unset CXXFLAGS_FOR_TARGET
|
unset CXXFLAGS_FOR_TARGET
|
||||||
|
|
||||||
export PATH=$old_path
|
|
||||||
unset old_path
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if rs_prepare_module "ninja"; then
|
if rs_prepare_module "ninja"; then
|
||||||
export old_path=$PATH
|
rs_do_command ../ninja/configure.py --bootstrap --platform mingw
|
||||||
export PATH=".:$PATH"
|
|
||||||
|
|
||||||
rs_do_command cd ../ninja
|
|
||||||
rs_do_command ./configure.py --bootstrap --platform mingw
|
|
||||||
rs_do_command install ninja "$rs_prefixdir/bin"
|
rs_do_command install ninja "$rs_prefixdir/bin"
|
||||||
rs_clean_module "ninja"
|
rs_clean_module "ninja"
|
||||||
|
|
||||||
export PATH=$old_path
|
|
||||||
unset old_path
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Final actions
|
# Final actions
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Shared setup functions for RosBE-Windows' buildtoolchain and RosBE-Unix
|
# Shared setup functions for RosBE-Windows' buildtoolchain and RosBE-Unix
|
||||||
# Copyright 2009-2019 Colin Finck <colin@reactos.org>
|
# Copyright 2009-2020 Colin Finck <colin@reactos.org>
|
||||||
#
|
#
|
||||||
# Released under GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
# Released under GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -130,22 +130,15 @@ rs_check_requirements()
|
|||||||
# Check whether the previous command finished with errorlevel 0
|
# Check whether the previous command finished with errorlevel 0
|
||||||
# If it did so, print a green "OK" and delete the debug logfile for the command.
|
# If it did so, print a green "OK" and delete the debug logfile for the command.
|
||||||
# If that wasn't the case, print a red "FAILED" and give information about the debug logfile.
|
# If that wasn't the case, print a red "FAILED" and give information about the debug logfile.
|
||||||
# Parameter 1: Can fail, if set to 0, failure leads to process termination
|
|
||||||
rs_check_run()
|
rs_check_run()
|
||||||
{
|
{
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
if [ $1 -eq 0 ]; then
|
|
||||||
rs_redmsg "FAILED"
|
rs_redmsg "FAILED"
|
||||||
echo "Please take a look at the log file \"$rs_workdir/build.log\""
|
echo "Please take a look at the log file \"$rs_workdir/build.log\""
|
||||||
echo "If you did not do something wrong, please save the log file and contact the ReactOS Team."
|
echo "If you did not do something wrong, please save the log file and contact the ReactOS Team."
|
||||||
|
|
||||||
echo "Aborted!"
|
echo "Aborted!"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
rs_yellowmsg "ERRORS"
|
|
||||||
cat "$rs_workdir/build.log" >> "$rs_workdir/build-ignored.log"
|
|
||||||
rm "$rs_workdir/build.log"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
rs_greenmsg "OK"
|
rs_greenmsg "OK"
|
||||||
rm "$rs_workdir/build.log"
|
rm "$rs_workdir/build.log"
|
||||||
@ -169,17 +162,7 @@ rs_do_command()
|
|||||||
{
|
{
|
||||||
echo -n "Running \"$*\"... "
|
echo -n "Running \"$*\"... "
|
||||||
$* >& "$rs_workdir/build.log"
|
$* >& "$rs_workdir/build.log"
|
||||||
rs_check_run 0
|
rs_check_run
|
||||||
}
|
|
||||||
|
|
||||||
# Executes a building command and checks whether it succeeded.
|
|
||||||
# Doesn't terminate the building process in case of failure.
|
|
||||||
# Parameters: The command to execute including parameters
|
|
||||||
rs_do_command_can_fail()
|
|
||||||
{
|
|
||||||
echo -n "Running \"$*\"... "
|
|
||||||
$* >& "$rs_workdir/build.log"
|
|
||||||
rs_check_run 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks whether the given module needs to be processed and if so, extracts it.
|
# Checks whether the given module needs to be processed and if so, extracts it.
|
||||||
@ -218,26 +201,6 @@ rs_yellowmsg()
|
|||||||
echo -e $2 "\033[33m$1\033[0m"
|
echo -e $2 "\033[33m$1\033[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Creates the given directory if it does not exist and cleans it if it does.
|
|
||||||
# Parameter 1: The directory
|
|
||||||
rs_mkdir_empty()
|
|
||||||
{
|
|
||||||
if [ -d "$1" ]; then
|
|
||||||
rm -rf "$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Creates a directory if it does not exist.
|
|
||||||
# Parameter 1: The directory
|
|
||||||
rs_mkdir_if_not_exists()
|
|
||||||
{
|
|
||||||
if ! [ -d "$1" ]; then
|
|
||||||
mkdir -p "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Checks whether the given module needs to be processed and if so, extracts it into a dedicated build directory
|
# Checks whether the given module needs to be processed and if so, extracts it into a dedicated build directory
|
||||||
# Returns 0 if it needs to be built, otherwise 1.
|
# Returns 0 if it needs to be built, otherwise 1.
|
||||||
# Parameter 1: The module name
|
# Parameter 1: The module name
|
||||||
@ -267,33 +230,3 @@ rs_redmsg()
|
|||||||
echo -e $2 "\033[31m$1\033[0m"
|
echo -e $2 "\033[31m$1\033[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow a choice between several options
|
|
||||||
# If a valid choice was done, the result is stored in $choice
|
|
||||||
# Parameter 1 - The default value
|
|
||||||
# Parameter 2 - All possible values
|
|
||||||
rs_showchoice()
|
|
||||||
{
|
|
||||||
local default_value="$1"
|
|
||||||
local valid_choices="$2"
|
|
||||||
|
|
||||||
local breakloop=false
|
|
||||||
choice=""
|
|
||||||
|
|
||||||
while ! $breakloop; do
|
|
||||||
read -p "Your choice [$default_value]: " choice
|
|
||||||
|
|
||||||
if [ "$choice" = "" ]; then
|
|
||||||
choice="$default_value"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
for valid_choice in $valid_choices; do
|
|
||||||
if [ "$choice" = "$valid_choice" ]; then
|
|
||||||
breakloop=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user