From 1cc7a472afc93b88f9fe910b703d7216bfa7979e Mon Sep 17 00:00:00 2001 From: Charles Barto Date: Fri, 11 Nov 2016 00:55:55 -0500 Subject: added libpq port --- ports/libpq/CMakeLists.txt | 74 ++++++++++++++++++++++++++++++++++++++++++++++ ports/libpq/CONTROL | 3 ++ ports/libpq/portfile.cmake | 29 ++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 ports/libpq/CMakeLists.txt create mode 100644 ports/libpq/CONTROL create mode 100644 ports/libpq/portfile.cmake diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt new file mode 100644 index 000000000..a9e18d4d6 --- /dev/null +++ b/ports/libpq/CMakeLists.txt @@ -0,0 +1,74 @@ +cmake_minimum_required(VERSION 3.5) +project(libpq VERSION 9.6.1 LANGUAGES C) + +find_package(OpenSSL REQUIRED) +set(CMAKE_DEBUG_POSTFIX "d") +configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h) +configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h) +configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/port/win32.h ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_os.h) +file(WRITE src/interfaces/libpq/pg_config_paths.h "#define SYSCONFDIR \"\"") +set(INSTALL_INCLUDES ON CACHE BOOL "Install include files") +set(pg_port_src + src/port/getaddrinfo.c + src/port/pgstrcasecmp.c + src/port/pqsignal.c + src/port/thread.c + src/port/inet_aton.c + src/port/crypt.c + src/port/noblock.c + src/port/chklocale.c + src/port/inet_net_ntop.c + src/port/snprintf.c + src/port/strlcpy.c + src/port/dirent.c + src/port/dirmod.c + src/port/pgsleep.c + src/port/open.c + src/port/system.c + src/port/win32error.c + src/port/win32setlocale.c +) +set(pg_backend_src + src/backend/libpq/md5.c + src/backend/libpq/ip.c + src/backend/utils/mb/wchar.c + src/backend/utils/mb/encnames.c +) +set(pg_libpq_src + src/interfaces/libpq/fe-auth.c + src/interfaces/libpq/fe-connect.c + src/interfaces/libpq/fe-exec.c + src/interfaces/libpq/fe-lobj.c + src/interfaces/libpq/fe-misc.c + src/interfaces/libpq/fe-print.c + src/interfaces/libpq/fe-protocol2.c + src/interfaces/libpq/fe-protocol3.c + src/interfaces/libpq/fe-secure-openssl.c + src/interfaces/libpq/fe-secure.c + src/interfaces/libpq/libpq-events.c + src/interfaces/libpq/pqexpbuffer.c + src/interfaces/libpq/pthread-win32.c + src/interfaces/libpq/win32.c + src/interfaces/libpq/libpq-dist.rc + src/interfaces/libpq/libpqddll.def + src/interfaces/libpq/libpqdll.def +) +set(pg_libpq_interface + src/include/postgres_ext.h + src/include/pg_config_ext.h + src/interfaces/libpq/libpq-fe.h + ) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +add_library(libpq ${pg_port_src} ${pg_backend_src} ${pg_libpq_src}) +target_compile_definitions(libpq PRIVATE -DFRONTEND -DENABLE_THREAD_SAFETY -DUSE_OPENSSL -D_CRT_SECURE_NO_WARNINGS) +target_link_libraries(libpq PRIVATE OpenSSL::SSL ws2_32 secur32 advapi32 shell32) +target_include_directories(libpq PRIVATE src/include src/include/port/win32 src/include/port/win32_msvc src/port) + +install(TARGETS libpq + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) +if(INSTALL_INCLUDES) + install(FILES ${pg_libpq_interface} DESTINATION include) +endif() \ No newline at end of file diff --git a/ports/libpq/CONTROL b/ports/libpq/CONTROL new file mode 100644 index 000000000..7007a2e1a --- /dev/null +++ b/ports/libpq/CONTROL @@ -0,0 +1,3 @@ +Source: libpq +Version: 9.6.1 +Description: The official database access API of postgresql diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake new file mode 100644 index 000000000..966bef79d --- /dev/null +++ b/ports/libpq/portfile.cmake @@ -0,0 +1,29 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/postgresql-9.6.1) +vcpkg_download_distfile(ARCHIVE + URLS "https://ftp.postgresql.org/pub/source/v9.6.1/postgresql-9.6.1.tar.bz2" + FILENAME "postgresql-9.6.1.tar.bz2" + SHA512 f27af67f9a96f6327150330bf091a803e10eabbac4e488cf5e4d72907e2eb1dbde7282fe0b89fd75711fd8bdcdb3688b5a9eac1e4d6871f4e8681c9c8b0e7c45 +) +vcpkg_extract_source_archive(${ARCHIVE}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + OPTIONS_DEBUG -DINSTALL_INCLUDES=OFF +) + +vcpkg_install_cmake() + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpq) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpq/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/libpq/copyright) -- cgit v1.2.3 From 6c22b89959f3b46cacbdb2f34bfadb45def46e7e Mon Sep 17 00:00:00 2001 From: charlie barto Date: Mon, 14 Nov 2016 23:52:22 -0500 Subject: updated dependencies for libpq --- ports/libpq/CONTROL | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/libpq/CONTROL b/ports/libpq/CONTROL index 7007a2e1a..386588680 100644 --- a/ports/libpq/CONTROL +++ b/ports/libpq/CONTROL @@ -1,3 +1,4 @@ Source: libpq Version: 9.6.1 Description: The official database access API of postgresql +Build-Depends: openssl \ No newline at end of file -- cgit v1.2.3 From 2418a15b0d225fb733fdd89fec8c1d2a5901f381 Mon Sep 17 00:00:00 2001 From: charlie barto Date: Wed, 16 Nov 2016 00:48:57 -0500 Subject: install pg_config.h --- ports/libpq/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index a9e18d4d6..93a1e9179 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -56,6 +56,7 @@ set(pg_libpq_src set(pg_libpq_interface src/include/postgres_ext.h src/include/pg_config_ext.h + src/include/pg_config.h src/interfaces/libpq/libpq-fe.h ) set(CMAKE_INCLUDE_CURRENT_DIR ON) -- cgit v1.2.3 From 79ff44494815c01eac11bfddb0e7a9c26b3e8669 Mon Sep 17 00:00:00 2001 From: charlie barto Date: Wed, 16 Nov 2016 02:34:25 -0500 Subject: removed debug suffix from libpq --- ports/libpq/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index 93a1e9179..0fab91724 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.5) project(libpq VERSION 9.6.1 LANGUAGES C) find_package(OpenSSL REQUIRED) -set(CMAKE_DEBUG_POSTFIX "d") configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/port/win32.h ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_os.h) -- cgit v1.2.3 From a77bed25fc0a2a38188e555cd6d9c7f7b11040ce Mon Sep 17 00:00:00 2001 From: charlie barto Date: Wed, 16 Nov 2016 02:57:26 -0500 Subject: revert debug rename, it was a stupid idea --- ports/libpq/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index 0fab91724..66c84b639 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) project(libpq VERSION 9.6.1 LANGUAGES C) - +set(CMAKE_DEBUG_POSTFIX "d") find_package(OpenSSL REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h) -- cgit v1.2.3 From da65430a30bb5d45e8b03794381a8a0f9401ec77 Mon Sep 17 00:00:00 2001 From: charlie barto Date: Wed, 16 Nov 2016 03:02:01 -0500 Subject: made libpq copy pdb files --- ports/libpq/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake index 966bef79d..14748a1da 100644 --- a/ports/libpq/portfile.cmake +++ b/ports/libpq/portfile.cmake @@ -27,3 +27,5 @@ vcpkg_install_cmake() # Handle copyright file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpq) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpq/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/libpq/copyright) + +vcpkg_copy_pdbs() \ No newline at end of file -- cgit v1.2.3 From b81c91489841cb3315b4111f5c9c077a36386151 Mon Sep 17 00:00:00 2001 From: charlie barto Date: Wed, 16 Nov 2016 12:12:04 -0500 Subject: used export all symbols instead of pq's .def files, this is so that we don't have to change the sources depending on debug or release config --- ports/libpq/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index 66c84b639..be42c8d32 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -49,8 +49,6 @@ set(pg_libpq_src src/interfaces/libpq/pthread-win32.c src/interfaces/libpq/win32.c src/interfaces/libpq/libpq-dist.rc - src/interfaces/libpq/libpqddll.def - src/interfaces/libpq/libpqdll.def ) set(pg_libpq_interface src/include/postgres_ext.h @@ -63,7 +61,7 @@ add_library(libpq ${pg_port_src} ${pg_backend_src} ${pg_libpq_src}) target_compile_definitions(libpq PRIVATE -DFRONTEND -DENABLE_THREAD_SAFETY -DUSE_OPENSSL -D_CRT_SECURE_NO_WARNINGS) target_link_libraries(libpq PRIVATE OpenSSL::SSL ws2_32 secur32 advapi32 shell32) target_include_directories(libpq PRIVATE src/include src/include/port/win32 src/include/port/win32_msvc src/port) - +set_target_properties(libpq PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) install(TARGETS libpq ARCHIVE DESTINATION lib LIBRARY DESTINATION lib -- cgit v1.2.3 From dcca77cd67993185e91739545d105f5141f15ea7 Mon Sep 17 00:00:00 2001 From: Charlie Barto Date: Thu, 17 Nov 2016 03:01:38 -0500 Subject: install types and genbki, this seems to be needed for cmake's findpostgresql --- ports/libpq/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index be42c8d32..19b8787b9 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) project(libpq VERSION 9.6.1 LANGUAGES C) -set(CMAKE_DEBUG_POSTFIX "d") +#set(CMAKE_DEBUG_POSTFIX "d") find_package(OpenSSL REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h) @@ -56,6 +56,10 @@ set(pg_libpq_interface src/include/pg_config.h src/interfaces/libpq/libpq-fe.h ) +set(pg_libpq_catalog_interface + src/include/catalog/pg_type.h + src/include/catalog/genbki.h +) set(CMAKE_INCLUDE_CURRENT_DIR ON) add_library(libpq ${pg_port_src} ${pg_backend_src} ${pg_libpq_src}) target_compile_definitions(libpq PRIVATE -DFRONTEND -DENABLE_THREAD_SAFETY -DUSE_OPENSSL -D_CRT_SECURE_NO_WARNINGS) @@ -69,4 +73,5 @@ install(TARGETS libpq ) if(INSTALL_INCLUDES) install(FILES ${pg_libpq_interface} DESTINATION include) + install(FILES ${pg_libpq_catalog_interface} DESTINATION include/catalog) endif() \ No newline at end of file -- cgit v1.2.3 From cb488d840739c8cf460d5f6ad5c566afaec51fd4 Mon Sep 17 00:00:00 2001 From: Charles Barto Date: Fri, 11 Nov 2016 00:55:55 -0500 Subject: added libpq port --- ports/libpq/CMakeLists.txt | 2 +- ports/libpq/CONTROL | 2 +- ports/libpq/portfile.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index 19b8787b9..8d222924a 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) project(libpq VERSION 9.6.1 LANGUAGES C) -#set(CMAKE_DEBUG_POSTFIX "d") + find_package(OpenSSL REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h) diff --git a/ports/libpq/CONTROL b/ports/libpq/CONTROL index 386588680..580a06857 100644 --- a/ports/libpq/CONTROL +++ b/ports/libpq/CONTROL @@ -1,4 +1,4 @@ Source: libpq Version: 9.6.1 Description: The official database access API of postgresql -Build-Depends: openssl \ No newline at end of file +Build-Depends: openssl diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake index 14748a1da..6d5d91055 100644 --- a/ports/libpq/portfile.cmake +++ b/ports/libpq/portfile.cmake @@ -28,4 +28,4 @@ vcpkg_install_cmake() file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpq) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpq/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/libpq/copyright) -vcpkg_copy_pdbs() \ No newline at end of file +vcpkg_copy_pdbs() -- cgit v1.2.3 From 5ace53834827430e2353e79cfeafef0dafd9f07b Mon Sep 17 00:00:00 2001 From: charlie barto Date: Wed, 16 Nov 2016 02:57:26 -0500 Subject: revert debug rename, it was a stupid idea --- ports/libpq/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index 8d222924a..c03cf40eb 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) project(libpq VERSION 9.6.1 LANGUAGES C) - +set(CMAKE_DEBUG_POSTFIX "d") find_package(OpenSSL REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h) -- cgit v1.2.3 From 89b42cce9095184f280d2db18859f39be003efd2 Mon Sep 17 00:00:00 2001 From: charlie barto Date: Wed, 16 Nov 2016 03:02:01 -0500 Subject: made libpq copy pdb files --- ports/libpq/portfile.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake index 6d5d91055..67a45dba0 100644 --- a/ports/libpq/portfile.cmake +++ b/ports/libpq/portfile.cmake @@ -28,4 +28,5 @@ vcpkg_install_cmake() file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpq) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpq/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/libpq/copyright) + vcpkg_copy_pdbs() -- cgit v1.2.3 From 901db2357ad7c7d12e7963f46958c447563a5efe Mon Sep 17 00:00:00 2001 From: Charlie Barto Date: Thu, 17 Nov 2016 03:20:16 -0500 Subject: remove debug postfix again, missed in rebase --- ports/libpq/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt index c03cf40eb..8d222924a 100644 --- a/ports/libpq/CMakeLists.txt +++ b/ports/libpq/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) project(libpq VERSION 9.6.1 LANGUAGES C) -set(CMAKE_DEBUG_POSTFIX "d") + find_package(OpenSSL REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h) configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h) -- cgit v1.2.3