# 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) # # 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) # # ============================================================================== # 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 # GHDL for Windows - GHDL compile script # Use 'compile.ps1 -Help' to see the integrated help page # # .EXAMPLE # # # # Normal flow # PS> .\compile.ps1 -Clean # PS> .\compile.ps1 -Compile # PS> .\compile.ps1 -Install # # # Combine all commands in a single call # PS>.\compile.ps1 -Clean -Compile -Install "C:\Tools\GHDL" # # # Install to user defined dir # PS> .\compile.ps1 -Install "C:\Tools\GHDL" # # # Update or Uninstall # PS> .\compile.ps1 -Update # PS> .\compile.ps1 -Uninstall # # # Create a Zip-file # PS>.\compile.ps1 -Package -Zip # [CmdletBinding()] Param( # Clean up all files and directories [switch]$Clean, [switch]$Clean_GHDL, [switch]$Clean_Libraries, # Compile GHDL [switch]$Compile, [switch]$Compile_GHDL, [switch]$Compile_Libraries, # Create an installer package [switch]$Package, # Creates a zip-file for xcopy deployment [switch]$Zip, # Creates a self-extracting ps1-file for xcopy deployment [switch]$PS1, # Install all files into a directory (xcopy deployment) [switch]$Install = $false, [parameter(mandatory=$false, ValueFromRemainingArguments=$true)] [string]$InstallDir = "", # Update files [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 = "..\.." # save parameters and current working directory $Script_ScriptDir = $PSScriptRoot $Script_WorkingDir = Get-Location $GHDLRootDir = Convert-Path (Resolve-Path ($PSScriptRoot + "\" + $RelPathToRoot)) # set default values $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 Import-Module $PSScriptRoot\targets.psm1 -Verbose:$false -Debug:$false # Display help if no command was selected $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 $Package -or $Install -or $Update -or $Uninstall )) Write-Host "================================================================================" -ForegroundColor Magenta Write-Host "GHDL for Windows - GHDL compile and bundle script" -ForegroundColor Magenta Write-Host "========================================