Mooore tidy up work, some optimizations and removal of external functions by internal ones. raddr2line almost works. makex works.

svn path=/trunk/tools/RosBE/; revision=885
This commit is contained in:
Daniel Reimer 2008-11-18 15:16:16 +00:00
parent ef2a5ce299
commit 9b6b38c026
10 changed files with 88 additions and 103 deletions

View File

@ -42,7 +42,7 @@ if ($_ROSBE_STRIP -ne $null) {
# Small Security Check to prevent useless apps.
if ($ENV:ROS_LEAN_AND_MEAN -eq "yes") {
if ($ENV:ROS_BUILDNOSTRIP -eq "yes") {
cls
clear-host
"Selecting Stripping and removing Debug Symbols together will most likely cause useless apps. Please deselect one of them."
exit
}
@ -170,7 +170,7 @@ function BUILD {
function BUILDMULTI {
#
# Get the number of CPUs in the system so we know how many jobs to execute.
$CPUCOUNT= (gwmi win32_processor).numberofcores + 1
$CPUCOUNT = (gwmi win32_processor).numberofcores + 1
if ($_ROSBE_SHOWTIME -eq 1) {
[System.Diagnostics.Stopwatch] $sw;
@ -204,15 +204,12 @@ function BUILDMULTI {
#
# Check if we are using -j or not.
#
if ($args.count -gt 1) {
if ($args[0] -eq "multi") {
$host.ui.RawUI.WindowTitle = "makex $($args) parallel build started: $TIMERAW $ENV:ROS_ARCH"
}
if ($args[0] -eq "multi") {
$args.setvalue($null, 0)
$host.ui.RawUI.WindowTitle = "''makex $($args)'' parallel build started: $TIMERAW $ENV:ROS_ARCH"
BUILDMULTI $args
} else {
if ($args.count -gt 0) {
$host.ui.RawUI.WindowTitle = "make $($args) build started: $TIMERAW $ENV:ROS_ARCH"
}
$host.ui.RawUI.WindowTitle = "''make $($args)'' build started: $TIMERAW $ENV:ROS_ARCH"
BUILD $args
}
@ -230,6 +227,7 @@ if ($_ROSBE_VERSION -ne $null) {
#
$ENV:ROS_BUILDNOSTRIP = $null
$ENV:ROS_LEAN_AND_MEAN = $null
$ENV:CCACHE_DIR = $null
$ENV:HOST_CC = $null
$ENV:HOST_CPP = $null
$ENV:TARGET_CC = $null
@ -237,7 +235,8 @@ $ENV:TARGET_CPP = $null
$ENV:ROS_INTERMEDIATE = $null
$ENV:ROS_OUTPUT = $null
$ENV:ROS_TEMPORARY = $null
$ENV:CPUCOUNT = $null
$ENV:CCACHE_DIR = $null
$ENV:ROSA_DEL = $null
$ENV:ROSB_DEL = $null
$TIMERAW = $null
$DATENAME = $null
$TIMENAME = $null
$CPUCOUNT = $null
$sw = $null

View File

@ -47,7 +47,7 @@ function rembin {
"ERROR: There is no compiler output to clean."
}
}
if ($ENV:ROS_ARCH -eq "ppc") {
elseif ($ENV:ROS_ARCH -eq "ppc") {
if (Test-Path ".\obj-ppc") {
"Cleaning ReactOS PPC source directory..."
#
@ -67,7 +67,7 @@ function rembin {
"ERROR: There is no compiler output to clean."
}
}
if ($ENV:ROS_ARCH -eq "amd64") {
elseif ($ENV:ROS_ARCH -eq "amd64") {
if (Test-Path ".\obj-amd64") {
"Cleaning ReactOS x86_64 source directory..."
#
@ -87,7 +87,7 @@ function rembin {
"ERROR: There is no compiler output to clean."
}
}
if ($ENV:ROS_ARCH -eq $null) {
elseif ($ENV:ROS_ARCH -eq $null) {
if (Test-Path ".\obj-i386") {
"Cleaning ReactOS i386 source directory..."
#
@ -121,16 +121,16 @@ if ("$args" -eq "") {
rembin
end
}
if ("$args" -eq "logs") {
elseif ("$args" -eq "logs") {
remlog
end
}
if ("$args" -eq "all") {
elseif ("$args" -eq "all") {
rembin
remlog
end
}
if ("$args" -ne "") {
elseif ("$args" -ne "") {
"Unknown parameter specified. Try ''help [COMMAND]''."
end
}

View File

@ -25,13 +25,13 @@ if ($args[0] -eq "delete") {
$YESNO = Read-Host "(yes), (no)"
if ($YESNO -eq "yes") {
if (Test-Path ".\config.rbuild") {
del ".\config.rbuild"
remove-item ".\config.rbuild"
"Main Configuration File was found and deleted."
} else {
"Main Configuration File was not found in ReactOS Source Tree."
}
if (Test-Path "$ENV:APPDATA\RosBE\config.rbuild") {
del "$ENV:APPDATA\RosBE\config.rbuild"
remove-item "$ENV:APPDATA\RosBE\config.rbuild"
"Working Configuration File was found and deleted."
} else {
"Working Configuration File was not found in ReactOS Source Tree."
@ -45,9 +45,9 @@ elseif ($args[0] -eq "update") {
"Continue?"
$YESNO = Read-Host "(yes), (no)"
if ($YESNO -eq "yes") {
del "$_ROSBE_BASEDIR\*.rbuild"
del ".\config.rbuild"
copy ".\config.template.rbuild" "$ENV:APPDATA\RosBE\config.rbuild"
remove-item "$_ROSBE_BASEDIR\*.rbuild"
remove-item ".\config.rbuild"
copy-item ".\config.template.rbuild" "$ENV:APPDATA\RosBE\config.rbuild"
"Successfully Updated."
}
settitle
@ -61,7 +61,7 @@ elseif ($args[0] -ne $null) {
# Check if config.rbuild already exists. If not, get a working copy.
#
if (!(Test-Path "$ENV:APPDATA\RosBE\config.rbuild")) {
copy ".\config.template.rbuild" "$ENV:APPDATA\RosBE\config.rbuild"
copy-item ".\config.template.rbuild" "$ENV:APPDATA\RosBE\config.rbuild"
}
#
@ -76,7 +76,7 @@ if (!(Test-Path "$ENV:APPDATA\RosBE\config.rbuild")) {
$YESNO = Read-Host "(yes), (no)"
if ($YESNO -eq "no") {settitle}
if ($YESNO -ne "yes") {settitle}
#
# Check if config.template.rbuild is newer than config.rbuild, if it is then
@ -91,15 +91,15 @@ if (Test-Path ".\config.rbuild") {
"*** previously made settings. ***"
""
$YESNO = Read-Host "(yes), (no)"
if ($YESNO -eq "yes") {del "$ENV:APPDATA\RosBE\*.rbuild" | del ".\config.rbuild" | copy ".\config.template.rbuild" "$ENV:APPDATA\RosBE\config.rbuild"}
if ($YESNO -eq "no") {settitle}
if ($YESNO -eq "yes") {remove-item "$ENV:APPDATA\RosBE\*.rbuild" | remove-item ".\config.rbuild" | copy-item ".\config.template.rbuild" "$ENV:APPDATA\RosBE\config.rbuild"}
else {settitle}
}
}
#
# Prepare XML Parser.
#
[xml] $XML = type "$ENV:APPDATA\RosBE\config.rbuild"
[xml] $XML = get-content "$ENV:APPDATA\RosBE\config.rbuild"
#
# Start with reading settings from config.rbuild and let the user edit them.
@ -110,7 +110,7 @@ if (Test-Path ".\config.rbuild") {
$SARCH = $xml.group.property | ? { $_.Name -eq "SARCH" } | % { $_.Value}
"Right now: $SARCH"
$SARCH_CH = Read-Host "(), (xbox)"
cls
clear-host
"Which CPU ReactOS should be optimized for."
""
@ -129,7 +129,7 @@ $OARCH_CH = Read-Host
if ($OARCH_CH -eq $null) {
$OARCH_CH = $OARCH
}
cls
clear-host
"What level do you want ReactOS to be optimized at."
"This setting does not work if GDB is set."
@ -144,7 +144,7 @@ $OPTIMIZE_CH = Read-Host "(0), (1), (2), (3), (4), (5)"
if ($OPTIMIZE_CH -eq $null) {
$OPTIMIZE_CH = $OPTIMIZE
}
cls
clear-host
"Whether to compile in the integrated kernel debugger."
"Default is: 1"
@ -155,7 +155,7 @@ $KDBG_CH = Read-Host "(0), (1)"
if ($KDBG_CH -eq $null) {
$KDBG_CH = $KDBG
}
cls
clear-host
"Whether to compile for debugging. No compiler optimizations will be"
"performed."
@ -167,7 +167,7 @@ $DBG_CH = Read-Host "(0), (1)"
if ($KDBG_CH -eq $null) {
$DBG_CH = $DBG
}
cls
clear-host
"Whether to compile for debugging with GDB. If you don't use GDB,"
"don't enable this."
@ -179,7 +179,7 @@ $GDB_CH = Read-Host "(0), (1)"
if ($GDB_CH -eq $null) {
$GDB_CH = $GDB
}
cls
clear-host
"Whether to compile apps/libs with features covered software patents"
"or not. If you live in a country where software patents are"
@ -193,7 +193,7 @@ $NSWPAT_CH = Read-Host "(0), (1)"
if ($NSWPAT_CH -eq $null) {
$NSWPAT_CH = $NSWPAT
}
cls
clear-host
"Whether to compile with the KD protocol. This will disable support for"
"KDBG as well as rossym and symbol lookups, and allow WinDBG to connect"
@ -209,7 +209,7 @@ $WINKD_CH = Read-Host "(0), (1)"
if ($WINKD_CH -eq $null) {
$WINKD_CH = $WINKD
}
cls
clear-host
"Whether to compile support for ELF files. Do not enable unless you know what"
"you're doing."
@ -221,7 +221,7 @@ $ELF_CH = Read-Host "(0), (1)"
if ($ELF_CH -eq $null) {
$ELF_CH = $ELF
}
cls
clear-host
#
# Generate a config.rbuild, copy it to the Source Tree and delete temp files.
@ -236,7 +236,7 @@ $xml.group.property | ? { $_.Name -eq "NSWPAT" } | % { $_.Value = "$NSWPAT_CH"}
$xml.group.property | ? { $_.Name -eq "_WINKD_" } | % { $_.Value = "$WINKD_CH"}
$xml.group.property | ? { $_.Name -eq "_ELF_" } | % { $_.Value = "$ELF_CH"}
$xml.save("$ENV:APPDATA\RosBE\config.rbuild")
copy "$ENV:APPDATA\RosBE\config.rbuild" ".\config.rbuild"
copy-item "$ENV:APPDATA\RosBE\config.rbuild" ".\config.rbuild"
if ($_ROSBE_VERSION -ne $null) {
$host.ui.RawUI.WindowTitle = "ReactOS Build Environment $_ROSBE_VERSION"

View File

@ -15,7 +15,7 @@ if ($args -ne "") {
(Get-Host).UI.RawUI.ForegroundColor = "Green"
(Get-Host).UI.RawUI.BackgroundColor = "Black"
cls
clear-host
$ENV:PATH = "$ENV:SystemRoot\system32;$ENV:SystemRoot"
$global:0 = $myInvocation.MyCommand.Definition
$global:_ROSBE_BASEDIR = [System.IO.Path]::GetDirectoryName($0)
@ -32,13 +32,13 @@ $global:_ROSBE_TARGET_MINGWPATH = "$_ROSBE_BASEDIR\i386"
#
# Get the number of CPUs in the system so we know how many jobs to execute.
$CPUCOUNT= (gwmi win32_processor).numberofcores + 1
$CPUCOUNT = (gwmi win32_processor).numberofcores + 1
if (Test-Path "$_ROSBE_BASEDIR\chdefgcc.ps1") {
set-alias CHDEFGCC "$_ROSBE_BASEDIR\chdefgcc.ps1" -scope Global
}
set-alias MAKE "$_ROSBE_BASEDIR\Build.ps1" -scope Global
set-alias MAKEX "$_ROSBE_BASEDIR\Build.ps1 multi" -scope Global
function global:MAKEX {IEX "&'$_ROSBE_BASEDIR\Build.ps1' multi"}
if (Test-Path "$_ROSBE_BASEDIR\scut.ps1") {
set-alias SCUT "$_ROSBE_BASEDIR\scut.ps1" -scope Global
}

View File

@ -13,7 +13,7 @@
#
(Get-Host).UI.RawUI.ForegroundColor = "Green"
(Get-Host).UI.RawUI.BackgroundColor = "Black"
cls
clear-host
if ($ENV:APPDATA.Length -lt 1) {
$ENV:APPDATA = $ENV:USERPROFILE
@ -62,7 +62,7 @@ function RosBE {
function LoadAliases {
function global:BASEDIR {
cd "$_ROSBE_ROSSOURCEDIR"
set-location "$_ROSBE_ROSSOURCEDIR"
}
if (Test-Path "$_ROSBE_BASEDIR\chdefdir.ps1") {
set-alias CHDEFDIR "$_ROSBE_BASEDIR\chdefdir.ps1" -scope Global
@ -84,7 +84,7 @@ function LoadAliases {
set-alias HELP "$_ROSBE_BASEDIR\Help.ps1" -scope Global
set-alias MAKE "$_ROSBE_BASEDIR\Build.ps1" -scope Global
set-alias MAKEX "$_ROSBE_BASEDIR\Build.ps1 multi" -scope Global
function global:MAKEX($xargs) {IEX "&'$_ROSBE_BASEDIR\Build.ps1' multi $($xargs)"}
if (Test-Path "$_ROSBE_BASEDIR\reladdr2line.ps1") {
set-alias RADDR2LINE "$_ROSBE_BASEDIR\reladdr2line.ps1" -scope Global
@ -129,23 +129,23 @@ $host.ui.RawUI.WindowTitle = "ReactOS Build Environment $_ROSBE_VERSION"
#
if ($args.count -gt 0) {
if ($args -eq "oldmode") {
cls
clear-host
$_ROSBE_MODE = "MinGW"
}
elseif ($args -eq "arm") {
cls
clear-host
$_ROSBE_ARCH = 1
}
elseif ($args -eq "ppc") {
cls
clear-host
$_ROSBE_ARCH = 2
}
elseif ($args -eq "amd64") {
cls
clear-host
$_ROSBE_ARCH = 3
}
elseif ($args -ne $null) {
cls
clear-host
"Unknown parameter specified. Exiting."
exit
}

View File

@ -26,13 +26,13 @@ if ($args.count -eq 0) {
$_1 = $args
}
if ($_1 -eq "previous") {
popd
pop-location
} else {
if (!(Test-Path "$_1\.")) {
"ERROR: The path specified doesn't seem to exist."
}
pushd "$_1"
push-location "$_1"
}
$global:_ROSBE_ROSSOURCEDIR = "$pwd"

View File

@ -17,39 +17,30 @@ $host.ui.RawUI.WindowTitle = "reladdr2line..."
# sub-directories.
#
function CHECKPATH {
IEX "$ '&_ROSBE_BASEDIR\Tools\chkslash.exe' $_1"
if (errorlevel -eq 2) {
$_1 = dir /a:-d /s /b $_1 2>NUL | findstr "$_1"
}
}
#
# If Parameters were set, parse them, if not, ask the user to add them.
#
function INTERACTIVE {
if ($_1 -eq $null) {
$_1 = Read-Host "Please enter the path/file to be examined: "
CHECKPATH
}
if ($_2 -eq $null) {
$_2 = Read-Host "Please enter the address you would like to analyze: "
if ($_1.Contains("\")) {
$_1 = get-childitem "$_1\*" -name -recurse 2>NUL | select-string "$_1"
}
}
#
# Receive the Parameters and decide what to do.
#
if ($args[2] -ne $null) {
$_1 = $args[0]
$_2 = $args[1]
if ($args.length -bt 2) {
"ERROR: Too many parameters specified."
}
elseif ($args[0] -ne $null) {
$_1 = $args[0]
CHECKPATH
elseif ($args.length -lt 1) {
if ($_1 -eq $null) {
$_1 = Read-Host "Please enter the path/file to be examined: "
CHECKPATH
}
}
elseif ($args[1] -ne $null) {
$_2 = $args[1]
elseif ($args.length -lt 2) {
if ($_2 -eq $null) {
$_2 = Read-Host "Please enter the address you would like to analyze: "
}
}
INTERACTIVE
#
# First get the ImageBase of the File. If its smaller than the given
@ -63,12 +54,12 @@ if ($_1 -eq $null) {
if ($_2 -eq $null) {
"ERROR: You must specify a address to analyze."
}
$baseaddr = objdump -p $_1 2>NUL | findstr ImageBase
if ($i -lt $_2) {
$baseaddr = (objdump -p $_1 2>NUL | select-string "ImageBase")
if ($baseaddr -lt $_2) {
IEX "& '$_ROSBE_BASEDIR\Tools\raddr2line.exe' '$_1' '$_2'"
} else {
set /a baseaddr+=0x$_2
$relbase = IEX "'$_ROSBE_BASEDIR\Tools\echoh.exe' $baseaddr"
$baseaddr = $baseaddr + 0x$_2
$relbase = "{0:X}" -f $baseaddr
IEX "& '$_ROSBE_BASEDIR\Tools\raddr2line.exe' '$_1' '$relbase'"
}

View File

@ -47,20 +47,18 @@ if ($_ROSBE_ARCH -eq 3) {
$ENV:PATH = "$_ROSBE_HOST_MINGWPATH\bin;$_ROSBE_TARGET_MINGWPATH\bin;$_ROSBE_ORIGINALPATH"
$global:_ROSBE_MINGWMAKE = "$_ROSBE_HOST_MINGWPATH\bin\mingw32-make.exe"
if ($ENV:ROS_ARCH -ne $null) {
& "$ENV:ROS_PREFIX-gcc" -v 2> v.txt
$global:_ROSBE_GCCVERSION = (select-string -path .\v.txt "gcc version") -replace ".*version ((\d|\.)+).*",'$1'
$global:_ROSBE_GCCTARGET = (select-string -path .\v.txt "target=") -replace ".*--target=(.+?)\b.*",'$1'
rm v.txt
& "$ENV:ROS_PREFIX-gcc" -v 2> gcctvers.tmp
$global:_ROSBE_GCCVERSION = (select-string -path .\gcctvers.tmp "gcc version") -replace ".*version ((\d|\.)+).*",'$1'
$global:_ROSBE_GCCTARGET = (select-string -path .\gcctvers.tmp "target=") -replace ".*--target=(.+?)\b.*",'$1'
} else {
gcc -v 2> v.txt
$global:_ROSBE_GCCVERSION = (select-string -path .\v.txt "gcc version") -replace ".*version ((\d|\.)+).*",'$1'
$global:_ROSBE_GCCTARGET = (select-string -path .\v.txt "target=") -replace ".*--target=(.+?)\b.*",'$1'
rm v.txt
gcc -v 2> gcctvers.tmp
$global:_ROSBE_GCCVERSION = (select-string -path .\gcctvers.tmp "gcc version") -replace ".*version ((\d|\.)+).*",'$1'
$global:_ROSBE_GCCTARGET = (select-string -path .\gcctvers.tmp "target=") -replace ".*--target=(.+?)\b.*",'$1'
}
gcc -v 2> v.txt
$global:_ROSBE_HOST_GCCVERSION = (select-string -path .\v.txt "gcc version") -replace ".*version ((\d|\.)+).*",'$1'
$global:_ROSBE_HOST_GCCTARGET = (select-string -path .\v.txt "target=") -replace ".*--target=(.+?)\b.*",'$1'
rm v.txt
gcc -v 2> gcchvers.tmp
$global:_ROSBE_HOST_GCCVERSION = (select-string -path .\gcchvers.tmp "gcc version") -replace ".*version ((\d|\.)+).*",'$1'
$global:_ROSBE_HOST_GCCTARGET = (select-string -path .\gcchvers.tmp "target=") -replace ".*--target=(.+?)\b.*",'$1'
remove-item gcchvers.tmp
if ($_ROSBE_MODE -eq "MinGW") {
$ENV:C_INCLUDE_PATH = "$_ROSBE_HOST_MINGWPATH\include;$_ROSBE_HOST_MINGWPATH\lib\gcc\$_ROSBE_GCCTARGET\$_ROSBE_GCCVERSION\include"
@ -75,17 +73,14 @@ if ($_ROSBE_MODE -eq "MinGW") {
#
# Display the current version of GCC, NASM, ld and make.
#
(select-string -path .\gcctvers.tmp "gcc version") -replace ".*: (.+?)\b",'$1'
"gcc target - $_ROSBE_GCCTARGET"
remove-item gcctvers.tmp
if ($ENV:ROS_ARCH -ne $null) {
& "$_ROSBE_TARGET_MINGWPATH\bin\$ENV:ROS_PREFIX-gcc" -v 2> v.txt
(select-string -path .\v.txt "gcc version") -replace ".*: (.+?)\b",'$1'
rm v.txt
"gcc target - $_ROSBE_GCCTARGET"
& "$_ROSBE_TARGET_MINGWPATH\bin\$ENV:ROS_PREFIX-ld" -v
} else {
gcc -v 2> v.txt
(select-string -path .\v.txt "gcc version" ) -replace ".*: (.+?)\b",'$1'
rm v.txt
"gcc target - $_ROSBE_GCCTARGET"
& ld -v
}
if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\nasm.exe") {

View File

@ -59,7 +59,7 @@ elseif ($args[0] -eq "create") {
if (Test-Path ".svn\.") {
"ERROR: Folder already contains a repository."
} else {
$dir = dir
$dir = get-childitem
if ($dir -eq $null) {
IEX "&'$_ROSBE_BASEDIR\Tools\svn.exe' checkout svn://svn.reactos.org/reactos/trunk/reactos ."
} else {
@ -76,8 +76,8 @@ elseif ($args[0] -eq "status") {
$host.ui.RawUI.WindowTitle = "SVN Status"
"This might take a while, so please be patient."
""
$OFFSVN = IEX "&'$_ROSBE_BASEDIR\Tools\svn.exe' info" | findstr "Revision:"
$ONSVN = IEX "&'$_ROSBE_BASEDIR\Tools\svn.exe' info svn://svn.reactos.org/reactos/trunk/reactos" | findstr "Revision:"
$OFFSVN = IEX "&'$_ROSBE_BASEDIR\Tools\svn.exe' info" | select-string "Revision:"
$ONSVN = IEX "&'$_ROSBE_BASEDIR\Tools\svn.exe' info svn://svn.reactos.org/reactos/trunk/reactos" | select-string "Revision:"
UP
}

View File

@ -18,7 +18,7 @@ function parse($arg) {
if ($OUT -ne "Default") {
if (Test-Path "$OUT\.") {
cd $OUT
set-location $OUT
$_ROSBE_ROSSOURCEDIR = $OUT
}
}