> -----Original Message-----
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Victor B. Wagner
> Sent: 05 July 2006 12:28
> To: pgsql-hackers@postgresql.org
> Subject: [HACKERS] Creating custom Win32 installer
> I need to build custom win32 binary package for PostgreSQL.
> I've downloaded source for PGinstaller but found them hard to
> understand - WiX toolkit and MSI is totally alien territory for me.
> Things I need to modify:
> 1. Exclude all unneccessary extensions such as PostGIS

In wxs/pginst.wxs, remove the appropriate Component and Feature
sections. E.g. To remove JDBC, you would take out:

<!-- *** JDBC *** -->
<Directory Id="JDBCDIR" Name="jdbc">
  <Component Id="jdbc" Guid="412ED45F-047B-4A63-8C09-590DE16B4C5E">
    <File Id="jdbc2" LongName="postgresql-8.1-405.jdbc2.jar"
Name="jdbc2.jar" DiskId="1"
src="$(var.PKGDIR)/jdbc/postgresql-8.1-405.jdbc2.jar" />
    <File Id="jdbc2ee" LongName="postgresql-8.1-405.jdbc2ee.jar"
Name="jdbc2ee.jar" DiskId="1"
src="$(var.PKGDIR)/jdbc/postgresql-8.1-405.jdbc2ee.jar" />
    <File Id="jdbc3" LongName="postgresql-8.1-405.jdbc3.jar"
Name="jdbc3.jar" DiskId="1"
src="$(var.PKGDIR)/jdbc/postgresql-8.1-405.jdbc3.jar" />
  <Component Id="postgisjdbc"
    <File Id="postgisjdbc" LongName="postgis_1_0_0.jar"
Name="postgis.jar" DiskId="1"
src="$(var.PKGDIR)/postgis/jdbc/postgis_1_0_0.jar" />

... And ...

<Feature Id="jdbc" Title="JDBC Driver" Level="1" Description="The
PostgreSQL JDBC driver." AllowAdvertise="no">
   <ComponentRef Id="jdbc" />

(as well as the postgisjdbc feature).

Some parts (those that require additional processing to install) are
harder to remove, e.g. PostGIS. In these cases, remove the sections as
above, but also look out for:

<Custom Action="PrepInstallPostgis" After="InstallFiles">&amp;postgis=3
AND DOSERVICE=1 AND DOINITDB=1 AND MaintenanceType="Modify"</Custom>
<Custom Action="InstallPostgis" After="InstallContrib">&amp;postgis=3
AND DOSERVICE=1 AND DOINITDB=1 AND MaintenanceType="Modify"</Custom>

... And ...

<Property Id="POSTGIS" Value=" " Secure="yes" />

... And ...

<ProgressText Action="InstallPostgis">Activating

... And ...

<CustomAction Id="PrepInstallPostgis" Property="InstallPostgis"
R];[POSTGIS]" Execute="immediate" />
<CustomAction Id="InstallPostgis" Return="check" BinaryKey="pginstca"
DllEntry="[EMAIL PROTECTED]" Execute="deferred" />

As well as the UI in wxs/uidata.wxs, and the custom action code that
installs PostGIS in ca/pginstca.c

It sounds a lot, but once you get used to it it's pretty

> 2. Add some other extension 

To simply install a new feature, just add the required components and a
feature section. If you need post-processing of any kind, you'll need to
add an appropriate CustomAction, and the required C function.

> 3. Add some environment variables to server process (as needed by
> modified version of OpenSSL)

You'll need to write a CustomAction to modify the service user account's

> 4. Enable openssl by default and create certificate signing request
> during installation.

CustomAction again.

> By quick examination of pginstaller sources I haven't found 
> how it does
> register postgresql as service. When I compile postgres from 
> sources and
> start it using pg_ctl, it starts as console process, and closing of
> command line window where it have been started, kill it.
> I know about separate tools to run arbitrary program as 
> service, such as
> one in Cygwin suite, but it seems that PGinstaller doesn't 
> include such
> tool. 

No, pg_ctl.exe is a service as well as a standalone app. Look at the
"service" component in wxs/pginst.wxs. It calls ServiceInstall to
install the service.

For more info, look at the WiX schema docs, and in particular, the docs
(http://windowssdk.msdn.microsoft.com/en-us/library/ms710796.aspx). They
tend to speak of 'Tables', just remember that the WiX is what builds
those tables so you can see that tags in the wxs file relate to rows
being added to tables.

Regards, Dave.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?


Reply via email to