Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Cleaning up some Windows HP 7.10.2 changes #198

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hptool/os-extras/win/templates/Nsisfile.nsi.mu
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
7 changes: 4 additions & 3 deletions hptool/src/OS/Win.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -86,7 +86,6 @@ winOsFromConfig BuildConfig{..} = os
whenM mp m = mp >>= \p -> when p m

osTargetAction = do
copyWinTargetExtras
-- Now, targetDir is actually ready to snapshot (we skipped doing
-- this in osGhcTargetInstall).
void $ getDirectoryFiles "" [targetDir ++ "//*"]
Expand Down Expand Up @@ -123,13 +122,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"
Expand Down
6 changes: 6 additions & 0 deletions hptool/src/OS/Win/WinPaths.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions hptool/src/OS/Win/WinRules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ()
Expand Down
43 changes: 32 additions & 11 deletions windows-platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ 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

if [ \! \( -e $HPTOOL -a -x $HPTOOL \) ]
then
if ( cabal sandbox --help >/dev/null 2>&1 ) ; then
if [ \! -d hptool/.cabal-sandbox ]
then
echo '***'
Expand All @@ -25,25 +25,38 @@ 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 ||
{ echo "Could not find cabal.exe on PATH!"; echo "PATH=$PATH"; exit 1; }
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] }'`
Expand Down Expand Up @@ -79,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 '***'
Expand All @@ -87,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:'
Expand All @@ -111,6 +127,11 @@ then
winghci/
winghci.exe
<and any other DLL, etc. needed to run this particular winghci>
msys/
i386/
usr/{bin,lib,libexec,share,ssl}
x86_64/
usr/{bin,lib,libexec,share,ssl}

EOF

Expand Down