aboutsummaryrefslogtreecommitdiffstats
path: root/dist
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2017-07-28 15:45:54 +0200
committerTristan Gingold <tgingold@free.fr>2017-07-29 08:39:30 +0200
commit06906cef13381eb8a021d0822b778df219b1f7b1 (patch)
tree8ad220372d6a022ee7d3cb2f1a28ed8532d5a9a1 /dist
parent59e5071d5eb9ba98fa0c2189e48359d416165b4d (diff)
downloadghdl-06906cef13381eb8a021d0822b778df219b1f7b1.tar.gz
ghdl-06906cef13381eb8a021d0822b778df219b1f7b1.tar.bz2
ghdl-06906cef13381eb8a021d0822b778df219b1f7b1.zip
Reworked and improved pre-compile scripts.
Added Intel FPGA support. Extended list of UVVM verification IPs.
Diffstat (limited to 'dist')
-rw-r--r--dist/windows/InstallerTemplate.ps1161
-rw-r--r--dist/windows/compile.ps1397
2 files changed, 321 insertions, 237 deletions
diff --git a/dist/windows/InstallerTemplate.ps1 b/dist/windows/InstallerTemplate.ps1
index af60009f2..54c1894a1 100644
--- a/dist/windows/InstallerTemplate.ps1
+++ b/dist/windows/InstallerTemplate.ps1
@@ -42,17 +42,22 @@
# PS> .\install.ps1 -Install
#
# # Advanced flow
-# PS> .\compile.ps1 -Install "C:\Tools\GHDL"
+# PS> .\compile.ps1 -AddToPath Machine -Install "C:\Tools\GHDL"
#
[CmdletBinding()]
Param(
# install all files into a directory (xcopy deployment)
[switch]$Install = $false,
- [parameter(mandatory=$false, ValueFromRemainingArguments=$true)]
- [string]$InstallDir = "",
+ [Parameter(Mandatory=$false, ValueFromRemainingArguments=$true)]
+ [String]$InstallDir = "",
# update files
[switch]$Update,
+ # register GHDL in PATH
+ [Parameter(Mandatory=$false)]
+ [ValidateSet("Machine", "User", "Session", "Remove", "Pass")]
+ [String]$AddToPath = "",
+
# display this help"
[switch]$Help
)
@@ -81,16 +86,6 @@ Write-Host "====================================================================
Write-Host "GHDL for Windows - GHDL install script" -ForegroundColor Magenta
Write-Host "================================================================================" -ForegroundColor Magenta
-if ($Help)
-{ Get-Help $MYINVOCATION.InvocationName -Detailed
- Exit-CompileScript
-}
-
-$EnvPath_ContainerMapping = @{
- Machine = [EnvironmentVariableTarget]::Machine
- User = [EnvironmentVariableTarget]::User
-}
-
function Exit-Script
{ [CmdletBinding()]
param(
@@ -100,6 +95,16 @@ function Exit-Script
exit $ExitCode
}
+if ($Help)
+{ Get-Help $MYINVOCATION.InvocationName -Detailed
+ Exit-Script
+}
+
+$EnvPath_ContainerMapping = @{
+ Machine = [EnvironmentVariableTarget]::Machine
+ User = [EnvironmentVariableTarget]::User
+}
+
# GitHub user: https://github.com/mkropat
# Gist account at GitHub: https://gist.github.com/mkropat
# Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
@@ -210,16 +215,30 @@ if ($Install)
Remove-Item $TempFilePath
- Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
- Write-Host "M" -NoNewline -ForegroundColor Cyan
- Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "u" -NoNewline -ForegroundColor Cyan
- Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "s" -NoNewline -ForegroundColor Cyan
- Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "n" -NoNewline -ForegroundColor Cyan
- Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan
- $InstallInPath = (Read-Host).ToLower()
+
+ if ($AddToPath -eq "")
+ { while($true)
+ { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "M" -NoNewline -ForegroundColor Cyan
+ Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "u" -NoNewline -ForegroundColor Cyan
+ Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "s" -NoNewline -ForegroundColor Cyan
+ Write-Host "ession]: " -NoNewline -ForegroundColor DarkCyan
+ $InstallInPath = (Read-Host).ToLower()
+ if ($InstallInPath -in "m","u","s")
+ { break }
+ else
+ { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red }
+ }
+ }
+ elseif ($AddToPath -eq "Machine")
+ { $InstallInPath = "m" }
+ elseif ($AddToPath -eq "User")
+ { $InstallInPath = "u" }
+ elseif ($AddToPath -eq "Session")
+ { $InstallInPath = "s" }
+
if (($InstallInPath -eq "") -or ($InstallInPath -eq "m"))
{ Write-Host " Adding GHDL to PATH at machine level."
Add-EnvPath -Path "$InstallPath\bin" -Container "Machine"
@@ -244,7 +263,12 @@ if ($Install)
} # Install
elseif ($Update)
{ Write-Host "Updating GHDL $GHDLVersion for Windows..."
- $InstallPath = $InstallDir.TrimEnd("\")
+ if ($InstallDir -eq "")
+ { $InstallPath = $DefaultInstallPath
+ }
+ else
+ { $InstallPath = $InstallDir }
+ $InstallPath = $InstallPath.TrimEnd("\")
Write-Host " Install directory: $InstallPath"
if (Test-Path -Path $InstallPath)
@@ -252,17 +276,6 @@ elseif ($Update)
Get-ChildItem -Path $InstallPath -Depth 0 | foreach { Remove-Item $_.FullName -Recurse -Force }
}
- Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow
- foreach ($container in @("Machine", "User"))
- { foreach ($entry in (Get-EnvPath -Container $container))
- { if ($entry.ToLower().Contains("ghdl"))
- { Write-Host " Removing '$entry' from $container level."
- Remove-EnvPath -Path $entry -Container $container
- }
- }
- }
- Remove-EnvPath -Path $entry -Container "Session"
-
Write-Host " Creating directory sub-directories in '$InstallPath' ..."
# writing ZIP file to disk
@@ -276,29 +289,63 @@ elseif ($Update)
Remove-Item $TempFilePath
- Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
- Write-Host "M" -NoNewline -ForegroundColor Cyan
- Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "u" -NoNewline -ForegroundColor Cyan
- Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "s" -NoNewline -ForegroundColor Cyan
- Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "n" -NoNewline -ForegroundColor Cyan
- Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan
- $InstallInPath = (Read-Host).ToLower()
- if (($InstallInPath -eq "") -or ($InstallInPath -eq "m"))
- { Write-Host " Adding GHDL to PATH at machine level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "Machine"
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
- }
- elseif ($InstallInPath -eq "u")
- { Write-Host " Adding GHDL to PATH at user level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "User"
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ if ($AddToPath -eq "")
+ { while($true)
+ { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "M" -NoNewline -ForegroundColor Cyan
+ Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "u" -NoNewline -ForegroundColor Cyan
+ Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "s" -NoNewline -ForegroundColor Cyan
+ Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "r" -NoNewline -ForegroundColor Cyan
+ Write-Host "emove/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "p" -NoNewline -ForegroundColor Cyan
+ Write-Host "ass]: " -NoNewline -ForegroundColor DarkCyan
+ $InstallInPath = (Read-Host).ToLower()
+ if ($InstallInPath -in "m","u","s","r","p")
+ { break }
+ else
+ { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red }
+ }
}
- elseif ($InstallInPath -eq "s")
- { Write-Host " Adding GHDL to PATH at session level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ elseif ($AddToPath -eq "Machine")
+ { $InstallInPath = "m" }
+ elseif ($AddToPath -eq "User")
+ { $InstallInPath = "u" }
+ elseif ($AddToPath -eq "Session")
+ { $InstallInPath = "s" }
+ elseif ($AddToPath -eq "Remove")
+ { $InstallInPath = "r" }
+ elseif ($AddToPath -eq "Pass")
+ { $InstallInPath = "p" }
+
+ if ($InstallInPath -ne "p")
+ { Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow
+ foreach ($container in @("Machine", "User"))
+ { foreach ($entry in (Get-EnvPath -Container $container))
+ { if ($entry.ToLower().Contains("ghdl"))
+ { Write-Host " Removing '$entry' from $container level."
+ Remove-EnvPath -Path $entry -Container $container
+ }
+ }
+ }
+ Remove-EnvPath -Path $entry -Container "Session"
+
+ if (($InstallInPath -eq "") -or ($InstallInPath -eq "m"))
+ { Write-Host " Adding GHDL to PATH at machine level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Machine"
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
+ elseif ($InstallInPath -eq "u")
+ { Write-Host " Adding GHDL to PATH at user level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "User"
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
+ elseif ($InstallInPath -eq "s")
+ { Write-Host " Adding GHDL to PATH at session level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
}
Write-Host
diff --git a/dist/windows/compile.ps1 b/dist/windows/compile.ps1
index f75729192..da3c67731 100644
--- a/dist/windows/compile.ps1
+++ b/dist/windows/compile.ps1
@@ -1,39 +1,39 @@
-# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
+# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
#
# ==============================================================================
-# Authors: Patrick Lehmann (ported batch file to PowerShell)
-# Brian Davis (contributions to the batch file)
-# Tristan Gingold (initial batch file for compilations on Windows)
+# Authors: Patrick Lehmann (ported batch file to PowerShell)
+# Brian Davis (contributions to the batch file)
+# Tristan Gingold (initial batch file for compilations on Windows)
#
-# PowerShell Script: Script to compile GHDL for Windows
+# PowerShell Script: Script to compile GHDL for Windows
#
# Description:
# ------------------------------------
-# This is a PowerShell script (executable) which:
-# - compiles GHDL and GHDLFilter
-# - analyses VHDL libraries
-# - installs GHDL into a directory (xcopy deploiment)
+# This is a PowerShell script (executable) which:
+# - compiles GHDL and GHDLFilter
+# - analyses VHDL libraries
+# - installs GHDL into a directory (xcopy deploiment)
#
# ==============================================================================
-# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
-# Copyright (C) 2015-2017 Patrick Lehmann
-#
-# GHDL is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 2, or (at your option) any later
-# version.
-#
-# GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GHDL; see the file COPYING. If not, write to the Free
-# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
+# Copyright (C) 2015-2017 Patrick Lehmann
+#
+# GHDL is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GHDL; see the file COPYING. If not, write to the Free
+# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
# ==============================================================================
# .SYNOPSIS
@@ -58,7 +58,7 @@
# PS> .\compile.ps1 -Uninstall
#
# # Create a Zip-file
-# PS>.\compile.ps1 -CreatePackage -Zip
+# PS>.\compile.ps1 -Package -Zip
#
[CmdletBinding()]
Param(
@@ -73,7 +73,7 @@ Param(
[switch]$Compile_Libraries,
# Create an installer package
- [switch]$CreatePackage,
+ [switch]$Package,
# Creates a zip-file for xcopy deployment
[switch]$Zip,
# Creates a self-extracting ps1-file for xcopy deployment
@@ -87,26 +87,28 @@ Param(
[switch]$Update,
# Uninstall all files from a directory
[switch]$Uninstall,
+
+ # register GHDL in PATH
+ [Parameter(Mandatory=$false)]
+ [ValidateSet("Machine", "User", "Session", "Remove", "Pass")]
+ [String]$AddToPath = "",
# Display this help"
[switch]$Help
)
# configure script here
-$RelPathToRoot = "..\.."
+$RelPathToRoot = "..\.."
# save parameters and current working directory
-$Script_ScriptDir = $PSScriptRoot
-$Script_WorkingDir = Get-Location
-$GHDLRootDir = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $RelPathToRoot))
+$Script_ScriptDir = $PSScriptRoot
+$Script_WorkingDir = Get-Location
+$GHDLRootDir = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $RelPathToRoot))
# set default values
-$Hosting = $true
-$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"]
-$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"]
-if ($EnableVerbose -eq $null) { $EnableVerbose = $false }
-if ($EnableDebug -eq $null) { $EnableDebug = $false }
-if ($EnableDebug -eq $true) { $EnableVerbose = $true }
+$Hosting = $true
+$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"]
+$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug
# load modules from GHDL's 'libraries' directory
Import-Module $PSScriptRoot\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList "$Script_WorkingDir", $Hosting
@@ -117,7 +119,7 @@ $Help = $Help -or (-not (
$All -or
$Clean -or $Clean_GHDL -or $Clean_Libraries -or $Clean_Package_Zip -or
$Compile -or $Compile_GHDL -or $Compile_Libraries -or
- $CreatePackage -or
+ $Package -or
$Install -or $Update -or $Uninstall
))
@@ -131,49 +133,49 @@ if ($Help)
}
if ($All)
-{ $Clean = $true
- $Compile = $true
- $CreatePackage = $true
+{ $Clean = $true
+ $Compile = $true
+ $Package = $true
}
if ($Clean)
-{ $Clean_GHDL = $true
- $Clean_Libraries = $true
- $Clean_Package_Zip = $true
+{ $Clean_GHDL = $true
+ $Clean_Libraries = $true
+ $Clean_Package_Zip = $true
}
if ($Compile)
-{ $Compile_GHDL = $true
- $Compile_Libraries = $true
+{ $Compile_GHDL = $true
+ $Compile_Libraries = $true
}
# configure some variables: paths, executables, directory names, ...
-$GHDLVersion = Get-GHDLVersion $GHDLRootDir
-$Backend = "mcode"
-$WindowsDirName = "dist\windows" #\$Backend"
-$BuildDirectoryName = "build"
-$BuildBackendDirectoryName = "$BuildDirectoryName\$Backend"
-$VHDLLibrariesDirectoryName = "lib"
-$PackageDirectoryName = "build\zip\$Backend"
-$ZipPackageFileName = "ghdl-$Backend-$GHDLVersion.zip"
-$PS1PackageFileName = "ghdl-$Backend-$GHDLVersion.installer.ps1"
-$InstallerTemplateFileName = "InstallerTemplate.ps1"
-$DefaultInstallPath = "C:\Program Files (x86)\GHDL" # This is the default path for 32-bit applications (x86-32)
+$GHDLVersion = Get-GHDLVersion $GHDLRootDir
+$Backend = "mcode"
+$WindowsDirName = "dist\windows" #\$Backend"
+$BuildDirectoryName = "build"
+$BuildBackendDirectoryName = "$BuildDirectoryName\$Backend"
+$VHDLLibrariesDirectoryName = "lib"
+$PackageDirectoryName = "build\zip\$Backend"
+$ZipPackageFileName = "ghdl-$Backend-$GHDLVersion.zip"
+$PS1PackageFileName = "ghdl-$Backend-$GHDLVersion.installer.ps1"
+$InstallerTemplateFileName = "InstallerTemplate.ps1"
+$DefaultInstallPath = "C:\Program Files (x86)\GHDL" # This is the default path for 32-bit applications (x86-32)
# construct directories
-$GHDLWindowsDir = "$GHDLRootDir\$WindowsDirName"
-$GHDLBuildDir = "$GHDLRootDir\$BuildBackendDirectoryName"
-$GHDLVendorLibraryDir = "$GHDLRootDir\libraries\vendors"
-$GHDLCompiledLibraryDir = "$GHDLRootDir\$BuildBackendDirectoryName\$VHDLLibrariesDirectoryName"
-$GHDLZipPackageDir = "$GHDLRootDir\$PackageDirectoryName"
-$GHDLZipPackageFile = "$GHDLZipPackageDir\$ZipPackageFileName"
-$InstallerTemplateFile = "$GHDLWindowsDir\$InstallerTemplateFileName"
-$GHDLPS1PackageFile = "$GHDLZipPackageDir\$PS1PackageFileName"
+$GHDLWindowsDir = "$GHDLRootDir\$WindowsDirName"
+$GHDLBuildDir = "$GHDLRootDir\$BuildBackendDirectoryName"
+$GHDLVendorLibraryDir = "$GHDLRootDir\libraries\vendors"
+$GHDLCompiledLibraryDir = "$GHDLRootDir\$BuildBackendDirectoryName\$VHDLLibrariesDirectoryName"
+$GHDLZipPackageDir = "$GHDLRootDir\$PackageDirectoryName"
+$GHDLZipPackageFile = "$GHDLZipPackageDir\$ZipPackageFileName"
+$InstallerTemplateFile = "$GHDLWindowsDir\$InstallerTemplateFileName"
+$GHDLPS1PackageFile = "$GHDLZipPackageDir\$PS1PackageFileName"
# construct files
-$InstallDirFile = "$BuildDirectoryName\InstallDir.conf"
+$InstallDirFile = "$BuildDirectoryName\InstallDir.conf"
$EnvPath_ContainerMapping = @{
- Machine = [EnvironmentVariableTarget]::Machine
- User = [EnvironmentVariableTarget]::User
+ Machine = [EnvironmentVariableTarget]::Machine
+ User = [EnvironmentVariableTarget]::User
}
function Exit-Script
@@ -183,8 +185,8 @@ function Exit-Script
)
cd $Script_WorkingDir
# unload modules
- Remove-Module shared -Verbose:$false -Debug:$false
- Remove-Module targets -Verbose:$false -Debug:$false
+ Remove-Module shared -Verbose:$false -Debug:$false
+ Remove-Module targets -Verbose:$false -Debug:$false
exit $ExitCode
}
@@ -201,8 +203,8 @@ function Add-EnvPath
)
if ($Container -ne "Session")
- { $containerType = $EnvPath_ContainerMapping[$Container]
- $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";"
+ { $containerType = $EnvPath_ContainerMapping[$Container]
+ $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";"
if ($persistedPaths -notcontains $Path)
{ $persistedPaths = $persistedPaths + $Path | where { $_ }
[Environment]::SetEnvironmentVariable("Path", $persistedPaths -join ";", $containerType)
@@ -229,8 +231,8 @@ function Remove-EnvPath
)
if ($Container -ne "Session")
- { $containerType = $EnvPath_ContainerMapping[$Container]
- $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";"
+ { $containerType = $EnvPath_ContainerMapping[$Container]
+ $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";"
if ($persistedPaths -contains $Path)
{ $persistedPaths = $persistedPaths | where { $_ -and $_ -ne $Path }
[Environment]::SetEnvironmentVariable("Path", $persistedPaths -join ";", $containerType)
@@ -264,17 +266,17 @@ if ($false)
# Write-Host "[ERROR]: This command is not implemented." -ForegroundColor Red
Exit-Script -1
-} # Uninstall
+} # Uninstall
else
{ # ============================================================================
# Clean tasks
# ============================================================================
if ($Clean)
- { Write-Host "Removing all created files and directories..." }
+ { Write-Host "Removing all created files and directories..." }
if ($Clean_GHDL)
- { $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
- $Script_Parameters = @(
+ { $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
+ $Script_Parameters = @(
'-Clean',
'-Hosted',
'-Verbose:$EnableVerbose',
@@ -296,13 +298,13 @@ else
Write-Host "[SUCCESSFUL]" -ForegroundColor Green
Write-Host
}
- } # Clean_GHDL
+ } # Clean_GHDL
if ($Clean_Libraries)
{ if ($Clean_GHDL)
- { Write-Host }
+ { Write-Host }
- $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
- $Script_Parameters = @(
+ $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
+ $Script_Parameters = @(
'-Clean',
'-Hosted',
'-Verbose:$EnableVerbose',
@@ -324,10 +326,10 @@ else
Write-Host "[SUCCESSFUL]" -ForegroundColor Green
Write-Host
}
- } # Clean_Libraries
+ } # Clean_Libraries
if ($Clean_Package_Zip)
{ if ($Clean_GHDL -or $Clean_Libraries)
- { Write-Host }
+ { Write-Host }
Write-Host "Running more clean-up tasks..." -ForegroundColor DarkCyan
Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
@@ -354,18 +356,18 @@ else
Write-Host "Clean " -NoNewline
Write-Host "[SUCCESSFUL]" -ForegroundColor Green
Write-Host
- } # Clean_Package_Zip
+ } # Clean_Package_Zip
# ============================================================================
# Compile tasks
# ============================================================================
if ($Compile_GHDL)
{ if ($Clean)
- { Write-Host }
+ { Write-Host }
- $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
- $Script_Parameters = @()
- $Script_Parameters = @(
+ $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
+ $Script_Parameters = @()
+ $Script_Parameters = @(
'-All',
'-Hosted',
'-Verbose:$EnableVerbose',
@@ -391,14 +393,14 @@ else
Write-Host "[SUCCESSFUL]" -ForegroundColor Green
Write-Host
}
- } # Compile_GHDL
+ } # Compile_GHDL
if ($Compile_Libraries)
{ if ($Compile_GHDL)
- { Write-Host }
+ { Write-Host }
- $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
- $Script_Parameters = @()
- $Script_Parameters = @(
+ $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
+ $Script_Parameters = @()
+ $Script_Parameters = @(
'-Compile',
'-Hosted',
'-Verbose:$EnableVerbose',
@@ -427,12 +429,12 @@ else
Write-Host "[SUCCESSFUL]" -ForegroundColor Green
Write-Host
}
- } # Compile_GHDL
+ } # Compile_GHDL
# ============================================================================
# Package tasks
# ============================================================================
- if ($CreatePackage)
+ if ($Package)
{ Write-Host "Creating an installation package for GHDL $GHDLVersion for Windows"
$Good = $false
@@ -443,7 +445,7 @@ else
Write-Host "[Done]" -ForegroundColor Green
}
else
- { Write-Host "[FAILED]" -ForegroundColor RED
+ { Write-Host "[FAILED]" -ForegroundColor RED
Exit-Script -1
}
@@ -465,26 +467,26 @@ else
}
Write-Host " Creating directory '$GHDLZipPackageDir' and sub-directories..."
- New-Item -ItemType directory -Path "$GHDLZipPackageDir" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$GHDLZipPackageDir\bin" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$GHDLZipPackageDir\lib" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$GHDLZipPackageDir" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$GHDLZipPackageDir\bin" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$GHDLZipPackageDir\lib" -ErrorAction SilentlyContinue | Out-Null
Write-Host " Gathering files..."
# executables
- Copy-Item "$GHDLBuildDir\ghdl.exe" "$GHDLZipPackageDir\bin\ghdl.exe" -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLBuildDir\ghdl.exe" "$GHDLZipPackageDir\bin\ghdl.exe" -ErrorAction SilentlyContinue
# include files
- Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$GHDLZipPackageDir\include" -ErrorAction SilentlyContinue
# pre-compile scripts
- Copy-Item $GHDLVendorLibraryDir -Recurse "$GHDLZipPackageDir\lib\vendors" -ErrorAction SilentlyContinue
+ Copy-Item $GHDLVendorLibraryDir -Recurse "$GHDLZipPackageDir\lib\vendors" -ErrorAction SilentlyContinue
# pre-compiled libraries
- Copy-Item $GHDLCompiledLibraryDir -Recurse "$GHDLZipPackageDir" -ErrorAction SilentlyContinue
+ Copy-Item $GHDLCompiledLibraryDir -Recurse "$GHDLZipPackageDir" -ErrorAction SilentlyContinue
Write-Host " Compressing all files into '$GHDLZipPackageFile'..."
$file = Get-ChildItem $GHDLZipPackageDir -Recurse | Write-Zip -IncludeEmptyDirectories -EntryPathRoot $GHDLZipPackageDir -OutputPath $GHDLZipPackageFile
Write-Host " $([math]::round(($file.Length / 1MB), 3)) MiB written to disk"
-
- Write-Host
+
+ Write-Host
Write-Host "Creating package " -NoNewline
Write-Host "[SUCCESSFUL]" -ForegroundColor Green
Write-Host
@@ -501,9 +503,9 @@ else
}
# Read ZIP file and convert it to base64
- $ResolvedPath = Resolve-Path "$GHDLZipPackageFile"
- $CompressedFileContentAsBytes = [System.IO.File]::ReadAllBytes("$ResolvedPath")
- $CompressedFileContentInBase64 = [System.Convert]::ToBase64String($CompressedFileContentAsBytes)
+ $ResolvedPath = Resolve-Path "$GHDLZipPackageFile"
+ $CompressedFileContentAsBytes = [System.IO.File]::ReadAllBytes("$ResolvedPath")
+ $CompressedFileContentInBase64 = [System.Convert]::ToBase64String($CompressedFileContentAsBytes)
# Read a Installer template and add the base64 content
$Installer = Get-Content $InstallerTemplateFile
@@ -536,10 +538,10 @@ else
$InstallPath = Get-Content $InstallDirFile -Encoding Ascii
}
else
- { $InstallPath = $DefaultInstallPath }
+ { $InstallPath = $DefaultInstallPath }
}
else
- { $InstallPath = $InstallDir }
+ { $InstallPath = $InstallDir }
$InstallPath = $InstallPath.TrimEnd("\")
if ($Zip)
@@ -549,7 +551,7 @@ else
Write-Host "[Done]" -ForegroundColor Green
}
else
- { Write-Host "[FAILED]" -ForegroundColor RED
+ { Write-Host "[FAILED]" -ForegroundColor RED
Exit-Script -1
}
@@ -567,31 +569,38 @@ else
}
Write-Host " Install directory: $InstallPath"
Write-Host " Creating directory '$InstallPath' and sub-directories..."
- New-Item -ItemType directory -Path "$InstallPath" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$InstallPath" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null
Write-Host " Copying files..."
# executables
- Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# include files
- Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compile scripts
- Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compiled libraries
- Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
-
- Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
- Write-Host "M" -NoNewline -ForegroundColor Cyan
- Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "u" -NoNewline -ForegroundColor Cyan
- Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "s" -NoNewline -ForegroundColor Cyan
- Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "n" -NoNewline -ForegroundColor Cyan
- Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan
- $InstallInPath = (Read-Host).ToLower()
+ Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+
+ while($true)
+ { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "M" -NoNewline -ForegroundColor Cyan
+ Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "u" -NoNewline -ForegroundColor Cyan
+ Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "s" -NoNewline -ForegroundColor Cyan
+ Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "p" -NoNewline -ForegroundColor Cyan
+ Write-Host "ass]: " -NoNewline -ForegroundColor DarkCyan
+ $InstallInPath = (Read-Host).ToLower()
+ if ($InstallInPath -in "m","u","s","p")
+ { break }
+ else
+ { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red }
+ }
+
if (($InstallInPath -eq "") -or ($InstallInPath -eq "m"))
{ Write-Host " Adding GHDL to PATH at machine level."
Add-EnvPath -Path "$InstallPath\bin" -Container "Machine"
@@ -613,8 +622,8 @@ else
Write-Host
Exit-Script
- } # Zip
- } # Install
+ } # Zip
+ } # Install
elseif ($Update)
{ Write-Host "Updating GHDL $GHDLVersion for Windows..."
if (Test-Path $InstallDirFile -PathType Leaf)
@@ -622,7 +631,11 @@ else
$InstallPath = Get-Content $InstallDirFile -Encoding Ascii
}
else
- { $InstallPath = $InstallDir }
+ { if ($InstallDir -eq "")
+ { }
+ else
+ { $InstallPath = $InstallDir }
+ }
$InstallPath = $InstallPath.TrimEnd("\")
Write-Host " Install directory: $InstallPath"
@@ -631,55 +644,79 @@ else
Get-ChildItem -Path $InstallPath -Depth 0 | foreach { Remove-Item $_.FullName -Recurse -Force }
}
- Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow
- foreach ($container in @("Machine", "User"))
- { foreach ($entry in (Get-EnvPath -Container $container))
- { if ($entry.ToLower().Contains("ghdl"))
- { Write-Host " Removing '$entry' from $container level."
- Remove-EnvPath -Path $entry -Container $container
- }
- }
- }
- Remove-EnvPath -Path $entry -Container "Session"
Write-Host " Creating directory sub-directories in '$InstallPath' ..."
- New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null
- New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$InstallPath\bin" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$InstallPath\include" -ErrorAction SilentlyContinue | Out-Null
+ New-Item -ItemType directory -Path "$InstallPath\lib" -ErrorAction SilentlyContinue | Out-Null
Write-Host " Copying files..."
# executables
- Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLBuildDir\ghdl.exe" "$InstallPath\bin\ghdl.exe" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# include files
- Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item "$GHDLRootDir\src\grt\vpi_user.h" "$InstallPath\include" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compile scripts
- Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+ Copy-Item $GHDLVendorLibraryDir -Recurse "$InstallPath\lib" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
# pre-compiled libraries
- Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
-
- Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
- Write-Host "M" -NoNewline -ForegroundColor Cyan
- Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "u" -NoNewline -ForegroundColor Cyan
- Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "s" -NoNewline -ForegroundColor Cyan
- Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan
- Write-Host "n" -NoNewline -ForegroundColor Cyan
- Write-Host "o]: " -NoNewline -ForegroundColor DarkCyan
- $InstallInPath = (Read-Host).ToLower()
- if (($InstallInPath -eq "") -or ($InstallInPath -eq "m"))
- { Write-Host " Adding GHDL to PATH at machine level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "Machine"
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
- }
- elseif ($InstallInPath -eq "u")
- { Write-Host " Adding GHDL to PATH at user level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "User"
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ Copy-Item $GHDLCompiledLibraryDir -Recurse "$InstallPath" -Verbose:$EnableVerbose -ErrorAction SilentlyContinue
+
+ if ($AddToPath -eq "")
+ { while($true)
+ { Write-Host " Install GHDL in PATH at machine level? [" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "M" -NoNewline -ForegroundColor Cyan
+ Write-Host "achine/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "u" -NoNewline -ForegroundColor Cyan
+ Write-Host "ser/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "s" -NoNewline -ForegroundColor Cyan
+ Write-Host "ession/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "r" -NoNewline -ForegroundColor Cyan
+ Write-Host "emove/" -NoNewline -ForegroundColor DarkCyan
+ Write-Host "p" -NoNewline -ForegroundColor Cyan
+ Write-Host "ass]: " -NoNewline -ForegroundColor DarkCyan
+ $InstallInPath = (Read-Host).ToLower()
+ if ($InstallInPath -in "m","u","s","r","p")
+ { break }
+ else
+ { Write-Host "[ERROR]: Unsupported choice: '$InstallInPath'." -ForegroundColor Red }
+ }
}
- elseif ($InstallInPath -eq "s")
- { Write-Host " Adding GHDL to PATH at session level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ elseif ($AddToPath -eq "Machine")
+ { $InstallInPath = "m" }
+ elseif ($AddToPath -eq "User")
+ { $InstallInPath = "u" }
+ elseif ($AddToPath -eq "Session")
+ { $InstallInPath = "s" }
+ elseif ($AddToPath -eq "Remove")
+ { $InstallInPath = "r" }
+ elseif ($AddToPath -eq "Pass")
+ { $InstallInPath = "p" }
+
+ if ($InstallInPath -ne "p")
+ { Write-Host " Removing GHDL from PATH variables in Machine, User, Session ..." -ForegroundColor Yellow
+ foreach ($container in @("Machine", "User"))
+ { foreach ($entry in (Get-EnvPath -Container $container))
+ { if ($entry.ToLower().Contains("ghdl"))
+ { Write-Host " Removing '$entry' from $container level."
+ Remove-EnvPath -Path $entry -Container $container
+ }
+ }
+ }
+ Remove-EnvPath -Path $entry -Container "Session"
+
+ if (($InstallInPath -eq "") -or ($InstallInPath -eq "m"))
+ { Write-Host " Adding GHDL to PATH at machine level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Machine"
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
+ elseif ($InstallInPath -eq "u")
+ { Write-Host " Adding GHDL to PATH at user level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "User"
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
+ elseif ($InstallInPath -eq "s")
+ { Write-Host " Adding GHDL to PATH at session level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
}
Write-Host
@@ -688,7 +725,7 @@ else
Write-Host
Exit-Script
- } # Update
+ } # Update
elseif ($Uninstall)
{ Write-Host "Uninstalling GHDL $GHDLVersion for Windows..."
if (Test-Path $InstallDirFile -PathType Leaf)
@@ -696,7 +733,7 @@ else
$InstallPath = Get-Content $InstallDirFile -Encoding Ascii
}
else
- { $InstallPath = $DefaultInstallPath }
+ { $InstallPath = $DefaultInstallPath }
Write-Host " Install directory: $InstallPath"
if (Test-Path -Path $InstallPath)
@@ -721,8 +758,8 @@ else
Write-Host
Exit-Script
- } # Uninstall
+ } # Uninstall
-} # Clean
+} # Clean
Exit-Script