[Setup]
AppName=Glom
AppVerName=Glom @VERSION@
DefaultDirName={pf}\Glom
DefaultGroupName=Glom
UninstallDisplayIcon={app}\Glom.exe
Uninstallable=yes
AppPublisher=Openismus GmbH
AppPublisherURL=http://www.glom.org/
AppVersion=@VERSION@
OutputBaseFilename=glom-setup-@VERSION@-INSTALLERREVISION

[Components]
Name: "gtk"; Description: "GTK+ runtime environment"; Types: full compact custom; Flags: fixed
Name: "python"; Description: "Python runtime and modules"; Types: full compact custom; Flags: fixed
Name: "main"; Description: "Glom"; Types: full compact custom; Flags: fixed
Name: "locale"; Description: "Translations"; Types: full compact custom; Flags: fixed

; TODO: Enable languages separately

[Tasks]
Name: common; Description: "For all users"; Components: main; Flags: exclusive
Name: user; Description: "For the current user only"; Components: main; Flags: exclusive unchecked

[Icons]
; Common task icons
Name: "{commonprograms}\{groupname}\Glom"; Filename: "{app}\bin\Glom.exe"; Tasks: common
Name: "{commonprograms}\{groupname}\Uninstall Glom"; Filename: "{uninstallexe}"; Tasks: common

; User task icons
Name: "{userprograms}\{groupname}\Glom"; Filename: "{app}\bin\Glom.exe"; Tasks: user
Name: "{userprograms}\{groupname}\Uninstall Glom"; Filename: "{uninstallexe}"; Tasks: user

[Files]

; GTK+
Source: "bin\intl.dll"; DestDir: "{app}\bin"; Components: gtk
; TODO: Remove iconv.dll when libgda uses the new libxml dll
Source: "bin\iconv.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\zlib1.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libpng14-14.dll"; DestDir: "{app}\bin"; Components: gtk
; TODO: Remove libxml2.dll when libgda uses the new libxml dll
Source: "bin\libxml2.dll"; DestDir: "{app}\bin"; Components: gtk
;Source: "bin\libjpeg-7.dll"; DestDir: "{app}\bin"; Components: gtk
;Source: "bin\libtiff-3.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libxml2-2.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libxslt-1.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libfontconfig-1.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libexpat-1.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\freetype6.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libglib-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libgobject-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libgio-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libgmodule-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libgthread-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\gspawn-win32-helper.exe"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\gspawn-win32-helper-console.exe"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libatk-1.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libpango-1.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libpangoft2-1.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libpangocairo-1.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libpangowin32-1.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libcairo-2.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libgdk-win32-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libgdk_pixbuf-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk
Source: "bin\libgtk-win32-2.0-0.dll"; DestDir: "{app}\bin"; Components: gtk

; Other glom dependency DLLs
;Source: "bin\libORBit-2-0.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libORBit-imodule-2-0.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libORBitCosNaming-2-0.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libgconf-2-4.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgda-4.0-4.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgda-report-4.0-4.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libgdasql-4.0-4.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgettextpo-0.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libglade-2.0-0.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgoocanvas-3.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgtksourceview-2.0-0.dll"; DestDir: "{app}\bin"; Components: main

Source: "bin\libatkmm-1.6-1.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libbakery-2.6--6-1.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libcairomm-1.0-1.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libgconfmm-2.6-1.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgdamm-4.0-12.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgdkmm-2.4-1.dll"; DestDir: "{app}\bin"; Components: main
;Source: "bin\libglademm-2.4-1.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libglibmm-2.4-1.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgiomm-2.4-1.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgoocanvasmm-1.0-5.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgtkmm-2.4-1.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libgtksourceviewmm-2.0-2.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libpangomm-1.4-1.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libsigc-2.0-0.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\libxml++-2.6-2.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\mingwm10.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\boost_python-mgw34-mt-1_42.dll"; DestDir: "{app}\bin"; Components: main

; Postgres
Source: "bin/postgres.exe"; DestDir: "{app}/bin"; Components: main
Source: "bin/initdb.exe"; DestDir: "{app}/bin"; Components: main
Source: "bin/pg_ctl.exe"; DestDir: "{app}/bin"; Components: main
Source: "bin/libpq.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/libintl3.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/libiconv2.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/krb5_32.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/k5sprt32.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/gssapi32.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/comerr32.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/libeay32.dll"; DestDir: "{app}/bin"; Components: main
;Source: "bin/ssleay32.dll"; DestDir: "{app}/bin"; Components: main

; TODO: I would like to install these into {app}/share/postgresql, but postgres
; does not find them then. Perhaps we should install all of postgres elsewhere,
; and make glom find it.
Source: "share/postgresql/*"; DestDir: "{app}/share"; Components: main; Flags: recursesubdirs
; TODO: Again, same with lib
Source: "lib/postgresql/*.dll"; DestDir: "{app}/lib"; Components: main;

