Refactor Templates to expose platformExpander

This is needed to support the Windows build.
Clean up Utils.shakeToCabalVerbosity

Rather than use magic numbers which are needed when
issuing an external command to the cabal executable,
we can actually use Cabal's API value for verbosity,
then use fromEnum to convert back to an integer.
This change makes this function useable for mapping
Shake's verbosity to the Cabal API's verbosity.

hptool/src/Target.hs is modified to track this change.
Factor out localCommand into new file

The functions localCommand and localCommand'
(also helper function addPath') are moved from GhcDist
to a new file, hptool/src/LocalCommand.hs.  This
change allows these functions to now be used by the
OS-specific files, by preventing an import cycle.  The
other files included in this commit simply have their
imports modified (and note that most modules which
were importing GhcDist were doing so only for
localCommand.

* hptool/src/GhcDist.hs
* hptool/src/HaddockMaster.hs
* hptool/src/LocalCommand.hs
* hptool/src/Package.hs
* hptool/src/SourceTarballs.hs
* hptool/src/Target.hs
Correct spelling of "package.conf.d"

* hptool/src/Paths.hs
* hptool/src/Target.hs
Add LocalCommand to hptool.cabal

Forgotten file from "Factor out localCommand into new file"
Merge pull request #121 from randen/windows-1

Refactoring in preparation for Windows build
Add support to build HP for Windows 32- and 64-bit

One issue unresolved in this commit is that the links in the
html docs which point from an HP package back into a GHC
package, are still broken.

Another mechanical thing to clean up is how the GLUT libraries
and the GHC User's Guide are to be found by the hptool.
Currently, hptool assumes a directory exists called
"winExternalSrc", which must be populated in a certain way,
which is documented and checked by the windows-platform.sh.
If we do not mind depending on a environment variable, we
could use that mechanism instead (which could also be checked
and tested by the windows-platform script).

Modified:

* hptool/hptool.cabal
  * Add Windows-specific data and source
  * bytestring is now needed to build hptool
* hptool/src/GhcDist.hs
  * Re-factor ghcInstall function so that the configure/make
    behavior is optional, replaceable by an field in the OS
    record as a "custom" step to happen after untar-ing.
* hptool/src/HaddockMaster.hs
  * When assembling the list of HP packages for generating
    the master indices, the non-Windows packages must be
    filtered out.
  * The path for ghcDb is different on Windows than the other
    platforms; this is now specified by a function in the OS
    record.
* hptool/src/OS.hs
  * Add the Windows case for osFromConfig
* hptool/src/OS/Internal.hs
  * osGhcLocalInstall: platform-specific actions needed to
    finish the ghc-bindist/local install step (and before any
    HP packages are built).
  * osGhcTargetInstall: platform-specific actions needed to
    finish the target-ghc install step.
  * osToCabalPrefix: formats a path suitable for the native
    cabal's "--prefix" option, which is just 'id' on most
    platforms; the cabal tool on Windows requires an absolute
    path, and that includes the drive letter.
  * osDoShared: set True if GHC in this build supports
    creating shared libs (Windows GHC does not).
  * osPackagePostRegister: any action to take, after creation
    of the package conf file, before the package's haddock
    files are created (for Windows, the conf files need the
    paths inside to be made portable by re-writing them to be
    rooted at "${pkgroot}"; ref:
    https://ghc.haskell.org/trac/ghc/ticket/3268).
  * osGhcDbDir: directory relative to ghc install for
    package.conf.d (Windows has it in a different place than
    the other platforms).
  * Track these OS record changes in genericOS.
* hptool/src/OS/Mac.hs
  * Track the changes per OS record.
* hptool/src/Target.hs
  * Utilize the osPackagePostRegister function.
  * Use the osToCabalPrefix in the "cabal configure --prefix"
    command.
  * Explicitly provide the correct haddock to use, as cabal
    isn't finding the correct one by its heuristics when
    running on the Windows platform.
  * Utilize the osDoShared setting, so we don't configure for
    shared libs for Windows, as the ghc-7.8.2 build for
    Windows does not have pre-built .dyn_hi files.
* hptool/src/Types.hs
  * Add a record, GhcInstall, to capture whether the build
    needs to use configure/make or a custom step for ghc
    installation.

Copied from previous:

* hptool/os-extras/win/CreateInternetShortcut.nsh
* hptool/os-extras/win/EnvVarUpdate.nsh
* hptool/os-extras/win/icons/hackage.ico
* hptool/os-extras/win/icons/hsicon.ico
* hptool/os-extras/win/icons/installer.ico
* hptool/os-extras/win/welcome.bmp
  * New. Some files needed for the Windows-specific build,
    including GHC icons and scripts for the installer.  These
    files are copies of those used in prior releases.

* hptool/os-extras/win/test/glut.hs
* hptool/os-extras/win/test/regex.hs
  * Two sanity checks from previous release.

Copied, then modified from previous:

* hptool/os-extras/win/LICENSE
  * New. Copied from prior release, but added the freeglut
    info from the COPYING file that accompanied the
    binaries.
* hptool/os-extras/win/templates/Nsisfile.nsi.mu
* hptool/os-extras/win/templates/inst.dat.mu
* hptool/os-extras/win/templates/uninst.dat.mu
  * Hastache templates for the installer data files.  The
    Nsisfile.nsi.mu is copied from the previous release, but
    templatized.

New.
* hptool/src/OS/Win.hs
  * New. Windows-specific impl of the OS structure.
* hptool/src/OS/Win/WinNsis.hs
  * New. Rules to generate the files needed to drive the
    installer-creation tool (NSIS), using Hastache templates.
* hptool/src/OS/Win/WinPaths.hs
  * New. Windows-specific path locations for its build
* hptool/src/OS/Win/WinRules.hs
  * New. Windows-specific rules.
* hptool/src/OS/Win/WinUtils.hs
  * New. Windows-specific utilties.
* windows-platform.sh
  * New. Script to drive the Windows build of hptool.  Many
  assumptions and explanations from the prior releases'
  README have been turned into tests and messages in this
  script. This might make it fragile, but it helps document
  as well as enforce/check the assumptions and requirements
  to build on Windows (and having the fragile piece be
  outside hptool, rather than inside it, is also a goal).
missing return value in cabal.wrap
update to use GHC 7.8.3 - and bumped HP name to 2014.2.0.0
Merge pull request #122 from randen/windows-1

Add support to build HP for Windows 32- and 64-bit
Remove brokenness from hptool.cabal file

(I think this didn't fail in my build since for
WIndows, I am not building the source dist.)
Merge pull request #123 from randen/windows-1

Remove brokenness from hptool.cabal file
Remove Windows-specific Data-files section

This section is tripping up the other platforms while
building the build-source target; this section is not
used for the Windows build.  If there is some reason for
the hptool source tarball for Windows at some point,
we can revisit what has to be included here.
Merge pull request #124 from randen/windows-1

Remove Windows-specific Data-files section
version bumps as per mailing list
Adding historical release information
Merge remote-tracking branch 'upstream/new-build' into new-build

Conflicts:
	hptool/src/Releases2014.hs