Subject: RE: Windows meson build

From: "Kohei Harikae (Fujitsu)" <[email-masked]>
Date: Mon, 6 Jan 2025 09:57:58 +0000

Hi,

> I think in the phrase:
> "add the directory where the .pc file resides to PKG_CONFIG_PATH."
> better to add wording, that PKG_CONFIG_PATH is the list of directories 
> separated by PATH separator ( ; in Windows, : in POSIX). Otherwise the 
> reader has to search additional information about this variable in 
> meson documentation.

Thank you for your advice.
I added the description of PATH separator based on your advice.

> I think, it is better to add the other options how to configure external
> libraries, if they do not have .pc file:
> add meson options defined by PostgreSQL for its configuration (gettext 
> library example)
>   
> -Dextra_include_dirs=c:\postgres\gettext\x64-windows\include,c:\otherlibs\include
>   -Dextra_lib_dirs=c:\postgres\gettext\x64-windows\lib,c:\otherlibs\lib
>
> extra_include_dirs and extra_lib_dirs are options defined by PostgreSQL. 
> This options are
> comma separated lists of directories, if every value does not contain 
> comma itself.

- 0001 icu
- 0002 libxml
- 0003 libxslt
- 0004 lz4
- 0005 tcl
- 0006 zlib
- 0007 zstd
These libraries could not be built by setting extra_include_dirs and extra_lib_dirs.
These libraries may not have .pc file created.
For example, if I use msc (Visual Studio) to build zLib, zlib.pc is not created.
Could you tell me which libraries can use this option?

Regards,
Kohei Harikae

---

From: Vladlen Popolitov <[email-masked]>
Date: Thu, 09 Jan 2025 18:03:56 +0700

> Could you tell me which libraries can use this option?
Hi!

I don't have my Windows PC near me just now, I take information from my 
memory regarding these
libraries.

I use Windows package manager vcpkg to build these libraries, and vcpkg 
uses msvc (Visual Studio).
As I remember, icu, libxml2, libxslt build by vcpkg have .pc file. 
Really pc file is easy to
create by hands the text file with
a) product name and version
b) relative (from .pc file location) path to libs
c) relative path to includes
Libraries with .pc file can be listed in environment variable 
PKG_CONFIG_PATH.

gettext does not have pc file, and lib and include location must be 
included in extra_include_dirs
and extra_lib_dirs options, that are PostgreSQL options in meson (not 
meson itself options) added
for libraries without .pc file.

Steps to build PostgreSQL under Windsows using meson and vcpkg
1) create build.cmd for all commands
2) install vcpkg to any location (except network drive, it has problems 
with it. Hard drive C: is OK)
3) install all libraries:
  vcpkg install libxml2
  etc...
4) look for all libraries lib/pkgconf library and find .pc file. All pc 
file paths add to
SET PKG_CONFIG_PATH=... in build.cmd
5) all libraries without pc file - add to -Dextra_include_dirs= and 
-Dextra_lib_dirs for meson command,
that prepares the build directory - add it to build.cmd
6) add in the beginning build.cmd this or correct path for your system
  call "C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
7) run build.cmd

This library configuration should work. I recommend install libraries to 
special location for every
build version to control exact location and library version. vcpkg has 
options for library version
and install directory.

-- 
Best regards,

Vladlen Popolitov.

---

From: "Kohei Harikae (Fujitsu)" <[email-masked]>
Date: Fri, 10 Jan 2025 09:43:02 +0000

Hi,

Thank you for your advice.
Based on your advice, I have added a description of the vcpkg and -Dextra_include_dirs options.
How do you think about this?

Regards,
Kohei Harikae

---

From: Vladlen Popolitov <[email-masked]>
Date: Thu, 16 Jan 2025 16:05:28 +0700

Hi,

Looks good! If you create commitfest entry, I would make review.

-- 
Best regards,

Vladlen Popolitov.

---

From: "Kohei Harikae (Fujitsu)" <[email-masked]>
Date: Fri, 24 Jan 2025 12:13:23 +0000

Hi,

My previous patch had whitespace issues.
I recreated the patch.
I will create a commitfest with this patch.

Regards,
Kohei Harikae