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

Commit aac4418

Browse files
committed
Merge most of pull request #202 - fixes to the windows installer
2 parents 36d1f00 + 2035784 commit aac4418

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

hptool/os-extras/win/templates/Nsisfile.nsi.mu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ Section "Store GHC's location in registry" SecGHCLoc
289289
WriteRegStr HKCU "Software\Haskell\GHC\ghc-${GHC_VERSION}" "InstallDir" "$INSTDIR"
290290
WriteRegStr HKCU "Software\Haskell\GHC" "InstallDir" "$INSTDIR"
291291

292+
WriteRegStr HKCU "Software\Haskell\WinGHCi 1.0.6" "WorkingDir" "$INSTDIR\winghci"
293+
292294
SectionEnd
293295

294296
Section "Create uninstaller" SecAddRem
@@ -397,6 +399,8 @@ Section "Uninstall"
397399
398400
DeleteRegKey HKCU "Software\Haskell\GHC\ghc-${GHC_VERSION}"
399401
DeleteRegKey HKCU "Software\Haskell\GHC"
402+
; remove WorkingDir but keep any user customizations for winGHCi
403+
DeleteRegValue HKCU "Software\Haskell\WinGHCi 1.0.6" "WorkingDir"
400404
DeleteRegKey HKLM "${PRODUCT_DIR_REG_KEY}"
401405
DeleteRegKey /IfEmpty HKCU Software\Haskell
402406
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HaskellPlatform-${PLATFORM_VERSION}"

hptool/src/OS/Win.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ winOsFromConfig BuildConfig{..} = os
5252

5353
osPackageTargetDir p = winHpPrefix </> packagePattern p
5454

55-
-- The ghc-7.8.3 build for Windows does not have pre-built .dyn_hi files
55+
-- The ghc builds for Windows do not have pre-built .dyn_hi files
5656
-- (Revisit this in future versions)
5757
osDoShared = False
5858

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

8888
osTargetAction = do
89-
copyWinTargetExtras
9089
-- Now, targetDir is actually ready to snapshot (we skipped doing
9190
-- this in osGhcTargetInstall).
9291
void $ getDirectoryFiles "" [targetDir ++ "//*"]
@@ -123,13 +122,15 @@ winOsFromConfig BuildConfig{..} = os
123122

124123
osProduct = winProductFile hpVersion bcArch
125124

126-
osRules _rel _bc = do
125+
osRules _rel bc = do
127126
winRules
128127

129128
osProduct %> \_ -> do
130129
need $ [dir ghcLocalDir, targetDir, vdir ghcVirtualTarget]
131130
++ winNeeds
132131

132+
copyWinTargetExtras bc
133+
133134
-- Now, it is time to make sure there are no problems with the
134135
-- conf files copied to
135136
localCommand' [] "ghc-pkg"

hptool/src/OS/Win/WinPaths.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ winExternalWinGhciDir = winExternalSrc </> "winghci"
106106
winWinGhciTargetDir :: FilePath
107107
winWinGhciTargetDir = winTargetDir </> "winghci"
108108

109+
winExternalMSysDir :: BuildConfig -> FilePath
110+
winExternalMSysDir bc = winExternalSrc </> "msys" </> bcArch bc
111+
112+
winMSysTargetDir :: FilePath
113+
winMSysTargetDir = winTargetDir </> "msys"
114+
109115
-- | ghc.exe file, relative to the install
110116
winGhcExeBin :: FilePath
111117
winGhcExeBin = "bin" </> "ghc" <.> exe

hptool/src/OS/Win/WinRules.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ winGhcInstall destDir bc distDir = do
5858
return destDir
5959

6060

61-
copyWinTargetExtras :: Action ()
62-
copyWinTargetExtras = do
61+
copyWinTargetExtras :: BuildConfig -> Action ()
62+
copyWinTargetExtras bc = do
6363
-- copy icons
6464
let mkIconsDir = makeDirectory $ winTargetDir </> "icons"
6565
copyFilesAction mkIconsDir winExtrasSrc winTargetDir winIconsFiles
@@ -70,6 +70,9 @@ copyWinTargetExtras = do
7070
-- copy winghci pieces
7171
copyDirAction winExternalWinGhciDir winWinGhciTargetDir
7272

73+
-- copy msys(msys2) pieces
74+
copyDirAction (winExternalMSysDir bc) winMSysTargetDir
75+
7376

7477
-- | These files are needed when building the installer
7578
copyInstExtras :: Rules ()

windows-platform.sh

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ GHC_VERS=${tar_vers%%-*}
77

