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