haskell/haskell-platform — pull request #122 by randen (2014-07-11 07:36:15+00:00)
Title: 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).