From 0f8babb75968471a38dfe4533c217025f5f920ed Mon Sep 17 00:00:00 2001 From: randen Date: Fri, 31 Jul 2015 21:19:51 -0700 Subject: [PATCH 1/4] Update a reg entry for WinGHCi * hptool/os-extras/win/templates/Nsisfile.nsi.mu * winGHCi adds some reg entries when it is run, and one "WorkdingDir", it reads but never updates if it already exists, causing winGHCi associated with any newer HP installs to use an old value. So, create and remove this particular entry when we do the install. --- hptool/os-extras/win/templates/Nsisfile.nsi.mu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hptool/os-extras/win/templates/Nsisfile.nsi.mu b/hptool/os-extras/win/templates/Nsisfile.nsi.mu index 8c761a4..08de22b 100644 --- a/hptool/os-extras/win/templates/Nsisfile.nsi.mu +++ b/hptool/os-extras/win/templates/Nsisfile.nsi.mu @@ -289,6 +289,8 @@ Section "Store GHC's location in registry" SecGHCLoc WriteRegStr HKCU "Software\Haskell\GHC\ghc-${GHC_VERSION}" "InstallDir" "$INSTDIR" WriteRegStr HKCU "Software\Haskell\GHC" "InstallDir" "$INSTDIR" + WriteRegStr HKCU "Software\Haskell\WinGHCi 1.0.6" "WorkingDir" "$INSTDIR\winghci" + SectionEnd Section "Create uninstaller" SecAddRem @@ -397,6 +399,8 @@ Section "Uninstall" DeleteRegKey HKCU "Software\Haskell\GHC\ghc-${GHC_VERSION}" DeleteRegKey HKCU "Software\Haskell\GHC" + ; remove WorkingDir but keep any user customizations for winGHCi + DeleteRegValue HKCU "Software\Haskell\WinGHCi 1.0.6" "WorkingDir" DeleteRegKey HKLM "${PRODUCT_DIR_REG_KEY}" DeleteRegKey /IfEmpty HKCU Software\Haskell DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HaskellPlatform-${PLATFORM_VERSION}" From b8a373fa8479853a94e54fed2ca45d545b2a72cc Mon Sep 17 00:00:00 2001 From: randen Date: Fri, 31 Jul 2015 22:13:31 -0700 Subject: [PATCH 2/4] Track changes in platform.sh * windows-platform.sh * pick up some robustness fixes from platform.sh * add a few more sanity checks for Windows (easier to catch these before the long build starts and it then hits them) --- windows-platform.sh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/windows-platform.sh b/windows-platform.sh index 50b88be..08305d9 100644 --- a/windows-platform.sh +++ b/windows-platform.sh @@ -15,8 +15,7 @@ NSIS_BIN="/c/Program Files (x86)/NSIS" HPTOOL=hptool/dist/build/hptool/hptool.exe -if [ \! \( -e $HPTOOL -a -x $HPTOOL \) ] -then +if ( cabal sandbox --help >/dev/null 2>&1 ) ; then if [ \! -d hptool/.cabal-sandbox ] then echo '***' @@ -25,18 +24,25 @@ then cabal update (cd hptool; cabal sandbox init; cabal install --only-dependencies) fi - - echo '***' - echo '*** Building hptool' - echo '***' - (cd hptool; cabal build) +else + if ( cabal install --dry-run --only-dependencies | grep -q 'would be installed' ) ; then + echo '=== pre-requisite packages for hptool are not installed' + echo ' run the following:' + echo ' cd hptool ; cabal install --only-dependencies' + exit 1 + fi fi +echo '***' +echo '*** Building hptool' +echo '***' +(cd hptool; cabal build) + CWD=`pwd` GHC_BINDIST=build/ghc-bindist/local MINGW=$GHC_BINDIST/mingw -# A clean, cruft-free PATH +# A clean, well-lighted, cruft-free PATH export PATH=$CWD/$GHC_BINDIST/bin:$CWD/$MINGW/bin:$MSYS_BIN:$NSIS_BIN:$HASK_BIN which cabal || @@ -44,6 +50,13 @@ which cabal || which makensisw || { echo "Could not find makensisw.exe on PATH!"; echo "PATH=$PATH"; exit 1; } +echo "> cabal --version" +cabal --version +echo "> which haddock" +which haddock +echo "> haddock --version" +haddock --version + # Make sure makensisw.exe is compiled with support for large strings # makensisw="/c/Program\ Files\ \(x86\)/NSIS/Orig/makensis //HDRINFO" nsis_max_strlen=`makensis //HDRINFO | grep 'NSIS_MAX_STRLEN' | awk '{ match($0, /NSIS_MAX_STRLEN=([0-9]+)/, x); if(x[1] != "") print x[1] }'` From 7e3b3e6f6fba2ab99eafad7c7fe360579d6509d0 Mon Sep 17 00:00:00 2001 From: randen Date: Fri, 31 Jul 2015 22:19:21 -0700 Subject: [PATCH 3/4] Some tool path updates (These would likely be different for anyone else building the Windows HP) --- windows-platform.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/windows-platform.sh b/windows-platform.sh index 08305d9..fd08ed3 100644 --- a/windows-platform.sh +++ b/windows-platform.sh @@ -7,11 +7,12 @@ GHC_VERS=${tar_vers%%-*} # These may need to be edited to suit your specific environment # MSYS_BIN is needed on path for configure scripts; -# HASK_BIN is needed on path for cabal.exe +# HASK_BIN is needed on path for shake.exe, HsColour.exe (maybe cabal.exe) # NSIS_BIN is needed on path for makensisw.exe MSYS_BIN="/c/Program Files (x86)/MinGW/msys/1.0/bin" -HASK_BIN="/c/Program Files (x86)/Haskell/bin" +HASK_BIN="/c/Program Files/Haskell/bin:/c/Program Files/Haskell Platform/2014.2.0.0/lib/extralibs/bin" NSIS_BIN="/c/Program Files (x86)/NSIS" +GHC_BINDIST=build/ghc-bindist/local HPTOOL=hptool/dist/build/hptool/hptool.exe @@ -39,7 +40,6 @@ echo '***' (cd hptool; cabal build) CWD=`pwd` -GHC_BINDIST=build/ghc-bindist/local MINGW=$GHC_BINDIST/mingw # A clean, well-lighted, cruft-free PATH From b3496c6ecd8ca3ae677fbc1418160fb962ca16a1 Mon Sep 17 00:00:00 2001 From: randen Date: Fri, 31 Jul 2015 22:34:24 -0700 Subject: [PATCH 4/4] Incorporate msys2 tools into installer * hptool/src/OS/Win.hs * call copyWinTargetExtras with the BuildConfig * hptool/src/OS/Win/WinPaths.hs * Add the build source and target dest paths for msys * hptool/src/OS/Win/WinRules.hs * Add a step which copies the pre-built msys folder from our build tree to the target tree (no installer change is needed here since the installer just bundles up every file from the target tree) * windows-platform.sh * add some sanity checks to make sure the pre-built msys tree is available --- hptool/src/OS/Win.hs | 6 ++++-- hptool/src/OS/Win/WinPaths.hs | 6 ++++++ hptool/src/OS/Win/WinRules.hs | 7 +++++-- windows-platform.sh | 8 ++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/hptool/src/OS/Win.hs b/hptool/src/OS/Win.hs index 1319918..fcbed72 100644 --- a/hptool/src/OS/Win.hs +++ b/hptool/src/OS/Win.hs @@ -52,7 +52,7 @@ winOsFromConfig BuildConfig{..} = os osPackageTargetDir p = winHpPrefix packagePattern p - -- The ghc-7.8.3 build for Windows does not have pre-built .dyn_hi files + -- The ghc builds for Windows do not have pre-built .dyn_hi files -- (Revisit this in future versions) osDoShared = False @@ -123,13 +123,15 @@ winOsFromConfig BuildConfig{..} = os osProduct = winProductFile hpVersion bcArch - osRules _rel _bc = do + osRules _rel bc = do winRules osProduct %> \_ -> do need $ [dir ghcLocalDir, targetDir, vdir ghcVirtualTarget] ++ winNeeds + copyWinTargetExtras bc + -- Now, it is time to make sure there are no problems with the -- conf files copied to localCommand' [] "ghc-pkg" diff --git a/hptool/src/OS/Win/WinPaths.hs b/hptool/src/OS/Win/WinPaths.hs index d53ce12..0e2ebcd 100644 --- a/hptool/src/OS/Win/WinPaths.hs +++ b/hptool/src/OS/Win/WinPaths.hs @@ -106,6 +106,12 @@ winExternalWinGhciDir = winExternalSrc "winghci" winWinGhciTargetDir :: FilePath winWinGhciTargetDir = winTargetDir "winghci" +winExternalMSysDir :: BuildConfig -> FilePath +winExternalMSysDir bc = winExternalSrc "msys" bcArch bc + +winMSysTargetDir :: FilePath +winMSysTargetDir = winTargetDir "msys" + -- | ghc.exe file, relative to the install winGhcExeBin :: FilePath winGhcExeBin = "bin" "ghc" <.> exe diff --git a/hptool/src/OS/Win/WinRules.hs b/hptool/src/OS/Win/WinRules.hs index 35ca353..6023877 100644 --- a/hptool/src/OS/Win/WinRules.hs +++ b/hptool/src/OS/Win/WinRules.hs @@ -58,8 +58,8 @@ winGhcInstall destDir bc distDir = do return destDir -copyWinTargetExtras :: Action () -copyWinTargetExtras = do +copyWinTargetExtras :: BuildConfig -> Action () +copyWinTargetExtras bc = do -- copy icons let mkIconsDir = makeDirectory $ winTargetDir "icons" copyFilesAction mkIconsDir winExtrasSrc winTargetDir winIconsFiles @@ -70,6 +70,9 @@ copyWinTargetExtras = do -- copy winghci pieces copyDirAction winExternalWinGhciDir winWinGhciTargetDir + -- copy msys(msys2) pieces + copyDirAction (winExternalMSysDir bc) winMSysTargetDir + -- | These files are needed when building the installer copyInstExtras :: Rules () diff --git a/windows-platform.sh b/windows-platform.sh index fd08ed3..0b57285 100644 --- a/windows-platform.sh +++ b/windows-platform.sh @@ -92,6 +92,8 @@ if [ \! \( -d winExternalSrc \ -a -d winExternalSrc/doc/html \ -a -d winExternalSrc/winghci \ -a -e winExternalSrc/winghci/winghci.exe \ + -a -d winExternalSrc/msys/i386/usr \ + -a -d winExternalSrc/msys/x86_64/usr \ \) ] then echo '***' @@ -100,6 +102,7 @@ then echo ' * winghci (can copy from a previous HP release)' echo ' * GLUT library & DLL (e.g,. from freeglut-MinGW-2.8.1-1.mp.zip)' echo " * GHC user's guide (matching the GHC in this HP)" + echo " * MSys2 'usr' directory, as seen in git-for-windows(tm)" echo '' echo 'Please create a subdirectory in this directory (where this script' echo 'is), with the following contents and structure:' @@ -124,6 +127,11 @@ then winghci/ winghci.exe + msys/ + i386/ + usr/{bin,lib,libexec,share,ssl} + x86_64/ + usr/{bin,lib,libexec,share,ssl} EOF