From 2f56fdad4bcf43c21ec6f952cf7b91c8c43c5c0d Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 1 Jun 2023 04:55:03 +0200 Subject: [PATCH] [libpq,libxslt] Update libpq, fix misc issues (#31314) * [libpq] Install msys2 autoconf-archive * Install msys2 zic tool * Fix zstd patching * Always build as if cross compiling * Enable feature client for non-windows * Cleanup (WIP) * Cleanup (WIP) * Update portfile.cmake * WIP * WIP * WIP * WIP * [libxslt] Fix pc files * WIP * WIP: Test libpq[all] * WIP * Update to 15.3 * Move patches * Revert "WIP: Test libpq[all]" * Fix install * Skip import libs for plugins * Full CI --- ports/libpq/Makefile | 43 +- ports/libpq/build-msvc.cmake | 80 ++++ ports/libpq/config.pl | 29 -- ports/libpq/libpq.props.in | 8 +- .../windows/MSBuildProject-static-crt.patch | 23 - .../windows/MSBuildProject-static-lib.patch | 13 - .../MSBuildProject_fix_gendef_perl.patch | 13 - .../windows/Mkvcbuild-static-lib.patch | 13 - ports/libpq/patches/windows/Solution.patch | 45 -- .../patches/windows/Solution_DEBUG.patch | 98 ---- .../patches/windows/Solution_RELEASE.patch | 98 ---- ports/libpq/patches/windows/arm.patch | 37 -- .../patches/windows/fix-compile-flag-Zi.patch | 33 -- ports/libpq/patches/windows/install.patch | 223 --------- .../patches/windows/minimize_install.patch | 35 -- ports/libpq/patches/windows/msgfmt.patch | 13 - .../patches/windows/openssl-version.patch | 14 - .../patches/windows/python3_build_DEBUG.patch | 44 -- .../windows/python3_build_RELEASE.patch | 42 -- ports/libpq/patches/windows/tcl_version.patch | 13 - ports/libpq/portfile.cmake | 407 ++++------------- .../{patches => unix}/fix-configure.patch | 21 +- ports/libpq/unix/mingw-install.patch | 36 ++ ports/libpq/unix/no-server-tools.patch | 37 ++ ports/libpq/unix/python.patch | 25 + ports/libpq/unix/single-linkage.patch | 56 +++ ports/libpq/vcpkg-cmake-wrapper.cmake | 2 +- ports/libpq/vcpkg-libs.props.in | 31 ++ ports/libpq/vcpkg.json | 98 +++- .../{patches => }/windows/macro-def.patch | 0 ports/libpq/windows/msbuild.patch | 428 ++++++++++++++++++ .../{patches => }/windows/python_lib.patch | 0 ports/libpq/windows/spin_delay.patch | 24 + .../windows/win_bison_flex.patch | 0 ports/libxslt/portfile.cmake | 9 + ports/libxslt/vcpkg.json | 2 +- versions/baseline.json | 6 +- versions/l-/libpq.json | 5 + versions/l-/libxslt.json | 5 + 39 files changed, 962 insertions(+), 1147 deletions(-) create mode 100644 ports/libpq/build-msvc.cmake delete mode 100644 ports/libpq/config.pl delete mode 100644 ports/libpq/patches/windows/MSBuildProject-static-crt.patch delete mode 100644 ports/libpq/patches/windows/MSBuildProject-static-lib.patch delete mode 100644 ports/libpq/patches/windows/MSBuildProject_fix_gendef_perl.patch delete mode 100644 ports/libpq/patches/windows/Mkvcbuild-static-lib.patch delete mode 100644 ports/libpq/patches/windows/Solution.patch delete mode 100644 ports/libpq/patches/windows/Solution_DEBUG.patch delete mode 100644 ports/libpq/patches/windows/Solution_RELEASE.patch delete mode 100644 ports/libpq/patches/windows/arm.patch delete mode 100644 ports/libpq/patches/windows/fix-compile-flag-Zi.patch delete mode 100644 ports/libpq/patches/windows/install.patch delete mode 100644 ports/libpq/patches/windows/minimize_install.patch delete mode 100644 ports/libpq/patches/windows/msgfmt.patch delete mode 100644 ports/libpq/patches/windows/openssl-version.patch delete mode 100644 ports/libpq/patches/windows/python3_build_DEBUG.patch delete mode 100644 ports/libpq/patches/windows/python3_build_RELEASE.patch delete mode 100644 ports/libpq/patches/windows/tcl_version.patch rename ports/libpq/{patches => unix}/fix-configure.patch (84%) create mode 100644 ports/libpq/unix/mingw-install.patch create mode 100644 ports/libpq/unix/no-server-tools.patch create mode 100644 ports/libpq/unix/python.patch create mode 100644 ports/libpq/unix/single-linkage.patch create mode 100644 ports/libpq/vcpkg-libs.props.in rename ports/libpq/{patches => }/windows/macro-def.patch (100%) create mode 100644 ports/libpq/windows/msbuild.patch rename ports/libpq/{patches => }/windows/python_lib.patch (100%) create mode 100644 ports/libpq/windows/spin_delay.patch rename ports/libpq/{patches => }/windows/win_bison_flex.patch (100%) diff --git a/ports/libpq/Makefile b/ports/libpq/Makefile index ee2ffcaf195..67994f4bac2 100644 --- a/ports/libpq/Makefile +++ b/ports/libpq/Makefile @@ -2,14 +2,12 @@ subdir = . top_builddir = . include src/Makefile.global -.NOTPARALLEL: - ifeq ($(LIBPQ_LIBRARY_TYPE), static) LIBPQ_INSTALL_LIBS = install-stlib endif ifeq ($(LIBPQ_LIBRARY_TYPE), shared) -ifeq ($(USING_MINGW), yes) +ifeq ($(LIBPQ_USING_MINGW), yes) # The import library name is the same as the static library name EXTRA_TARGET = install-lib-static endif @@ -17,21 +15,40 @@ endif .PHONY: all all: - $(MAKE) -C src/include MAKELEVEL=0 - $(MAKE) -C src/common MAKELEVEL=0 - $(MAKE) -C src/port MAKELEVEL=0 - $(MAKE) -C src/interfaces/libpq MAKELEVEL=0 all-$(LIBPQ_LIBRARY_TYPE)-lib - $(MAKE) -C src/bin/pg_config MAKELEVEL=0 + $(MAKE) -C src/include + $(MAKE) -C src/common + $(MAKE) -C src/port + $(MAKE) -C src/interfaces/libpq all-$(LIBPQ_LIBRARY_TYPE)-lib + $(MAKE) -C src/interfaces/ecpg/include + $(MAKE) -C src/interfaces/ecpg/pgtypeslib + $(MAKE) -C src/interfaces/ecpg/ecpglib + $(MAKE) -C src/interfaces/ecpg/compatlib +ifeq ($(LIBPQ_ENABLE_TOOLS), yes) + $(MAKE) -C src/interfaces/ecpg/preproc + $(MAKE) -C src/fe_utils + $(MAKE) -C src/bin +else + $(MAKE) -C src/bin/pg_config +endif .PHONY: install-stlib install-stlib: - $(MAKE) -C src/common MAKELEVEL=0 install -o all + $(MAKE) -C src/common install -o all rm -f '$(DESTDIR)$(libdir)/libpgcommon_shlib.a' - $(MAKE) -C src/port MAKELEVEL=0 install -o all + $(MAKE) -C src/port install -o all rm -f '$(DESTDIR)$(libdir)/libpgport_shlib.a' .PHONY: install install: $(LIBPQ_INSTALL_LIBS) - $(MAKE) -C src/include MAKELEVEL=0 install - $(MAKE) -C src/interfaces/libpq MAKELEVEL=0 $(EXTRA_TARGET) install-lib-$(LIBPQ_LIBRARY_TYPE) install-lib-pc install -o all -o install-lib - $(MAKE) -C src/bin/pg_config MAKELEVEL=0 install + $(MAKE) -C src/include install + $(MAKE) -C src/interfaces/libpq $(EXTRA_TARGET) install-lib-$(LIBPQ_LIBRARY_TYPE) install-lib-pc install -o all -o install-lib + $(MAKE) -C src/interfaces/ecpg/include install + $(MAKE) -C src/interfaces/ecpg/pgtypeslib install + $(MAKE) -C src/interfaces/ecpg/ecpglib install + $(MAKE) -C src/interfaces/ecpg/compatlib install +ifeq ($(LIBPQ_ENABLE_TOOLS), yes) + $(MAKE) -C src/interfaces/ecpg/preproc install + $(MAKE) -C src/bin install +else + $(MAKE) -C src/bin/pg_config install +endif diff --git a/ports/libpq/build-msvc.cmake b/ports/libpq/build-msvc.cmake new file mode 100644 index 00000000000..7857b11e3a9 --- /dev/null +++ b/ports/libpq/build-msvc.cmake @@ -0,0 +1,80 @@ +function(build_msvc build_type source_path) + if(build_type STREQUAL "DEBUG") + set(vcpkg_configuration "Debug") + set(label "${TARGET_TRIPLET}-dbg") + set(packages_dir "${CURRENT_PACKAGES_DIR}/debug") + else() + set(vcpkg_configuration "Release") + set(label "${TARGET_TRIPLET}-rel") + set(packages_dir "${CURRENT_PACKAGES_DIR}") + endif() + + set(build_path "${CURRENT_BUILDTREES_DIR}/${label}") + file(REMOVE_RECURSE "${build_path}") + file(COPY "${source_path}/" DESTINATION "${build_path}") + + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${build_path}/src/include/port/win32.h" "__declspec (dllimport)" "") + endif() + vcpkg_replace_string("${build_path}/src/tools/msvc/MSBuildProject.pm" "perl " "\"${PERL}\" ") + configure_file("${CURRENT_PORT_DIR}/libpq.props.in" "${build_path}/libpq.props" @ONLY) + configure_file("${CURRENT_PORT_DIR}/vcpkg-libs.props.in" "${build_path}/vcpkg-libs.props" @ONLY) + set(config "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n\n") + foreach(var IN ITEMS VCPKG_TARGET_ARCHITECTURE VCPKG_LIBRARY_LINKAGE VCPKG_CRT_LINKAGE) + string(APPEND config "\$config->{${var}} = \"${${var}}\";\n") + endforeach() + foreach(option IN ITEMS icu lz4 nls openssl python tcl xml xslt zlib zstd) + if(option IN_LIST FEATURES) + string(APPEND config "\$config->{${option}} = \"${CURRENT_INSTALLED_DIR}\";\n") + endif() + endforeach() + if("openssl" IN_LIST FEATURES) + file(STRINGS "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/openssl.pc" OPENSSL_VERSION REGEX "Version:") + string(APPEND config "\$config->{openssl_version} = '${OPENSSL_VERSION}';\n") + endif() + string(APPEND config "\$config->{python_version} = '3.10';\n") + string(APPEND config "\$config->{tcl_version} = '90';\n") + file(WRITE "${build_path}/src/tools/msvc/config.pl" "${config}") + + set(build_in_parallel "-m") + set(build_targets libpq libecpg_compat) + set(install_target core) + if(HAS_TOOLS AND NOT build_type STREQUAL "DEBUG") + set(build_in_parallel "") # mitigate winflex races + set(build_targets client) + set(install_target client) + endif() + + string(REPLACE "x86" "Win32" platform "${VCPKG_TARGET_ARCHITECTURE}") + vcpkg_get_windows_sdk(VCPKG_TARGET_PLATFORM_VERSION) + set(ENV{MSBFLAGS} "\ + /p:Platform=${platform} \ + /p:PlatformToolset=${VCPKG_PLATFORM_TOOLSET} \ + /p:VCPkgLocalAppDataDisabled=true \ + /p:UseIntelMKL=No \ + /p:WindowsTargetPlatformVersion=${VCPKG_TARGET_PLATFORM_VERSION} \ + /p:VcpkgConfiguration=${vcpkg_configuration} \ + ${build_in_parallel} \ + /p:ForceImportBeforeCppTargets=\"${SCRIPTS}/buildsystems/msbuild/vcpkg.targets;${build_path}/vcpkg-libs.props\" \ + /p:VcpkgTriplet=${TARGET_TRIPLET} \ + /p:VcpkgCurrentInstalledDir=\"${CURRENT_INSTALLED_DIR}\" \ + /p:ForceImportAfterCppTargets=\"${build_path}/libpq.props\" \ + ") + + message(STATUS "Building ${label}") + foreach(target IN LISTS build_targets) + string(REPLACE "client" "" target "${target}") + vcpkg_execute_required_process( + COMMAND "${PERL}" build.pl ${build_type} ${target} + WORKING_DIRECTORY "${build_path}/src/tools/msvc" + LOGNAME "build-${target}-${label}" + ) + endforeach() + + message(STATUS "Installing ${label}") + vcpkg_execute_required_process( + COMMAND "${PERL}" install.pl "${packages_dir}" ${install_target} + WORKING_DIRECTORY "${build_path}/src/tools/msvc" + LOGNAME "install-${label}" + ) +endfunction() diff --git a/ports/libpq/config.pl b/ports/libpq/config.pl deleted file mode 100644 index 412eb09c484..00000000000 --- a/ports/libpq/config.pl +++ /dev/null @@ -1,29 +0,0 @@ -our $config = { - asserts => 0, # --enable-cassert - # float4byval=>1, # --disable-float4-byval, on by default - - # float8byval=> $platformbits == 64, # --disable-float8-byval, - # off by default on 32 bit platforms, on by default on 64 bit platforms - - # blocksize => 8, # --with-blocksize, 8kB by default - # wal_blocksize => 8, # --with-wal-blocksize, 8kB by default - ldap => 1, # --with-ldap - extraver => undef, # --with-extra-version= - gss => undef, # --with-gssapi= - icu => undef, # --with-icu= - lz4 => undef, # --with-lz4= - zstd => undef, # --with-zstd= - nls => undef, # --enable-nls= - tap_tests => undef, # --enable-tap-tests - tcl => undef, # --with-tcl= - perl => undef, # --with-perl= - python => undef, # --with-python= - openssl => undef, # --with-ssl=openssl with - uuid => undef, # --with-uuid= - xml => undef, # --with-libxml= - xslt => undef, # --with-libxslt= - iconv => undef, # (not in configure, path to iconv) - zlib => undef # --with-zlib= -}; - -1; diff --git a/ports/libpq/libpq.props.in b/ports/libpq/libpq.props.in index d172a4af401..223e528fe9f 100644 --- a/ports/libpq/libpq.props.in +++ b/ports/libpq/libpq.props.in @@ -1,9 +1,9 @@ - + %(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_DEBUG@ - + %(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG@ @@ -12,9 +12,9 @@ - + %(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_RELEASE@ - + %(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE@ diff --git a/ports/libpq/patches/windows/MSBuildProject-static-crt.patch b/ports/libpq/patches/windows/MSBuildProject-static-crt.patch deleted file mode 100644 index 03bd832f859..00000000000 --- a/ports/libpq/patches/windows/MSBuildProject-static-crt.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm -index 823357c02..faa3e336f 100644 ---- a/src/tools/msvc/MSBuildProject.pm -+++ b/src/tools/msvc/MSBuildProject.pm -@@ -84,16 +84,16 @@ EOF - defs => "_DEBUG;DEBUG=1", - opt => 'Disabled', - strpool => 'false', -- runtime => 'MultiThreadedDebugDLL' -+ runtime => 'MultiThreadedDebug' - }); - $self->WriteItemDefinitionGroup( - $f, - 'Release', - { - defs => "", - opt => 'Full', - strpool => 'true', -- runtime => 'MultiThreadedDLL' -+ runtime => 'MultiThreaded' - }); - return; - } diff --git a/ports/libpq/patches/windows/MSBuildProject-static-lib.patch b/ports/libpq/patches/windows/MSBuildProject-static-lib.patch deleted file mode 100644 index 70cd22d60ba..00000000000 --- a/ports/libpq/patches/windows/MSBuildProject-static-lib.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm -index 823357c02..e1dc59aa7 100644 ---- a/src/tools/msvc/MSBuildProject.pm -+++ b/src/tools/msvc/MSBuildProject.pm -@@ -265,7 +265,7 @@ sub WriteConfigurationPropertyGroup - my $cfgtype = - ($self->{type} eq "exe") - ? 'Application' -- : ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary'); -+ : ($self->{type} eq "dll" ? 'StaticLibrary' : 'StaticLibrary'); - - print $f < diff --git a/ports/libpq/patches/windows/MSBuildProject_fix_gendef_perl.patch b/ports/libpq/patches/windows/MSBuildProject_fix_gendef_perl.patch deleted file mode 100644 index 10955c3f98d..00000000000 --- a/ports/libpq/patches/windows/MSBuildProject_fix_gendef_perl.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm -index 823357c02..b93992f22 100644 ---- a/src/tools/msvc/MSBuildProject.pm -+++ b/src/tools/msvc/MSBuildProject.pm -@@ -384,7 +384,7 @@ EOF - print $f < - Generate DEF file -- perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform} -+ perl "src\\tools\\msvc\\gendef.pl" $cfgname\\$self->{name} $self->{platform} - - EOF - } diff --git a/ports/libpq/patches/windows/Mkvcbuild-static-lib.patch b/ports/libpq/patches/windows/Mkvcbuild-static-lib.patch deleted file mode 100644 index 554d8527a43..00000000000 --- a/ports/libpq/patches/windows/Mkvcbuild-static-lib.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm -index 99f39caa5..4f51c12f2 100644 ---- a/src/tools/msvc/Mkvcbuild.pm -+++ b/src/tools/msvc/Mkvcbuild.pm -@@ -199,7 +199,7 @@ sub mkvcbuild - 'syncrep_gram.y'); - $postgres->AddFiles('src/backend/utils/adt', 'jsonpath_scan.l', - 'jsonpath_gram.y'); -- $postgres->AddDefine('BUILDING_DLL'); -+ # $postgres->AddDefine('BUILDING_DLL'); - $postgres->AddLibrary('secur32.lib'); - $postgres->AddLibrary('ws2_32.lib'); - $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap}); diff --git a/ports/libpq/patches/windows/Solution.patch b/ports/libpq/patches/windows/Solution.patch deleted file mode 100644 index 3387349e0b7..00000000000 --- a/ports/libpq/patches/windows/Solution.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm -index 51711c2bf..d33fdc3b0 100644 ---- a/src/tools/msvc/Solution.pm -+++ b/src/tools/msvc/Solution.pm -@@ -63,17 +63,21 @@ sub DeterminePlatform - my $self = shift; - - if ($^O eq "MSWin32") - { - # Examine CL help output to determine if we are in 32 or 64-bit mode. - my $output = `cl /help 2>&1`; - $? >> 8 == 0 or die "cl command not found"; -- $self->{platform} = -- ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32'; -+ if ($output =~ m/x64\s/) { $self->{platform} = 'x64'; -+ } elsif ($output =~ m/x86\s/) { $self->{platform} = 'Win32'; -+ } elsif ($output =~ m/ARM64\s/) { $self->{platform} = 'ARM64'; -+ } elsif ($output =~ m/ARM\s/) { $self->{platform} = 'ARM'; -+ } else { $self->{platform} = 'Unknown' -+ } - } - else - { - $self->{platform} = 'FAKE'; - } - print "Detected hardware platform: $self->{platform}\n"; - return; - } -@@ -757,14 +757,14 @@ EOF - || confess "Could not open pg_config_paths.h"; - print $o <{options}->{zlib}) - { - $proj->AddIncludeDir($self->{options}->{zlib} . '\include'); -- $proj->AddLibrary($self->{options}->{zlib} . '\lib\zdll.lib'); -+ $proj->AddLibrary($self->{options}->{zlib} . '\debug\lib\zlibd.lib'); - } - if ($self->{options}->{openssl}) - { -@@ -989,8 +989,11 @@ sub AddProject - # On both Win32 and Win64 the same library - # names are used without a debugging context. - $dbgsuffix = 0; -- $libsslpath = '\lib\libssl.lib'; -- $libcryptopath = '\lib\libcrypto.lib'; -+ $libsslpath = '\debug\lib\libssl.lib'; # -+ $libcryptopath = '\debug\lib\libcrypto.lib'; # -+ $proj->AddLibrary('crypt32.lib'); -+ $proj->AddLibrary('ws2_32.lib'); -+ $proj->AddLibrary('secur32.lib'); - } - - $proj->AddLibrary($self->{options}->{openssl} . $libsslpath, -@@ -1024,7 +1024,7 @@ sub AddProject - if ($self->{options}->{nls}) - { - $proj->AddIncludeDir($self->{options}->{nls} . '\include'); -- $proj->AddLibrary($self->{options}->{nls} . '\lib\libintl.lib'); -+ $proj->AddLibrary($self->{options}->{nls} . '\debug\lib\intl.lib'); # - } - if ($self->{options}->{gss}) - { -@@ -1051,21 +1051,21 @@ sub AddProject - } - if ($self->{options}->{iconv}) - { - $proj->AddIncludeDir($self->{options}->{iconv} . '\include'); -- $proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib'); -+ $proj->AddLibrary($self->{options}->{iconv} . '\debug\lib\iconv.lib'); # - } - if ($self->{options}->{icu}) - { - $proj->AddIncludeDir($self->{options}->{icu} . '\include'); - if ($self->{platform} eq 'Win32') - { -- $proj->AddLibrary($self->{options}->{icu} . '\lib\icuin.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib\icuuc.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib\icudt.lib'); -+ $proj->AddLibrary($self->{options}->{icu} . '\debug\lib\icuind.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\debug\lib\icuucd.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\debug\lib\icudtd.lib'); # - } - else - { -- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icuin.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icuuc.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icudt.lib'); -+ $proj->AddLibrary($self->{options}->{icu} . '\debug\lib\icuind.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\debug\lib\icuucd.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\debug\lib\icudtd.lib'); # - } -@@ -1074,27 +1074,27 @@ sub AddProject - { - $proj->AddIncludeDir($self->{options}->{xml} . '\include'); - $proj->AddIncludeDir($self->{options}->{xml} . '\include\libxml2'); -- $proj->AddLibrary($self->{options}->{xml} . '\lib\libxml2.lib'); -+ $proj->AddLibrary($self->{options}->{xml} . '\debug\lib\libxml2.lib'); # - } - if ($self->{options}->{xslt}) - { - $proj->AddIncludeDir($self->{options}->{xslt} . '\include'); -- $proj->AddLibrary($self->{options}->{xslt} . '\lib\libxslt.lib'); -+ $proj->AddLibrary($self->{options}->{xslt} . '\debug\lib\libxslt.lib'); # - } - if ($self->{options}->{lz4}) - { - $proj->AddIncludeDir($self->{options}->{lz4} . '\include'); -- $proj->AddLibrary($self->{options}->{lz4} . '\lib\liblz4.lib'); -+ $proj->AddLibrary($self->{options}->{lz4} . '\debug\lib\lz4d.lib'); # - } - if ($self->{options}->{zstd}) - { - $proj->AddIncludeDir($self->{options}->{zstd} . '\include'); -- $proj->AddLibrary($self->{options}->{zstd} . '\lib\libzstd.lib'); -+ $proj->AddLibrary($self->{options}->{zstd} . '\debug\lib\zstd.lib'); - } - if ($self->{options}->{uuid}) - { - $proj->AddIncludeDir($self->{options}->{uuid} . '\include'); -- $proj->AddLibrary($self->{options}->{uuid} . '\lib\uuid.lib'); -+ $proj->AddLibrary($self->{options}->{uuid} . '\debug\lib\uuid.lib'); # - } - return $proj; - } diff --git a/ports/libpq/patches/windows/Solution_RELEASE.patch b/ports/libpq/patches/windows/Solution_RELEASE.patch deleted file mode 100644 index d0bb480413c..00000000000 --- a/ports/libpq/patches/windows/Solution_RELEASE.patch +++ /dev/null @@ -1,98 +0,0 @@ -diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm -index 2820ace22..7fddbf0fb 100644 ---- a/src/tools/msvc/Solution.pm -+++ b/src/tools/msvc/Solution.pm -@@ -948,7 +948,7 @@ sub AddProject - if ($self->{options}->{zlib}) - { - $proj->AddIncludeDir($self->{options}->{zlib} . '\include'); -- $proj->AddLibrary($self->{options}->{zlib} . '\lib\zdll.lib'); -+ $proj->AddLibrary($self->{options}->{zlib} . '\lib\zlib.lib'); - } - if ($self->{options}->{openssl}) - { -@@ -989,8 +989,11 @@ sub AddProject - # On both Win32 and Win64 the same library - # names are used without a debugging context. - $dbgsuffix = 0; -- $libsslpath = '\lib\libssl.lib'; -- $libcryptopath = '\lib\libcrypto.lib'; -+ $libsslpath = '\lib\libssl.lib'; # -+ $libcryptopath = '\lib\libcrypto.lib'; # -+ $proj->AddLibrary('crypt32.lib'); -+ $proj->AddLibrary('ws2_32.lib'); -+ $proj->AddLibrary('secur32.lib'); - } - - $proj->AddLibrary($self->{options}->{openssl} . $libsslpath, -@@ -1024,7 +1024,7 @@ sub AddProject - if ($self->{options}->{nls}) - { - $proj->AddIncludeDir($self->{options}->{nls} . '\include'); -- $proj->AddLibrary($self->{options}->{nls} . '\lib\libintl.lib'); -+ $proj->AddLibrary($self->{options}->{nls} . '\lib\intl.lib'); # - } - if ($self->{options}->{gss}) - { -@@ -1051,21 +1051,21 @@ sub AddProject - } - if ($self->{options}->{iconv}) - { - $proj->AddIncludeDir($self->{options}->{iconv} . '\include'); -- $proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib'); -+ $proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib'); # - } - if ($self->{options}->{icu}) - { - $proj->AddIncludeDir($self->{options}->{icu} . '\include'); - if ($self->{platform} eq 'Win32') - { -- $proj->AddLibrary($self->{options}->{icu} . '\lib\icuin.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib\icuuc.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib\icudt.lib'); -+ $proj->AddLibrary($self->{options}->{icu} . '\lib\icuin.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\lib\icuuc.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\lib\icudt.lib'); # - } - else - { -- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icuin.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icuuc.lib'); -- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icudt.lib'); -+ $proj->AddLibrary($self->{options}->{icu} . '\lib\icuin.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\lib\icuuc.lib'); # -+ $proj->AddLibrary($self->{options}->{icu} . '\lib\icudt.lib'); # - } -@@ -1074,27 +1074,27 @@ sub AddProject - { - $proj->AddIncludeDir($self->{options}->{xml} . '\include'); - $proj->AddIncludeDir($self->{options}->{xml} . '\include\libxml2'); -- $proj->AddLibrary($self->{options}->{xml} . '\lib\libxml2.lib'); -+ $proj->AddLibrary($self->{options}->{xml} . '\lib\libxml2.lib'); # - } - if ($self->{options}->{xslt}) - { - $proj->AddIncludeDir($self->{options}->{xslt} . '\include'); -- $proj->AddLibrary($self->{options}->{xslt} . '\lib\libxslt.lib'); -+ $proj->AddLibrary($self->{options}->{xslt} . '\lib\libxslt.lib'); # - } - if ($self->{options}->{lz4}) - { - $proj->AddIncludeDir($self->{options}->{lz4} . '\include'); -- $proj->AddLibrary($self->{options}->{lz4} . '\lib\liblz4.lib'); -+ $proj->AddLibrary($self->{options}->{lz4} . '\lib\lz4.lib'); # - } - if ($self->{options}->{zstd}) - { - $proj->AddIncludeDir($self->{options}->{zstd} . '\include'); -- $proj->AddLibrary($self->{options}->{zstd} . '\lib\libzstd.lib'); -+ $proj->AddLibrary($self->{options}->{zstd} . '\lib\zstd.lib'); - } - if ($self->{options}->{uuid}) - { - $proj->AddIncludeDir($self->{options}->{uuid} . '\include'); -- $proj->AddLibrary($self->{options}->{uuid} . '\lib\uuid.lib'); -+ $proj->AddLibrary($self->{options}->{uuid} . '\lib\uuid.lib'); # - } - return $proj; - } diff --git a/ports/libpq/patches/windows/arm.patch b/ports/libpq/patches/windows/arm.patch deleted file mode 100644 index c6329b14e5c..00000000000 --- a/ports/libpq/patches/windows/arm.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm -index 99f39caa5..4f51c12f2 100644 ---- a/src/tools/msvc/Mkvcbuild.pm -+++ b/src/tools/msvc/Mkvcbuild.pm -@@ -110,8 +110,8 @@ sub mkvcbuild - - if ($vsVersion >= '9.00') - { -- push(@pgportfiles, 'pg_crc32c_sse42_choose.c'); -- push(@pgportfiles, 'pg_crc32c_sse42.c'); -+ #push(@pgportfiles, 'pg_crc32c_sse42_choose.c'); -+ #push(@pgportfiles, 'pg_crc32c_sse42.c'); - push(@pgportfiles, 'pg_crc32c_sb8.c'); - } - else -diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm -index 823357c02..625f32bf8 100644 ---- a/src/tools/msvc/MSBuildProject.pm -+++ b/src/tools/msvc/MSBuildProject.pm -@@ -307,7 +307,6 @@ sub WriteItemDefinitionGroup - : ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary'); - my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';'); - -- my $targetmachine = -- $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64'; -- -+ my $targetmachine = $self->{platform} eq 'ARM64' ? 'MachineARM64' : 'MachineARM'; -+ - my $includes = join ';', @{ $self->{includes} }, ""; -@@ -347,7 +349,6 @@ sub WriteItemDefinitionGroup - .\\$cfgname\\$self->{name}\\$self->{name}.pdb - false - .\\$cfgname\\$self->{name}\\$self->{name}.map -- false - - - Console diff --git a/ports/libpq/patches/windows/fix-compile-flag-Zi.patch b/ports/libpq/patches/windows/fix-compile-flag-Zi.patch deleted file mode 100644 index b5e3b6cdb33..00000000000 --- a/ports/libpq/patches/windows/fix-compile-flag-Zi.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm -index b93992f..2397511 100644 ---- a/src/tools/msvc/MSBuildProject.pm -+++ b/src/tools/msvc/MSBuildProject.pm -@@ -336,7 +336,7 @@ sub WriteItemDefinitionGroup - false - Level3 - true -- ProgramDatabase -+ OldStyle - Default - - -diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm -index e0c9a88..98f9e67 100644 ---- a/src/tools/msvc/Install.pm -+++ b/src/tools/msvc/Install.pm -@@ -352,9 +352,12 @@ sub CopySolutionOutput - || croak "Could not copy $pf.$ext\n"; - } - } -- lcopy("$conf\\$pf\\$pf.pdb", "$target\\bin\\$pf.pdb") -- || croak "Could not copy $pf.pdb\n"; -- print "."; -+ if ($1 eq 'DynamicLibrary') -+ { -+ lcopy("$conf\\$pf\\$pf.pdb", "$target\\bin\\$pf.pdb") -+ || croak "Could not copy $pf.pdb\n"; -+ print "."; -+ } - } - print "\n"; - return; diff --git a/ports/libpq/patches/windows/install.patch b/ports/libpq/patches/windows/install.patch deleted file mode 100644 index 0d7a6d69a10..00000000000 --- a/ports/libpq/patches/windows/install.patch +++ /dev/null @@ -1,223 +0,0 @@ -diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm -index d109b2c90..75c7446e6 100644 ---- a/src/tools/msvc/Install.pm -+++ b/src/tools/msvc/Install.pm -@@ -89,10 +89,10 @@ sub Install - my $majorver = DetermineMajorVersion(); - print "Installing version $majorver for $conf in $target\n"; - -- my @client_dirs = ('bin', 'lib', 'share', 'symbols'); -+ my @client_dirs = ('bin', 'lib', 'share', 'tools', 'share/libpq', 'tools/libpq'); - my @all_dirs = ( -- @client_dirs, 'doc', 'doc/contrib', 'doc/extension', 'share/contrib', -- 'share/extension', 'share/timezonesets', 'share/tsearch_data'); -+ @client_dirs, 'doc', 'doc/libpq', 'doc/libpq/contrib', 'doc/libpq/extension', 'share/libpq/contrib', -+ 'share/libpq/extension', 'share/libpq/timezonesets', 'share/libpq/tsearch_data'); - if ($insttype eq "client") - { - EnsureDirectories($target, @client_dirs); -@@ -117,7 +117,7 @@ sub Install - } - }, - @top_dir); -- CopySetOfFiles('config files', $sample_files, $target . '/share/'); -+ CopySetOfFiles('config files', $sample_files, $target . '/share/libpq/'); - CopyFiles( - 'Import libraries', - $target . '/lib/', -@@ -131,35 +131,35 @@ sub Install - CopySetOfFiles( - 'timezone names', - [ glob('src\timezone\tznames\*.txt') ], -- $target . '/share/timezonesets/'); -+ $target . '/share/libpq/timezonesets/'); - CopyFiles( - 'timezone sets', -- $target . '/share/timezonesets/', -+ $target . '/share/libpq/timezonesets/', - 'src/timezone/tznames/', 'Default', 'Australia', 'India'); - CopySetOfFiles( - 'BKI files', - [ glob("src\\backend\\catalog\\postgres.*") ], -- $target . '/share/'); -+ $target . '/share/libpq/'); - CopySetOfFiles( - 'SQL files', - [ glob("src\\backend\\catalog\\*.sql") ], -- $target . '/share/'); -+ $target . '/share/libpq/'); - CopyFiles( -- 'Information schema data', $target . '/share/', -+ 'Information schema data', $target . '/share/libpq/', - 'src/backend/catalog/', 'sql_features.txt'); - CopyFiles( -- 'Error code data', $target . '/share/', -+ 'Error code data', $target . '/share/libpq/', - 'src/backend/utils/', 'errcodes.txt'); - GenerateTimezoneFiles($target, $conf); - GenerateTsearchFiles($target); - CopySetOfFiles( - 'Stopword files', - [ glob("src\\backend\\snowball\\stopwords\\*.stop") ], -- $target . '/share/tsearch_data/'); -+ $target . '/share/libpq/tsearch_data/'); - CopySetOfFiles( - 'Dictionaries sample files', - [ glob("src\\backend\\tsearch\\dicts\\*_sample*") ], -- $target . '/share/tsearch_data/'); -+ $target . '/share/libpq/tsearch_data/'); - - my $pl_extension_files = []; - my @pldirs = ('src/pl/plpgsql/src'); -@@ -178,7 +178,7 @@ sub Install - }, - @pldirs); - CopySetOfFiles('PL Extension files', -- $pl_extension_files, $target . '/share/extension/'); -+ $pl_extension_files, $target . '/share/libpq/extension/'); - } - - GenerateNLSFiles($target, $config->{nls}, $majorver) if ($config->{nls}); -@@ -293,23 +293,26 @@ sub CopySolutionOutput - { - if ($1 == 1) - { -- push(@{ $install_list{'bin'} }, "exe"); -+ push(@{ $install_list{'tools\\libpq'} }, "exe"); - } - elsif ($1 == 2) - { -- push(@{ $install_list{'lib'} }, "dll"); -+ push(@{ $install_list{'bin'} }, "dll"); - if ($is_sharedlib) - { - push(@{ $install_list{'bin'} }, "dll"); - push(@{ $install_list{'lib'} }, "lib"); - } -+ else -+ { -+ push(@{ $install_list{'lib'} }, "lib"); -+ } - } - else - { -- -+ push(@{ $install_list{'lib'} }, "lib"); - # Static libraries, such as libpgport, only used internally - # during build, don't install. -- next; - } - } - elsif ($vcproj eq 'vcxproj' -@@ -320,11 +320,11 @@ sub CopySolutionOutput - { - if ($1 eq 'Application') - { -- push(@{ $install_list{'bin'} }, "exe"); -+ push(@{ $install_list{'tools\\libpq'} }, "exe"); - } - elsif ($1 eq 'DynamicLibrary') - { -- push(@{ $install_list{'lib'} }, "dll"); -+ push(@{ $install_list{'bin'} }, "dll"); - if ($is_sharedlib) - { - push(@{ $install_list{'bin'} }, "dll"); -@@ -333,10 +333,9 @@ sub CopySolutionOutput - } - else # 'StaticLibrary' - { -- -+ push(@{ $install_list{'lib'} }, "lib"); - # Static lib, such as libpgport, only used internally - # during build, don't install. -- next; - } - } - else -@@ -352,7 +352,7 @@ sub CopySolutionOutput - || croak "Could not copy $pf.$ext\n"; - } - } -- lcopy("$conf\\$pf\\$pf.pdb", "$target\\symbols\\$pf.pdb") -+ lcopy("$conf\\$pf\\$pf.pdb", "$target\\bin\\$pf.pdb") - || croak "Could not copy $pf.pdb\n"; - print "."; - } -@@ -374,5 +374,5 @@ sub GenerateTimezoneFiles - print "Generating timezone files..."; - -- my @args = ("$conf/zic/zic", '-d', "$target/share/timezone"); -+ my @args = ("$conf/zic/zic", '-d', "$target/share/libpq/timezone"); - foreach (@tzfiles) - { -@@ -398,7 +398,7 @@ sub GenerateTsearchFiles - $mf =~ /^LANGUAGES\s*=\s*(.*)$/m - || die "Could not find LANGUAGES line in snowball Makefile\n"; - my @pieces = split /\s+/, $1; -- open($F, '>', "$target/share/snowball_create.sql") -+ open($F, '>', "$target/share/libpq/snowball_create.sql") - || die "Could not write snowball_create.sql"; - print $F read_file('src/backend/snowball/snowball_func.sql.in'); - -@@ -483,7 +483,7 @@ sub CopySubdirFiles - foreach my $f (split /\s+/, $flist) - { - lcopy("$subdir/$module/$f.control", -- "$target/share/extension/$f.control") -+ "$target/share/libpq/extension/$f.control") - || croak("Could not copy file $f.control in contrib $module"); - print '.'; - } -@@ -501,7 +501,7 @@ sub CopySubdirFiles - foreach my $f (split /\s+/, $flist) - { - lcopy("$subdir/$module/$f", -- "$target/share/$moduledir/" . basename($f)) -+ "$target/share/libpq/$moduledir/" . basename($f)) - || croak("Could not copy file $f in contrib $module"); - print '.'; - } -@@ -516,7 +516,7 @@ sub CopySubdirFiles - foreach my $f (split /\s+/, $flist) - { - lcopy("$subdir/$module/$f", -- "$target/share/tsearch_data/" . basename($f)) -+ "$target/share/libpq/tsearch_data/" . basename($f)) - || croak("Could not copy file $f in $subdir $module"); - print '.'; - } -@@ -579,7 +579,7 @@ sub CopySubdirFiles - if ($module eq 'spi'); - foreach my $f (split /\s+/, $flist) - { -- lcopy("$subdir/$module/$f", "$target/doc/$moduledir/$f") -+ lcopy("$subdir/$module/$f", "$target/doc/libpq/$moduledir/$f") - || croak("Could not copy file $f in contrib $module"); - print '.'; - } -@@ -708,7 +708,7 @@ sub GenerateNLSFiles - my $majorver = shift; - - print "Installing NLS files..."; -- EnsureDirectories($target, "share/locale"); -+ EnsureDirectories($target, "share/libpq/locale"); - my @flist; - File::Find::find( - { -@@ -730,12 +730,12 @@ sub GenerateNLSFiles - next unless /([^\/]+)\.po/; - $lang = $1; - -- EnsureDirectories($target, "share/locale/$lang", -- "share/locale/$lang/LC_MESSAGES"); -+ EnsureDirectories($target, "share/libpq/locale/$lang", -+ "share/libpq/locale/$lang/LC_MESSAGES"); - my @args = ( - "$nlspath\\bin\\msgfmt", - '-o', -- "$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo", -+ "$target\\share\\libpq\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo", - $_); - system(@args) && croak("Could not run msgfmt on $dir\\$_"); - print "."; diff --git a/ports/libpq/patches/windows/minimize_install.patch b/ports/libpq/patches/windows/minimize_install.patch deleted file mode 100644 index 1a57c275f75..00000000000 --- a/ports/libpq/patches/windows/minimize_install.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm -index d109b2c90..75c7446e6 100644 ---- a/src/tools/msvc/Install.pm -+++ b/src/tools/msvc/Install.pm -@@ -22,13 +22,13 @@ our (@ISA, @EXPORT_OK); - - my $insttype; - my @client_contribs = ('oid2name', 'pgbench', 'vacuumlo'); --my @client_program_files = ( -- 'clusterdb', 'createdb', 'createuser', 'dropdb', -- 'dropuser', 'ecpg', 'libecpg', 'libecpg_compat', -- 'libpgtypes', 'libpq', 'pg_amcheck', 'pg_basebackup', -- 'pg_config', 'pg_dump', 'pg_dumpall', 'pg_isready', -- 'pg_receivewal', 'pg_recvlogical', 'pg_restore', 'psql', -- 'reindexdb', 'vacuumdb', @client_contribs); -+my @client_program_files = ( 'libecpg','libecpg_compat', 'libpgtypes', 'libpq' ); -+ #'clusterdb', 'createdb', 'createuser', 'dropdb', -+ #'dropuser', 'ecpg', 'libecpg', 'libecpg_compat', -+ #'libpgtypes', 'libpq', 'pg_amcheck', 'pg_basebackup', -+ #'pg_config', 'pg_dump', 'pg_dumpall', 'pg_isready', -+ #'pg_receivewal', 'pg_recvlogical', 'pg_restore', 'psql', -+ #'reindexdb', 'vacuumdb', @client_contribs); - - sub lcopy - { -@@ -121,7 +121,7 @@ sub Install - CopyFiles( - 'Import libraries', - $target . '/lib/', -- "$conf\\", "postgres\\postgres.lib", "libpgcommon\\libpgcommon.lib", -+ "$conf\\", "libpgcommon\\libpgcommon.lib", - "libpgport\\libpgport.lib"); - CopyContribFiles($config, $target); - CopyIncludeFiles($target); - diff --git a/ports/libpq/patches/windows/msgfmt.patch b/ports/libpq/patches/windows/msgfmt.patch deleted file mode 100644 index 98be285bcfb..00000000000 --- a/ports/libpq/patches/windows/msgfmt.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm -index 66c0c3483..2154c6cf6 100644 ---- a/src/tools/msvc/Install.pm -+++ b/src/tools/msvc/Install.pm -@@ -733,7 +733,7 @@ sub GenerateNLSFiles - EnsureDirectories($target, "share/libpq/locale/$lang", - "share/libpq/locale/$lang/LC_MESSAGES"); - my @args = ( -- "$nlspath\\bin\\msgfmt", -+ "msgfmt.exe", - '-o', - "$target\\share\\libpq\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo", - $_); diff --git a/ports/libpq/patches/windows/openssl-version.patch b/ports/libpq/patches/windows/openssl-version.patch deleted file mode 100644 index 77f464041c9..00000000000 --- a/ports/libpq/patches/windows/openssl-version.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm -index 72c5b98..0d153c0 100644 ---- a/src/tools/msvc/Solution.pm -+++ b/src/tools/msvc/Solution.pm -@@ -128,6 +128,9 @@ sub copyFile - sub GetOpenSSLVersion - { - my $self = shift; -+ if (($ENV{'VCPKG_OPENSSL_VERSION'} // '') =~ /(\d+)\.(\d+)\.(\d+)/m) { -+ return ($1, $2, $3); -+ } - - # Attempt to get OpenSSL version and location. This assumes that - # openssl.exe is in the specified directory. diff --git a/ports/libpq/patches/windows/python3_build_DEBUG.patch b/ports/libpq/patches/windows/python3_build_DEBUG.patch deleted file mode 100644 index 532a066f9b7..00000000000 --- a/ports/libpq/patches/windows/python3_build_DEBUG.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm -index 99f39caa5..21b5559d6 100644 ---- a/src/tools/msvc/Mkvcbuild.pm -+++ b/src/tools/msvc/Mkvcbuild.pm -@@ -494,14 +494,15 @@ sub mkvcbuild - - # Attempt to get python version and location. - # Assume python.exe in specified dir. -- my $pythonprog = "import sys;print(sys.prefix);" -- . "print(str(sys.version_info[0])+str(sys.version_info[1]))"; -- my $prefixcmd = -- qq("$solution->{options}->{python}\\python" -c "$pythonprog"); -- my $pyout = `$prefixcmd`; -- die "Could not query for python version!\n" if $?; -- my ($pyprefix, $pyver) = split(/\r?\n/, $pyout); -- -+ #my $pythonprog = "import sys;print(sys.prefix);" -+ # . "print(str(sys.version_info[0])+str(sys.version_info[1]))"; -+ #my $prefixcmd = -+ # qq("$solution->{options}->{python}\\python" -c "$pythonprog"); -+ #my $pyout = `$prefixcmd`; -+ #die "Could not query for python version!\n" if $?; -+ #my ($pyprefix, $pyver) = split(/\r?\n/, $pyout); -+ my $pyprefix = $solution->{options}->{python}; -+ my $pyver = 310; - # Sometimes (always?) if python is not present, the execution - # appears to work, but gives no data... - die "Failed to query python for version information\n" -@@ -510,11 +511,12 @@ sub mkvcbuild - die - "Python version $pyver is too old (version 3 or later is required)" - if int($pymajorver) < 3; - - my $plpython = $solution->AddProject('plpython' . $pymajorver, - 'dll', 'PLs', 'src/pl/plpython'); -- $plpython->AddIncludeDir($pyprefix . '/include'); -- $plpython->AddLibrary($pyprefix . "/Libs/python$pyver.lib"); -+ $plpython->AddIncludeDir($pyprefix . '/include/python3.10'); -+ $plpython->AddDefine('_DEBUG'); # required for python autolink linking correctly! -+ $plpython->AddLibrary($pyprefix . "/debug/lib/python$pyver" . "_d.lib"); - $plpython->AddReference($postgres); - - # Add transform modules dependent on plpython - \ No newline at end of file diff --git a/ports/libpq/patches/windows/python3_build_RELEASE.patch b/ports/libpq/patches/windows/python3_build_RELEASE.patch deleted file mode 100644 index 5a11378942f..00000000000 --- a/ports/libpq/patches/windows/python3_build_RELEASE.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm -index 99f39caa5..21b5559d6 100644 ---- a/src/tools/msvc/Mkvcbuild.pm -+++ b/src/tools/msvc/Mkvcbuild.pm -@@ -494,14 +494,15 @@ sub mkvcbuild - - # Attempt to get python version and location. - # Assume python.exe in specified dir. -- my $pythonprog = "import sys;print(sys.prefix);" -- . "print(str(sys.version_info[0])+str(sys.version_info[1]))"; -- my $prefixcmd = -- qq("$solution->{options}->{python}\\python" -c "$pythonprog"); -- my $pyout = `$prefixcmd`; -- die "Could not query for python version!\n" if $?; -- my ($pyprefix, $pyver) = split(/\r?\n/, $pyout); -- -+ #my $pythonprog = "import sys;print(sys.prefix);" -+ # . "print(str(sys.version_info[0])+str(sys.version_info[1]))"; -+ #my $prefixcmd = -+ # qq("$solution->{options}->{python}\\python" -c "$pythonprog"); -+ #my $pyout = `$prefixcmd`; -+ #die "Could not query for python version!\n" if $?; -+ #my ($pyprefix, $pyver) = split(/\r?\n/, $pyout); -+ my $pyprefix = $solution->{options}->{python}; -+ my $pyver = 310; - # Sometimes (always?) if python is not present, the execution - # appears to work, but gives no data... - die "Failed to query python for version information\n" -@@ -510,11 +511,11 @@ sub mkvcbuild - die - "Python version $pyver is too old (version 3 or later is required)" - if int($pymajorver) < 3; - - my $plpython = $solution->AddProject('plpython' . $pymajorver, - 'dll', 'PLs', 'src/pl/plpython'); -- $plpython->AddIncludeDir($pyprefix . '/include'); -- $plpython->AddLibrary($pyprefix . "/Libs/python$pyver.lib"); -+ $plpython->AddIncludeDir($pyprefix . '/include/python3.10'); -+ $plpython->AddLibrary($pyprefix . "/lib/python$pyver.lib"); - $plpython->AddReference($postgres); - - # Add transform modules dependent on plpython diff --git a/ports/libpq/patches/windows/tcl_version.patch b/ports/libpq/patches/windows/tcl_version.patch deleted file mode 100644 index 5518949a3a0..00000000000 --- a/ports/libpq/patches/windows/tcl_version.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm -index e2fbe95..8c4f279 100644 ---- a/src/tools/msvc/Mkvcbuild.pm -+++ b/src/tools/msvc/Mkvcbuild.pm -@@ -226,7 +226,7 @@ sub mkvcbuild - $pltcl->AddIncludeDir($solution->{options}->{tcl} . '/include'); - $pltcl->AddReference($postgres); - -- for my $tclver (qw(86t 86 85 84)) -+ for my $tclver (qw(90 90g 90s 90sg)) - { - my $tcllib = $solution->{options}->{tcl} . "/lib/tcl$tclver.lib"; - if (-e $tcllib) diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake index 4b704a915ae..b03f3a996da 100644 --- a/ports/libpq/portfile.cmake +++ b/ports/libpq/portfile.cmake @@ -1,365 +1,154 @@ -set(PORT_VERSION ${VERSION}) -# NOTE: the python patches must be regenerated on version update - -## Download and extract sources vcpkg_download_distfile(ARCHIVE - URLS "https://ftp.postgresql.org/pub/source/v${PORT_VERSION}/postgresql-${PORT_VERSION}.tar.bz2" - FILENAME "postgresql-${PORT_VERSION}.tar.bz2" - SHA512 115a8a4234791bba4e6dcc4617e9dd77abedcf767894ce9472c59cce9d5d4ef2d4e1746f3a0c7a99de4fc4385fb716652b70dce9f48be45a9db5a682517db7e8 + URLS "https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.bz2" + FILENAME "postgresql-${VERSION}.tar.bz2" + SHA512 cac97edeb40df1e8f2162f401b465751132929d7249495ef001e950645a2db46343bd732e7bd6504a7f795e25aea66724f2f4ab0065e3d9331b36db4b3a3bec6 ) -set(PATCHES - patches/windows/install.patch - patches/windows/win_bison_flex.patch - patches/windows/openssl-version.patch - patches/windows/Solution.patch - patches/windows/MSBuildProject_fix_gendef_perl.patch - patches/windows/msgfmt.patch - patches/windows/python_lib.patch - patches/windows/fix-compile-flag-Zi.patch - patches/windows/tcl_version.patch - patches/windows/macro-def.patch - patches/fix-configure.patch - ) - -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - list(APPEND PATCHES patches/windows/MSBuildProject-static-lib.patch) - list(APPEND PATCHES patches/windows/Mkvcbuild-static-lib.patch) -endif() -if(VCPKG_CRT_LINKAGE STREQUAL "static") - list(APPEND PATCHES patches/windows/MSBuildProject-static-crt.patch) -endif() -if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") - list(APPEND PATCHES patches/windows/arm.patch) -endif() -if(NOT "${FEATURES}" MATCHES "client") - list(APPEND PATCHES patches/windows/minimize_install.patch) -else() - set(HAS_TOOLS TRUE) -endif() vcpkg_extract_source_archive( SOURCE_PATH ARCHIVE "${ARCHIVE}" - PATCHES ${PATCHES} + PATCHES + unix/fix-configure.patch + unix/single-linkage.patch + unix/no-server-tools.patch + unix/mingw-install.patch + unix/python.patch + windows/macro-def.patch + windows/python_lib.patch + windows/win_bison_flex.patch + windows/msbuild.patch + windows/spin_delay.patch ) -unset(buildenv_contents) -# Get paths to required programs -set(REQUIRED_PROGRAMS PERL) -if(VCPKG_TARGET_IS_WINDOWS) - list(APPEND REQUIRED_PROGRAMS BISON FLEX) + +if("client" IN_LIST FEATURES) + set(HAS_TOOLS TRUE) +else() + set(HAS_TOOLS FALSE) endif() -foreach(program_name ${REQUIRED_PROGRAMS}) + +set(required_programs PERL) +if(VCPKG_TARGET_IS_WINDOWS) + list(APPEND required_programs BISON FLEX) +endif() +foreach(program_name IN LISTS required_programs) # Need to rename win_bison and win_flex to just bison and flex vcpkg_find_acquire_program(${program_name}) - get_filename_component(${program_name}_EXE_PATH ${${program_name}} DIRECTORY) - vcpkg_add_to_path(PREPEND "${${program_name}_EXE_PATH}") - set(buildenv_contents "${buildenv_contents}\n\$ENV{'PATH'}=\$ENV{'PATH'} . ';${${program_name}_EXE_PATH}';") + get_filename_component(program_dir ${${program_name}} DIRECTORY) + vcpkg_add_to_path(PREPEND "${program_dir}") endforeach() -## Setup build types -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE MATCHES "[Rr][Ee][Ll][Ee][Aa][Ss][Ee]") - set(_buildtype RELEASE) - set(_short rel) - list(APPEND port_config_list ${_buildtype}) - set(INSTALL_PATH_SUFFIX_${_buildtype} "") - set(BUILDPATH_${_buildtype} "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${_short}") - file(REMOVE_RECURSE "${BUILDPATH_${_buildtype}}") #Clean old builds - set(PACKAGE_DIR_${_buildtype} ${CURRENT_PACKAGES_DIR}) - unset(_short) - unset(_buildtype) -endif() -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") - set(_buildtype DEBUG) - set(_short dbg) - list(APPEND port_config_list ${_buildtype}) - set(INSTALL_PATH_SUFFIX_${_buildtype} "/debug") - set(BUILDPATH_${_buildtype} "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${_short}") - file(REMOVE_RECURSE "${BUILDPATH_${_buildtype}}") #Clean old builds - set(PACKAGE_DIR_${_buildtype} "${CURRENT_PACKAGES_DIR}${INSTALL_PATH_SUFFIX_${_buildtype}}") - unset(_short) - unset(_buildtype) -endif() +vcpkg_cmake_get_vars(cmake_vars_file) +include("${cmake_vars_file}") -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") - -## Do the build -if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) - vcpkg_cmake_get_vars(vars_file) - include("${vars_file}") - - if("openssl" IN_LIST FEATURES) - file(STRINGS "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/openssl.pc" OPENSSL_VERSION REGEX "Version:") - if(OPENSSL_VERSION) - set(ENV{VCPKG_OPENSSL_VERSION} "${OPENSSL_VERSION}") - endif() +if(VCPKG_DETECTED_MSVC) + if("nls" IN_LIST FEATURES) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES gettext) + vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") + endif() + if("xml" IN_LIST FEATURES) + x_vcpkg_pkgconfig_get_modules( + PREFIX PC_LIBXML2 + MODULES --msvc-syntax libxml-2.0 + LIBS + ) + separate_arguments(LIBXML2_LIBS_DEBUG NATIVE_COMMAND "${PC_LIBXML2_LIBS_DEBUG}") + separate_arguments(LIBXML2_LIBS_RELEASE NATIVE_COMMAND "${PC_LIBXML2_LIBS_RELEASE}") + endif() + if("xslt" IN_LIST FEATURES) + x_vcpkg_pkgconfig_get_modules( + PREFIX PC_LIBXSLT + MODULES --msvc-syntax libxslt + LIBS + ) + separate_arguments(LIBXSLT_LIBS_DEBUG NATIVE_COMMAND "${PC_LIBXSLT_LIBS_DEBUG}") + separate_arguments(LIBXSLT_LIBS_RELEASE NATIVE_COMMAND "${PC_LIBXSLT_LIBS_RELEASE}") endif() - file(GLOB SOURCE_FILES ${SOURCE_PATH}/*) - foreach(_buildtype ${port_config_list}) - # Copy libpq sources. - message(STATUS "Copying libpq source files to ${BUILDPATH_${_buildtype}}...") - foreach(SOURCE_FILE ${SOURCE_FILES}) - file(COPY ${SOURCE_FILE} DESTINATION "${BUILDPATH_${_buildtype}}") - endforeach() - message(STATUS "Copying libpq source files... done") - - vcpkg_apply_patches( - SOURCE_PATH "${BUILDPATH_${_buildtype}}" - PATCHES patches/windows/Solution_${_buildtype}.patch - patches/windows/python3_build_${_buildtype}.patch - ) - message(STATUS "Patches applied!") - file(COPY "${CURRENT_PORT_DIR}/config.pl" DESTINATION "${BUILDPATH_${_buildtype}}/src/tools/msvc") - - set(MSPROJ_PERL "${BUILDPATH_${_buildtype}}/src/tools/msvc/MSBuildProject.pm") - file(READ "${MSPROJ_PERL}" _contents) - string(REPLACE "perl" "\"${PERL}\"" _contents "${_contents}") - file(WRITE "${MSPROJ_PERL}" "${_contents}") - - set(CONFIG_FILE "${BUILDPATH_${_buildtype}}/src/tools/msvc/config.pl") - file(READ "${CONFIG_FILE}" _contents) - - ## ldap => undef, # --with-ldap - ## extraver => undef, # --with-extra-version= - ## gss => undef, # --with-gssapi= - ## icu => undef, # --with-icu= ##done - ## nls => undef, # --enable-nls= ##done - ## tap_tests => undef, # --enable-tap-tests - ## tcl => undef, # --with-tcl= #done - ## perl => undef, # --with-perl - ## python => undef, # --with-python= ##done - ## openssl => undef, # --with-openssl= ##done - ## uuid => undef, # --with-ossp-uuid - ## xml => undef, # --with-libxml= ##done - ## xslt => undef, # --with-libxslt= ##done - ## iconv => undef, # (not in configure, path to iconv) ##done (needed by xml) - ## zlib => undef # --with-zlib= ##done - - ## Setup external dependencies - ##"-DFEATURES=core;openssl;zlib" "-DALL_FEATURES=openssl;zlib;readline;libedit;python;tcl;nls;systemd;llvm;icu;bonjour;uuid;xml;xslt;" - if("${FEATURES}" MATCHES "icu") - string(REPLACE "icu => undef" "icu => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "nls") - string(REPLACE "nls => undef" "nls => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - vcpkg_acquire_msys(MSYS_ROOT PACKAGES gettext) - vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") - endif() - if("${FEATURES}" MATCHES "openssl") - string(REPLACE "openssl => undef" "openssl => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "python") - #vcpkg_find_acquire_program(PYTHON3) - #get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) - #vcpkg_add_to_path("${PYTHON3_EXE_PATH}") - string(REPLACE "python => undef" "python => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "tcl") - string(REPLACE "tcl => undef" "tcl => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "xml") - string(REPLACE "xml => undef" "xml => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - string(REPLACE "iconv => undef" "iconv => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "xslt") - string(REPLACE "xslt => undef" "xslt => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "zlib") - string(REPLACE "zlib => undef" "zlib => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "lz4") - string(REPLACE "lz4 => undef" "lz4 => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - if("${FEATURES}" MATCHES "zstd") - string(REPLACE "zstd => undef" "zstd => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}") - endif() - - file(WRITE "${CONFIG_FILE}" "${_contents}") - file(WRITE "${BUILDPATH_${_buildtype}}/src/tools/msvc/buildenv.pl" "${buildenv_contents}") - configure_file("${CURRENT_PORT_DIR}/libpq.props.in" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/libpq.props" @ONLY) - vcpkg_get_windows_sdk(VCPKG_TARGET_PLATFORM_VERSION) - set(ENV{MSBFLAGS} "/p:PlatformToolset=${VCPKG_PLATFORM_TOOLSET} - /p:VCPkgLocalAppDataDisabled=true - /p:UseIntelMKL=No - /p:WindowsTargetPlatformVersion=${VCPKG_TARGET_PLATFORM_VERSION} - /m - /p:ForceImportBeforeCppTargets=\"${SCRIPTS}/buildsystems/msbuild/vcpkg.targets\" - /p:ForceImportAfterCppTargets=\"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/libpq.props\" - /p:VcpkgTriplet=${TARGET_TRIPLET} - /p:VcpkgCurrentInstalledDir=\"${CURRENT_INSTALLED_DIR}\"" - ) - if(HAS_TOOLS) - if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) - set(ENV{MSBFLAGS} "$ENV{MSBFLAGS} /p:Platform=Win32") - endif() - message(STATUS "Building libpq ${TARGET_TRIPLET}-${_buildtype}...") - vcpkg_execute_required_process( - COMMAND ${PERL} build.pl ${_buildtype} - WORKING_DIRECTORY "${BUILDPATH_${_buildtype}}/src/tools/msvc" - LOGNAME "build-${TARGET_TRIPLET}-${_buildtype}" - ) - message(STATUS "Building libpq ${TARGET_TRIPLET}-${_buildtype}... done") - else() - set(build_libs libpq libecpg_compat) - foreach(build_lib ${build_libs}) - message(STATUS "Building ${build_lib} ${TARGET_TRIPLET}-${_buildtype}...") - vcpkg_execute_required_process( - COMMAND ${PERL} build.pl ${_buildtype} ${build_lib} - WORKING_DIRECTORY "${BUILDPATH_${_buildtype}}/src/tools/msvc" - LOGNAME "build-${build_lib}-${TARGET_TRIPLET}-${_buildtype}" - ) - message(STATUS "Building ${build_lib} ${TARGET_TRIPLET}-${_buildtype}... done") - endforeach() - endif() - - message(STATUS "Installing libpq ${TARGET_TRIPLET}-${_buildtype}...") - vcpkg_execute_required_process( - COMMAND ${PERL} install.pl "${CURRENT_PACKAGES_DIR}${INSTALL_PATH_SUFFIX_${_buildtype}}" client - WORKING_DIRECTORY "${BUILDPATH_${_buildtype}}/src/tools/msvc" - LOGNAME "install-${TARGET_TRIPLET}-${_buildtype}" - ) - message(STATUS "Installing libpq ${TARGET_TRIPLET}-${_buildtype}... done") - endforeach() - - message(STATUS "Cleanup libpq ${TARGET_TRIPLET}...") - #Cleanup - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/doc") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/tools") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/symbols") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/symbols") + include("${CMAKE_CURRENT_LIST_DIR}/build-msvc.cmake") + if(NOT VCPKG_BUILD_TYPE) + build_msvc(DEBUG "${SOURCE_PATH}") + endif() + build_msvc(RELEASE "${SOURCE_PATH}") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() - if(NOT HAS_TOOLS) - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools") - else() + if(HAS_TOOLS) vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}") + else() + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools") endif() - - message(STATUS "Cleanup libpq ${TARGET_TRIPLET}... - done") - set(USE_DL OFF) else() file(COPY "${CMAKE_CURRENT_LIST_DIR}/Makefile" DESTINATION "${SOURCE_PATH}") - + + vcpkg_list(SET BUILD_OPTS) + foreach(option IN ITEMS icu lz4 nls openssl python readline xml xslt zlib zstd) + if(option IN_LIST FEATURES) + list(APPEND BUILD_OPTS --with-${option}) + else() + list(APPEND BUILD_OPTS --without-${option}) + endif() + endforeach() if("nls" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --enable-nls) set(ENV{MSGFMT} "${CURRENT_HOST_INSTALLED_DIR}/tools/gettext/bin/msgfmt${VCPKG_HOST_EXECUTABLE_SUFFIX}") - else() - list(APPEND BUILD_OPTS --disable-nls) - endif() - if("openssl" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-openssl) - else() - list(APPEND BUILD_OPTS --without-openssl) - endif() - if("zlib" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-zlib) - else() - list(APPEND BUILD_OPTS --without-zlib) - endif() - if("zstd" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-zstd) - else() - list(APPEND BUILD_OPTS --without-zstd) - endif() - if("icu" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-icu) - else() - list(APPEND BUILD_OPTS --without-icu) - endif() - if("lz4" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-lz4) - else() - list(APPEND BUILD_OPTS --without-lz4) - endif() - if("readline" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-readline) - else() - list(APPEND BUILD_OPTS --without-readline) - endif() - if("xml" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-libxml) - else() - list(APPEND BUILD_OPTS --without-libxml) - endif() - if("xslt" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-libxslt) - else() - list(APPEND BUILD_OPTS --without-libxslt) + if(VCPKG_TARGET_IS_ANDROID) + list(APPEND BUILD_OPTS [[LIBS=$LIBS -liconv]]) + endif() endif() if("python" IN_LIST FEATURES) - list(APPEND BUILD_OPTS --with-python) - else() - list(APPEND BUILD_OPTS --without-python) + vcpkg_find_acquire_program(PYTHON3) + list(APPEND BUILD_OPTS "PYTHON=${PYTHON3}") endif() if(VCPKG_TARGET_IS_ANDROID) # AND CMAKE_SYSTEM_VERSION LESS 26) list(APPEND BUILD_OPTS ac_cv_header_langinfo_h=no) endif() - vcpkg_cmake_get_vars(cmake_vars_file) - include("${cmake_vars_file}") if(VCPKG_DETECTED_CMAKE_OSX_SYSROOT) list(APPEND BUILD_OPTS "PG_SYSROOT=${VCPKG_DETECTED_CMAKE_OSX_SYSROOT}") endif() vcpkg_configure_make( - AUTOCONFIG SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE - DETERMINE_BUILD_TRIPLET + AUTOCONFIG + ADDITIONAL_MSYS_PACKAGES autoconf-archive + DIRECT_PACKAGES + "https://mirror.msys2.org/msys/x86_64/tzcode-2023c-1-x86_64.pkg.tar.zst" + 7550b843964744607f736a7138f10c6cd92489406a1b84ac71d9a9d8aa16bc69048aa1b24e1f49291b010347047008194c334ca9c632e17fa8245e85549e3c7a OPTIONS ${BUILD_OPTS} - OPTIONS_RELEASE - "DYLD_FALLBACK_LIBRARY_PATH=${CURRENT_INSTALLED_DIR}/lib:${CURRENT_INSTALLED_DIR}/debug/lib" OPTIONS_DEBUG --enable-debug - "DYLD_FALLBACK_LIBRARY_PATH=${CURRENT_INSTALLED_DIR}/debug/lib:${CURRENT_INSTALLED_DIR}/lib" ) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - set(ENV{LIBPQ_LIBRARY_TYPE} shared) + set(ENV{LIBPQ_LIBRARY_TYPE} shared) else() - set(ENV{LIBPQ_LIBRARY_TYPE} static) + set(ENV{LIBPQ_LIBRARY_TYPE} static) endif() if(VCPKG_TARGET_IS_MINGW) - set(ENV{USING_MINGW} yes) + set(ENV{LIBPQ_USING_MINGW} yes) + endif() + if(HAS_TOOLS) + set(ENV{LIBPQ_ENABLE_TOOLS} yes) endif() vcpkg_install_make() - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") - if(NOT HAS_TOOLS) - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") - else() - vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug") - endif() - if(VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") - file(RENAME "${CURRENT_PACKAGES_DIR}/lib/libpq.a" "${CURRENT_PACKAGES_DIR}/lib/libpq.dll.a") - file(RENAME "${CURRENT_PACKAGES_DIR}/lib/libpq.dll" "${CURRENT_PACKAGES_DIR}/bin/libpq.dll") - endif() - if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") - file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/libpq.a" "${CURRENT_PACKAGES_DIR}/debug/lib/libpq.dll.a") - file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/libpq.dll" "${CURRENT_PACKAGES_DIR}/debug/bin/libpq.dll") - endif() - endif() - if(VCPKG_TARGET_IS_MINGW) - set(USE_DL OFF) - else() - set(USE_DL ON) - endif() - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/postgresql/server/pg_config.h" "#define CONFIGURE_ARGS" "// #define CONFIGURE_ARGS") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/pg_config.h" "#define CONFIGURE_ARGS" "// #define CONFIGURE_ARGS") endif() -configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/postgresql/vcpkg-cmake-wrapper.cmake" @ONLY) -file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) vcpkg_fixup_pkgconfig() +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/postgresql/vcpkg-cmake-wrapper.cmake" @ONLY) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/doc" + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/debug/symbols" + "${CURRENT_PACKAGES_DIR}/debug/tools" + "${CURRENT_PACKAGES_DIR}/symbols" + "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug" +) + +file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYRIGHT") diff --git a/ports/libpq/patches/fix-configure.patch b/ports/libpq/unix/fix-configure.patch similarity index 84% rename from ports/libpq/patches/fix-configure.patch rename to ports/libpq/unix/fix-configure.patch index 6fd28899cde..c0a7f78906c 100644 --- a/ports/libpq/patches/fix-configure.patch +++ b/ports/libpq/unix/fix-configure.patch @@ -1,17 +1,18 @@ diff --git a/configure.ac b/configure.ac -index fba79ee..4fadb94 100644 +index 9a73f50..a35395e 100644 --- a/configure.ac +++ b/configure.ac -@@ -19,7 +19,7 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros +@@ -19,7 +19,8 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros - AC_INIT([PostgreSQL], [15.2], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/]) + AC_INIT([PostgreSQL], [15.3], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/]) -m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required. ++cross_compiling=yes # Avoid conftest loading shared objects +m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_warn([unsupported],[Autoconf version 2.69 is required. Untested combinations of 'autoconf' and PostgreSQL versions are not recommended. You can remove the check from 'configure.ac' but it is then your responsibility whether the result works or not.])]) -@@ -1184,7 +1184,8 @@ if test "$enable_thread_safety" = yes; then +@@ -1274,7 +1275,8 @@ if test "$enable_thread_safety" = yes; then fi if test "$with_readline" = yes; then @@ -21,7 +22,7 @@ index fba79ee..4fadb94 100644 if test x"$pgac_cv_check_readline" = x"no"; then AC_MSG_ERROR([readline library not found If you have readline already installed, see config.log for details on the -@@ -1194,7 +1195,7 @@ Use --without-readline to disable readline support.]) +@@ -1284,7 +1286,7 @@ Use --without-readline to disable readline support.]) fi if test "$with_zlib" = yes; then @@ -30,7 +31,7 @@ index fba79ee..4fadb94 100644 [AC_MSG_ERROR([zlib library not found If you have zlib already installed, see config.log for details on the failure. It is possible the compiler isn't looking in the proper directory. -@@ -1243,6 +1244,9 @@ if test "$with_ssl" = openssl ; then +@@ -1333,6 +1335,9 @@ if test "$with_ssl" = openssl ; then # Minimum required OpenSSL version is 1.0.1 AC_DEFINE(OPENSSL_API_COMPAT, [0x10001000L], [Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.]) @@ -40,7 +41,7 @@ index fba79ee..4fadb94 100644 if test "$PORTNAME" != "win32"; then AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])]) AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])]) -@@ -1250,6 +1254,7 @@ if test "$with_ssl" = openssl ; then +@@ -1340,6 +1345,7 @@ if test "$with_ssl" = openssl ; then AC_SEARCH_LIBS(CRYPTO_new_ex_data, [eay32 crypto], [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])]) AC_SEARCH_LIBS(SSL_new, [ssleay32 ssl], [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])]) fi @@ -48,7 +49,7 @@ index fba79ee..4fadb94 100644 # Function introduced in OpenSSL 1.0.2. AC_CHECK_FUNCS([X509_get_signature_nid]) # Functions introduced in OpenSSL 1.1.0. We used to check for -@@ -1365,15 +1365,18 @@ if test "$with_pam" = yes ; then +@@ -1363,19 +1369,23 @@ if test "$with_pam" = yes ; then fi if test "$with_libxml" = yes ; then @@ -71,8 +72,8 @@ index fba79ee..4fadb94 100644 if test "$with_zstd" = yes ; then - AC_CHECK_LIB(zstd, ZSTD_compress, [], [AC_MSG_ERROR([library 'zstd' is required for ZSTD support])]) -+ PKG_CHECK_MODULES([zstd], [zstd], [AC_DEFINE(HAVE_LIBZSTD,1,[Define to 1 if with lz4])], [AC_MSG_ERROR([library 'zstd' is required for ZSTD support])]) -+ LIBS="$LZ4_LIBS $LIBS" ++ PKG_CHECK_MODULES([ZSTD], [libzstd], [AC_DEFINE(HAVE_LIBZSTD,1,[Define to 1 if with zstd])], [AC_MSG_ERROR([library 'zstd' is required for ZSTD support])]) ++ LIBS="$ZSTD_LIBS $LIBS" fi # Note: We can test for libldap_r only after we know PTHREAD_LIBS; diff --git a/ports/libpq/unix/mingw-install.patch b/ports/libpq/unix/mingw-install.patch new file mode 100644 index 00000000000..ffeea023cfc --- /dev/null +++ b/ports/libpq/unix/mingw-install.patch @@ -0,0 +1,36 @@ +diff --git a/src/Makefile.shlib b/src/Makefile.shlib +index 16255d7..51e9ed2 100644 +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -85,7 +85,11 @@ else + # Naming convention for dynamically loadable modules + shlib = $(NAME)$(DLSUFFIX) + endif ++ifeq ($(PORTNAME)-$(LIBPQ_LIBRARY_TYPE), win32-shared) ++stlib = lib$(NAME).dll.a ++else + stlib = lib$(NAME).a ++endif + + ifndef soname + # additional flags for backend modules +@@ -468,6 +472,9 @@ endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif ++ifeq ($(PORTNAME)-$(LIBPQ_LIBRARY_TYPE), win32-shared) ++ mv '$(DESTDIR)$(libdir)/$(shlib)' '$(DESTDIR)$(libdir)/../bin/$(shlib)' ++endif + + + installdirs-lib: +@@ -476,6 +483,9 @@ ifdef soname + else + $(MKDIR_P) '$(DESTDIR)$(pkglibdir)' + endif ++ifeq ($(PORTNAME)-$(LIBPQ_LIBRARY_TYPE), win32-shared) ++ $(MKDIR_P) '$(DESTDIR)$(libdir)/../bin' ++endif + + + ## diff --git a/ports/libpq/unix/no-server-tools.patch b/ports/libpq/unix/no-server-tools.patch new file mode 100644 index 00000000000..f83682afb05 --- /dev/null +++ b/ports/libpq/unix/no-server-tools.patch @@ -0,0 +1,37 @@ +diff --git a/src/bin/Makefile b/src/bin/Makefile +index 7f9dde9..bc6d835 100644 +--- a/src/bin/Makefile ++++ b/src/bin/Makefile +@@ -13,29 +13,20 @@ subdir = src/bin + top_builddir = ../.. + include $(top_builddir)/src/Makefile.global + ++.NOTPARALLEL: ++# incl. https://www.postgresql.org/docs/current/reference-client.html ++# excl. https://www.postgresql.org/docs/current/reference-server.html + SUBDIRS = \ +- initdb \ + pg_amcheck \ +- pg_archivecleanup \ + pg_basebackup \ +- pg_checksums \ + pg_config \ +- pg_controldata \ +- pg_ctl \ + pg_dump \ +- pg_resetwal \ +- pg_rewind \ +- pg_test_fsync \ +- pg_test_timing \ +- pg_upgrade \ + pg_verifybackup \ +- pg_waldump \ + pgbench \ + psql \ + scripts + + ifeq ($(PORTNAME), win32) +-SUBDIRS += pgevent + else + ALWAYS_SUBDIRS += pgevent + endif diff --git a/ports/libpq/unix/python.patch b/ports/libpq/unix/python.patch new file mode 100644 index 00000000000..6466746ed43 --- /dev/null +++ b/ports/libpq/unix/python.patch @@ -0,0 +1,25 @@ +diff --git a/configure.ac b/configure.ac +index a35395e..3c1b3e2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1176,7 +1176,19 @@ fi + + if test "$with_python" = yes; then + PGAC_PATH_PYTHON +- PGAC_CHECK_PYTHON_EMBED_SETUP ++ python_majorversion=3 ++ python_version=3.10 ++ PKG_CHECK_MODULES(PYTHON_EMBED, python-${python_version}-embed) ++ python_includespec="${PYTHON_EMBED_CFLAGS}" ++ python_libdir=[$(echo " ${PYTHON_EMBED_LIBS}" | sed -e 's/\( -L[^ ]*\).*/\1/' -e 's/^.* -L//')] ++ python_libspec="${PYTHON_EMBED_LIBS}" ++ python_additional_libs="" ++ AC_SUBST(python_majorversion) ++ AC_SUBST(python_version) ++ AC_SUBST(python_includespec) ++ AC_SUBST(python_libdir) ++ AC_SUBST(python_libspec) ++ AC_SUBST(python_additional_libs) + fi + + if test x"$cross_compiling" = x"yes" && test -z "$with_system_tzdata"; then diff --git a/ports/libpq/unix/single-linkage.patch b/ports/libpq/unix/single-linkage.patch new file mode 100644 index 00000000000..dd149c7d3a5 --- /dev/null +++ b/ports/libpq/unix/single-linkage.patch @@ -0,0 +1,56 @@ +diff --git a/src/Makefile.shlib b/src/Makefile.shlib +index 551023c..16255d7 100644 +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -260,10 +260,14 @@ endif + + .PHONY: all-lib all-static-lib all-shared-lib + ++ifndef LIBPQ_LIBRARY_TYPE + all-lib: all-shared-lib + ifdef soname + # no static library when building a dynamically loadable module + all-lib: all-static-lib ++endif ++else ++all-lib: all-$(LIBPQ_LIBRARY_TYPE)-lib + all-lib: lib$(NAME).pc + endif + +@@ -417,9 +421,13 @@ endif # PORTNAME == cygwin || PORTNAME == win32 + ## + + .PHONY: install-lib install-lib-static install-lib-shared installdirs-lib ++ifndef LIBPQ_LIBRARY_TYPE + install-lib: install-lib-shared + ifdef soname + install-lib: install-lib-static ++endif ++else ++install-lib: install-lib-$(LIBPQ_LIBRARY_TYPE) + install-lib: install-lib-pc + endif + +diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile +index 8abdb09..185461e 100644 +--- a/src/interfaces/libpq/Makefile ++++ b/src/interfaces/libpq/Makefile +@@ -115,6 +115,7 @@ backend_src = $(top_srcdir)/src/backend + # Also skip the test on platforms where libpq infrastructure may be provided + # by statically-linked libraries, as we can't expect them to honor this + # coding rule. ++ifeq ($(LIBPQ_LIBRARY_TYPE), shared) + libpq-refs-stamp: $(shlib) + ifneq ($(enable_coverage), yes) + ifeq (,$(filter aix solaris,$(PORTNAME))) +@@ -124,6 +125,10 @@ ifeq (,$(filter aix solaris,$(PORTNAME))) + endif + endif + touch $@ ++else ++.PHONY: libpq-refs-stamp ++libpq-refs-stamp: ++endif + + # Make dependencies on pg_config_paths.h visible in all builds. + fe-connect.o: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h diff --git a/ports/libpq/vcpkg-cmake-wrapper.cmake b/ports/libpq/vcpkg-cmake-wrapper.cmake index 311f3bb9d53..6f1432570cd 100644 --- a/ports/libpq/vcpkg-cmake-wrapper.cmake +++ b/ports/libpq/vcpkg-cmake-wrapper.cmake @@ -6,7 +6,7 @@ PATHS NO_DEFAULT_PATH ) _find_package(${ARGS}) -if(PostgreSQL_FOUND AND @USE_DL@) +if(PostgreSQL_FOUND AND NOT "@VCPKG_TARGET_IS_WINDOWS@") find_library(PostgreSQL_DL_LIBRARY NAMES dl) if(PostgreSQL_DL_LIBRARY) list(APPEND PostgreSQL_LIBRARIES "dl") diff --git a/ports/libpq/vcpkg-libs.props.in b/ports/libpq/vcpkg-libs.props.in new file mode 100644 index 00000000000..4c777561c7f --- /dev/null +++ b/ports/libpq/vcpkg-libs.props.in @@ -0,0 +1,31 @@ + + + + @CURRENT_INSTALLED_DIR@/debug/lib/icuind.lib;@CURRENT_INSTALLED_DIR@/debug/lib/icuucd.lib;@CURRENT_INSTALLED_DIR@/debug/lib/icudtd.lib; + @CURRENT_INSTALLED_DIR@/debug/lib/lz4d.lib + @CURRENT_INSTALLED_DIR@/debug/lib/intl.lib;@CURRENT_INSTALLED_DIR@/debug/lib/iconv.lib;@CURRENT_INSTALLED_DIR@/debug/lib/charset.lib + @CURRENT_INSTALLED_DIR@/debug/lib/libssl.lib;@CURRENT_INSTALLED_DIR@/debug/lib/libcrypto.lib;crypt32.lib;ws2_32.lib;secur32.lib + @CURRENT_INSTALLED_DIR@/debug/lib/python310_d.lib + @CURRENT_INSTALLED_DIR@/debug/lib/tcl90g.lib + @CURRENT_INSTALLED_DIR@/debug/lib/tcl90sg.lib + @CURRENT_INSTALLED_DIR@/debug/lib/tcl90sgx.lib + @LIBXML2_LIBS_DEBUG@ + @LIBXSLT_LIBS_DEBUG@ + @CURRENT_INSTALLED_DIR@/debug/lib/zlibd.lib + @CURRENT_INSTALLED_DIR@/debug/lib/zstd.lib + + + @CURRENT_INSTALLED_DIR@/lib/icuin.lib;@CURRENT_INSTALLED_DIR@/lib/icuuc.lib;@CURRENT_INSTALLED_DIR@/lib/icudt.lib; + @CURRENT_INSTALLED_DIR@/lib/lz4.lib + @CURRENT_INSTALLED_DIR@/lib/intl.lib;@CURRENT_INSTALLED_DIR@/lib/iconv.lib;@CURRENT_INSTALLED_DIR@/lib/charset.lib + @CURRENT_INSTALLED_DIR@/lib/libssl.lib;@CURRENT_INSTALLED_DIR@/lib/libcrypto.lib;crypt32.lib;ws2_32.lib;secur32.lib + @CURRENT_INSTALLED_DIR@/lib/python310.lib + @CURRENT_INSTALLED_DIR@/lib/tcl90.lib + @CURRENT_INSTALLED_DIR@/lib/tcl90s.lib + @CURRENT_INSTALLED_DIR@/lib/tcl90sx.lib + @LIBXML2_LIBS_RELEASE@ + @LIBXSLT_LIBS_RELEASE@ + @CURRENT_INSTALLED_DIR@/lib/zlib.lib + @CURRENT_INSTALLED_DIR@/lib/zstd.lib + + diff --git a/ports/libpq/vcpkg.json b/ports/libpq/vcpkg.json index 6e5fea70597..106e4694a9e 100644 --- a/ports/libpq/vcpkg.json +++ b/ports/libpq/vcpkg.json @@ -1,7 +1,6 @@ { "name": "libpq", - "version": "15.2", - "port-version": 3, + "version": "15.3", "description": "The official database access API of postgresql", "homepage": "https://www.postgresql.org/", "license": "PostgreSQL", @@ -18,6 +17,11 @@ { "name": "vcpkg-cmake-get-vars", "host": true + }, + { + "name": "vcpkg-pkgconfig-get-modules", + "host": true, + "platform": "windows & !mingw" } ], "default-features": [ @@ -26,28 +30,77 @@ "zlib" ], "features": { + "all": { + "description": "Build all supported features", + "dependencies": [ + { + "name": "libpq", + "features": [ + "client", + "icu", + "xml", + "xslt", + "zstd" + ] + }, + { + "name": "libpq", + "features": [ + "bonjour" + ], + "platform": "osx" + }, + { + "name": "libpq", + "features": [ + "nls" + ], + "platform": "!osx" + }, + { + "name": "libpq", + "features": [ + "readline" + ], + "platform": "!windows" + }, + { + "name": "libpq", + "features": [ + "python" + ], + "platform": "!android & !mingw" + }, + { + "name": "libpq", + "features": [ + "tcl" + ], + "platform": "windows & !mingw & !arm" + } + ] + }, "bonjour": { - "description": "Build with Bonjour support (--with-bonjour)", + "description": "Build with Bonjour support", "supports": "osx" }, "client": { - "description": "Build all client tools and libraries (dynamic only?)", - "supports": "!(windows & !mingw & static)" + "description": "Build all client tools and libraries" }, "icu": { - "description": "Build with support for the ICU library (--with-icu)", + "description": "Build with support for the ICU library", "dependencies": [ "icu" ] }, "lz4": { - "description": "Use lz4 (else --without-lz4)", + "description": "Use lz4", "dependencies": [ "lz4" ] }, "nls": { - "description": "Native Language Support (--enable-nls[=LANGUAGES])", + "description": "Native Language Support", "supports": "!osx", "dependencies": [ "gettext", @@ -56,19 +109,20 @@ "host": true, "features": [ "tools" - ] + ], + "platform": "!windows, mingw" } ] }, "openssl": { - "description": "support for encrypted client connections and random number generation on platforms that do not have \"/dev/urandom\" (except windows) (--with-openssl)", + "description": "support for encrypted client connections and random number generation on platforms that do not have \"/dev/urandom\" (except windows)", "dependencies": [ "openssl" ] }, "python": { - "description": "build the PL/Python server programming language (dynamic only?) (--with-python)", - "supports": "!(windows & (static | mingw))", + "$supports": "!(windows & (static | mingw))", + "description": "build the PL/Python server programming language", "dependencies": [ { "name": "libpq", @@ -81,15 +135,16 @@ ] }, "readline": { - "description": "Use readline (else --without-readline)", + "description": "Use readline", "supports": "!windows, mingw", "dependencies": [ "readline" ] }, "tcl": { - "description": "build the PL/Tcl procedural language(dynamic only?) (--with-tcl)", - "supports": "!(windows & (static | mingw))", + "$supports": "!(windows & (static | mingw))", + "description": "build the PL/Tcl procedural language", + "supports": "windows & !mingw", "dependencies": [ { "name": "libpq", @@ -102,13 +157,16 @@ ] }, "xml": { - "description": "Build with libxml (--with-libxml)", + "description": "Build with libxml", "dependencies": [ - "libxml2" + { + "name": "libxml2", + "default-features": false + } ] }, "xslt": { - "description": "Build with libxslt (--with-libxslt)", + "description": "Build with libxslt", "dependencies": [ { "name": "libpq", @@ -121,13 +179,13 @@ ] }, "zlib": { - "description": "Use zlib (else --without-zlib)", + "description": "Use zlib", "dependencies": [ "zlib" ] }, "zstd": { - "description": "Use zstd (else --without-zstd)", + "description": "Use zstd", "dependencies": [ "zstd" ] diff --git a/ports/libpq/patches/windows/macro-def.patch b/ports/libpq/windows/macro-def.patch similarity index 100% rename from ports/libpq/patches/windows/macro-def.patch rename to ports/libpq/windows/macro-def.patch diff --git a/ports/libpq/windows/msbuild.patch b/ports/libpq/windows/msbuild.patch new file mode 100644 index 00000000000..ce243a326e6 --- /dev/null +++ b/ports/libpq/windows/msbuild.patch @@ -0,0 +1,428 @@ +diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm +index 8de79c6..3bc677d 100644 +--- a/src/tools/msvc/Install.pm ++++ b/src/tools/msvc/Install.pm +@@ -53,6 +53,11 @@ sub Install + my $target = shift; + $insttype = shift; + $insttype = "all" unless ($insttype); ++ if ($insttype eq 'core') ++ { ++ $insttype = 'client'; ++ @client_program_files = ( 'libecpg','libecpg_compat', 'libpgtypes', 'libpq' ); ++ } + + # if called from vcregress, the config will be passed to us + # so no need to re-include these +@@ -89,7 +94,7 @@ sub Install + my $majorver = DetermineMajorVersion(); + print "Installing version $majorver for $conf in $target\n"; + +- my @client_dirs = ('bin', 'lib', 'share', 'symbols'); ++ my @client_dirs = ('bin', 'lib', 'share', 'tools', 'share/libpq', 'tools/libpq'); + my @all_dirs = ( + @client_dirs, 'doc', 'doc/contrib', 'doc/extension', 'share/contrib', + 'share/extension', 'share/timezonesets', 'share/tsearch_data'); +@@ -117,11 +122,11 @@ sub Install + } + }, + @top_dir); +- CopySetOfFiles('config files', $sample_files, $target . '/share/'); ++ CopySetOfFiles('config files', $sample_files, $target . '/share/libpq/'); + CopyFiles( + 'Import libraries', + $target . '/lib/', +- "$conf\\", "postgres\\postgres.lib", "libpgcommon\\libpgcommon.lib", ++ "$conf\\", "libpgcommon\\libpgcommon.lib", + "libpgport\\libpgport.lib"); + CopyContribFiles($config, $target); + CopyIncludeFiles($target); +@@ -293,7 +298,16 @@ sub CopySolutionOutput + { + if ($1 == 1) + { +- push(@{ $install_list{'bin'} }, "exe"); ++ push(@{ $install_list{'tools\\libpq'} }, "exe"); ++ } ++ elsif ($1 == 2) ++ { ++ push(@{ $install_list{'bin'} }, "dll"); ++ push(@{ $install_list{'lib'} }, "lib") if $is_sharedlib; # not for plugins ++ } ++ elsif ($is_sharedlib) # forced to static lib by vcpkg triplet ++ { ++ push(@{ $install_list{'lib'} }, "lib"); + } + elsif ($1 == 2) + { +@@ -317,7 +331,16 @@ sub CopySolutionOutput + { + if ($1 eq 'Application') + { +- push(@{ $install_list{'bin'} }, "exe"); ++ push(@{ $install_list{'tools\\libpq'} }, "exe"); ++ } ++ elsif ($1 eq 'DynamicLibrary') ++ { ++ push(@{ $install_list{'bin'} }, "dll"); ++ push(@{ $install_list{'lib'} }, "lib") if $is_sharedlib; # not for plugins ++ } ++ elsif ($is_sharedlib) # forced to static lib by vcpkg triplet ++ { ++ push(@{ $install_list{'lib'} }, "lib"); + } + elsif ($1 eq 'DynamicLibrary') + { +@@ -350,7 +373,8 @@ sub CopySolutionOutput + || croak "Could not copy $pf.$ext\n"; + } + } +- lcopy("$conf\\$pf\\$pf.pdb", "$target\\symbols\\$pf.pdb") ++ $1 ne 'DynamicLibrary' || ++ lcopy("$conf\\$pf\\$pf.pdb", "$target\\bin\\$pf.pdb") + || croak "Could not copy $pf.pdb\n"; + print "."; + } +@@ -482,7 +506,7 @@ sub CopySubdirFiles + foreach my $f (split /\s+/, $flist) + { + lcopy("$subdir/$module/$f.control", +- "$target/share/extension/$f.control") ++ "$target/share/libpq/extension/$f.control") + || croak("Could not copy file $f.control in contrib $module"); + print '.'; + } +@@ -500,7 +524,7 @@ sub CopySubdirFiles + foreach my $f (split /\s+/, $flist) + { + lcopy("$subdir/$module/$f", +- "$target/share/$moduledir/" . basename($f)) ++ "$target/share/libpq/$moduledir/" . basename($f)) + || croak("Could not copy file $f in contrib $module"); + print '.'; + } +@@ -515,7 +539,7 @@ sub CopySubdirFiles + foreach my $f (split /\s+/, $flist) + { + lcopy("$subdir/$module/$f", +- "$target/share/tsearch_data/" . basename($f)) ++ "$target/share/libpq/tsearch_data/" . basename($f)) + || croak("Could not copy file $f in $subdir $module"); + print '.'; + } +@@ -578,7 +602,7 @@ sub CopySubdirFiles + if ($module eq 'spi'); + foreach my $f (split /\s+/, $flist) + { +- lcopy("$subdir/$module/$f", "$target/doc/$moduledir/$f") ++ lcopy("$subdir/$module/$f", "$target/share/libpq/doc/$moduledir/$f") + || croak("Could not copy file $f in contrib $module"); + print '.'; + } +@@ -708,7 +732,7 @@ sub GenerateNLSFiles + my $majorver = shift; + + print "Installing NLS files..."; +- EnsureDirectories($target, "share/locale"); ++ EnsureDirectories($target, "share/libpq/locale"); + my @flist; + File::Find::find( + { +@@ -730,12 +754,12 @@ sub GenerateNLSFiles + next unless /([^\/]+)\.po/; + $lang = $1; + +- EnsureDirectories($target, "share/locale/$lang", +- "share/locale/$lang/LC_MESSAGES"); ++ EnsureDirectories($target, "share/libpq/locale/$lang", ++ "share/libpq/locale/$lang/LC_MESSAGES"); + my @args = ( +- "$nlspath\\bin\\msgfmt", ++ "msgfmt", + '-o', +- "$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo", ++ "$target\\share\\libpq\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo", + $_); + system(@args) && croak("Could not run msgfmt on $dir\\$_"); + print "."; +diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm +index f24d9e5..356cc31 100644 +--- a/src/tools/msvc/MSBuildProject.pm ++++ b/src/tools/msvc/MSBuildProject.pm +@@ -81,13 +81,14 @@ EOF + + EOF + ++ my $maybe_dll = $self->{solution}->{options}->{VCPKG_CRT_LINKAGE} eq 'dynamic' ? "DLL" : ''; + $self->WriteItemDefinitionGroup( + $f, 'Debug', + { + defs => "_DEBUG;DEBUG=1", + opt => 'Disabled', + strpool => 'false', +- runtime => 'MultiThreadedDebugDLL' ++ runtime => 'MultiThreadedDebug' . $maybe_dll + }); + $self->WriteItemDefinitionGroup( + $f, +@@ -96,7 +97,7 @@ EOF + defs => "", + opt => 'Full', + strpool => 'true', +- runtime => 'MultiThreadedDLL' ++ runtime => 'MultiThreaded' . $maybe_dll + }); + return; + } +@@ -266,6 +267,8 @@ sub WriteConfigurationPropertyGroup + ($self->{type} eq "exe") + ? 'Application' + : ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary'); ++ if ($self->{solution}->{options}->{VCPKG_LIBRARY_LINKAGE} eq 'static') ++ { $cfgtype =~ s/DynamicLibrary/StaticLibrary/; } + + print $f < +@@ -311,7 +314,9 @@ sub WriteItemDefinitionGroup + my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';'); + + my $targetmachine = +- $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64'; ++ 'Machine' . uc($self->{platform}); ++ $targetmachine =~ s/WIN32/X86/; ++ my $randomizebase = ($self->{platform} =~ /^ARM/) ? 'true' : 'false'; + + my $includes = join ';', @{ $self->{includes} }, ""; + +@@ -347,7 +352,7 @@ sub WriteItemDefinitionGroup + .\\$cfgname\\$self->{name}\\$self->{name}.pdb + false + .\\$cfgname\\$self->{name}\\$self->{name}.map +- false ++ $randomizebase + + + Console +diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm +index ef0a33c..dd68424 100644 +--- a/src/tools/msvc/Mkvcbuild.pm ++++ b/src/tools/msvc/Mkvcbuild.pm +@@ -114,8 +114,10 @@ sub mkvcbuild + + if ($vsVersion >= '9.00') + { ++ if ($solution->{platform} !~ /^ARM/) { + push(@pgportfiles, 'pg_crc32c_sse42_choose.c'); + push(@pgportfiles, 'pg_crc32c_sse42.c'); ++ } + push(@pgportfiles, 'pg_crc32c_sb8.c'); + } + else +@@ -196,6 +198,7 @@ sub mkvcbuild + 'syncrep_gram.y'); + $postgres->AddFiles('src/backend/utils/adt', 'jsonpath_scan.l', + 'jsonpath_gram.y'); ++ ($config->{VCPKG_LIBRARY_LINKAGE} eq 'dynamic') && + $postgres->AddDefine('BUILDING_DLL'); + $postgres->AddLibrary('secur32.lib'); + $postgres->AddLibrary('ws2_32.lib'); +@@ -240,12 +243,13 @@ sub mkvcbuild + $pltcl->AddIncludeDir($solution->{options}->{tcl} . '/include'); + $pltcl->AddReference($postgres); + +- for my $tclver (qw(86t 86 85 84)) ++ my $v = $solution->{options}->{tcl_version}; ++ for my $tclver ( ("${v}","${v}s","${v}sx") ) + { + my $tcllib = $solution->{options}->{tcl} . "/lib/tcl$tclver.lib"; + if (-e $tcllib) + { +- $pltcl->AddLibrary($tcllib); ++ $pltcl->AddLibrary("\$(VcpkgTcl${tclver}Libs)"); + $found = 1; + last; + } +@@ -500,8 +504,7 @@ sub mkvcbuild + . "print(str(sys.version_info[0])+str(sys.version_info[1]))"; + my $prefixcmd = + qq("$solution->{options}->{python}\\python" -c "$pythonprog"); +- my $pyout = `$prefixcmd`; +- die "Could not query for python version!\n" if $?; ++ my $pyout = "$solution->{options}->{python}\n$solution->{options}->{python_version}"; + my ($pyprefix, $pyver) = split(/\r?\n/, $pyout); + + # Sometimes (always?) if python is not present, the execution +@@ -517,8 +520,8 @@ sub mkvcbuild + + my $plpython = $solution->AddProject('plpython' . $pymajorver, + 'dll', 'PLs', 'src/pl/plpython'); +- $plpython->AddIncludeDir($pyprefix . '/include'); +- $plpython->AddLibrary($pyprefix . "/Libs/python$pyver.lib"); ++ $plpython->AddIncludeDir($pyprefix . "/include/python$pyver"); ++ $plpython->AddLibrary('$(VcpkgPythonLibs)'); + $plpython->AddReference($postgres); + + # Add transform modules dependent on plpython +diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm +index 570bab5..2d51abe 100644 +--- a/src/tools/msvc/Project.pm ++++ b/src/tools/msvc/Project.pm +@@ -167,6 +167,11 @@ sub AddReference + } + $self->AddLibrary( + "__CFGNAME__/" . $ref->{name} . "/" . $ref->{name} . ".lib"); ++ ++ if ($self->{solution}->{options}->{VCPKG_LIBRARY_LINKAGE} eq 'static') ++ { ++ map { $self->AddLibrary($_) } @{ $ref->{libraries} }; ++ } + } + return; + } +diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm +index d30e8fc..231275b 100644 +--- a/src/tools/msvc/Solution.pm ++++ b/src/tools/msvc/Solution.pm +@@ -63,6 +63,11 @@ sub DeterminePlatform + my $self = shift; + + if ($^O eq "MSWin32") ++ { ++ $self->{platform} = uc($self->{options}->{VCPKG_TARGET_ARCHITECTURE}); ++ $self->{platform} =~ s/^X86$/Win32/; ++ } ++ elsif (0) + { + # Examine CL help output to determine if we are in 32 or 64-bit mode. + my $output = `cl /help 2>&1`; +@@ -124,6 +129,9 @@ sub copyFile + sub GetOpenSSLVersion + { + my $self = shift; ++ if ($self->{options}->{openssl_version} =~ /(\d+)\.(\d+)\.(\d+)/m) { ++ return ($1, $2, $3); ++ } + + # Attempt to get OpenSSL version and location. This assumes that + # openssl.exe is in the specified directory. +@@ -148,7 +156,7 @@ sub GetOpenSSLVersion + sub GenerateFiles + { + my $self = shift; +- my $bits = $self->{platform} eq 'Win32' ? 32 : 64; ++ my $bits = $self->{platform} =~ /64/ ? 64 : 32; + my $ac_init_found = 0; + my $package_name; + my $package_version; +@@ -502,7 +510,7 @@ sub GenerateFiles + USE_PAM => undef, + USE_SLICING_BY_8_CRC32C => undef, + USE_SSE42_CRC32C => undef, +- USE_SSE42_CRC32C_WITH_RUNTIME_CHECK => 1, ++ USE_SSE42_CRC32C_WITH_RUNTIME_CHECK => $self->{platform} =~ /^ARM/ ? undef : 1, + USE_SYSTEMD => undef, + USE_SYSV_SEMAPHORES => undef, + USE_SYSV_SHARED_MEMORY => undef, +@@ -760,14 +768,14 @@ sub GenerateFiles + || confess "Could not open pg_config_paths.h"; + print $o <{options}->{zlib}) + { + $proj->AddIncludeDir($self->{options}->{zlib} . '\include'); +- $proj->AddLibrary($self->{options}->{zlib} . '\lib\zdll.lib'); ++ $proj->AddLibrary('$(VcpkgZlibLibs)'); + } + if ($self->{options}->{openssl}) + { + $proj->AddIncludeDir($self->{options}->{openssl} . '\include'); ++ $proj->AddLibrary('$(VcpkgOpensslLibs)'); ++ } ++ elsif (0) ++ { + my ($digit1, $digit2, $digit3) = $self->GetOpenSSLVersion(); + + # Starting at version 1.1.0 the OpenSSL installers have +@@ -1027,7 +1039,7 @@ sub AddProject + if ($self->{options}->{nls}) + { + $proj->AddIncludeDir($self->{options}->{nls} . '\include'); +- $proj->AddLibrary($self->{options}->{nls} . '\lib\libintl.lib'); ++ $proj->AddLibrary('$(VcpkgNlsLibs)'); + } + if ($self->{options}->{gss}) + { +@@ -1060,6 +1072,10 @@ sub AddProject + if ($self->{options}->{icu}) + { + $proj->AddIncludeDir($self->{options}->{icu} . '\include'); ++ $proj->AddLibrary('$(VcpkgIcuLibs)'); ++ } ++ elsif (0) ++ { + if ($self->{platform} eq 'Win32') + { + $proj->AddLibrary($self->{options}->{icu} . '\lib\icuin.lib'); +@@ -1077,22 +1093,22 @@ sub AddProject + { + $proj->AddIncludeDir($self->{options}->{xml} . '\include'); + $proj->AddIncludeDir($self->{options}->{xml} . '\include\libxml2'); +- $proj->AddLibrary($self->{options}->{xml} . '\lib\libxml2.lib'); ++ $proj->AddLibrary('$(VcpkgXmlLibs)'); + } + if ($self->{options}->{xslt}) + { + $proj->AddIncludeDir($self->{options}->{xslt} . '\include'); +- $proj->AddLibrary($self->{options}->{xslt} . '\lib\libxslt.lib'); ++ $proj->AddLibrary('$(VcpkgXsltLibs)'); + } + if ($self->{options}->{lz4}) + { + $proj->AddIncludeDir($self->{options}->{lz4} . '\include'); +- $proj->AddLibrary($self->{options}->{lz4} . '\lib\liblz4.lib'); ++ $proj->AddLibrary('$(VcpkgLz4Libs)'); + } + if ($self->{options}->{zstd}) + { + $proj->AddIncludeDir($self->{options}->{zstd} . '\include'); +- $proj->AddLibrary($self->{options}->{zstd} . '\lib\libzstd.lib'); ++ $proj->AddLibrary('$(VcpkgZstdLibs)'); + } + if ($self->{options}->{uuid}) + { +diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl +index b8c514a..1fb7619 100644 +--- a/src/tools/msvc/gendef.pl ++++ b/src/tools/msvc/gendef.pl +@@ -122,7 +122,7 @@ sub writedef + + # Strip the leading underscore for win32, but not x64 + $f =~ s/^_// +- unless ($platform eq "x64"); ++ if ($platform eq "Win32"); + + # Emit just the name if it's a function symbol, or emit the name + # decorated with the DATA option for variables. +@@ -150,7 +150,7 @@ sub usage + usage() + unless scalar(@ARGV) == 2 + && ( ($ARGV[0] =~ /\\([^\\]+$)/) +- && ($ARGV[1] eq 'Win32' || $ARGV[1] eq 'x64')); ++ && ($ARGV[1] ne '')); + my $defname = uc $1; + my $deffile = "$ARGV[0]/$defname.def"; + my $platform = $ARGV[1]; diff --git a/ports/libpq/patches/windows/python_lib.patch b/ports/libpq/windows/python_lib.patch similarity index 100% rename from ports/libpq/patches/windows/python_lib.patch rename to ports/libpq/windows/python_lib.patch diff --git a/ports/libpq/windows/spin_delay.patch b/ports/libpq/windows/spin_delay.patch new file mode 100644 index 00000000000..163e8e6ef75 --- /dev/null +++ b/ports/libpq/windows/spin_delay.patch @@ -0,0 +1,24 @@ +diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h +index 4d3ffc7..658b1a1 100644 +--- a/src/include/storage/s_lock.h ++++ b/src/include/storage/s_lock.h +@@ -953,12 +953,18 @@ typedef LONG slock_t; + /* If using Visual C++ on Win64, inline assembly is unavailable. + * Use a _mm_pause intrinsic instead of rep nop. + */ +-#if defined(_WIN64) ++#if defined(_M_X64) && !defined(_M_ARM64EC) + static __forceinline void + spin_delay(void) + { + _mm_pause(); + } ++#elif defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) ++static __forceinline void ++spin_delay(void) ++{ ++ __yield(); ++} + #else + static __forceinline void + spin_delay(void) diff --git a/ports/libpq/patches/windows/win_bison_flex.patch b/ports/libpq/windows/win_bison_flex.patch similarity index 100% rename from ports/libpq/patches/windows/win_bison_flex.patch rename to ports/libpq/windows/win_bison_flex.patch diff --git a/ports/libxslt/portfile.cmake b/ports/libxslt/portfile.cmake index d2ac80d90a6..6624f6a7818 100644 --- a/ports/libxslt/portfile.cmake +++ b/ports/libxslt/portfile.cmake @@ -66,6 +66,15 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libexslt/exsltexports.h" "ifdef LIBEXSLT_STATIC" "if 1") endif() +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libxslt.pc" " -lxslt" " -llibxslt") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libexslt.pc" " -lexslt" " -llibexslt") + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libxslt.pc" " -lxslt" " -llibxslt") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libexslt.pc" " -lexslt" " -llibexslt") + endif() +endif() + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") diff --git a/ports/libxslt/vcpkg.json b/ports/libxslt/vcpkg.json index e5b9489b61b..8b9e8b83bc2 100644 --- a/ports/libxslt/vcpkg.json +++ b/ports/libxslt/vcpkg.json @@ -1,7 +1,7 @@ { "name": "libxslt", "version": "1.1.37", - "port-version": 1, + "port-version": 2, "description": "Libxslt is a XSLT library implemented in C for XSLT 1.0 and most of EXSLT", "homepage": "https://github.com/GNOME/libxslt", "license": null, diff --git a/versions/baseline.json b/versions/baseline.json index a4fbec32427..933c90bb207 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4417,8 +4417,8 @@ "port-version": 16 }, "libpq": { - "baseline": "15.2", - "port-version": 3 + "baseline": "15.3", + "port-version": 0 }, "libpqxx": { "baseline": "7.7.4", @@ -4842,7 +4842,7 @@ }, "libxslt": { "baseline": "1.1.37", - "port-version": 1 + "port-version": 2 }, "libxt": { "baseline": "1.2.1", diff --git a/versions/l-/libpq.json b/versions/l-/libpq.json index d3c147f6e07..e8c2ad3e18c 100644 --- a/versions/l-/libpq.json +++ b/versions/l-/libpq.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d5388715a119316e407f15a6612bf05d2292d73d", + "version": "15.3", + "port-version": 0 + }, { "git-tree": "74cc57fa79744500aef02f0b66be5f46b8005af3", "version": "15.2", diff --git a/versions/l-/libxslt.json b/versions/l-/libxslt.json index 2f867897ae9..b29b3a4855e 100644 --- a/versions/l-/libxslt.json +++ b/versions/l-/libxslt.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b5013956f82220811954d9ed3b68e122c11e88a0", + "version": "1.1.37", + "port-version": 2 + }, { "git-tree": "1e2ad3abc4c5d53f33c43f0a1b7aa09ca7e06dc1", "version": "1.1.37",