1; Sample script for using the GTK+ Runtime Environment
2;
3; Written by Todd Kulesza <todd@dropline.net>
4;
5; This script shows how to build an installer for the
6; fictitous program "GTK Foo" by "Foo Software"
7;
8
9[Setup]
10AppName=
11AppVerName=GTK Foo 1.0.0
12AppVersion=1.0.0
13AppPublisher=Foo Software
14AppPublisherURL=http://www.foo-software.com
15AppCopyright=Copyright (C) 2003 Foo Software
16AppSupportURL=http://www.foo-software.com
17AppUpdatesURL=http://www.foo-software.com
18DefaultDirName={pf}\GTK Foo
19DefaultGroupName=GTK Foo
20DisableStartupPrompt=yes
21WindowShowCaption=yes
22WindowVisible=no
23; Make sure this file exists!
24LicenseFile=license.txt
25;BackColor=$FF8200
26;BackColor=clPurple
27;BackColor2=clBlack
28Compression=bzip/9
29SourceDir=.
30OutputDir=.
31OutputBaseFilename=GTK Foo 1.0.0
32ChangesAssociations=no
33
34[Tasks]
35Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"
36
37[Registry]
38; This adds the GTK+ libraries to gtk-foo.exe's path
39Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\App Paths\gtk-foo.exe"; Flags: uninsdeletekeyifempty
40Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\App Paths\gtk-foo.exe"; ValueType: string; ValueData: "{app}\gtk-foo.exe"; Flags: uninsdeletevalue
41Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\App Paths\gtk-foo.exe"; ValueType: string; ValueName: "Path"; ValueData: "{app};{code:GetGtkPath}\lib"; Flags: uninsdeletevalue
42
43[Files]
44Source: "gtk-foo.exe"; DestDir: "{app}"; DestName: "gtk-foo.exe"; CopyMode: normal
45
46[Icons]
47Name: "{group}\GTK Foo"; Filename: "{app}\gtk-foo.exe"; Comment: "Foo!";
48Name: "{group}\GTK Foo Support Website"; Filename: "http://www.foo-software.com";
49Name: "{group}\Uninstall GTK Foo"; Filename: "{uninstallexe}";
50Name: "{userdesktop}\GTK Foo"; Filename: "{app}\gtk-foo.exe"; Tasks: desktopicon; Comment: "Desktop Foo!";
51
52[Code]
53
54var
55  Exists: Boolean;
56  GtkPath: String;
57
58function GetGtkInstalled (): Boolean;
59begin
60  Exists := RegQueryStringValue (HKLM, 'Software\GTK\2.0', 'Path', GtkPath);
61  if not Exists then begin
62    Exists := RegQueryStringValue (HKCU, 'Software\GTK\2.0', 'Path', GtkPath);
63  end;
64   Result := Exists
65end;
66
67function GetGtkPath (S: String): String;
68begin
69    Result := GtkPath;
70end;
71
72function InitializeSetup(): Boolean;
73begin
74  Result := GetGtkInstalled ();
75  if not Result then begin
76    MsgBox ('Please install the GTK+ 2.0 Runtime Environment before installing GTK Foo.  You can obtain GTK+ from http://www.dropline.net/gtk.', mbError, MB_OK);
77  end;
78end;
79
80