88
# These may need to be edited to suit your specific environment
99
# MSYS_BIN is needed on path for configure scripts;
10-
# HASK_BIN is needed on path for cabal.exe
10+
# HASK_BIN is needed on path for shake.exe, HsColour.exe (maybe cabal.exe)
1111
# NSIS_BIN is needed on path for makensisw.exe
1212
MSYS_BIN="/c/Program Files (x86)/MinGW/msys/1.0/bin"
13-
HASK_BIN="/c/Program Files (x86)/Haskell/bin"
13+
HASK_BIN="/c/Program Files/Haskell/bin:/c/Program Files/Haskell Platform/2014.2.0.0/lib/extralibs/bin"
1414
NSIS_BIN="/c/Program Files (x86)/NSIS"
15+
GHC_BINDIST=build/ghc-bindist/local
1516

1617
HPTOOL=hptool/dist/build/hptool/hptool.exe
1718

18-
if [ \! \( -e $HPTOOL -a -x $HPTOOL \) ]
19-
then
19+
if ( cabal sandbox --help >/dev/null 2>&1 ) ; then
2020
if [ \! -d hptool/.cabal-sandbox ]
2121
then
2222
echo '***'
@@ -25,25 +25,38 @@ then
2525
cabal update
2626
(cd hptool; cabal sandbox init; cabal install --only-dependencies)
2727
fi
28-
29-
echo '***'
30-
echo '*** Building hptool'
31-
echo '***'
32-
(cd hptool; cabal build)
28+
else
29+
if ( cabal install --dry-run --only-dependencies | grep -q 'would be installed' ) ; then
30+
echo '=== pre-requisite packages for hptool are not installed'
31+
echo ' run the following:'
32+
echo ' cd hptool ; cabal install --only-dependencies'
33+
exit 1
34+
fi
3335
fi
3436

37+
echo '***'
38+
echo '*** Building hptool'
39+
echo '***'
40+
(cd hptool; cabal build)
41+
3542
CWD=`pwd`
36-
GHC_BINDIST=build/ghc-bindist/local
3743
MINGW=$GHC_BINDIST/mingw
3844

39-
# A clean, cruft-free PATH
45+
# A clean, well-lighted, cruft-free PATH
4046
export PATH=$CWD/$GHC_BINDIST/bin:$CWD/$MINGW/bin:$MSYS_BIN:$NSIS_BIN:$HASK_BIN
4147

4248
which cabal ||
4349
{ echo "Could not find cabal.exe on PATH!"; echo "PATH=$PATH"; exit 1; }
4450
which makensisw ||
4551
{ echo "Could not find makensisw.exe on PATH!"; echo "PATH=$PATH"; exit 1; }
4652

53+
echo "> cabal --version"
54+
cabal --version
55+
echo "> which haddock"
56+
which haddock
57+
echo "> haddock --version"
58+
haddock --version
59+
4760
# Make sure makensisw.exe is compiled with support for large strings
4861
# makensisw="/c/Program\ Files\ \(x86\)/NSIS/Orig/makensis //HDRINFO"
4962
nsis_max_strlen=`makensis //HDRINFO | grep 'NSIS_MAX_STRLEN' | awk '{ match($0, /NSIS_MAX_STRLEN=([0-9]+)/, x); if(x[1] != "") print x[1] }'`
@@ -79,6 +92,8 @@ if [ \! \( -d winExternalSrc \
7992
-a -d winExternalSrc/doc/html \
8093
-a -d winExternalSrc/winghci \
8194
-a -e winExternalSrc/winghci/winghci.exe \
95+
-a -d winExternalSrc/msys/i386/usr \
96+
-a -d winExternalSrc/msys/x86_64/usr \
8297
\) ]
8398
then
8499
echo '***'
@@ -87,6 +102,7 @@ then
87102
echo ' * winghci (can copy from a previous HP release)'
88103
echo ' * GLUT library & DLL (e.g,. from freeglut-MinGW-2.8.1-1.mp.zip)'
89104
echo " * GHC user's guide (matching the GHC in this HP)"
105+
echo " * MSys2 'usr' directory, as seen in git-for-windows(tm)"
90106
echo ''
91107
echo 'Please create a subdirectory in this directory (where this script'
92108
echo 'is), with the following contents and structure:'
@@ -111,7 +127,11 @@ then
111127
winghci/
112128
winghci.exe
113129
<and any other DLL, etc. needed to run this particular winghci>
114-
130+
msys/
131+
i386/
132+
usr/{bin,lib,libexec,share,ssl}
133+
x86_64/
134+
usr/{bin,lib,libexec,share,ssl}
115135
EOF
116136

117137
exit 1

0 commit comments

Comments
 (0)