aboutsummaryrefslogtreecommitdiffstats
path: root/dist/windows
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@tu-dresden.de>2017-02-17 04:53:59 +0100
committerPatrick Lehmann <Patrick.Lehmann@tu-dresden.de>2017-02-17 04:53:59 +0100
commit330ea6732666779dcadaf8936805acefa4eadc0a (patch)
treec651eef937cc0b70ac6b6bc4b40fd87938fb6eab /dist/windows
parentf0857455d654fd3a3b9de1bbca52c7bd6fcb5033 (diff)
downloadghdl-330ea6732666779dcadaf8936805acefa4eadc0a.tar.gz
ghdl-330ea6732666779dcadaf8936805acefa4eadc0a.tar.bz2
ghdl-330ea6732666779dcadaf8936805acefa4eadc0a.zip
Fixed Windows compile flow (PowerShell scripts) for GHDL and library compilations.
Diffstat (limited to 'dist/windows')
-rw-r--r--dist/windows/compile-ghdl.ps1 (renamed from dist/windows/mcode/windows/compile-ghdl.ps1)8
-rw-r--r--dist/windows/compile-libraries.ps1 (renamed from dist/windows/mcode/windows/compile-libraries.ps1)18
-rw-r--r--dist/windows/compile.ps1 (renamed from dist/windows/mcode/winbuild.ps1)1384
-rw-r--r--dist/windows/mcode/compile.bat (renamed from dist/windows/mcode/windows/compile.bat)0
-rw-r--r--dist/windows/mcode/complib.bat (renamed from dist/windows/mcode/windows/complib.bat)238
-rw-r--r--dist/windows/mcode/ghdl.nsi (renamed from dist/windows/mcode/windows/ghdl.nsi)916
-rw-r--r--dist/windows/mcode/ghdlfilter.adb (renamed from dist/windows/mcode/windows/ghdlfilter.adb)0
-rw-r--r--[-rwxr-xr-x]dist/windows/mcode/ghdlversion.adb (renamed from dist/windows/mcode/windows/ghdlversion.adb)0
-rw-r--r--dist/windows/mcode/grt-modules.adb (renamed from dist/windows/mcode/windows/grt-modules.adb)0
-rw-r--r--dist/windows/mcode/ortho_code-x86-flags.ads (renamed from dist/windows/mcode/windows/ortho_code-x86-flags.ads)0
-rw-r--r--dist/windows/mcode/windows/default_pathes.ads10
-rw-r--r--dist/windows/mcode/windows/elf_arch.ads2
-rw-r--r--dist/windows/mcode/windows/grt-backtraces-impl.ads3
-rw-r--r--dist/windows/mcode/windows_default_path.adb (renamed from dist/windows/mcode/windows/windows_default_path.adb)0
-rw-r--r--dist/windows/mcode/windows_default_path.ads (renamed from dist/windows/mcode/windows/windows_default_path.ads)0
-rw-r--r--dist/windows/shared.psm1 (renamed from dist/windows/mcode/windows/shared.psm1)2
-rw-r--r--dist/windows/targets.psm1 (renamed from dist/windows/mcode/windows/targets.psm1)6
17 files changed, 1286 insertions, 1301 deletions
diff --git a/dist/windows/mcode/windows/compile-ghdl.ps1 b/dist/windows/compile-ghdl.ps1
index 2938683db..45e1d7c50 100644
--- a/dist/windows/mcode/windows/compile-ghdl.ps1
+++ b/dist/windows/compile-ghdl.ps1
@@ -18,7 +18,7 @@
#
# ==============================================================================
# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
-# Copyright (C) 2015-2016 Patrick Lehmann
+# 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
@@ -38,10 +38,10 @@
# .SYNOPSIS
# GHDL for Windows - GHDL compile script
-# Use 'compile.ps1 -Help' to see the integrated help page
+# Use 'compile-ghdl.ps1 -Help' to see the integrated help page
#
# .EXAMPLE
-# C:\PS> .\compile.ps1 -Clean -Compile
+# C:\PS> .\compile-ghdl.ps1 -Clean -Compile
#
[CmdletBinding()]
param(
@@ -81,7 +81,7 @@ param(
)
# configure script here
-$RelPathToRoot = "..\..\.."
+$RelPathToRoot = "..\.."
# ---------------------------------------------
# save parameters and working directory
diff --git a/dist/windows/mcode/windows/compile-libraries.ps1 b/dist/windows/compile-libraries.ps1
index da2b29c09..6579f2ace 100644
--- a/dist/windows/mcode/windows/compile-libraries.ps1
+++ b/dist/windows/compile-libraries.ps1
@@ -19,7 +19,7 @@
#
# ==============================================================================
# Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
-# Copyright (C) 2015-2016 Patrick Lehmann
+# 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
@@ -42,11 +42,11 @@
# Use 'compile-libraries.ps1 -Help' to see the integrated help page
#
# .EXAMPLE
-# C:\PS> .\complib.ps1 -Clean
+# C:\PS> .\compile-libraries.ps1 -Clean
# .EXAMPLE
-# C:\PS> .\complib.ps1 -Compile -Verbose
+# C:\PS> .\compile-libraries.ps1 -Compile -Verbose
# .EXAMPLE
-# C:\PS> .\complib.ps1 -VHDL2008 -SuppressWarnings
+# C:\PS> .\compile-libraries.ps1 -VHDL2008 -SuppressWarnings
#
[CmdletBinding()]
param(
@@ -78,7 +78,7 @@ param(
)
# configure script here
-$RelPathToRoot = "..\..\.."
+$RelPathToRoot = "..\.."
# ---------------------------------------------
# save parameters and working directory
@@ -166,13 +166,13 @@ $SourceFiles = @{
"prmtvs_p", "prmtvs_b",
"memory_p", "memory_b"
);
+ "synopsys8793" = @(
+ "std_logic_textio"
+ );
"synopsys" = @(
"std_logic_arith",
"std_logic_unsigned",
- "std_logic_signed"
- );
- "synopsys8793" = @(
- "std_logic_textio",
+ "std_logic_signed",
"std_logic_misc", "std_logic_misc-body"
);
"mentor" = @(
diff --git a/dist/windows/mcode/winbuild.ps1 b/dist/windows/compile.ps1
index 230213fcc..2835a4e58 100644
--- a/dist/windows/mcode/winbuild.ps1
+++ b/dist/windows/compile.ps1
@@ -1,692 +1,692 @@
-# 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-2016 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 'winbuild.ps1 -Help' to see the integrated help page
-#
-# .EXAMPLE
-# #
-# # Normal flow
-# PS> .\winbuild.ps1 -Clean
-# PS> .\winbuild.ps1 -Compile
-# PS> .\winbuild.ps1 -Install
-#
-# # Combine all commands in a single call
-# PS>.\winbuild.ps1 -Clean -Compile -Install "C:\Tools\GHDL"
-#
-# # Install to user defined dir
-# PS> .\winbuild.ps1 -Install "C:\Tools\GHDL"
-#
-# # Update or Uninstall
-# PS> .\winbuild.ps1 -Update
-# PS> .\winbuild.ps1 -Uninstall
-#
-# # Create a Zip-file
-# PS>.\winbuild.ps1 -CreatePackage -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]$CreatePackage,
- # creates a zip-file for xcopy deployment
- [switch]$Zip,
-
- # 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,
-
- # 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
-$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 }
-
-# load modules from GHDL's 'libraries' directory
-Import-Module $PSScriptRoot\windows\shared.psm1 -Verbose:$false -Debug:$false -ArgumentList "$Script_WorkingDir", $Hosting
-Import-Module $PSScriptRoot\windows\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
- $CreatePackage -or
- $Install -or $Update -or $Uninstall
- ))
-
-Write-Host "================================================================================" -ForegroundColor Magenta
-Write-Host "GHDL for Windows - GHDL compile and bundle script" -ForegroundColor Magenta
-Write-Host "================================================================================" -ForegroundColor Magenta
-
-if ($Help)
-{ Get-Help $MYINVOCATION.InvocationName -Detailed
- Exit-CompileScript
-}
-
-if ($All)
-{ $Clean = $true
- $Compile = $true
- $CreatePackage = $true
-}
-if ($Clean)
-{ $Clean_GHDL = $true
- $Clean_Libraries = $true
- $Clean_Package_Zip = $true
-}
-if ($Compile)
-{ $Compile_GHDL = $true
- $Compile_Libraries = $true
-}
-
-# configure some variables: paths, executables, directory names, ...
-$GHDLVersion = Get-GHDLVersion $GHDLRootDir
-$Backend = "mcode"
-$WindowsDirName = "dist\$Backend\windows"
-$BuildDirectoryName = "build"
-$BuildBackendDirectoryName = "$BuildDirectoryName\$Backend"
-$VHDLLibrariesDirectoryName = "lib"
-$PackageDirectoryName = "build\zip\$Backend"
-$ZipPackageFileName = "ghdl-$Backend-$GHDLVersion.zip"
-$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"
-
-# construct files
-$InstallDirFile = "$BuildDirectoryName\InstallDir.conf"
-
-$EnvPath_ContainerMapping = @{
- Machine = [EnvironmentVariableTarget]::Machine
- User = [EnvironmentVariableTarget]::User
-}
-
-function Exit-Script
-{ [CmdletBinding()]
- param(
- [int]$ExitCode = 0
- )
- cd $Script_WorkingDir
- # unload modules
- Remove-Module shared -Verbose:$false -Debug:$false
- Remove-Module targets -Verbose:$false -Debug:$false
- exit $ExitCode
-}
-
-# GitHub user: https://github.com/mkropat
-# Gist account at GitHub: https://gist.github.com/mkropat
-# Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
-function Add-EnvPath
-{ param(
- [Parameter(Mandatory=$true)]
- [string] $Path,
-
- [ValidateSet("Machine", "User", "Session")]
- [string] $Container = "Session"
- )
-
- if ($Container -ne "Session")
- { $containerType = $EnvPath_ContainerMapping[$Container]
- $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";"
- if ($persistedPaths -notcontains $Path)
- { $persistedPaths = $persistedPaths + $Path | where { $_ }
- [Environment]::SetEnvironmentVariable("Path", $persistedPaths -join ";", $containerType)
- }
- }
-
- $envPaths = $env:Path -split ";"
- if ($envPaths -notcontains $Path)
- { $envPaths = $envPaths + $Path | where { $_ }
- $env:Path = $envPaths -join ";"
- }
-}
-
-# GitHub user: https://github.com/mkropat
-# Gist account at GitHub: https://gist.github.com/mkropat
-# Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
-function Remove-EnvPath
-{ param (
- [Parameter(Mandatory=$true)]
- [string] $Path,
-
- [ValidateSet("Machine", "User", "Session")]
- [string] $Container = "Session"
- )
-
- if ($Container -ne "Session")
- { $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)
- }
- }
-
- $envPaths = $env:Path -split ";"
- if ($envPaths -contains $Path)
- { $envPaths = $envPaths | where { $_ -and $_ -ne $Path }
- $env:Path = $envPaths -join ";"
- }
-}
-
-# GitHub user: https://github.com/mkropat
-# Gist account at GitHub: https://gist.github.com/mkropat
-# Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
-function Get-EnvPath
-{ param (
- [Parameter(Mandatory=$true)]
- [ValidateSet("Machine", "User")]
- [string] $Container
- )
-
- $containerType = $EnvPath_ContainerMapping[$Container]
- [Environment]::GetEnvironmentVariable('Path', $containerType) -split ";" | where { $_ }
-}
-
-
-if ($false)
-{ # Write-Host "Uninstalling GHDL $GHDLVersion for Windows..."
-
- # Write-Host "[ERROR]: This command is not implemented." -ForegroundColor Red
- Exit-Script -1
-} # Uninstall
-else
-{ # ============================================================================
- # Clean tasks
- # ============================================================================
- if ($Clean)
- { Write-Host "Removing all created files and directories..." }
-
- if ($Clean_GHDL)
- { $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
- $Script_Parameters = @(
- '-Clean',
- '-Hosted',
- '-Verbose:$EnableVerbose',
- '-Debug:$EnableDebug'
- )
-
- Write-Host "Running compile-ghdl.ps1 -Clean ..." -ForegroundColor DarkCyan
- Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
- Invoke-Expression $InvokeExpr
- if ($LastExitCode -ne 0)
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
- Exit-Script -1
- }
- else
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "Completed compile-ghdl.ps1 " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
- }
- } # Clean_GHDL
- if ($Clean_Libraries)
- { if ($Clean_GHDL)
- { Write-Host }
-
- $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
- $Script_Parameters = @(
- '-Clean',
- '-Hosted',
- '-Verbose:$EnableVerbose',
- '-Debug:$EnableDebug'
- )
-
- Write-Host "Running compile-libraries.ps1 -Clean ..." -ForegroundColor DarkCyan
- Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
- Invoke-Expression $InvokeExpr
- if ($LastExitCode -ne 0)
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
- Exit-Script -1
- }
- else
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "Completed compile-libraries.ps1 " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
- }
- } # Clean_Libraries
- if ($Clean_Package_Zip)
- { if ($Clean_GHDL -or $Clean_Libraries)
- { Write-Host }
-
- Write-Host "Running more clean-up tasks..." -ForegroundColor DarkCyan
- Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "Removing installer packages and temporary directories..." -ForegroundColor Yellow
- if (Test-Path -Path $GHDLZipPackageDir)
- { Write-Host " rmdir $GHDLZipPackageDir"
- Remove-Item $GHDLZipPackageDir -Force -Recurse -ErrorAction SilentlyContinue
- if ($? -eq $false)
- { Write-Host "[ERROR]: While deleting '$GHDLZipPackageDir'." -ForegroundColor Red
- Exit-Script -1
- }
- }
-
- if (Test-Path -Path $GHDLZipPackageFile)
- { Write-Host " rm $GHDLZipPackageFile"
- Remove-Item $GHDLZipPackageFile -Force -Recurse -ErrorAction SilentlyContinue
- if ($? -eq $false)
- { Write-Host "[ERROR]: While deleting '$GHDLZipPackageFile'." -ForegroundColor Red
- Exit-Script -1
- }
- }
-
- Write-Host
- Write-Host "Clean " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
- } # Clean_Package_Zip
-
- # ============================================================================
- # Compile tasks
- # ============================================================================
- if ($Compile_GHDL)
- { if ($Clean)
- { Write-Host }
-
- $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
- $Script_Parameters = @()
- $Script_Parameters = @(
- '-All',
- '-Hosted',
- '-Verbose:$EnableVerbose',
- '-Debug:$EnableDebug'
- )
-
- # Write-Host "Compiling GHDL $GHDLVersion for Windows..." -ForegroundColor DarkCyan
- # Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
-
- Write-Host
- Write-Host "Running compile-ghdl.ps1 -All ..." -ForegroundColor DarkCyan
- Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
- Invoke-Expression $InvokeExpr
- if ($LastExitCode -ne 0)
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
- Exit-Script -1
- }
- else
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "Completed compile-ghdl.ps1 " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
- }
- } # Compile_GHDL
- if ($Compile_Libraries)
- { if ($Compile_GHDL)
- { Write-Host }
-
- $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
- $Script_Parameters = @()
- $Script_Parameters = @(
- '-Compile',
- '-Hosted',
- '-Verbose:$EnableVerbose',
- '-Debug:$EnableDebug'
- )
-
- # Write-Host "Compiling GHDL's libraries ..." -ForegroundColor DarkCyan
- # Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
-
- $env:GHDL = "$GHDLBuildDir\ghdl.exe"
- Write-Host ("Setting env:GHDL to '" + $env:GHDL + "'")
-
- Write-Host
- Write-Host "Running compile-libraries.ps1 -Compile ..." -ForegroundColor DarkCyan
- Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
- Invoke-Expression $InvokeExpr
- if ($LastExitCode -ne 0)
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
- Exit-Script -1
- }
- else
- { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
- Write-Host "Completed compile-libraries.ps1 " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
- }
- } # Compile_GHDL
-
- # ============================================================================
- # Package tasks
- # ============================================================================
- if ($CreatePackage)
- { Write-Host "Creating an installation package for GHDL $GHDLVersion for Windows"
-
- if ($Zip)
- { Write-Host "Loading PowerShell Community Extensions (PSCX) " -NoNewline
- if ((Get-Module -ListAvailable | Where {$_.Name -like "PSCX"}).Version -ge "3.1.0.0")
- { Import-Module Pscx -Verbose:$false
- Write-Host "[Done]" -ForegroundColor Green
- }
- else
- { Write-Host "[FAILED]" -ForegroundColor RED
- Exit-Script -1
- }
-
- Write-Host "Output format: zip-file"
- Write-Host " Removing old directory '$GHDLZipPackageDir'."
- if (Test-Path -Path $GHDLZipPackageDir)
- { Remove-Item $GHDLZipPackageDir -Force -Recurse -ErrorAction SilentlyContinue
- if ($? -eq $false)
- { Write-Host "[ERROR]: While deleting '$GHDLZipPackageDir'." -ForegroundColor Red
- Exit-Script -1
- }
- }
- if (Test-Path -Path $GHDLZipPackageFile)
- { Remove-Item $GHDLZipPackageFile -Force -Recurse -ErrorAction SilentlyContinue
- if ($? -eq $false)
- { Write-Host "[ERROR]: While deleting '$GHDLZipPackageFile'." -ForegroundColor Red
- Exit-Script -1
- }
- }
-
- 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
-
- Write-Host " Gathering files..."
- # executables
- 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
- # pre-compile scripts
- Copy-Item $GHDLVendorLibraryDir -Recurse "$GHDLZipPackageDir\lib\vendors" -ErrorAction SilentlyContinue
- # pre-compiled libraries
- 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 "Creating package " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
- }
- else
- { Write-Host "[ERROR]: No package format selected." -ForegroundColor Red
- Write-Host "Possible formats:"
- Write-Host " - Zip-file (-Zip)"
- Write-Host
- }
- }
- # ============================================================================
- # Compile tasks
- # ============================================================================
- if ($Install)
- { Write-Host "Installing GHDL $GHDLVersion for Windows..."
- if ($InstallDir -eq "")
- { if (Test-Path $InstallDirFile -PathType Leaf)
- { Write-Host " Reading installation path from '$InstallDirFile' ..."
- $InstallPath = Get-Content $InstallDirFile -Encoding Ascii
- }
- else
- { $InstallPath = $DefaultInstallPath }
- }
- else
- { $InstallPath = $InstallDir }
- $InstallPath = $InstallPath.TrimEnd("\")
-
- if ($Zip)
- { Write-Host "Loading PowerShell Community Extensions (PSCX) " -NoNewline
- if ((Get-Module -ListAvailable | Where {$_.Name -like "PSCX"}).Version -ge "3.1.0.0")
- { Import-Module Pscx -Verbose:$false
- Write-Host "[Done]" -ForegroundColor Green
- }
- else
- { Write-Host "[FAILED]" -ForegroundColor RED
- Exit-Script -1
- }
-
- Write-Host " Installing from Zip-file..."
-
- Write-Host "[ERROR]: This command is not implemented." -ForegroundColor Red
- }
- else
- { Write-Host " Writing installation path to '$InstallDirFile'..."
- $InstallPath | Out-File -FilePath $InstallDirFile -Encoding Ascii
-
- if (Test-Path -Path $InstallPath)
- { Write-Host "[ERROR]: Directory '$InstallPath' already exists." -ForegroundColor Red
- Exit-Script -1
- }
- 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
-
- Write-Host " Copying files..."
- # executables
- 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
- # pre-compile scripts
- 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"
- }
- elseif ($InstallInPath -eq "s")
- { Write-Host " Adding GHDL to PATH at session level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
- }
-
- Write-Host
- Write-Host "Installing files " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
-
- Exit-Script
- } # Zip
- } # Install
- elseif ($Update)
- { Write-Host "Updating GHDL $GHDLVersion for Windows..."
- if (Test-Path $InstallDirFile -PathType Leaf)
- { Write-Host " Reading installation path from '$InstallDirFile' ..."
- $InstallPath = Get-Content $InstallDirFile -Encoding Ascii
- }
- else
- { $InstallPath = $InstallDir }
- $InstallPath = $InstallPath.TrimEnd("\")
-
- Write-Host " Install directory: $InstallPath"
- if (Test-Path -Path $InstallPath)
- { Write-Host " Cleaning up installation directory '$InstallPath'." -ForegroundColor Yellow
- Get-ChildItem -Path $InstallPath -Depth 0 | foreach { Remove-Item $_ -Recurse -ErrorAction SilentlyContinue }
- }
-
- 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
-
- Write-Host " Copying files..."
- # executables
- 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
- # pre-compile scripts
- 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"
- }
- elseif ($InstallInPath -eq "s")
- { Write-Host " Adding GHDL to PATH at session level."
- Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
- }
-
- Write-Host
- Write-Host "Updating files " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
-
- Exit-Script
- } # Update
- elseif ($Uninstall)
- { Write-Host "Uninstalling GHDL $GHDLVersion for Windows..."
- if (Test-Path $InstallDirFile -PathType Leaf)
- { Write-Host " Reading installation path from '$InstallDirFile' ..."
- $InstallPath = Get-Content $InstallDirFile -Encoding Ascii
- }
- else
- { $InstallPath = $DefaultInstallPath }
-
- Write-Host " Install directory: $InstallPath"
- if (Test-Path -Path $InstallPath)
- { Write-Host " Removing installation directory '$InstallPath'." -ForegroundColor Yellow
- Remove-Item $InstallPath -Recurse -ErrorAction SilentlyContinue
- }
-
- 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
- Write-Host "Uninstalling files " -NoNewline
- Write-Host "[SUCCESSFUL]" -ForegroundColor Green
- Write-Host
-
- Exit-Script
- } # Update
-
-} # Clean
-
-Exit-Script
+# 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 -CreatePackage -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]$CreatePackage,
+ # creates a zip-file for xcopy deployment
+ [switch]$Zip,
+
+ # 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,
+
+ # 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
+$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 }
+
+# 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
+ $CreatePackage -or
+ $Install -or $Update -or $Uninstall
+ ))
+
+Write-Host "================================================================================" -ForegroundColor Magenta
+Write-Host "GHDL for Windows - GHDL compile and bundle script" -ForegroundColor Magenta
+Write-Host "================================================================================" -ForegroundColor Magenta
+
+if ($Help)
+{ Get-Help $MYINVOCATION.InvocationName -Detailed
+ Exit-CompileScript
+}
+
+if ($All)
+{ $Clean = $true
+ $Compile = $true
+ $CreatePackage = $true
+}
+if ($Clean)
+{ $Clean_GHDL = $true
+ $Clean_Libraries = $true
+ $Clean_Package_Zip = $true
+}
+if ($Compile)
+{ $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"
+$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"
+
+# construct files
+$InstallDirFile = "$BuildDirectoryName\InstallDir.conf"
+
+$EnvPath_ContainerMapping = @{
+ Machine = [EnvironmentVariableTarget]::Machine
+ User = [EnvironmentVariableTarget]::User
+}
+
+function Exit-Script
+{ [CmdletBinding()]
+ param(
+ [int]$ExitCode = 0
+ )
+ cd $Script_WorkingDir
+ # unload modules
+ Remove-Module shared -Verbose:$false -Debug:$false
+ Remove-Module targets -Verbose:$false -Debug:$false
+ exit $ExitCode
+}
+
+# GitHub user: https://github.com/mkropat
+# Gist account at GitHub: https://gist.github.com/mkropat
+# Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
+function Add-EnvPath
+{ param(
+ [Parameter(Mandatory=$true)]
+ [string] $Path,
+
+ [ValidateSet("Machine", "User", "Session")]
+ [string] $Container = "Session"
+ )
+
+ if ($Container -ne "Session")
+ { $containerType = $EnvPath_ContainerMapping[$Container]
+ $persistedPaths = [Environment]::GetEnvironmentVariable("Path", $containerType) -split ";"
+ if ($persistedPaths -notcontains $Path)
+ { $persistedPaths = $persistedPaths + $Path | where { $_ }
+ [Environment]::SetEnvironmentVariable("Path", $persistedPaths -join ";", $containerType)
+ }
+ }
+
+ $envPaths = $env:Path -split ";"
+ if ($envPaths -notcontains $Path)
+ { $envPaths = $envPaths + $Path | where { $_ }
+ $env:Path = $envPaths -join ";"
+ }
+}
+
+# GitHub user: https://github.com/mkropat
+# Gist account at GitHub: https://gist.github.com/mkropat
+# Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
+function Remove-EnvPath
+{ param (
+ [Parameter(Mandatory=$true)]
+ [string] $Path,
+
+ [ValidateSet("Machine", "User", "Session")]
+ [string] $Container = "Session"
+ )
+
+ if ($Container -ne "Session")
+ { $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)
+ }
+ }
+
+ $envPaths = $env:Path -split ";"
+ if ($envPaths -contains $Path)
+ { $envPaths = $envPaths | where { $_ -and $_ -ne $Path }
+ $env:Path = $envPaths -join ";"
+ }
+}
+
+# GitHub user: https://github.com/mkropat
+# Gist account at GitHub: https://gist.github.com/mkropat
+# Gist snippet URL: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
+function Get-EnvPath
+{ param (
+ [Parameter(Mandatory=$true)]
+ [ValidateSet("Machine", "User")]
+ [string] $Container
+ )
+
+ $containerType = $EnvPath_ContainerMapping[$Container]
+ [Environment]::GetEnvironmentVariable('Path', $containerType) -split ";" | where { $_ }
+}
+
+
+if ($false)
+{ # Write-Host "Uninstalling GHDL $GHDLVersion for Windows..."
+
+ # Write-Host "[ERROR]: This command is not implemented." -ForegroundColor Red
+ Exit-Script -1
+} # Uninstall
+else
+{ # ============================================================================
+ # Clean tasks
+ # ============================================================================
+ if ($Clean)
+ { Write-Host "Removing all created files and directories..." }
+
+ if ($Clean_GHDL)
+ { $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
+ $Script_Parameters = @(
+ '-Clean',
+ '-Hosted',
+ '-Verbose:$EnableVerbose',
+ '-Debug:$EnableDebug'
+ )
+
+ Write-Host "Running compile-ghdl.ps1 -Clean ..." -ForegroundColor DarkCyan
+ Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
+ Invoke-Expression $InvokeExpr
+ if ($LastExitCode -ne 0)
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "Completed compile-ghdl.ps1 " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Clean_GHDL
+ if ($Clean_Libraries)
+ { if ($Clean_GHDL)
+ { Write-Host }
+
+ $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
+ $Script_Parameters = @(
+ '-Clean',
+ '-Hosted',
+ '-Verbose:$EnableVerbose',
+ '-Debug:$EnableDebug'
+ )
+
+ Write-Host "Running compile-libraries.ps1 -Clean ..." -ForegroundColor DarkCyan
+ Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
+ Invoke-Expression $InvokeExpr
+ if ($LastExitCode -ne 0)
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "Completed compile-libraries.ps1 " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Clean_Libraries
+ if ($Clean_Package_Zip)
+ { if ($Clean_GHDL -or $Clean_Libraries)
+ { Write-Host }
+
+ Write-Host "Running more clean-up tasks..." -ForegroundColor DarkCyan
+ Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "Removing installer packages and temporary directories..." -ForegroundColor Yellow
+ if (Test-Path -Path $GHDLZipPackageDir)
+ { Write-Host " rmdir $GHDLZipPackageDir"
+ Remove-Item $GHDLZipPackageDir -Force -Recurse -ErrorAction SilentlyContinue
+ if ($? -eq $false)
+ { Write-Host "[ERROR]: While deleting '$GHDLZipPackageDir'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ }
+
+ if (Test-Path -Path $GHDLZipPackageFile)
+ { Write-Host " rm $GHDLZipPackageFile"
+ Remove-Item $GHDLZipPackageFile -Force -Recurse -ErrorAction SilentlyContinue
+ if ($? -eq $false)
+ { Write-Host "[ERROR]: While deleting '$GHDLZipPackageFile'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ }
+
+ Write-Host
+ Write-Host "Clean " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ } # Clean_Package_Zip
+
+ # ============================================================================
+ # Compile tasks
+ # ============================================================================
+ if ($Compile_GHDL)
+ { if ($Clean)
+ { Write-Host }
+
+ $Script_Path = $GHDLWindowsDir + "\compile-ghdl.ps1"
+ $Script_Parameters = @()
+ $Script_Parameters = @(
+ '-All',
+ '-Hosted',
+ '-Verbose:$EnableVerbose',
+ '-Debug:$EnableDebug'
+ )
+
+ # Write-Host "Compiling GHDL $GHDLVersion for Windows..." -ForegroundColor DarkCyan
+ # Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+
+ Write-Host
+ Write-Host "Running compile-ghdl.ps1 -All ..." -ForegroundColor DarkCyan
+ Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
+ Invoke-Expression $InvokeExpr
+ if ($LastExitCode -ne 0)
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "Completed compile-ghdl.ps1 " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Compile_GHDL
+ if ($Compile_Libraries)
+ { if ($Compile_GHDL)
+ { Write-Host }
+
+ $Script_Path = $GHDLWindowsDir + "\compile-libraries.ps1"
+ $Script_Parameters = @()
+ $Script_Parameters = @(
+ '-Compile',
+ '-Hosted',
+ '-Verbose:$EnableVerbose',
+ '-Debug:$EnableDebug'
+ )
+
+ # Write-Host "Compiling GHDL's libraries ..." -ForegroundColor DarkCyan
+ # Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+
+ $env:GHDL = "$GHDLBuildDir\ghdl.exe"
+ Write-Host ("Setting env:GHDL to '" + $env:GHDL + "'")
+
+ Write-Host
+ Write-Host "Running compile-libraries.ps1 -Compile ..." -ForegroundColor DarkCyan
+ Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ $InvokeExpr = "$Script_Path " + ($Script_Parameters -join " ")
+ Invoke-Expression $InvokeExpr
+ if ($LastExitCode -ne 0)
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "[ERROR]: While executing '$InvokeExpr'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ else
+ { Write-Host "--------------------------------------------------------------------------------" -ForegroundColor DarkCyan
+ Write-Host "Completed compile-libraries.ps1 " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ } # Compile_GHDL
+
+ # ============================================================================
+ # Package tasks
+ # ============================================================================
+ if ($CreatePackage)
+ { Write-Host "Creating an installation package for GHDL $GHDLVersion for Windows"
+
+ if ($Zip)
+ { Write-Host "Loading PowerShell Community Extensions (PSCX) " -NoNewline
+ if ((Get-Module -ListAvailable | Where {$_.Name -like "PSCX"}).Version -ge "3.1.0.0")
+ { Import-Module Pscx -Verbose:$false
+ Write-Host "[Done]" -ForegroundColor Green
+ }
+ else
+ { Write-Host "[FAILED]" -ForegroundColor RED
+ Exit-Script -1
+ }
+
+ Write-Host "Output format: zip-file"
+ Write-Host " Removing old directory '$GHDLZipPackageDir'."
+ if (Test-Path -Path $GHDLZipPackageDir)
+ { Remove-Item $GHDLZipPackageDir -Force -Recurse -ErrorAction SilentlyContinue
+ if ($? -eq $false)
+ { Write-Host "[ERROR]: While deleting '$GHDLZipPackageDir'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ }
+ if (Test-Path -Path $GHDLZipPackageFile)
+ { Remove-Item $GHDLZipPackageFile -Force -Recurse -ErrorAction SilentlyContinue
+ if ($? -eq $false)
+ { Write-Host "[ERROR]: While deleting '$GHDLZipPackageFile'." -ForegroundColor Red
+ Exit-Script -1
+ }
+ }
+
+ 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
+
+ Write-Host " Gathering files..."
+ # executables
+ 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
+ # pre-compile scripts
+ Copy-Item $GHDLVendorLibraryDir -Recurse "$GHDLZipPackageDir\lib\vendors" -ErrorAction SilentlyContinue
+ # pre-compiled libraries
+ 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 "Creating package " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+ }
+ else
+ { Write-Host "[ERROR]: No package format selected." -ForegroundColor Red
+ Write-Host "Possible formats:"
+ Write-Host " - Zip-file (-Zip)"
+ Write-Host
+ }
+ }
+ # ============================================================================
+ # Compile tasks
+ # ============================================================================
+ if ($Install)
+ { Write-Host "Installing GHDL $GHDLVersion for Windows..."
+ if ($InstallDir -eq "")
+ { if (Test-Path $InstallDirFile -PathType Leaf)
+ { Write-Host " Reading installation path from '$InstallDirFile' ..."
+ $InstallPath = Get-Content $InstallDirFile -Encoding Ascii
+ }
+ else
+ { $InstallPath = $DefaultInstallPath }
+ }
+ else
+ { $InstallPath = $InstallDir }
+ $InstallPath = $InstallPath.TrimEnd("\")
+
+ if ($Zip)
+ { Write-Host "Loading PowerShell Community Extensions (PSCX) " -NoNewline
+ if ((Get-Module -ListAvailable | Where {$_.Name -like "PSCX"}).Version -ge "3.1.0.0")
+ { Import-Module Pscx -Verbose:$false
+ Write-Host "[Done]" -ForegroundColor Green
+ }
+ else
+ { Write-Host "[FAILED]" -ForegroundColor RED
+ Exit-Script -1
+ }
+
+ Write-Host " Installing from Zip-file..."
+
+ Write-Host "[ERROR]: This command is not implemented." -ForegroundColor Red
+ }
+ else
+ { Write-Host " Writing installation path to '$InstallDirFile'..."
+ $InstallPath | Out-File -FilePath $InstallDirFile -Encoding Ascii
+
+ if (Test-Path -Path $InstallPath)
+ { Write-Host "[ERROR]: Directory '$InstallPath' already exists." -ForegroundColor Red
+ Exit-Script -1
+ }
+ 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
+
+ Write-Host " Copying files..."
+ # executables
+ 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
+ # pre-compile scripts
+ 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"
+ }
+ elseif ($InstallInPath -eq "s")
+ { Write-Host " Adding GHDL to PATH at session level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
+
+ Write-Host
+ Write-Host "Installing files " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+
+ Exit-Script
+ } # Zip
+ } # Install
+ elseif ($Update)
+ { Write-Host "Updating GHDL $GHDLVersion for Windows..."
+ if (Test-Path $InstallDirFile -PathType Leaf)
+ { Write-Host " Reading installation path from '$InstallDirFile' ..."
+ $InstallPath = Get-Content $InstallDirFile -Encoding Ascii
+ }
+ else
+ { $InstallPath = $InstallDir }
+ $InstallPath = $InstallPath.TrimEnd("\")
+
+ Write-Host " Install directory: $InstallPath"
+ if (Test-Path -Path $InstallPath)
+ { Write-Host " Cleaning up installation directory '$InstallPath'." -ForegroundColor Yellow
+ Get-ChildItem -Path $InstallPath -Depth 0 | foreach { Remove-Item $_ -Recurse -ErrorAction SilentlyContinue }
+ }
+
+ 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
+
+ Write-Host " Copying files..."
+ # executables
+ 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
+ # pre-compile scripts
+ 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"
+ }
+ elseif ($InstallInPath -eq "s")
+ { Write-Host " Adding GHDL to PATH at session level."
+ Add-EnvPath -Path "$InstallPath\bin" -Container "Session"
+ }
+
+ Write-Host
+ Write-Host "Updating files " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+
+ Exit-Script
+ } # Update
+ elseif ($Uninstall)
+ { Write-Host "Uninstalling GHDL $GHDLVersion for Windows..."
+ if (Test-Path $InstallDirFile -PathType Leaf)
+ { Write-Host " Reading installation path from '$InstallDirFile' ..."
+ $InstallPath = Get-Content $InstallDirFile -Encoding Ascii
+ }
+ else
+ { $InstallPath = $DefaultInstallPath }
+
+ Write-Host " Install directory: $InstallPath"
+ if (Test-Path -Path $InstallPath)
+ { Write-Host " Removing installation directory '$InstallPath'." -ForegroundColor Yellow
+ Remove-Item $InstallPath -Recurse -ErrorAction SilentlyContinue
+ }
+
+ 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
+ Write-Host "Uninstalling files " -NoNewline
+ Write-Host "[SUCCESSFUL]" -ForegroundColor Green
+ Write-Host
+
+ Exit-Script
+ } # Update
+
+} # Clean
+
+Exit-Script
diff --git a/dist/windows/mcode/windows/compile.bat b/dist/windows/mcode/compile.bat
index 0c0e33153..0c0e33153 100644
--- a/dist/windows/mcode/windows/compile.bat
+++ b/dist/windows/mcode/compile.bat
diff --git a/dist/windows/mcode/windows/complib.bat b/dist/windows/mcode/complib.bat
index bdd062b67..91504a832 100644
--- a/dist/windows/mcode/windows/complib.bat
+++ b/dist/windows/mcode/complib.bat
@@ -1,119 +1,119 @@
-set GHDL=ghdl
-
-cd build
-gnatmake -aI..\windows ghdlfilter
-cd ..
-
-set REL=..\..\..
-set LIBSRC=%REL%\..\..\libraries
-
-::
-:: library sources
-::
-set STD_SRCS= textio textio_body
-set IEEE_SRCS= std_logic_1164 std_logic_1164_body numeric_std numeric_std-body numeric_bit numeric_bit-body
-set MATH_SRCS= math_real math_real-body math_complex math_complex-body
-
-set STD08_SRCS= textio textio_body env env_body
-set IEEE08_SRCS= std_logic_1164 std_logic_1164-body std_logic_textio math_real math_real-body math_complex math_complex-body numeric_bit numeric_bit-body numeric_bit_unsigned numeric_bit_unsigned-body numeric_std numeric_std-body numeric_std_unsigned numeric_std_unsigned-body fixed_float_types fixed_generic_pkg fixed_generic_pkg-body fixed_pkg float_generic_pkg float_generic_pkg-body float_pkg ieee_bit_context ieee_std_context
-
-set VITAL95_SRCS= vital_timing vital_timing_body vital_primitives vital_primitives_body
-set VITAL2000_SRCS= timing_p timing_b prmtvs_p prmtvs_b memory_p memory_b
-
-set SYNOPSYS_SRCS= std_logic_arith std_logic_textio std_logic_unsigned std_logic_signed std_logic_misc std_logic_misc-body
-set MENTOR_SRCS= std_logic_arith std_logic_arith_body
-
-
-mkdir lib
-cd lib
-
-:::::::::::::::::
-echo v87 libraries...
-
-mkdir v87
-cd v87
-
-echo std
-mkdir std
-cd std
-for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\std\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 --bootstrap --work=std %%F.v87
-cd ..
-
-echo ieee
-mkdir ieee
-cd ieee
-for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\ieee\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.v87
-for %%F in (%VITAL95_SRCS%) do copy %LIBSRC%\vital95\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
-cd ..
-
-echo synopsys
-mkdir synopsys
-cd synopsys
-for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.v87
-for %%F in (%VITAL95_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.vhd
-for %%F in (%SYNOPSYS_SRCS%) do copy %LIBSRC%\synopsys\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
-cd ..
-
-cd ..
-
-:::::::::::::::::
-echo v93 libraries...
-
-mkdir v93
-cd v93
-
-echo std
-mkdir std
-cd std
-for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\std\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 --bootstrap --work=std %%F.v93
-cd ..
-
-echo ieee
-mkdir ieee
-cd ieee
-for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\ieee\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.v93
-for %%F in (%VITAL2000_SRCS%) do copy %LIBSRC%\vital2000\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
-for %%F in (%MATH_SRCS%) do copy %LIBSRC%\ieee\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
-cd ..
-
-echo synopsys
-mkdir synopsys
-cd synopsys
-for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.v93
-for %%F in (%VITAL2000_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
-for %%F in (%MATH_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
-for %%F in (%SYNOPSYS_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\..\v87\synopsys\%%F.vhd
-cd ..
-
-echo mentor
-mkdir mentor
-cd mentor
-for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.v93
-for %%F in (%VITAL2000_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
-for %%F in (%MATH_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
-for %%F in (%MENTOR_SRCS%) do copy %LIBSRC%\mentor\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
-cd ..
-
-cd ..
-
-:::::::::::::::::
-echo v08 libraries...
-
-mkdir v08
-cd v08
-
-echo std
-mkdir std
-cd std
-for %%F in (%STD08_SRCS%) do %REL%\build\ghdlfilter -v08 < %LIBSRC%\std\%%F.vhdl > %%F.v08 && %REL%\build\%GHDL% -a --std=08 --bootstrap --work=std %%F.v08
-cd ..
-
-echo ieee
-mkdir ieee
-cd ieee
-for %%F in (%IEEE08_SRCS%) do %REL%\build\ghdlfilter -v08 < %LIBSRC%\ieee2008\%%F.vhdl > %%F.v08 && %REL%\build\%GHDL% -a --std=08 -P..\std --work=ieee %%F.v08
-cd ..
-
-:::::::::::::::::
-
-cd ..\..
+set GHDL=ghdl
+
+cd build
+gnatmake -aI..\windows ghdlfilter
+cd ..
+
+set REL=..\..\..
+set LIBSRC=%REL%\..\..\libraries
+
+::
+:: library sources
+::
+set STD_SRCS= textio textio_body
+set IEEE_SRCS= std_logic_1164 std_logic_1164_body numeric_std numeric_std-body numeric_bit numeric_bit-body
+set MATH_SRCS= math_real math_real-body math_complex math_complex-body
+
+set STD08_SRCS= textio textio_body env env_body
+set IEEE08_SRCS= std_logic_1164 std_logic_1164-body std_logic_textio math_real math_real-body math_complex math_complex-body numeric_bit numeric_bit-body numeric_bit_unsigned numeric_bit_unsigned-body numeric_std numeric_std-body numeric_std_unsigned numeric_std_unsigned-body fixed_float_types fixed_generic_pkg fixed_generic_pkg-body fixed_pkg float_generic_pkg float_generic_pkg-body float_pkg ieee_bit_context ieee_std_context
+
+set VITAL95_SRCS= vital_timing vital_timing_body vital_primitives vital_primitives_body
+set VITAL2000_SRCS= timing_p timing_b prmtvs_p prmtvs_b memory_p memory_b
+
+set SYNOPSYS_SRCS= std_logic_arith std_logic_textio std_logic_unsigned std_logic_signed std_logic_misc std_logic_misc-body
+set MENTOR_SRCS= std_logic_arith std_logic_arith_body
+
+
+mkdir lib
+cd lib
+
+:::::::::::::::::
+echo v87 libraries...
+
+mkdir v87
+cd v87
+
+echo std
+mkdir std
+cd std
+for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\std\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 --bootstrap --work=std %%F.v87
+cd ..
+
+echo ieee
+mkdir ieee
+cd ieee
+for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\ieee\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.v87
+for %%F in (%VITAL95_SRCS%) do copy %LIBSRC%\vital95\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
+cd ..
+
+echo synopsys
+mkdir synopsys
+cd synopsys
+for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.v87
+for %%F in (%VITAL95_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%SYNOPSYS_SRCS%) do copy %LIBSRC%\synopsys\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
+cd ..
+
+cd ..
+
+:::::::::::::::::
+echo v93 libraries...
+
+mkdir v93
+cd v93
+
+echo std
+mkdir std
+cd std
+for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\std\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 --bootstrap --work=std %%F.v93
+cd ..
+
+echo ieee
+mkdir ieee
+cd ieee
+for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\ieee\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.v93
+for %%F in (%VITAL2000_SRCS%) do copy %LIBSRC%\vital2000\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
+for %%F in (%MATH_SRCS%) do copy %LIBSRC%\ieee\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
+cd ..
+
+echo synopsys
+mkdir synopsys
+cd synopsys
+for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.v93
+for %%F in (%VITAL2000_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%MATH_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%SYNOPSYS_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\..\v87\synopsys\%%F.vhd
+cd ..
+
+echo mentor
+mkdir mentor
+cd mentor
+for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.v93
+for %%F in (%VITAL2000_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%MATH_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%MENTOR_SRCS%) do copy %LIBSRC%\mentor\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
+cd ..
+
+cd ..
+
+:::::::::::::::::
+echo v08 libraries...
+
+mkdir v08
+cd v08
+
+echo std
+mkdir std
+cd std
+for %%F in (%STD08_SRCS%) do %REL%\build\ghdlfilter -v08 < %LIBSRC%\std\%%F.vhdl > %%F.v08 && %REL%\build\%GHDL% -a --std=08 --bootstrap --work=std %%F.v08
+cd ..
+
+echo ieee
+mkdir ieee
+cd ieee
+for %%F in (%IEEE08_SRCS%) do %REL%\build\ghdlfilter -v08 < %LIBSRC%\ieee2008\%%F.vhdl > %%F.v08 && %REL%\build\%GHDL% -a --std=08 -P..\std --work=ieee %%F.v08
+cd ..
+
+:::::::::::::::::
+
+cd ..\..
diff --git a/dist/windows/mcode/windows/ghdl.nsi b/dist/windows/mcode/ghdl.nsi
index 5b21aeaa6..21ecb50c4 100644
--- a/dist/windows/mcode/windows/ghdl.nsi
+++ b/dist/windows/mcode/ghdl.nsi
@@ -1,458 +1,458 @@
-; ghdl.nsi
-;
-; This script is based on example2.nsi.
-; remember the directory,
-; Check if administrator
-; uninstall support
-; TODO:
-; * allow multiple version
-; * command line installation
-; * Allow user install
-
-;--------------------------------
-!include version.nsi
-;--------------------------------
-
-; The name of the installer
-Name "Ghdl"
-
-; The file to write
-OutFile "ghdl-installer-${VERSION}.exe"
-
-SetDateSave on
-
-; The default installation directory
-InstallDir $PROGRAMFILES\Ghdl
-
-; Registry key to check for directory (so if you install again, it will
-; overwrite the old one automatically)
-InstallDirRegKey HKLM "Software\Ghdl" "Install_Dir"
-
-LicenseData ..\..\..\COPYING
-; LicenseForceSelection
-
-;--------------------------------
-
-; Pages
-
-Page license
-Page components
-Page directory
-Page instfiles
-
-UninstPage uninstConfirm
-UninstPage instfiles
-
-;--------------------------------
-Function .onInit
- Call IsNT
- pop $R0
- StrCmp $R0 1 nt_ok
- MessageBox MB_OK|MB_ICONEXCLAMATION "You must use Windows NT (XP/2000/Me...)"
- Quit
-
-nt_ok:
- Call IsUserAdmin
- Pop $R0
- StrCmp $R0 "true" Admin
- MessageBox MB_OK|MB_ICONEXCLAMATION "You must have Admin rights"
- Quit
-
-Admin:
-
- ;;; Check if already installed.
- ReadRegStr $0 HKLM "Software\Ghdl" "Install_Dir"
- IfErrors not_installed
- ReadRegStr $0 HKLM "Software\Ghdl" "Version"
- IfErrors unknown_prev_version
- Goto known_version
-unknown_prev_version:
- StrCpy $0 "(unknown)"
-known_version:
- MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "You already have GHDL version $0 installed. Deinstall ?" IDCANCEL install_abort IDOK deinstall
-install_abort:
- Abort "Installation aborted"
-deinstall:
- ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "UninstallString"
- IfErrors deinstall_failed
-
- ; First version of the GHDL installer adds quotes
- StrCpy $1 $0 1
- StrCmp $1 '"' 0 str_ok
- StrCpy $1 $0 "" 1
- StrCpy $0 $1 -1
-str_ok:
-
- ; Read install dir
- ReadRegStr $1 HKLM "Software\Ghdl" "Install_Dir"
- IfErrors deinstall_failed
-
-; MessageBox MB_OK 'copy $0 to $TEMP'
-
- ClearErrors
-; MessageBox MB_OK 'copy $0 to $TEMP'
- CopyFiles $0 $TEMP
- IfErrors deinstall_failed
- ExecWait '"$TEMP\uninst-ghdl.exe" /S _?=$1'
- IfErrors deinstall_failed
- Delete "$TEMP\uninst-ghdl.exe"
- Return
-deinstall_failed:
- Delete $TEMP\uninst-ghdl.exe
- MessageBox MB_YESNO|MB_ICONSTOP "Can't deinstall GHDL: de-installer not found or failed. Continue installation ?" IDNO install_abort
-not_installed:
- Return
-FunctionEnd
-
-;--------------------------------
-
-; The stuff to install
-Section "Ghdl Compiler (required)"
-
- SectionIn RO
-
- ; Set output path to the installation directory.
- SetOutPath $INSTDIR\bin
- File /oname=ghdl.exe ..\build\ghdl.exe
-
- SetOutPath $INSTDIR
- File /oname=COPYING.txt ..\..\..\COPYING
-
- ; Write the installation path into the registry
- WriteRegStr HKLM "Software\Ghdl" "Install_Dir" $INSTDIR
- ; Write te version
- WriteRegStr HKLM "Software\Ghdl" "Version" ${VERSION}
-
- ; Write the uninstall keys for Windows
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "DisplayName" "Ghdl"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "UninstallString" $INSTDIR\uninst-ghdl.exe
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "NoModify" 1
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "NoRepair" 1
- WriteUninstaller $INSTDIR\uninst-ghdl.exe"
-
-SectionEnd
-
-Section "VHDL standard and ieee libraries"
- SectionIn RO
- SetOutPath $INSTDIR\lib\v87
- File /r ..\lib\v87\std ..\lib\v87\ieee
- SetOutPath $INSTDIR\lib\v93
- File /r ..\lib\v93\std ..\lib\v93\ieee
- SetOutPath $INSTDIR\lib\v08
- File /r ..\lib\v08\std ..\lib\v08\ieee
-SectionEnd
-
-Section "Synopsys libraries (Recommended)"
- SetOutPath $INSTDIR\lib\v87
- File /r ..\lib\v87\synopsys
- SetOutPath $INSTDIR\lib\v93
- File /r ..\lib\v93\synopsys
-SectionEnd
-
-Section "Documentation (Recommended)"
- SetOutPath $INSTDIR
- File /oname=ghdl.htm ..\..\..\doc\ghdl.html
-SectionEnd
-
-Section "Add in PATH (Recommended)"
- WriteRegDWORD HKLM "Software\Ghdl" "PathSet" 1
- Push $INSTDIR\Bin
- Call AddToPath
-SectionEnd
-
-; Optional section (can be disabled by the user)
-;Section "Start Menu Shortcuts"
-;
-; CreateDirectory "$SMPROGRAMS\Ghdl"
-; CreateShortCut "$SMPROGRAMS\Ghdl\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
-; CreateShortCut "$SMPROGRAMS\Ghdl\Ghdl.lnk" "$INSTDIR\example2.nsi" "" "$INSTDIR\example2.nsi" 0
-;
-;SectionEnd
-;
-
-;--------------------------------
-
-; Uninstaller
-
-Section "Uninstall"
-
- ReadRegDWORD $0 HKLM "Software\Ghdl" "PathSet"
- StrCmp $0 "1" "" path_not_set
- Push $INSTDIR\Bin
- Call un.RemoveFromPath
-
-path_not_set:
-
- ; Remove registry keys
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl"
- DeleteRegKey HKLM Software\Ghdl
-
- ; Remove files and uninstaller
- Delete $INSTDIR\bin\ghdl.exe
- Delete $INSTDIR\bin\ghdl.htm
- Delete $INSTDIR\uninst-ghdl.exe
- Delete $INSTDIR\COPYING.txt
- RMDir $INSTDIR\bin
- RMDir /r $INSTDIR\lib
-
-
- ; Remove shortcuts, if any
- ; Delete "$SMPROGRAMS\Ghdl\*.*"
-
- ; Remove directories used
- ; RMDir "$SMPROGRAMS\Ghdl"
- RMDir "$INSTDIR"
-
-SectionEnd
-
-;;;;;;;; Misc functions
-
-; Author: Lilla (lilla@earthlink.net) 2003-06-13
-; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll
-; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi
-; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing).
-;
-; Usage:
-; Call IsUserAdmin
-; Pop $R0 ; at this point $R0 is "true" or "false"
-;
-Function IsUserAdmin
-Push $R0
-Push $R1
-Push $R2
-
-ClearErrors
-UserInfo::GetName
-IfErrors Win9x
-Pop $R1
-UserInfo::GetAccountType
-Pop $R2
-
-StrCmp $R2 "Admin" 0 Continue
-; Observation: I get here when running Win98SE. (Lilla)
-; The functions UserInfo.dll looks for are there on Win98 too,
-; but just don't work. So UserInfo.dll, knowing that admin isn't required
-; on Win98, returns admin anyway. (per kichik)
-; MessageBox MB_OK 'User "$R1" is in the Administrators group'
-StrCpy $R0 "true"
-Goto Done
-
-Continue:
-; You should still check for an empty string because the functions
-; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
-StrCmp $R2 "" Win9x
-StrCpy $R0 "false"
-;MessageBox MB_OK 'User "$R1" is in the "$R2" group'
-Goto Done
-
-Win9x:
-; comment/message below is by UserInfo.nsi author:
-; This one means you don't need to care about admin or
-; not admin because Windows 9x doesn't either
-;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
-StrCpy $R0 "true"
-
-Done:
-;MessageBox MB_OK 'User= "$R1" AccountType= "$R2" IsUserAdmin= "$R0"'
-
-Pop $R2
-Pop $R1
-Exch $R0
-FunctionEnd
-
-
-!define ALL_USERS
-
-!ifndef WriteEnvStr_RegKey
- !ifdef ALL_USERS
- !define WriteEnvStr_RegKey \
- 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
- !else
- !define WriteEnvStr_RegKey 'HKCU "Environment"'
- !endif
-!endif
-
-!verbose 3
-!include "WinMessages.NSH"
-!verbose 4
-
-; AddToPath - Adds the given dir to the search path.
-; Input - head of the stack
-; Note - Win9x systems requires reboot
-
-Function AddToPath
- Exch $0
- Push $1
- Push $2
- Push $3
-
- # don't add if the path doesn't exist
- IfFileExists "$0\*.*" "" AddToPath_done
-
- ReadEnvStr $1 PATH
- Push "$1;"
- Push "$0;"
- Call StrStr
- Pop $2
- StrCmp $2 "" "" AddToPath_done
- Push "$1;"
- Push "$0\;"
- Call StrStr
- Pop $2
- StrCmp $2 "" "" AddToPath_done
- GetFullPathName /SHORT $3 $0
- Push "$1;"
- Push "$3;"
- Call StrStr
- Pop $2
- StrCmp $2 "" "" AddToPath_done
- Push "$1;"
- Push "$3\;"
- Call StrStr
- Pop $2
- StrCmp $2 "" "" AddToPath_done
-
- ReadRegStr $1 ${WriteEnvStr_RegKey} "PATH"
- StrCpy $2 $1 1 -1 # copy last char
- StrCmp $2 ";" 0 +2 # if last char == ;
- StrCpy $1 $1 -1 # remove last char
- StrCmp $1 "" AddToPath_NTdoIt
- StrCpy $0 "$1;$0"
- AddToPath_NTdoIt:
- WriteRegExpandStr ${WriteEnvStr_RegKey} "PATH" $0
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- AddToPath_done:
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-; RemoveFromPath - Remove a given dir from the path
-; Input: head of the stack
-
-Function un.RemoveFromPath
- Exch $0
- Push $1
- Push $2
- Push $3
- Push $4
- Push $5
- Push $6
-
- IntFmt $6 "%c" 26 # DOS EOF
-
- ReadRegStr $1 ${WriteEnvStr_RegKey} "PATH"
- StrCpy $5 $1 1 -1 # copy last char
- StrCmp $5 ";" +2 # if last char != ;
- StrCpy $1 "$1;" # append ;
- Push $1
- Push "$0;"
- Call un.StrStr ; Find `$0;` in $1
- Pop $2 ; pos of our dir
- StrCmp $2 "" unRemoveFromPath_done
- ; else, it is in path
- # $0 - path to add
- # $1 - path var
- StrLen $3 "$0;"
- StrLen $4 $2
- StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
- StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
- StrCpy $3 $5$6
-
- StrCpy $5 $3 1 -1 # copy last char
- StrCmp $5 ";" 0 +2 # if last char == ;
- StrCpy $3 $3 -1 # remove last char
-
- WriteRegExpandStr ${WriteEnvStr_RegKey} "PATH" $3
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- unRemoveFromPath_done:
- Pop $6
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-###########################################
-# Utility Functions #
-###########################################
-
-; IsNT
-; no input
-; output, top of the stack = 1 if NT or 0 if not
-;
-; Usage:
-; Call IsNT
-; Pop $R0
-; ($R0 at this point is 1 or 0)
-
-!macro IsNT un
-Function ${un}IsNT
- Push $0
- ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
- StrCmp $0 "" 0 IsNT_yes
- ; we are not NT.
- Pop $0
- Push 0
- Return
-
- IsNT_yes:
- ; NT!!!
- Pop $0
- Push 1
-FunctionEnd
-!macroend
-!insertmacro IsNT ""
-;!insertmacro IsNT "un."
-
-; StrStr
-; input, top of stack = string to search for
-; top of stack-1 = string to search in
-; output, top of stack (replaces with the portion of the string remaining)
-; modifies no other variables.
-;
-; Usage:
-; Push "this is a long ass string"
-; Push "ass"
-; Call StrStr
-; Pop $R0
-; ($R0 at this point is "ass string")
-
-!macro StrStr un
-Function ${un}StrStr
-Exch $R1 ; st=haystack,old$R1, $R1=needle
- Exch ; st=old$R1,haystack
- Exch $R2 ; st=old$R1,old$R2, $R2=haystack
- Push $R3
- Push $R4
- Push $R5
- StrLen $R3 $R1
- StrCpy $R4 0
- ; $R1=needle
- ; $R2=haystack
- ; $R3=len(needle)
- ; $R4=cnt
- ; $R5=tmp
- loop:
- StrCpy $R5 $R2 $R3 $R4
- StrCmp $R5 $R1 done
- StrCmp $R5 "" done
- IntOp $R4 $R4 + 1
- Goto loop
-done:
- StrCpy $R1 $R2 "" $R4
- Pop $R5
- Pop $R4
- Pop $R3
- Pop $R2
- Exch $R1
-FunctionEnd
-!macroend
-!insertmacro StrStr ""
-!insertmacro StrStr "un."
-
+; ghdl.nsi
+;
+; This script is based on example2.nsi.
+; remember the directory,
+; Check if administrator
+; uninstall support
+; TODO:
+; * allow multiple version
+; * command line installation
+; * Allow user install
+
+;--------------------------------
+!include version.nsi
+;--------------------------------
+
+; The name of the installer
+Name "Ghdl"
+
+; The file to write
+OutFile "ghdl-installer-${VERSION}.exe"
+
+SetDateSave on
+
+; The default installation directory
+InstallDir $PROGRAMFILES\Ghdl
+
+; Registry key to check for directory (so if you install again, it will
+; overwrite the old one automatically)
+InstallDirRegKey HKLM "Software\Ghdl" "Install_Dir"
+
+LicenseData ..\..\..\COPYING
+; LicenseForceSelection
+
+;--------------------------------
+
+; Pages
+
+Page license
+Page components
+Page directory
+Page instfiles
+
+UninstPage uninstConfirm
+UninstPage instfiles
+
+;--------------------------------
+Function .onInit
+ Call IsNT
+ pop $R0
+ StrCmp $R0 1 nt_ok
+ MessageBox MB_OK|MB_ICONEXCLAMATION "You must use Windows NT (XP/2000/Me...)"
+ Quit
+
+nt_ok:
+ Call IsUserAdmin
+ Pop $R0
+ StrCmp $R0 "true" Admin
+ MessageBox MB_OK|MB_ICONEXCLAMATION "You must have Admin rights"
+ Quit
+
+Admin:
+
+ ;;; Check if already installed.
+ ReadRegStr $0 HKLM "Software\Ghdl" "Install_Dir"
+ IfErrors not_installed
+ ReadRegStr $0 HKLM "Software\Ghdl" "Version"
+ IfErrors unknown_prev_version
+ Goto known_version
+unknown_prev_version:
+ StrCpy $0 "(unknown)"
+known_version:
+ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "You already have GHDL version $0 installed. Deinstall ?" IDCANCEL install_abort IDOK deinstall
+install_abort:
+ Abort "Installation aborted"
+deinstall:
+ ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "UninstallString"
+ IfErrors deinstall_failed
+
+ ; First version of the GHDL installer adds quotes
+ StrCpy $1 $0 1
+ StrCmp $1 '"' 0 str_ok
+ StrCpy $1 $0 "" 1
+ StrCpy $0 $1 -1
+str_ok:
+
+ ; Read install dir
+ ReadRegStr $1 HKLM "Software\Ghdl" "Install_Dir"
+ IfErrors deinstall_failed
+
+; MessageBox MB_OK 'copy $0 to $TEMP'
+
+ ClearErrors
+; MessageBox MB_OK 'copy $0 to $TEMP'
+ CopyFiles $0 $TEMP
+ IfErrors deinstall_failed
+ ExecWait '"$TEMP\uninst-ghdl.exe" /S _?=$1'
+ IfErrors deinstall_failed
+ Delete "$TEMP\uninst-ghdl.exe"
+ Return
+deinstall_failed:
+ Delete $TEMP\uninst-ghdl.exe
+ MessageBox MB_YESNO|MB_ICONSTOP "Can't deinstall GHDL: de-installer not found or failed. Continue installation ?" IDNO install_abort
+not_installed:
+ Return
+FunctionEnd
+
+;--------------------------------
+
+; The stuff to install
+Section "Ghdl Compiler (required)"
+
+ SectionIn RO
+
+ ; Set output path to the installation directory.
+ SetOutPath $INSTDIR\bin
+ File /oname=ghdl.exe ..\build\ghdl.exe
+
+ SetOutPath $INSTDIR
+ File /oname=COPYING.txt ..\..\..\COPYING
+
+ ; Write the installation path into the registry
+ WriteRegStr HKLM "Software\Ghdl" "Install_Dir" $INSTDIR
+ ; Write te version
+ WriteRegStr HKLM "Software\Ghdl" "Version" ${VERSION}
+
+ ; Write the uninstall keys for Windows
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "DisplayName" "Ghdl"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "UninstallString" $INSTDIR\uninst-ghdl.exe
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "NoModify" 1
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl" "NoRepair" 1
+ WriteUninstaller $INSTDIR\uninst-ghdl.exe"
+
+SectionEnd
+
+Section "VHDL standard and ieee libraries"
+ SectionIn RO
+ SetOutPath $INSTDIR\lib\v87
+ File /r ..\lib\v87\std ..\lib\v87\ieee
+ SetOutPath $INSTDIR\lib\v93
+ File /r ..\lib\v93\std ..\lib\v93\ieee
+ SetOutPath $INSTDIR\lib\v08
+ File /r ..\lib\v08\std ..\lib\v08\ieee
+SectionEnd
+
+Section "Synopsys libraries (Recommended)"
+ SetOutPath $INSTDIR\lib\v87
+ File /r ..\lib\v87\synopsys
+ SetOutPath $INSTDIR\lib\v93
+ File /r ..\lib\v93\synopsys
+SectionEnd
+
+Section "Documentation (Recommended)"
+ SetOutPath $INSTDIR
+ File /oname=ghdl.htm ..\..\..\doc\ghdl.html
+SectionEnd
+
+Section "Add in PATH (Recommended)"
+ WriteRegDWORD HKLM "Software\Ghdl" "PathSet" 1
+ Push $INSTDIR\Bin
+ Call AddToPath
+SectionEnd
+
+; Optional section (can be disabled by the user)
+;Section "Start Menu Shortcuts"
+;
+; CreateDirectory "$SMPROGRAMS\Ghdl"
+; CreateShortCut "$SMPROGRAMS\Ghdl\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
+; CreateShortCut "$SMPROGRAMS\Ghdl\Ghdl.lnk" "$INSTDIR\example2.nsi" "" "$INSTDIR\example2.nsi" 0
+;
+;SectionEnd
+;
+
+;--------------------------------
+
+; Uninstaller
+
+Section "Uninstall"
+
+ ReadRegDWORD $0 HKLM "Software\Ghdl" "PathSet"
+ StrCmp $0 "1" "" path_not_set
+ Push $INSTDIR\Bin
+ Call un.RemoveFromPath
+
+path_not_set:
+
+ ; Remove registry keys
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ghdl"
+ DeleteRegKey HKLM Software\Ghdl
+
+ ; Remove files and uninstaller
+ Delete $INSTDIR\bin\ghdl.exe
+ Delete $INSTDIR\bin\ghdl.htm
+ Delete $INSTDIR\uninst-ghdl.exe
+ Delete $INSTDIR\COPYING.txt
+ RMDir $INSTDIR\bin
+ RMDir /r $INSTDIR\lib
+
+
+ ; Remove shortcuts, if any
+ ; Delete "$SMPROGRAMS\Ghdl\*.*"
+
+ ; Remove directories used
+ ; RMDir "$SMPROGRAMS\Ghdl"
+ RMDir "$INSTDIR"
+
+SectionEnd
+
+;;;;;;;; Misc functions
+
+; Author: Lilla (lilla@earthlink.net) 2003-06-13
+; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll
+; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi
+; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing).
+;
+; Usage:
+; Call IsUserAdmin
+; Pop $R0 ; at this point $R0 is "true" or "false"
+;
+Function IsUserAdmin
+Push $R0
+Push $R1
+Push $R2
+
+ClearErrors
+UserInfo::GetName
+IfErrors Win9x
+Pop $R1
+UserInfo::GetAccountType
+Pop $R2
+
+StrCmp $R2 "Admin" 0 Continue
+; Observation: I get here when running Win98SE. (Lilla)
+; The functions UserInfo.dll looks for are there on Win98 too,
+; but just don't work. So UserInfo.dll, knowing that admin isn't required
+; on Win98, returns admin anyway. (per kichik)
+; MessageBox MB_OK 'User "$R1" is in the Administrators group'
+StrCpy $R0 "true"
+Goto Done
+
+Continue:
+; You should still check for an empty string because the functions
+; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
+StrCmp $R2 "" Win9x
+StrCpy $R0 "false"
+;MessageBox MB_OK 'User "$R1" is in the "$R2" group'
+Goto Done
+
+Win9x:
+; comment/message below is by UserInfo.nsi author:
+; This one means you don't need to care about admin or
+; not admin because Windows 9x doesn't either
+;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
+StrCpy $R0 "true"
+
+Done:
+;MessageBox MB_OK 'User= "$R1" AccountType= "$R2" IsUserAdmin= "$R0"'
+
+Pop $R2
+Pop $R1
+Exch $R0
+FunctionEnd
+
+
+!define ALL_USERS
+
+!ifndef WriteEnvStr_RegKey
+ !ifdef ALL_USERS
+ !define WriteEnvStr_RegKey \
+ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+ !else
+ !define WriteEnvStr_RegKey 'HKCU "Environment"'
+ !endif
+!endif
+
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+; AddToPath - Adds the given dir to the search path.
+; Input - head of the stack
+; Note - Win9x systems requires reboot
+
+Function AddToPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+
+ # don't add if the path doesn't exist
+ IfFileExists "$0\*.*" "" AddToPath_done
+
+ ReadEnvStr $1 PATH
+ Push "$1;"
+ Push "$0;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$0\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ GetFullPathName /SHORT $3 $0
+ Push "$1;"
+ Push "$3;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$3\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+
+ ReadRegStr $1 ${WriteEnvStr_RegKey} "PATH"
+ StrCpy $2 $1 1 -1 # copy last char
+ StrCmp $2 ";" 0 +2 # if last char == ;
+ StrCpy $1 $1 -1 # remove last char
+ StrCmp $1 "" AddToPath_NTdoIt
+ StrCpy $0 "$1;$0"
+ AddToPath_NTdoIt:
+ WriteRegExpandStr ${WriteEnvStr_RegKey} "PATH" $0
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ AddToPath_done:
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+; RemoveFromPath - Remove a given dir from the path
+; Input: head of the stack
+
+Function un.RemoveFromPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ IntFmt $6 "%c" 26 # DOS EOF
+
+ ReadRegStr $1 ${WriteEnvStr_RegKey} "PATH"
+ StrCpy $5 $1 1 -1 # copy last char
+ StrCmp $5 ";" +2 # if last char != ;
+ StrCpy $1 "$1;" # append ;
+ Push $1
+ Push "$0;"
+ Call un.StrStr ; Find `$0;` in $1
+ Pop $2 ; pos of our dir
+ StrCmp $2 "" unRemoveFromPath_done
+ ; else, it is in path
+ # $0 - path to add
+ # $1 - path var
+ StrLen $3 "$0;"
+ StrLen $4 $2
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+ StrCpy $3 $5$6
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 ";" 0 +2 # if last char == ;
+ StrCpy $3 $3 -1 # remove last char
+
+ WriteRegExpandStr ${WriteEnvStr_RegKey} "PATH" $3
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ unRemoveFromPath_done:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+###########################################
+# Utility Functions #
+###########################################
+
+; IsNT
+; no input
+; output, top of the stack = 1 if NT or 0 if not
+;
+; Usage:
+; Call IsNT
+; Pop $R0
+; ($R0 at this point is 1 or 0)
+
+!macro IsNT un
+Function ${un}IsNT
+ Push $0
+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ StrCmp $0 "" 0 IsNT_yes
+ ; we are not NT.
+ Pop $0
+ Push 0
+ Return
+
+ IsNT_yes:
+ ; NT!!!
+ Pop $0
+ Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+;!insertmacro IsNT "un."
+
+; StrStr
+; input, top of stack = string to search for
+; top of stack-1 = string to search in
+; output, top of stack (replaces with the portion of the string remaining)
+; modifies no other variables.
+;
+; Usage:
+; Push "this is a long ass string"
+; Push "ass"
+; Call StrStr
+; Pop $R0
+; ($R0 at this point is "ass string")
+
+!macro StrStr un
+Function ${un}StrStr
+Exch $R1 ; st=haystack,old$R1, $R1=needle
+ Exch ; st=old$R1,haystack
+ Exch $R2 ; st=old$R1,old$R2, $R2=haystack
+ Push $R3
+ Push $R4
+ Push $R5
+ StrLen $R3 $R1
+ StrCpy $R4 0
+ ; $R1=needle
+ ; $R2=haystack
+ ; $R3=len(needle)
+ ; $R4=cnt
+ ; $R5=tmp
+ loop:
+ StrCpy $R5 $R2 $R3 $R4
+ StrCmp $R5 $R1 done
+ StrCmp $R5 "" done
+ IntOp $R4 $R4 + 1
+ Goto loop
+done:
+ StrCpy $R1 $R2 "" $R4
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Exch $R1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
diff --git a/dist/windows/mcode/windows/ghdlfilter.adb b/dist/windows/mcode/ghdlfilter.adb
index d75526dbd..d75526dbd 100644
--- a/dist/windows/mcode/windows/ghdlfilter.adb
+++ b/dist/windows/mcode/ghdlfilter.adb
diff --git a/dist/windows/mcode/windows/ghdlversion.adb b/dist/windows/mcode/ghdlversion.adb
index d2f1c28be..d2f1c28be 100755..100644
--- a/dist/windows/mcode/windows/ghdlversion.adb
+++ b/dist/windows/mcode/ghdlversion.adb
diff --git a/dist/windows/mcode/windows/grt-modules.adb b/dist/windows/mcode/grt-modules.adb
index de5eb79b8..de5eb79b8 100644
--- a/dist/windows/mcode/windows/grt-modules.adb
+++ b/dist/windows/mcode/grt-modules.adb
diff --git a/dist/windows/mcode/windows/ortho_code-x86-flags.ads b/dist/windows/mcode/ortho_code-x86-flags.ads
index 8915f3122..8915f3122 100644
--- a/dist/windows/mcode/windows/ortho_code-x86-flags.ads
+++ b/dist/windows/mcode/ortho_code-x86-flags.ads
diff --git a/dist/windows/mcode/windows/default_pathes.ads b/dist/windows/mcode/windows/default_pathes.ads
deleted file mode 100644
index 29fe8a3a5..000000000
--- a/dist/windows/mcode/windows/default_pathes.ads
+++ /dev/null
@@ -1,10 +0,0 @@
-with Windows_Default_Path;
-pragma Elaborate_All (Windows_Default_Path);
-
-package Default_Pathes is
- Install_Prefix : constant String :=
- Windows_Default_Path.Get_Windows_Exec_Path;
- Lib_Prefix : constant String := "lib";
-
- Shared_Library_Extension : constant String := ".dll";
-end Default_Pathes;
diff --git a/dist/windows/mcode/windows/elf_arch.ads b/dist/windows/mcode/windows/elf_arch.ads
deleted file mode 100644
index 325c4e5e3..000000000
--- a/dist/windows/mcode/windows/elf_arch.ads
+++ /dev/null
@@ -1,2 +0,0 @@
-with Elf_Arch32;
-package Elf_Arch renames Elf_Arch32;
diff --git a/dist/windows/mcode/windows/grt-backtraces-impl.ads b/dist/windows/mcode/windows/grt-backtraces-impl.ads
deleted file mode 100644
index 81db677ed..000000000
--- a/dist/windows/mcode/windows/grt-backtraces-impl.ads
+++ /dev/null
@@ -1,3 +0,0 @@
-with Grt.Backtraces.Jit;
-
-package Grt.Backtraces.Impl renames Grt.Backtraces.Jit;
diff --git a/dist/windows/mcode/windows/windows_default_path.adb b/dist/windows/mcode/windows_default_path.adb
index c627356f9..c627356f9 100644
--- a/dist/windows/mcode/windows/windows_default_path.adb
+++ b/dist/windows/mcode/windows_default_path.adb
diff --git a/dist/windows/mcode/windows/windows_default_path.ads b/dist/windows/mcode/windows_default_path.ads
index 9da3be559..9da3be559 100644
--- a/dist/windows/mcode/windows/windows_default_path.ads
+++ b/dist/windows/mcode/windows_default_path.ads
diff --git a/dist/windows/mcode/windows/shared.psm1 b/dist/windows/shared.psm1
index 20aa5d7da..2517a6ae4 100644
--- a/dist/windows/mcode/windows/shared.psm1
+++ b/dist/windows/shared.psm1
@@ -12,7 +12,7 @@
# This PowerShell module provides CommandLets (CmdLets) to ...
#
# ==============================================================================
-# Copyright (C) 2016 Patrick Lehmann
+# Copyright (C) 2016-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
diff --git a/dist/windows/mcode/windows/targets.psm1 b/dist/windows/targets.psm1
index 813873482..4df6f1358 100644
--- a/dist/windows/mcode/windows/targets.psm1
+++ b/dist/windows/targets.psm1
@@ -12,7 +12,7 @@
# This PowerShell module provides build targets for GHDL.
#
# ==============================================================================
-# Copyright (C) 2016 Patrick Lehmann
+# Copyright (C) 2016-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
@@ -45,8 +45,8 @@ $GHDL_Mcode_Name = "ghdl.exe"
# configure directory structure
$CommonSourceDirName = "src"
-$WinMcodeSourceDirName = "dist\mcode\windows"
-# $WinLLVMSourceDirName = "dist\llvm\windows"
+$WinMcodeSourceDirName = "dist\windows\mcode"
+# $WinLLVMSourceDirName = "dist\windows\llvm"
# construct file paths
$VersionFileName_In = "version.in"