Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libpq,libxslt] Update libpq, fix misc issues #31314

Merged
merged 22 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions ports/libpq/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,53 @@ 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
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
80 changes: 80 additions & 0 deletions ports/libpq/build-msvc.cmake
Original file line number Diff line number Diff line change
@@ -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()
29 changes: 0 additions & 29 deletions ports/libpq/config.pl

This file was deleted.

8 changes: 4 additions & 4 deletions ports/libpq/libpq.props.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<CLCompile>
<ClCompile>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_DEBUG@</AdditionalOptions>
</CLCompile>
</ClCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG@</AdditionalOptions>
</Link>
Expand All @@ -12,9 +12,9 @@
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<CLCompile>
<ClCompile>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_RELEASE@</AdditionalOptions>
</CLCompile>
</ClCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE@</AdditionalOptions>
</Link>
Expand Down
23 changes: 0 additions & 23 deletions ports/libpq/patches/windows/MSBuildProject-static-crt.patch

This file was deleted.

13 changes: 0 additions & 13 deletions ports/libpq/patches/windows/MSBuildProject-static-lib.patch

This file was deleted.

13 changes: 0 additions & 13 deletions ports/libpq/patches/windows/MSBuildProject_fix_gendef_perl.patch

This file was deleted.

13 changes: 0 additions & 13 deletions ports/libpq/patches/windows/Mkvcbuild-static-lib.patch

This file was deleted.

45 changes: 0 additions & 45 deletions ports/libpq/patches/windows/Solution.patch

This file was deleted.

Loading