From e4941dea87cbbf24dbf82724ca962cafbf57c520 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Tue, 8 Jul 2025 14:16:40 +0200 Subject: [PATCH] Add xtchain.ps1 --- scripts/xtchain.ps1 | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scripts/xtchain.ps1 diff --git a/scripts/xtchain.ps1 b/scripts/xtchain.ps1 new file mode 100644 index 0000000..3e6c0dd --- /dev/null +++ b/scripts/xtchain.ps1 @@ -0,0 +1,47 @@ +# PROJECT: XTchain +# LICENSE: See the COPYING.md in the top level directory +# FILE: scripts/xtchain.ps1 +# DESCRIPTION: XTchain Entry Script +# DEVELOPERS: Aiken Harris + +# Get the absolute path to the XTchain +$XTCDIR = (Get-Item -Path ".\").FullName + +# Read the XTchain version +$env:XTCVER = Get-Content "${XTCDIR}\Version" + +# Load the library (Make sure the xtclib.ps1 file is PowerShell compatible) +. "${XTCDIR}\lib\xtchain\xtclib.ps1" + +# Set the target architecture +$env:TARGET = $args[0] +if (-not $env:TARGET) { $env:TARGET = "amd64" } + +# Save the source directory +$SRCDIR = $args[1] +if (-not $SRCDIR) { $SRCDIR = (Get-Location).Path } + +# Make sure the compiler flags are clean +$env:HOST = $null +$env:CFLAGS = $null +$env:CXXFLAGS = $null +$env:LDFLAGS = $null + +# Update PATH +$env:PATH = "${XTCDIR}\bin;" + $env:PATH + +# Display banner +version + +# Invoke shell with fancy prompt +function global:prompt { + $esc = [char]27 + $resetColor = "$esc[0m" + $pathColor = "$esc[1;34m" + $toolchainColor = "$esc[1;97;44m" + $toolchainText = "${toolchainColor} XT Toolchain " + $pathText = "${pathColor}$($PWD.ProviderPath) " + $arrow = "⮀" + "${toolchainText}$arrow$pathText$resetColor> " +} +Set-Location -Path $SRCDIR