The Windows installer now needs to get its files from bindistprep/
[ghc-hetmet.git] / distrib / ghc.iss.in
1
2 [Setup]
3 AppName=GHC
4 AppVerName=GHC @ProjectVersion@
5 DefaultDirName={sd}\ghc\ghc-@ProjectVersion@
6 UsePreviousAppDir=no
7 DefaultGroupName=GHC
8 UninstallDisplayIcon={app}\bin\ghci.exe
9 Compression=lzma
10 SolidCompression=yes
11 PrivilegesRequired=none
12 ChangesAssociations=yes
13 ChangesEnvironment=yes
14
15
16 [Files]
17 Source: "bindistprep\ghc-@ProjectVersion@\*"; DestDir: "{app}"; Flags: recursesubdirs
18
19 [Icons]
20 Name: "{group}\@ProjectVersion@\GHCi"; Filename: "{app}\bin\ghci.exe"
21 Name: "{group}\@ProjectVersion@\GHC Documentation"; Filename: "{app}\doc\index.html"
22 Name: "{group}\@ProjectVersion@\GHC Library Documentation"; Filename: "{app}\doc\libraries\index.html"
23 Name: "{group}\@ProjectVersion@\GHC Flag Reference"; Filename: "{app}\doc\users_guide\flag-reference.html"
24
25 [Registry]
26 ; set up icon associations
27 ; this does _not_ follow the "play nice" proposal
28 ; future version should
29 Root: HKCR; Subkey: ".hs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue
30 Root: HKCR; Subkey: ".lhs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue
31 Root: HKCR; Subkey: "ghc_haskell"; ValueType: string; ValueName: ""; ValueData: "Haskell Source File"; Flags: uninsdeletekey
32 Root: HKCR; Subkey: "ghc_haskell\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\icons\hsicon.ico"
33 Root: HKCR; Subkey: "ghc_haskell\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\ghci.exe"" ""%1"""
34
35 ; these flags were always set in the past, by the installer
36 ; some programs may rely on them to find GHC
37 Root: HKCU; Subkey: "Software\Haskell\GHC\ghc-@ProjectVersion@"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey
38 Root: HKCU; Subkey: "Software\Haskell\GHC"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletevalue
39
40 ; set the PATH variable, for both GHC and Cabal
41 Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{app}\bin;{olddata}";  Check: NotOnPathAlready('{app}\bin'); Flags: preservestringtype
42 Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{pf}\Haskell\bin;{olddata}";  Check: NotOnPathAlready('{pf}\Haskell\bin'); Flags: preservestringtype
43
44
45 ; stolen from Gtk2Hs, I'm sure they like us :-)
46 ; @dcoutts++
47 [Code]
48
49 function NotOnPathAlready(NewValue : String): Boolean;
50 var
51   Path: String;
52 begin
53   // Log('Checking if Gtk2Hs\bin dir is already on the %PATH%');
54   if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Path) then
55   begin // Successfully read the value
56     // Log('HKCU\Environment\PATH = ' + Path);
57     NewValue := ExpandConstant(NewValue);
58     // Log('Looking for Gtk2Hs\bin dir in %PATH%: ' + BinDir + ' in ' + Path);
59     if Pos(LowerCase(NewValue), Lowercase(Path)) = 0 then
60     begin
61       // Log('Did not find Gtk2Hs\bin dir in %PATH% so will add it');
62       Result := True;
63     end
64     else
65     begin
66       // Log('Found Gtk2Hs bin dir in %PATH% so will not add it again');
67       Result := False;
68     end
69   end
70   else // The key probably doesn't exist
71   begin
72     // Log('Could not access HKCU\Environment\PATH so assume it is ok to add it');
73     Result := True;
74   end;
75 end;
76