New pg_msvc_generator tool available

From: Julien Rouhaud via PostgreSQL Announce <announce-noreply(at)postgresql(dot)org>
To: PostgreSQL Announce <pgsql-announce(at)lists(dot)postgresql(dot)org>
Subject: New pg_msvc_generator tool available
Date: 2021-08-24 20:10:57
Message-ID: 162983585743.28123.385911417186757165@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce

Hello,

I'm pleased to announce the release of pg_msvc_generator, version 1.0.0 beta.

[pg_msvc_generator](https://github.com/rjuju/pg_msvc_generator) is a new tool created to help extension authors to provide Windows versions of their extensions. It's written in Perl and is open source with a PostgreSQL license.

You can refer to the [project's README](https://github.com/rjuju/pg_msvc_generator/blob/master/README.md) for a complete description, or the [bug tracker](https://github.com/rjuju/pg_msvc_generator/issues) if you experience any problem.

This tool is composed of 2 scripts:

* pg_msvc_generator.pl
* release.pl

The main `pg_msvc_generator.pl` script will generate an msvc subdirectory in the given extension directory, containing the required **.sln** and **.vcxproj** files to be able to compile the extension using Visual Studio 2019, with support for Debug/Release and 32/64 bits builds. It will also create copy the `release.pl` and generate a `build.bat` scripts that can automatically compile and create release archive files and installers for all locally installed PostgreSQL versions.

### Usage

pg_msvc_generator.pl [ options ]

Options:

--default version pgver : default PostgreSQL version. This is only used
if you compile the project without specifying a specific major
version, or when the project is opened with Visual Studio
IDE. If not provided, a default value based on the year will
be chosen (13 for 2021, 14 for 2022 and so on).
-d | --dir ext_directory : root directory of the extension source code.
-e | --extension : extension name. If not provided, the extension
name will be assumed using the last part of the given root
directory.
-h | --help : Show this message.

For instance:

```
pg_msvc_generator.pl -d C:\git\hypopg
```

### Requirements

**At project generation time**:

- A Windows host with Perl installed to generate the project files

**At extension compilation time**:

- Perl
- Visual Studio 2019
- All major PostgreSQL versions for which you want to build the extension,
installed from PGDG packages in the default location
(`C:\Program Files\PostgreSQL\$MAJOR_VERSION`)
- Optionally, NSIS installed in the default location
(`C:\Program Files (x86)\NSIS) to generate installers

### Doing a release of your extension

All you need to do is to execute the `msvc\release.bat` script. It will setup
the MSVC environment and call the `release.pl` script. That script will
prepare everything for a release under a
`msvc\${extension_name}-${extension_version}` directory.

It will automatically find the installed PostgreSQL version reading the
`HKLM/SOFTWARE/PostgreSQL/Installations/` registry, compile the extension with
all those versions and for each will generate a subdirectory containing the dll
and the SQL scripts if any, a zip archive with the same content and optionally an installer.

For instance, assuming that you have PostgreSQL 12 and 13 installed and
released HypoPG 1.3.2 and NSIS installed, your `msvc` directory will now have
this additional content:

* msvc\hypopg-1.3.2\12-x64\lib\hypopg.dll
* msvc\hypopg-1.3.2\12-x64\share\extension\hypopg.control
* msvc\hypopg-1.3.2\12-x64\share\extension\\*.sql
* msvc\hypopg-1.3.2\13-x64\lib\hypopg.dll
* msvc\hypopg-1.3.2\13-x64\share\extension\hypopg.control
* msvc\hypopg-1.3.2\13-x64\share\extension\\*.sql
* msvc\hypopg-1.3.2\hypopg-1.3.2-pg12-x64.exe
* msvc\hypopg-1.3.2\hypopg-1.3.2-pg12-x64.zip
* msvc\hypopg-1.3.2\hypopg-1.3.2-pg13-x64.exe
* msvc\hypopg-1.3.2\hypopg-1.3.2-pg13-x64.zip

### Installer

If you have [NSIS](https://nsis.sourceforge.io/) installed in the default
location (`C:\Program Files (x86)\NSIS`), the `release.pl` script will generate
a `.nsi` file and compile it using **makensis.exe** to generate an specific
installer for each PostgreSQL major versions found when running the
`release.pl` script. At execution time, the installer will try to discover the
server's PostgreSQL installation path by reading the registry key
**HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-$architecture-$majorversion\Base
Directory**.

If the key is found, the installer will inform the user and use it as the
default installation location. Otherwise, the installer will inform the user
that no installation was automatically found and will force the user to choose
a location before being able to continue the installation.

Browse pgsql-announce by date

  From Date Subject
Next Message MigOps via PostgreSQL Announce 2021-08-25 23:50:59 PostgreSQL DBMS_JOB compatibility extension
Previous Message fish's dotNET via PostgreSQL Announce 2021-08-23 18:18:16 dbMigration .NET v14.4 released