Hello to all,

 

I translated the current batch file based build flow on Windows to PowerShell 
scripts. Every
Windows is equipped with PowerShell so it shouldn’t be any problem to use these 
new scripts.

 

This e-mail shall mainly address all Windows user, who build their GHDL from 
source code.

Nevertheless, all readers of this mailing list can write their comments and 
give suggestions.

 

Please consider the new scripts as beta-state, because it’s only tested on my 
machine. Further

test results and impressions are welcome!

 

Build environment:

-          Windows 7 (Enterprise, x86-64, SP1, de-DE)

-          GNAT 2014 (20140331)

-          PowerShell 4.0 (Part of Windows Management Framework 4.0)
=> http://www.microsoft.com/en-US/download/details.aspx?id=40855 

-          Installed PowerShell extensions

o   PowerShell Community Extensions (PSCX, v3.2)
=> http://pscx.codeplex.com/ 

 

Windows 7 is shipped with PowerShell 2.0, but most machines should already have 
a newer

version, which was installed by Windows Update. If your machine uses a PS prior 
to 4.0, please

update to 4.0 or try the new PowerShell 5.0 Preview (Nov. 2014 ) :).

 

The PowerShell Community Extensions are a de-facto standard for every PS user 
or admin, so I

think it’s not the end of the world to install PSCX, if it’s missing. This 
module is only required for

the zip-file creation process. So user who compile and install GHDL don’t need 
PSCX.

 

If one is new to PowerShell, if have added a short introduction at the end of 
this mail.

 

Back to the new build scripts. There are three scripts as before.

 

.\dist\mcode\winbuild.ps1                        => wrapper script for 
compilation, installation and package generation

.\dist\mcode\windows\compile.ps1     => compile GHDL and helper executables 
with GNAT

.\dist\mcode\windows\complib.ps1     => analyze VHDL libraries

 

So let’s set the working directory to dist\mcode

PS> cd .\dist\mcode

 

All three CmdLets accept common parameters like –Verbose or –Debug. They export 
a basic help

page for Get-Help and emit an extended help page with –Help.

 

Retrieving the exported help page with Get-Help (man). It’s possible to see 
more details with –Detailed or –Full

or inspect provided examples with –Examples.

PS> man .\winbuild.ps1

 

Call the integrated help with –Help

PS> .\winbuild.ps1 -Help

 

This is the expression to compile all sources (ghdl.exe, ghdlfilter.exe, 
libraries)

PS> .\winbuild.ps1 -Compile

 

If one needs to clean all directories, this can be done by executing

PS> .\winbuild.ps1 -Clean

 

The installation (xcopy deployment) is done by giving an addition installation 
folder. Because -InstallPath

is also a positional parameter it’s optional to use –InstallPath. This command 
also adds GHDL to the system

PATH.

PS> .\winbuild.ps1 -Install -InstallPath "C:\Program Files (x86)\GHDL\0.33dev"

 

There is also the possibility to call all steps at once

PS> .\winbuild.ps1 –Clean -Compile -Install C:\Tools\GHDL\0.33

 

If PSCX is installed on the machine it’s possible to assemble all files into a 
zip-file

PS> .\winbuild.ps1 -CreatePackage -Zip

 

 

:) ? Questions? :)

 

 

Which commands are planned to be implemented:

-          -Uninstall                                            to remove GHDL 
from PATH and disk

-          -CreatePackage –Nsis                   to build an installer package 
OR

-          -CreatePackage –WiX                   to build an installer package

-          pipe support                                     so the outputs of 
winbuild.ps1 can be redirected into a file or displayed in less

-          auto find executables                   search for GNAT and other 
tools on disk

-          override Write-Verbose              to use user defined verbose 
messages

 

So please play with these scripts and give some feedback :).

 

 

Regards

    Patrick

 

 

APPENDIX:

=============

 

If you are new to PS, here is a very short introduction (otherwise skip this 
section):

(1) Starting PS

                a) use the Start Menu and search for it ;)

                b) type powershell into the address field of an open explorer 
window to launch PS at the

                     current location (this works also with cmd :) )

 

(2) PowerShell commands are called CommandLets (CmdLet). They are written as 
<Very>-<Noun>
      e.g. Get-Help or Get-Process

      Use tab-completion to save time; reverse tab-completion (<Shift> + <Tab>)

 

(3) PowerShell is shipped with dozens of linux-like aliases:

man <=> Get-Help

cat <=> Get-Content

cd <=> Set-Location

dir <=> Get-ChildItem

     List all aliases: Get-Alias | less

 

(4) As cmd.exe and bash, PS supports pipes:

                ps | where {$_.Company -eq "Microsoft Corporation"} | less

 

(5) PS has an integrated help system like Linux man pages (but not so good)

      man <CmdLet>

      man <function>

      man <script.ps1>

 

(6) PS can be personalized by writing a profile.ps1 script, which is executed 
after a PS session is

      started. See this script for reference: 
https://gist.github.com/Paebbels/2e918b3b0150ce48803e 

 

 

-----------------------------------

Wissenschaftliche Hilfskraft

 

Technische Universität Dresden

Fakultät Informatik

Institut für Technische Informatik

Lehrstuhl VLSI-Entwurfssysteme, Diagnostik und Architektur

01062 Dresden

Tel.:   +49 351 463-38451

Fax:    +49 351 463-38324

Raum:   APB-1020

E-Mail:  <mailto:[email protected]> [email protected]

WWW:     <http://vlsi-eda.inf.tu-dresden.de/> http://vlsi-eda.inf.tu-dresden.de

 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to