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