; Python modules
Source: "bin\python25.dll"; DestDir: "{app}\bin"; Components: python
; TODO: I would like to install these into python/ instead of /bin, but I
; could not get python to locate them there (setting PYTHONPATH with setenv()
; in Glom's main() does not work).
; TODO: Change component of gda.pyd and glom.pyd to main instead of python
; since we also need these when the user installed python and pygtk on its own.
Source: "python/*.py"; DestDir: "{app}\bin"; Components: python; Flags: recursesubdirs
Source: "python/*.pyd"; DestDir: "{app}\bin"; Components: python; Flags: recursesubdirs

; Glom executables
Source: "bin\libglom-1.16-0.dll"; DestDir: "{app}\bin"; Components: main
Source: "bin\Glom.exe"; DestDir: "{app}\bin"; Components: main

; Modules
;Source: "lib/gtk-2.0/2.10.0/immodules/*"; DestDir: "{app}/lib/gtk-2.0/2.10.0/immodules"; Components: gtk
;Source: "gtk-query-immodules-2.0.exe"; DestDir: "{app}\bin"; Components: gtk; Flags: deleteafterinstall;

Source: "lib/gtk-2.0/2.10.0/engines/*"; DestDir: "{app}/lib/gtk-2.0/2.10.0/engines"; Components: gtk

;Source: "lib/gtk-2.0/2.10.0/loaders/*"; DestDir: "{app}/lib/gtk-2.0/2.10.0/loaders"; Components: gtk
Source: "etc/gtk-2.0/gdk-pixbuf.loaders"; DestDir: "{app}\etc\gtk-2.0"; Components: gtk;

;Source: "lib/pango/1.6.0/modules/*"; DestDir: "{app}/lib/pango/1.6.0/modules"; Components: gtk;
;Source: "pango-querymodules.exe"; DestDir: "{app}\bin"; Components: gtk; Flags: deleteafterinstall;

Source: "share/themes/MS-Windows/*"; DestDir: "{app}/share/themes/MS-Windows"; Flags: recursesubdirs; Components: gtk
Source: "etc/gtk-2.0/gtkrc"; DestDir: "{app}/etc/gtk-2.0"; Components: gtk
;Source: "querymodules.bat"; DestDir: "{app}\bin"; Components: gtk; Flags: deleteafterinstall;

;Source: "lib/gnome-vfs-2.0/modules/*.dll"; DestDir: "{app}/lib/gnome-vfs-2.0/modules"; Components: main;
;Source: "etc/gnome-vfs-2.0/modules/default-modules.conf"; DestDir: "{app}/etc/gnome-vfs-2.0/modules"; Components: main;

; GtkSourceView
Source: "share/gtksourceview-2.0/language-specs/*"; DestDir: "{app}/share/gtksourceview-2.0/language-specs"; Components: main
Source: "share/gtksourceview-2.0/styles/*"; DestDir: "{app}/share/gtksourceview-2.0/styles"; Components: main

; libgda
Source: "share/libgda-4.0/*"; DestDir: "{app}/share/libgda-4.0"; Components: main
Source: "share/libgda-4.0/dtd/*"; DestDir: "{app}/share/libgda-4.0/dtd"; Components: main
Source: "lib/libgda-4.0/providers/*"; DestDir: "{app}/lib/libgda-4.0/providers"; Components: main
Source: "etc/libgda-4.0/config"; DestDir: "{app}/etc/libgda-4.0"; Components: main

; Icons
Source: "share/icons/hicolor/48x48/apps/glom.png"; DestDir: "{app}/share/icons/hicolor/48x48/apps"; Components: main
Source: "share/pixmaps/glom.png"; DestDir: "{app}/share/pixmaps"; Components: main

; Other shared glom files
Source: "share/glom/glade/glom.glade"; DestDir: "{app}/share/glom/glade"; Components: main
Source: "share/glom/glade/glom_developer.glade"; DestDir: "{app}/share/glom/glade"; Components: main
Source: "share/glom/doc/*"; Destdir: "{app}/share/glom/doc/"; Components: main; Flags: recursesubdirs
Source: "share/glom/pixmaps/*"; Destdir: "{app}/share/glom/pixmaps/"; Components: main; Flags: recursesubdirs
Source: "share/glom/xslt/*"; DestDir: "{app}/share/glom/xslt/"; Components: main; Flags: recursesubdirs

;Source: "share/themes/MS-Windows/*"; DestDir: "{app}/share/themes/MS-Windows"; Flags: recursesubdirs; Components: gtk

; Locales
;Source: "lib\locale\*"; DestDir: "{app}\lib\locale\"; Flags: recursesubdirs; Components: locale
Source: "share\locale\*"; DestDir: "{app}\share\locale\"; Flags: recursesubdirs; Components: locale

; Register .glom file type if we install for all users. Is there a possibility
; to register a type just for a single user?
[Registry]
Root: HKCR; Subkey: ".glom"; ValueType: string; ValueData: "glomfile"; Flags: deletevalue uninsdeletekeyifempty uninsdeletevalue; Tasks: common
Root: HKCR; Subkey: ".glom"; ValueType: string; ValueName: "Content Type"; ValueData: "application/x-glom"; Flags: deletevalue uninsdeletekeyifempty uninsdeletevalue; Tasks: common

[Dirs]
;Name: "{app}\etc\pango";
;Name: "{app}\etc\gtk-2.0";

[Run]
Filename: "{app}\bin\querymodules.bat"; StatusMsg: "Querying modules..."; Flags: runhidden

; TODO: Remove compiled python files (*.pyc) in glom dir
[Code]
{ Remove generated files not generated by the installer }

//procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
//begin
//	if CurUninstallStep = usUninstall then
//	begin
//		DeleteFile(ExpandConstant('{app}') + '\etc\gtk-2.0\gtk.immodules');
//		DeleteFile(ExpandConstant('{app}') + '\etc\gtk-2.0\gdk-pixbuf.loaders');
//		DeleteFile(ExpandConstant('{app}') + '\etc\pango\pango.modules');
//	end;
//end;

//procedure DeinitializeUninstall();
//begin
//	{ Remove main dir and etc/ which are not removed automatically,
//          probably because of the querymodule files not installed by the
//          installer }
//	DelTree(ExpandConstant('{app}') + '\etc', TRUE, TRUE, TRUE);
//	DelTree(ExpandConstant('{app}'), TRUE, FALSE, FALSE);
//end;

// Skip Components selection, all components are required anyway
function ShouldSkipPage(CurPageID: Integer): Boolean;
begin
	if CurPageID = wpSelectComponents then
		Result := True
	else
		Result := False;
end;
