fix haddock submodule pointer
[ghc-hetmet.git] / distrib / ghc.iss.in
1 ; Inno Setup documentation: http://www.jrsoftware.org/ishelp/
2
3 [Setup]
4 AppName=GHC
5 AppVerName=GHC @ProjectVersion@
6 DefaultDirName={sd}\ghc\ghc-@ProjectVersion@
7 UsePreviousAppDir=no
8 DefaultGroupName=GHC
9 UninstallDisplayIcon={app}\bin\ghci.exe
10 Compression=lzma
11 SolidCompression=yes
12 PrivilegesRequired=none
13 ChangesAssociations=yes
14 ChangesEnvironment=yes
15 LicenseFile=distrib/windows-installer-licences.txt
16
17 ; tasks can be disabled selectively
18 [Tasks]
19 Name: fileassoc; Description: "Associate with .hs/.lhs files"
20 Name: fileassoc\default; Description: "Make this version of GHCi the default"
21 Name: fileassoc\addon; Description: "Add versioned GHCi to right-click menu"
22 Name: fileassoc\icon; Description: "Add icon"
23 Name: path; Description: "Add bin directories to PATH"
24
25 ; install main payload, license file and icon
26 [Files]
27 Source: "bindistprep\ghc-@ProjectVersion@\*"; DestDir: "{app}"; Flags: recursesubdirs
28 Source: "distrib\windows-installer-licences.txt"; DestDir: "{app}\doc"
29 Source: "distrib\hsicon.ico"; DestDir: "{app}\icons"
30
31 ; Start Menu shortcuts
32 [Icons]
33 Name: "{group}\@ProjectVersion@\GHCi"; Filename: "{app}\bin\ghci.exe"; WorkingDir: "{app}\bin"
34 Name: "{group}\@ProjectVersion@\GHC Documentation"; Filename: "{app}\doc\html\index.html"
35 Name: "{group}\@ProjectVersion@\GHC Library Documentation"; Filename: "{app}\doc\html\libraries\index.html"
36 Name: "{group}\@ProjectVersion@\GHC Flag Reference"; Filename: "{app}\doc\html\users_guide\flag-reference.html"
37
38 [Registry]
39 ; set up file associations
40 ; this does _not_ entirely follow the "play nice" proposal (cf. ticket #916)
41 ; future version should
42 Root: HKCR; Subkey: ".hs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue; Tasks: fileassoc
43 Root: HKCR; Subkey: ".lhs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue; Tasks: fileassoc
44 Root: HKCR; Subkey: "ghc_haskell"; ValueType: string; ValueName: ""; ValueData: "Haskell Source File"; Flags: uninsdeletekeyifempty; Tasks: fileassoc
45
46 ; make this GHCi the default action
47 Root: HKCR; Subkey: "ghc_haskell\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\ghci.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: fileassoc\default
48
49 ; add versioned GHCi entry to right-click menu
50 Root: HKCR; Subkey: "ghc_haskell\shell\Open with GHCi @ProjectVersion@"; ValueType: none; ValueName: ""; ValueData: ""; Flags: uninsdeletekey; Tasks: fileassoc\addon
51 Root: HKCR; Subkey: "ghc_haskell\shell\Open with GHCi @ProjectVersion@\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\ghci.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: fileassoc\addon
52
53 ; associate file type with icon
54 Root: HKCR; Subkey: "ghc_haskell\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\icons\hsicon.ico"; Tasks: fileassoc\icon
55
56 ; these flags were always set in the past, by the installer
57 ; some programs may rely on them to find GHC
58 Root: HKCU; Subkey: "Software\Haskell\GHC\ghc-@ProjectVersion@"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey
59 Root: HKCU; Subkey: "Software\Haskell\GHC"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletevalue
60
61 ; set the PATH variable, for both GHC and Cabal
62 Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{app}\bin;{olddata}";  Check: NotOnPathAlready('{app}\bin'); Flags: preservestringtype; Tasks: path
63 Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{pf}\Haskell\bin;{olddata}";  Check: NotOnPathAlready('{pf}\Haskell\bin'); Flags: preservestringtype; Tasks: path
64
65
66 ; stolen from Gtk2Hs, I'm sure they like us :-)
67 ; @dcoutts++
68 [Code]
69
70 function NotOnPathAlready(NewValue : String): Boolean;
71 var
72   Path: String;
73 begin
74   // Log('Checking if Gtk2Hs\bin dir is already on the %PATH%');
75   if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Path) then
76   begin // Successfully read the value
77     // Log('HKCU\Environment\PATH = ' + Path);
78     NewValue := ExpandConstant(NewValue);
79     // Log('Looking for Gtk2Hs\bin dir in %PATH%: ' + BinDir + ' in ' + Path);
80     if Pos(LowerCase(NewValue), Lowercase(Path)) = 0 then
81     begin
82       // Log('Did not find Gtk2Hs\bin dir in %PATH% so will add it');
83       Result := True;
84     end
85     else
86     begin
87       // Log('Found Gtk2Hs bin dir in %PATH% so will not add it again');
88       Result := False;
89     end
90   end
91   else // The key probably doesn't exist
92   begin
93     // Log('Could not access HKCU\Environment\PATH so assume it is ok to add it');
94     Result := True;
95   end;
96 end;
97