diff --git a/config/pkg/lib/postgresql.yml b/config/pkg/lib/postgresql.yml index 4be33190..290650df 100644 --- a/config/pkg/lib/postgresql.yml +++ b/config/pkg/lib/postgresql.yml @@ -17,6 +17,11 @@ postgresql: depends@windows: - openssl - zlib + tools@windows: + - meson + - ninja + - winflexbison + - strawberry-perl suggests@unix: - icu - libxslt diff --git a/config/pkg/tool/meson.yml b/config/pkg/tool/meson.yml new file mode 100644 index 00000000..0021bf93 --- /dev/null +++ b/config/pkg/tool/meson.yml @@ -0,0 +1,11 @@ +meson: + type: tool + artifact: + binary: + windows-x86_64: { type: url, url: 'https://github.com/mesonbuild/meson/releases/download/1.11.1/meson-1.11.1-py3-none-any.whl', extract: '{pkg_root_path}/meson/meson-1.11.1-py3-none-any.whl' } + path@windows: + - '{pkg_root_path}\meson' + tool: + provides: + - meson.bat + binary-subdir: meson diff --git a/config/pkg/tool/ninja.yml b/config/pkg/tool/ninja.yml new file mode 100644 index 00000000..820e154d --- /dev/null +++ b/config/pkg/tool/ninja.yml @@ -0,0 +1,9 @@ +ninja: + type: tool + artifact: + binary: + windows-x86_64: { type: url, url: 'https://github.com/ninja-build/ninja/releases/download/v1.13.2/ninja-win.zip', extract: { ninja.exe: '{pkg_root_path}/bin/ninja.exe' } } + tool: + provides: + - ninja.exe + binary-subdir: bin diff --git a/config/pkg/tool/winflexbison.yml b/config/pkg/tool/winflexbison.yml new file mode 100644 index 00000000..f117b5b9 --- /dev/null +++ b/config/pkg/tool/winflexbison.yml @@ -0,0 +1,12 @@ +winflexbison: + type: tool + artifact: + binary: + windows-x86_64: { type: url, url: 'https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip', extract: '{pkg_root_path}/winflexbison' } + path@windows: + - '{pkg_root_path}\winflexbison' + tool: + provides: + - win_flex.exe + - win_bison.exe + binary-subdir: winflexbison diff --git a/src/Package/Artifact/meson_win.php b/src/Package/Artifact/meson_win.php new file mode 100644 index 00000000..d3a911be --- /dev/null +++ b/src/Package/Artifact/meson_win.php @@ -0,0 +1,45 @@ +execWithResult("{$candidate} --version", false); + if ($code === 0) { + $python = $candidate; + break; + } + } + if ($python === null) { + throw new EnvironmentException('meson needs Python 3 on PATH. Install it from https://www.python.org or with `winget install Python.Python.3.13`.'); + } + + if (is_dir($venv)) { + FileSystem::removeDir($venv); + } + cmd()->exec("{$python} -m venv \"{$venv}\"") + ->exec("\"{$venv}\\Scripts\\python.exe\" -m pip install --no-index --no-deps \"{$target_path}\""); + + FileSystem::writeFile("{$dir}\\meson.bat", "@echo off\r\n\"%~dp0venv\\Scripts\\meson.exe\" %*\r\n"); + } +} diff --git a/src/Package/Library/postgresql.php b/src/Package/Library/postgresql.php index d0fcc2eb..25d600e2 100644 --- a/src/Package/Library/postgresql.php +++ b/src/Package/Library/postgresql.php @@ -98,7 +98,8 @@ class postgresql extends LibraryPackage . ' -Dextra_lib_dirs=' . escapeshellarg($lib_dir); // Build only the three frontend static libs (not the server) — keeps it fast and avoids - // needing every backend dependency. meson/ninja/win_bison/win_flex/perl come from PATH. + // needing every backend dependency. meson/ninja/win_bison/win_flex/perl come from the + // tool packages declared in the package config (tools@windows). $targets = 'src/interfaces/libpq/libpq.a src/common/libpgcommon.a src/port/libpgport.a'; cmd()->cd($src)