2023-03-02 03:04:27 +08:00
|
|
|
set(PORT_VERSION ${VERSION})
|
2021-04-29 12:30:37 +08:00
|
|
|
# NOTE: the python patches must be regenerated on version update
|
2020-05-19 01:36:03 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
## Download and extract sources
|
2016-11-11 13:55:55 +08:00
|
|
|
vcpkg_download_distfile(ARCHIVE
|
2020-05-19 01:36:03 +08:00
|
|
|
URLS "https://ftp.postgresql.org/pub/source/v${PORT_VERSION}/postgresql-${PORT_VERSION}.tar.bz2"
|
|
|
|
FILENAME "postgresql-${PORT_VERSION}.tar.bz2"
|
2023-03-02 03:04:27 +08:00
|
|
|
SHA512 115a8a4234791bba4e6dcc4617e9dd77abedcf767894ce9472c59cce9d5d4ef2d4e1746f3a0c7a99de4fc4385fb716652b70dce9f48be45a9db5a682517db7e8
|
2016-11-11 13:55:55 +08:00
|
|
|
)
|
2019-05-29 07:58:00 +08:00
|
|
|
|
2020-03-19 00:45:41 +08:00
|
|
|
set(PATCHES
|
2020-01-14 07:43:36 +08:00
|
|
|
patches/windows/install.patch
|
|
|
|
patches/windows/win_bison_flex.patch
|
2023-03-15 05:11:06 +08:00
|
|
|
patches/windows/openssl-version.patch
|
2020-01-14 07:43:36 +08:00
|
|
|
patches/windows/Solution.patch
|
2020-05-19 01:36:03 +08:00
|
|
|
patches/windows/MSBuildProject_fix_gendef_perl.patch
|
|
|
|
patches/windows/msgfmt.patch
|
|
|
|
patches/windows/python_lib.patch
|
2022-03-24 07:41:00 +08:00
|
|
|
patches/windows/fix-compile-flag-Zi.patch
|
|
|
|
patches/windows/tcl_version.patch
|
2022-08-05 10:31:00 +08:00
|
|
|
patches/windows/macro-def.patch
|
|
|
|
patches/fix-configure.patch
|
2022-03-24 07:41:00 +08:00
|
|
|
)
|
2020-01-14 07:43:36 +08:00
|
|
|
|
2022-03-24 07:41:00 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2020-01-14 07:43:36 +08:00
|
|
|
list(APPEND PATCHES patches/windows/MSBuildProject-static-lib.patch)
|
|
|
|
list(APPEND PATCHES patches/windows/Mkvcbuild-static-lib.patch)
|
|
|
|
endif()
|
2022-03-24 07:41:00 +08:00
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
2020-01-14 07:43:36 +08:00
|
|
|
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()
|
2023-03-02 03:04:27 +08:00
|
|
|
vcpkg_extract_source_archive(
|
|
|
|
SOURCE_PATH
|
2022-03-24 07:41:00 +08:00
|
|
|
ARCHIVE "${ARCHIVE}"
|
2020-01-14 07:43:36 +08:00
|
|
|
PATCHES ${PATCHES}
|
2019-05-29 07:58:00 +08:00
|
|
|
)
|
2020-01-14 07:43:36 +08:00
|
|
|
unset(buildenv_contents)
|
|
|
|
# Get paths to required programs
|
2020-08-06 05:01:13 +08:00
|
|
|
set(REQUIRED_PROGRAMS PERL)
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
list(APPEND REQUIRED_PROGRAMS BISON FLEX)
|
|
|
|
endif()
|
|
|
|
foreach(program_name ${REQUIRED_PROGRAMS})
|
2020-01-14 07:43:36 +08:00
|
|
|
# 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}")
|
2020-05-19 01:36:03 +08:00
|
|
|
set(buildenv_contents "${buildenv_contents}\n\$ENV{'PATH'}=\$ENV{'PATH'} . ';${${program_name}_EXE_PATH}';")
|
2020-01-14 07:43:36 +08:00
|
|
|
endforeach()
|
2018-03-13 22:32:27 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
## 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}")
|
2020-05-19 01:36:03 +08:00
|
|
|
file(REMOVE_RECURSE "${BUILDPATH_${_buildtype}}") #Clean old builds
|
2020-01-14 07:43:36 +08:00
|
|
|
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}")
|
2020-05-19 01:36:03 +08:00
|
|
|
file(REMOVE_RECURSE "${BUILDPATH_${_buildtype}}") #Clean old builds
|
2022-03-24 07:41:00 +08:00
|
|
|
set(PACKAGE_DIR_${_buildtype} "${CURRENT_PACKAGES_DIR}${INSTALL_PATH_SUFFIX_${_buildtype}}")
|
2020-01-14 07:43:36 +08:00
|
|
|
unset(_short)
|
|
|
|
unset(_buildtype)
|
|
|
|
endif()
|
|
|
|
|
2022-03-24 07:41:00 +08:00
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2020-01-14 07:43:36 +08:00
|
|
|
|
|
|
|
## Do the build
|
2021-04-20 08:19:44 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
2022-08-05 10:31:00 +08:00
|
|
|
vcpkg_cmake_get_vars(vars_file)
|
|
|
|
include("${vars_file}")
|
|
|
|
|
2023-03-15 05:11:06 +08:00
|
|
|
file(STRINGS "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/openssl.pc" OPENSSL_VERSION REGEX "Version:")
|
|
|
|
if(OPENSSL_VERSION)
|
|
|
|
set(ENV{VCPKG_OPENSSL_VERSION} "${OPENSSL_VERSION}")
|
|
|
|
endif()
|
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
file(GLOB SOURCE_FILES ${SOURCE_PATH}/*)
|
|
|
|
foreach(_buildtype ${port_config_list})
|
|
|
|
# Copy libpq sources.
|
2020-03-19 00:45:41 +08:00
|
|
|
message(STATUS "Copying libpq source files to ${BUILDPATH_${_buildtype}}...")
|
2020-01-14 07:43:36 +08:00
|
|
|
foreach(SOURCE_FILE ${SOURCE_FILES})
|
|
|
|
file(COPY ${SOURCE_FILE} DESTINATION "${BUILDPATH_${_buildtype}}")
|
|
|
|
endforeach()
|
|
|
|
message(STATUS "Copying libpq source files... done")
|
2020-06-04 10:31:28 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH "${BUILDPATH_${_buildtype}}"
|
|
|
|
PATCHES patches/windows/Solution_${_buildtype}.patch
|
2020-05-19 01:36:03 +08:00
|
|
|
patches/windows/python3_build_${_buildtype}.patch
|
2020-01-14 07:43:36 +08:00
|
|
|
)
|
|
|
|
message(STATUS "Patches applied!")
|
|
|
|
file(COPY "${CURRENT_PORT_DIR}/config.pl" DESTINATION "${BUILDPATH_${_buildtype}}/src/tools/msvc")
|
2020-06-04 10:31:28 +08:00
|
|
|
|
2020-05-19 01:36:03 +08:00
|
|
|
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}")
|
2020-06-04 10:31:28 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
set(CONFIG_FILE "${BUILDPATH_${_buildtype}}/src/tools/msvc/config.pl")
|
|
|
|
file(READ "${CONFIG_FILE}" _contents)
|
2020-06-04 10:31:28 +08:00
|
|
|
|
2020-07-16 05:48:22 +08:00
|
|
|
## ldap => undef, # --with-ldap
|
2020-01-14 07:43:36 +08:00
|
|
|
## extraver => undef, # --with-extra-version=<string>
|
|
|
|
## gss => undef, # --with-gssapi=<path>
|
|
|
|
## icu => undef, # --with-icu=<path> ##done
|
|
|
|
## nls => undef, # --enable-nls=<path> ##done
|
|
|
|
## tap_tests => undef, # --enable-tap-tests
|
2020-05-19 01:36:03 +08:00
|
|
|
## tcl => undef, # --with-tcl=<path> #done
|
2020-07-16 05:48:22 +08:00
|
|
|
## perl => undef, # --with-perl
|
2020-05-19 01:36:03 +08:00
|
|
|
## python => undef, # --with-python=<path> ##done
|
2020-01-14 07:43:36 +08:00
|
|
|
## openssl => undef, # --with-openssl=<path> ##done
|
|
|
|
## uuid => undef, # --with-ossp-uuid
|
|
|
|
## xml => undef, # --with-libxml=<path> ##done
|
|
|
|
## xslt => undef, # --with-libxslt=<path> ##done
|
|
|
|
## iconv => undef, # (not in configure, path to iconv) ##done (needed by xml)
|
|
|
|
## zlib => undef # --with-zlib=<path> ##done
|
2020-06-04 10:31:28 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
## Setup external dependencies
|
2020-07-16 05:48:22 +08:00
|
|
|
##"-DFEATURES=core;openssl;zlib" "-DALL_FEATURES=openssl;zlib;readline;libedit;python;tcl;nls;systemd;llvm;icu;bonjour;uuid;xml;xslt;"
|
2020-01-14 07:43:36 +08:00
|
|
|
if("${FEATURES}" MATCHES "icu")
|
2020-05-19 01:36:03 +08:00
|
|
|
string(REPLACE "icu => undef" "icu => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
|
2020-01-14 07:43:36 +08:00
|
|
|
endif()
|
|
|
|
if("${FEATURES}" MATCHES "nls")
|
2020-05-19 01:36:03 +08:00
|
|
|
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")
|
2020-01-14 07:43:36 +08:00
|
|
|
endif()
|
|
|
|
if("${FEATURES}" MATCHES "openssl")
|
|
|
|
string(REPLACE "openssl => undef" "openssl => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
|
|
|
|
endif()
|
2020-05-19 01:36:03 +08:00
|
|
|
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()
|
2020-01-14 07:43:36 +08:00
|
|
|
if("${FEATURES}" MATCHES "xml")
|
2020-05-19 01:36:03 +08:00
|
|
|
string(REPLACE "xml => undef" "xml => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
|
|
|
|
string(REPLACE "iconv => undef" "iconv => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
|
2020-01-14 07:43:36 +08:00
|
|
|
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()
|
2022-03-24 07:41:00 +08:00
|
|
|
if("${FEATURES}" MATCHES "lz4")
|
|
|
|
string(REPLACE "lz4 => undef" "lz4 => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
|
|
|
|
endif()
|
2023-03-02 03:04:27 +08:00
|
|
|
if("${FEATURES}" MATCHES "zstd")
|
|
|
|
string(REPLACE "zstd => undef" "zstd => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
|
|
|
|
endif()
|
2020-06-04 10:31:28 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
file(WRITE "${CONFIG_FILE}" "${_contents}")
|
|
|
|
file(WRITE "${BUILDPATH_${_buildtype}}/src/tools/msvc/buildenv.pl" "${buildenv_contents}")
|
2022-08-05 10:31:00 +08:00
|
|
|
configure_file("${CURRENT_PORT_DIR}/libpq.props.in" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/libpq.props" @ONLY)
|
2020-01-14 07:43:36 +08:00
|
|
|
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
|
2020-03-28 11:28:09 +08:00
|
|
|
/p:ForceImportBeforeCppTargets=\"${SCRIPTS}/buildsystems/msbuild/vcpkg.targets\"
|
2022-08-05 10:31:00 +08:00
|
|
|
/p:ForceImportAfterCppTargets=\"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/libpq.props\"
|
2020-06-04 10:31:28 +08:00
|
|
|
/p:VcpkgTriplet=${TARGET_TRIPLET}
|
|
|
|
/p:VcpkgCurrentInstalledDir=\"${CURRENT_INSTALLED_DIR}\""
|
2020-01-14 07:43:36 +08:00
|
|
|
)
|
|
|
|
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}
|
2022-03-24 07:41:00 +08:00
|
|
|
WORKING_DIRECTORY "${BUILDPATH_${_buildtype}}/src/tools/msvc"
|
|
|
|
LOGNAME "build-${TARGET_TRIPLET}-${_buildtype}"
|
2020-01-14 07:43:36 +08:00
|
|
|
)
|
|
|
|
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}
|
2022-03-24 07:41:00 +08:00
|
|
|
WORKING_DIRECTORY "${BUILDPATH_${_buildtype}}/src/tools/msvc"
|
|
|
|
LOGNAME "build-${build_lib}-${TARGET_TRIPLET}-${_buildtype}"
|
2020-01-14 07:43:36 +08:00
|
|
|
)
|
|
|
|
message(STATUS "Building ${build_lib} ${TARGET_TRIPLET}-${_buildtype}... done")
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "Installing libpq ${TARGET_TRIPLET}-${_buildtype}...")
|
|
|
|
vcpkg_execute_required_process(
|
2022-03-24 07:41:00 +08:00
|
|
|
COMMAND ${PERL} install.pl "${CURRENT_PACKAGES_DIR}${INSTALL_PATH_SUFFIX_${_buildtype}}" client
|
|
|
|
WORKING_DIRECTORY "${BUILDPATH_${_buildtype}}/src/tools/msvc"
|
|
|
|
LOGNAME "install-${TARGET_TRIPLET}-${_buildtype}"
|
2020-01-14 07:43:36 +08:00
|
|
|
)
|
|
|
|
message(STATUS "Installing libpq ${TARGET_TRIPLET}-${_buildtype}... done")
|
|
|
|
endforeach()
|
2020-03-19 00:45:41 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
message(STATUS "Cleanup libpq ${TARGET_TRIPLET}...")
|
|
|
|
#Cleanup
|
2022-03-24 07:41:00 +08:00
|
|
|
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")
|
2020-01-14 07:43:36 +08:00
|
|
|
|
2020-10-23 12:56:51 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2022-03-24 07:41:00 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
2020-01-14 07:43:36 +08:00
|
|
|
endif()
|
2020-06-04 10:31:28 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
if(NOT HAS_TOOLS)
|
2022-03-24 07:41:00 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools")
|
2020-01-14 07:43:36 +08:00
|
|
|
else()
|
2022-03-24 07:41:00 +08:00
|
|
|
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
2020-01-14 07:43:36 +08:00
|
|
|
endif()
|
2020-05-22 01:46:07 +08:00
|
|
|
|
2020-01-14 07:43:36 +08:00
|
|
|
message(STATUS "Cleanup libpq ${TARGET_TRIPLET}... - done")
|
2020-10-23 12:56:51 +08:00
|
|
|
set(USE_DL OFF)
|
2020-01-14 07:43:36 +08:00
|
|
|
else()
|
2022-03-24 07:41:00 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/Makefile" DESTINATION "${SOURCE_PATH}")
|
|
|
|
|
|
|
|
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()
|
2020-10-23 12:56:51 +08:00
|
|
|
if("openssl" IN_LIST FEATURES)
|
2020-01-14 07:43:36 +08:00
|
|
|
list(APPEND BUILD_OPTS --with-openssl)
|
2020-10-23 12:56:51 +08:00
|
|
|
else()
|
|
|
|
list(APPEND BUILD_OPTS --without-openssl)
|
2020-01-14 07:43:36 +08:00
|
|
|
endif()
|
2020-10-23 12:56:51 +08:00
|
|
|
if("zlib" IN_LIST FEATURES)
|
|
|
|
list(APPEND BUILD_OPTS --with-zlib)
|
|
|
|
else()
|
2020-01-14 07:43:36 +08:00
|
|
|
list(APPEND BUILD_OPTS --without-zlib)
|
|
|
|
endif()
|
2023-03-02 03:04:27 +08:00
|
|
|
if("zstd" IN_LIST FEATURES)
|
|
|
|
list(APPEND BUILD_OPTS --with-zstd)
|
|
|
|
else()
|
|
|
|
list(APPEND BUILD_OPTS --without-zstd)
|
|
|
|
endif()
|
2022-03-24 07:41:00 +08:00
|
|
|
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()
|
2020-10-23 12:56:51 +08:00
|
|
|
if("readline" IN_LIST FEATURES)
|
|
|
|
list(APPEND BUILD_OPTS --with-readline)
|
|
|
|
else()
|
2020-01-14 07:43:36 +08:00
|
|
|
list(APPEND BUILD_OPTS --without-readline)
|
|
|
|
endif()
|
2022-03-24 07:41:00 +08:00
|
|
|
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)
|
|
|
|
endif()
|
|
|
|
if("python" IN_LIST FEATURES)
|
|
|
|
list(APPEND BUILD_OPTS --with-python)
|
|
|
|
else()
|
|
|
|
list(APPEND BUILD_OPTS --without-python)
|
|
|
|
endif()
|
2021-11-09 13:31:08 +08:00
|
|
|
if(VCPKG_TARGET_IS_ANDROID) # AND CMAKE_SYSTEM_VERSION LESS 26)
|
|
|
|
list(APPEND BUILD_OPTS ac_cv_header_langinfo_h=no)
|
|
|
|
endif()
|
2022-09-27 05:50:08 +08:00
|
|
|
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}")
|
2021-12-15 02:59:38 +08:00
|
|
|
endif()
|
2020-01-14 07:43:36 +08:00
|
|
|
vcpkg_configure_make(
|
2022-03-24 07:41:00 +08:00
|
|
|
AUTOCONFIG
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2020-05-22 01:46:07 +08:00
|
|
|
COPY_SOURCE
|
2021-04-20 08:19:44 +08:00
|
|
|
DETERMINE_BUILD_TRIPLET
|
2020-01-14 07:43:36 +08:00
|
|
|
OPTIONS
|
|
|
|
${BUILD_OPTS}
|
2022-10-06 05:58:04 +08:00
|
|
|
OPTIONS_RELEASE
|
|
|
|
"DYLD_FALLBACK_LIBRARY_PATH=${CURRENT_INSTALLED_DIR}/lib:${CURRENT_INSTALLED_DIR}/debug/lib"
|
2020-01-14 07:43:36 +08:00
|
|
|
OPTIONS_DEBUG
|
|
|
|
--enable-debug
|
2022-10-06 05:58:04 +08:00
|
|
|
"DYLD_FALLBACK_LIBRARY_PATH=${CURRENT_INSTALLED_DIR}/debug/lib:${CURRENT_INSTALLED_DIR}/lib"
|
2020-01-14 07:43:36 +08:00
|
|
|
)
|
2020-03-19 00:45:41 +08:00
|
|
|
|
2020-10-23 12:56:51 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
2020-09-25 03:29:13 +08:00
|
|
|
set(ENV{LIBPQ_LIBRARY_TYPE} shared)
|
|
|
|
else()
|
|
|
|
set(ENV{LIBPQ_LIBRARY_TYPE} static)
|
|
|
|
endif()
|
2021-04-20 08:19:44 +08:00
|
|
|
if(VCPKG_TARGET_IS_MINGW)
|
|
|
|
set(ENV{USING_MINGW} yes)
|
|
|
|
endif()
|
2020-03-19 00:45:41 +08:00
|
|
|
vcpkg_install_make()
|
2020-05-22 01:46:07 +08:00
|
|
|
|
2022-03-24 07:41:00 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
2020-01-14 07:43:36 +08:00
|
|
|
if(NOT HAS_TOOLS)
|
2022-03-24 07:41:00 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
|
2020-01-14 07:43:36 +08:00
|
|
|
else()
|
2022-03-24 07:41:00 +08:00
|
|
|
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
|
2020-01-14 07:43:36 +08:00
|
|
|
endif()
|
2021-04-20 08:19:44 +08:00
|
|
|
if(VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
2022-03-24 07:41:00 +08:00
|
|
|
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")
|
2021-04-20 08:19:44 +08:00
|
|
|
endif()
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
2022-03-24 07:41:00 +08:00
|
|
|
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")
|
2021-04-20 08:19:44 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(VCPKG_TARGET_IS_MINGW)
|
|
|
|
set(USE_DL OFF)
|
|
|
|
else()
|
|
|
|
set(USE_DL ON)
|
|
|
|
endif()
|
2022-04-01 01:56:04 +08:00
|
|
|
|
|
|
|
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")
|
2020-01-14 07:43:36 +08:00
|
|
|
endif()
|
2016-11-11 13:55:55 +08:00
|
|
|
|
2021-05-01 02:10:51 +08:00
|
|
|
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)
|
2021-12-15 02:59:38 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|