Author: dreimer Date: Tue Apr 29 13:41:31 2008 New Revision: 33192
URL: http://svn.reactos.org/svn/reactos?rev=33192&view=rev Log: Start of a PowerShell Port of RosBE. Right now it does not do anything useful, because my DOSKEY Replacement function does not set the aliases global and I dont have any idea how to correct this right now.
Added: trunk/tools/RosBE/RosBE-Windows/Powershell/ trunk/tools/RosBE/RosBE-Windows/Powershell/Build.ps1 (with props) trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 (with props) trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 (with props)
Added: trunk/tools/RosBE/RosBE-Windows/Powershell/Build.ps1 URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershel... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/Build.ps1 (added) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/Build.ps1 [iso-8859-1] Tue Apr 29 13:41:31 2008 @@ -1,0 +1,175 @@ +# +# PROJECT: RosBE - ReactOS Build Environment for Windows +# LICENSE: GNU General Public License v2. (see LICENSE.txt) +# FILE: Root/Build.cmd +# PURPOSE: Perform the build of ReactOS. +# COPYRIGHT: Copyright 2007 Daniel Reimer reimer.daniel@freenet.de +# Colin Finck mail@colinfinck.de +# Peter Ward dralnix@gmail.com +# +# + +# +# Check if config.template.rbuild is newer than config.rbuild, if it is then +# abort the build and inform the user. +# +if exist .\config.rbuild ( + "%_ROSBE_BASEDIR%\Tools\chknewer.exe" .\config.template.rbuild .\config.rbuild + if !errorlevel! == 1 ( + echo. + echo *** config.template.rbuild is newer than config.rbuild *** + echo *** aborting build. Please check for changes and *** + echo *** update your config.rbuild. *** + echo. + endlocal + goto :EOC + ) +) + +# +# Check if strip or ccache are being used and set the appropriate options. +# +if defined _ROSBE_STRIP ( + if %_ROSBE_STRIP% == 1 ( + set ROS_LEAN_AND_MEAN=yes + ) else ( + set ROS_LEAN_AND_MEAN=no + ) +) +if defined _ROSBE_USECCACHE ( + if %_ROSBE_USECCACHE% == 1 ( + set CCACHE_DIR=%APPDATA%\RosBE.ccache + set HOST_CC=ccache gcc + set HOST_CPP=ccache g++ + set TARGET_CC=ccache gcc + set TARGET_CPP=ccache g++ + ) else ( + set HOST_CC=gcc + set HOST_CPP=g++ + set TARGET_CC=gcc + set TARGET_CPP=g++ + ) +) + +# +# Check if the user has chosen to use a different object or output path +# and set it accordingly. +# +if defined _ROSBE_OBJPATH ( + if not exist "%_ROSBE_OBJPATH%." ( + echo ERROR: The path specified doesn't seem to exist. + goto :EOC + ) else ( + set ROS_INTERMEDIATE=%_ROSBE_OBJPATH% + ) +) +if defined _ROSBE_OUTPATH ( + if not exist "%_ROSBE_OUTPATH%." ( + echo ERROR: The path specified doesn't seem to exist. + goto :EOC + ) else ( + set ROS_OUTPUT=%_ROSBE_OUTPATH% + set ROS_TEMPORARY=%_ROSBE_OUTPATH% + ) +) + +# +# Get the current date and time for use in in our build log's file name. +# +call "%_ROSBE_BASEDIR%\TimeDate.cmd" + +# +# Check if writing logs is enabled, if so check if our log directory +# exists, if it doesn't, create it. +# +if %_ROSBE_WRITELOG% == 1 ( + if not exist "%_ROSBE_LOGDIR%." ( + mkdir "%_ROSBE_LOGDIR%" 1> NUL 2> NUL + ) +) + +# +# Check if we are using -j or not. +# +if "%1" == "multi" ( + if not "%2" == "" ( + title 'makex %2' parallel build started: %TIMERAW% + ) else ( + title 'makex' parallel build started: %TIMERAW% + ) + call :BUILDMULTI %* +) else ( + if not "%1" == "" ( + title 'make %1' build started: %TIMERAW% + ) else ( + title 'make' build started: %TIMERAW% + ) + call :BUILD %* +) +goto :EOC + +:BUILD + if %_ROSBE_SHOWTIME% == 1 ( + if %_ROSBE_WRITELOG% == 1 ( + "%_ROSBE_BASEDIR%\Tools\buildtime.exe" "%_ROSBE_MINGWMAKE%" %* 2>&1 | "%_ROSBE_BASEDIR%\Tools\tee.exe" "%_ROSBE_LOGDIR%\BuildLog-%_ROSBE_GCCVERSION%-%DATENAME%-%TIMENAME%.txt" + ) else ( + "%_ROSBE_BASEDIR%\Tools\buildtime.exe" "%_ROSBE_MINGWMAKE%" %* + ) + ) else ( + if %_ROSBE_WRITELOG% == 1 ( + "%_ROSBE_MINGWMAKE%" %* 2>&1 | "%_ROSBE_BASEDIR%\Tools\tee.exe" "%_ROSBE_LOGDIR%\BuildLog-%_ROSBE_GCCVERSION%-%DATENAME%-%TIMENAME%.txt" + ) else ( + "%_ROSBE_MINGWMAKE%" %* + ) + ) +goto :EOF + +:BUILDMULTI + # + # Get the number of CPUs in the system so we know how many jobs to execute. + # To modify the number used alter the options used with cpucount: + # No Option - Number of CPUs. + # -x1 - Number of CPUs, plus 1. + # -x2 - Number of CPUs, doubled. + # -a - Determine the cpu count based on the inherited process affinity mask. + # + for /f "usebackq" %%i in (`"%_ROSBE_BASEDIR%\Tools\cpucount.exe" -x1`) do set CPUCOUNT=%%i + + if %_ROSBE_SHOWTIME% == 1 ( + if %_ROSBE_WRITELOG% == 1 ( + "%_ROSBE_BASEDIR%\Tools\buildtime.exe" "%_ROSBE_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9 2>&1 | "%_ROSBE_BASEDIR%\Tools\tee.exe" "%_ROSBE_LOGDIR%\BuildLog-%_ROSBE_GCCVERSION%-%DATENAME%-%TIMENAME%.txt" + ) else ( + "%_ROSBE_BASEDIR%\Tools\buildtime.exe" "%_ROSBE_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9 + ) + ) else ( + if %_ROSBE_WRITELOG% == 1 ( + "%_ROSBE_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9 2>&1 | "%_ROSBE_BASEDIR%\Tools\tee.exe" "%_ROSBE_LOGDIR%\BuildLog-%_ROSBE_GCCVERSION%-%DATENAME%-%TIMENAME%.txt" + ) else ( + "%_ROSBE_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9 + ) + ) +goto :EOF + +:EOC +# +# Highlight the fact that building has ended. +# +"%_ROSBE_BASEDIR%\Tools\flash.exe" + +if defined _ROSBE_VERSION ( + title ReactOS Build Environment %_ROSBE_VERSION% +) + +# +# Unload all used Vars. +# +set ROS_LEAN_AND_MEAN= +set HOST_CC= +set HOST_CPP= +set TARGET_CC= +set TARGET_CPP= +set ROS_INTERMEDIATE= +set ROS_OUTPUT= +set ROS_TEMPORARY= +set CPUCOUNT= +set CCACHE_DIR=
Propchange: trunk/tools/RosBE/RosBE-Windows/Powershell/Build.ps1 ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershel... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 (added) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 [iso-8859-1] Tue Apr 29 13:41:31 2008 @@ -1,0 +1,168 @@ +# +# PROJECT: RosBE - ReactOS Build Environment for Windows +# LICENSE: GNU General Public License v2. (see LICENSE.txt) +# FILE: Root/RosBE.ps1 +# PURPOSE: This script provides/sets up various build environments for +# ReactOS. Currently it provides a GCC 4.1.3 build environment. +# COPYRIGHT: Copyright 2007 Daniel Reimer reimer.daniel@freenet.de +# Peter Ward dralnix@gmail.com +# +# + +# +# Set defaults to work with and override them if edited by +# the options utility. +# +(Get-Host).UI.RawUI.ForegroundColor = "Green" +(Get-Host).UI.RawUI.BackgroundColor = "Black" +cls +if ($APPDATA.Length -lt 1) {$APPDATA = $ENV:USERPROFILE} +$global:PATH = "$ENV:SystemRoot\system32;$ENV:SystemRoot" +$global:_ROSBE_VERSION = 1.2 +$global:_ROSBE_BASEDIR = "C:\Programme\RosBE" #NOCH FALSCH +$global:_ROSBE_MODE = "RosBE" +$global:_ROSBE_ROSSOURCEDIR = "$pwd" +$global:_ROSBE_ORIGINALPATH = "$PATH" +$global:_ROSBE_SHOWTIME = 1 +$global:_ROSBE_WRITELOG = 1 +$global:_ROSBE_USECCACHE = 0 +$global:_ROSBE_STRIP = 0 +$global:_ROSBE_MINGWPATH = "$_ROSBE_BASEDIR\4.1.3" +$global:_ROSBE_LOGDIR = "$_ROSBE_ROSSOURCEDIR\RosBE-Logs" +$global:_ROSBE_OBJPATH = $null +$global:_ROSBE_OUTPATH = $null + +# +# Display the banner and set up the environment for the GCC 4.x.x build +# environment. +# +function RosBE4 +{ +"*******************************************************************************" +"* *" +"* ReactOS Build Environment $_ROSBE_VERSION *" +"* *" +"*******************************************************************************" +"" +"" +(get-WmiObject Win32_OperatingSystem).caption +# +# Set the correct path for the build tools and set the MinGW make. +# +& "$_ROSBE_BASEDIR\rosbe-gcc-env.ps1" +} + +# +# Load the doskey macros and delete any macros for components +# that are not actually present. +# + +function LOADDOSKEYMACROS +{ +if (Test-Path "$_ROSBE_BASEDIR\chdefdir.ps1") { +set-alias CHDEFDIR "& $_ROSBE_BASEDIR\chdefdir.ps1" +} + +if (Test-Path "$_ROSBE_BASEDIR\chdefgcc.ps1") { +set-alias CHDEFGCC "& $_ROSBE_BASEDIR\chdefgcc.ps1" +} + +if (Test-Path "$_ROSBE_BASEDIR\charch.ps1") { +set-alias CHARCH "& $_ROSBE_BASEDIR\charch.ps1" +} + +set-alias CLEAN "& $_ROSBE_BASEDIR\Clean.ps1" + +if (Test-Path "$_ROSBE_BASEDIR\Config.ps1") { +set-alias CONFIG "& $_ROSBE_BASEDIR\Config.ps1" +} + +set-alias HELP "& $_ROSBE_BASEDIR\Help.ps1" +set-alias MAKE "& $_ROSBE_BASEDIR\Build.ps1" +set-alias MAKEX "& $_ROSBE_BASEDIR\Build.ps1 multi" + +if (Test-Path "$_ROSBE_BASEDIR\reladdr2line.ps1") { +set-alias RADDR2LINE "& $_ROSBE_BASEDIR\reladdr2line.ps1" +} + +if (Test-Path "$_ROSBE_BASEDIR\scut.ps1") { +set-alias SCUT "& $_ROSBE_BASEDIR\scut.ps1" +} + +if (Test-Path "$_ROSBE_BASEDIR\sSVN.ps1") { +set-alias SSVN "& $_ROSBE_BASEDIR\sSVN.ps1" +set-alias SVN "& $_ROSBE_BASEDIR\Tools\svn.exe" +} + +if (Test-Path "$_ROSBE_BASEDIR\options.ps1") { +set-alias OPTIONS "& $_ROSBE_BASEDIR\options.ps1" +} + +set-alias test "ddd" + +test +} + +# +# Check if RosBE data directory exists, if not, create it. +# +if (!(Test-Path "$APPDATA\RosBE")) {mkdir $APPDATA\RosBE} + +# +# Check if the user has used the options utility and +# if so, load their options. +# +if (Test-Path "$APPDATA\RosBE\rosbe-options.ps1") { +& "$APPDATA\RosBE\rosbe-options.ps1" +} + +$host.ui.RawUI.WindowTitle = "ReactOS Build Environment $_ROSBE_VERSION" + +# +# Check if we are using oldmode or if any unknown parameters +# were specified. +# +if ($args.count -gt 0) { +if ($args[0] = "oldmode") { +# cls + $_ROSBE_MODE = "MinGW" +} +} else { +# cls + "Unknown parameter specified. Exiting." +exit +} +RosBE4 +#cls + +# +# Load the base directory from srclist.txt and set it as the +# new source directory. +# +if (Test-Path "$_ROSBE_BASEDIR\scut.ps1") { +& "$_ROSBE_BASEDIR\scut.ps1" +} + +# +# Tell how to display the available commands. +# +"" +"For a list of all included commands, type: ""help""" +"-------------------------------------------------" +"" + +# +# Load the doskey macros that serve as our commands. +# +LOADDOSKEYMACROS + +# +# Look if the ReactOS source directory is empty. If so, +# inform the user and mention 'ssvn create' (only if ssvn is installed). +# +if (!(Test-Path "$_ROSBE_BASEDIR\sSVN.ps1")) { +# dir /b $_ROSBE_ROSSOURCEDIR 2>nul | findstr "." >nul + if ($errorlevel = 1) { + "No ReactOS source detected. Please use ""ssvn create"" to download it." + } +}
Propchange: trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershel... ============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 (added) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 [iso-8859-1] Tue Apr 29 13:41:31 2008 @@ -1,0 +1,67 @@ +# +# PROJECT: RosBE - ReactOS Build Environment for Windows +# LICENSE: GNU General Public License v2. (see LICENSE.txt) +# FILE: Root/rosbe-gcc-env.cmd +# PURPOSE: Set up the GCC 4.x.x build environment. +# COPYRIGHT: Copyright 2007 Daniel Reimer reimer.daniel@freenet.de +# Peter Ward dralnix@gmail.com +# +# + +# +# Check if we are running within the RosBE, and if not +# initialize GCC for the current directory. +# +if not defined _ROSBE_MINGWPATH ( + set _ROSBE_MODE=MinGW + set _ROSBE_MINGWPATH=%CD% + set _ROSBE_ORIGINALPATH=%PATH% +) + +# +# Set up the GCC 4.x.x build environment. +# +set PATH=%_ROSBE_MINGWPATH%\bin;%_ROSBE_ORIGINALPATH% +set _ROSBE_GCCVERSION= +set _ROSBE_GCCTARGET= +for /f "usebackq tokens=3" %%i in (`"gcc -v 2>&1 | find "gcc version""`) do set _ROSBE_GCCVERSION=%%i +for /f "usebackq tokens=2" %%i in (`"gcc -v 2>&1 | find "Target""`) do set _ROSBE_GCCTARGET=%%i +set PATH=%_ROSBE_MINGWPATH%\bin;%_ROSBE_MINGWPATH%\libexec\gcc%_ROSBE_GCCTARGET%%_ROSBE_GCCVERSION%;%_ROSBE_ORIGINALPATH% +set _ROSBE_MINGWMAKE=%_ROSBE_MINGWPATH%\bin\mingw32-make.exe +if "%_ROSBE_MODE%" == "MinGW" ( + set C_INCLUDE_PATH=%_ROSBE_MINGWPATH%\include;%_ROSBE_MINGWPATH%\lib\gcc%_ROSBE_GCCTARGET%%_ROSBE_GCCVERSION%\include + set CPLUS_INCLUDE_PATH=%_ROSBE_MINGWPATH%\include;%_ROSBE_MINGWPATH%\include\c++%_ROSBE_GCCVERSION%;%_ROSBE_MINGWPATH%\include\c++%_ROSBE_GCCVERSION%%_ROSBE_GCCTARGET%;%_ROSBE_MINGWPATH%\lib\gcc%_ROSBE_GCCTARGET%%_ROSBE_GCCVERSION%\include +) else ( + set HOST_CFLAGS=-I"%_ROSBE_MINGWPATH%\include" -I"%_ROSBE_MINGWPATH%\lib\gcc%_ROSBE_GCCTARGET%%_ROSBE_GCCVERSION%\include" + set HOST_CPPFLAGS=-I"%_ROSBE_MINGWPATH%\include" -I"%_ROSBE_MINGWPATH%\include\c++%_ROSBE_GCCVERSION%" -I"%_ROSBE_MINGWPATH%\include\c++%_ROSBE_GCCVERSION%%_ROSBE_GCCTARGET%" -I"%_ROSBE_MINGWPATH%\lib\gcc%_ROSBE_GCCTARGET%%_ROSBE_GCCVERSION%\include" +) +set LIBRARY_PATH=%_ROSBE_MINGWPATH%\lib;%_ROSBE_MINGWPATH%\lib\gcc%_ROSBE_GCCTARGET%%_ROSBE_GCCVERSION% + +# +# Display the current version of GCC, NASM, ld and make. +# +gcc -v 2>&1 | find "gcc version" +echo gcc target^: %_ROSBE_GCCTARGET% +ld -v +if exist "%_ROSBE_MINGWPATH%\bin\nasm.exe" ( + nasm -v +) else ( + if "%_ROSBE_MODE%" == "RosBE" ( + echo ERROR: NASM is required to build ReactOS, none found in the current MinGW/GCC. + ) +) +if exist "%_ROSBE_MINGWPATH%\bin\bison.exe" ( + bison --version | find "GNU Bison" +) else ( + if "%_ROSBE_MODE%" == "RosBE" ( + echo WARNING: Bison will soon be required to build ReactOS, none found in the current MinGW/GCC. + ) +) +if exist "%_ROSBE_MINGWPATH%\bin\flex.exe" ( + flex --version +) else ( + if "%_ROSBE_MODE%" == "RosBE" ( + echo WARNING: Flex will soon be required to build ReactOS, none found in the current MinGW/GCC. + ) +) +mingw32-make -v | find "GNU Make"
Propchange: trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 ------------------------------------------------------------------------------ svn:eol-style = native