Skip to content

Commit

Permalink
[getdns] Add new port. (#12090)
Browse files Browse the repository at this point in the history
* [getdns] Add new port.

* Add support for vcpkg static library builds.

* Convert libevent and libuv libraries to features.

* Use ${PORT} in copyright install.

* getdns does not currently support UWP.

* Add failing port on UWP to portfile.

* Remove optional FEATURES keyword.
  • Loading branch information
banburybill authored Jul 7, 2020
1 parent 6a41626 commit e1285b4
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ports/getdns/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Source: getdns
Version: 1.6.0
Build-Depends: libidn2, openssl
Description: GetDNS is a modern asynchronous DNS API
Homepage: https://getdnsapi.net/
Supports: !uwp

Feature: libevent
Description: libevent event loop integration
Build-Depends: libevent

Feature: libuv
Description: libuv event loop integration
Build-Depends: libuv
12 changes: 12 additions & 0 deletions ports/getdns/ignore_copying.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10d10b99..fda6fa3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1087,6 +1087,6 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/getdns DESTINATION include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man3 DESTINATION share/man)

set(docdir share/doc/getdns)
-install(FILES AUTHORS ChangeLog COPYING LICENSE NEWS README.md DESTINATION ${docdir})
+install(FILES AUTHORS ChangeLog LICENSE NEWS README.md DESTINATION ${docdir})
install(FILES spec/index.html DESTINATION ${docdir}/spec)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/getdns.pc DESTINATION lib/pkgconfig)
24 changes: 24 additions & 0 deletions ports/getdns/install_dlls.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10d10b99..35761647 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1065,15 +1065,15 @@ if (ENABLE_STATIC)
endif ()
endif ()
if (ENABLE_SHARED)
- install(TARGETS getdns_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+ install(TARGETS getdns_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
if (USE_LIBEV)
- install(TARGETS getdns_ex_ev_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+ install(TARGETS getdns_ex_ev_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
endif ()
if (USE_LIBEVENT2)
- install(TARGETS getdns_ex_event_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+ install(TARGETS getdns_ex_event_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
endif ()
if (USE_LIBUV)
- install(TARGETS getdns_ex_uv_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+ install(TARGETS getdns_ex_uv_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
endif ()
endif ()
if (BUILD_GETDNS_QUERY)
13 changes: 13 additions & 0 deletions ports/getdns/openssl_depend_libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d22d3ca..7784ab58 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -335,7 +335,7 @@ check_include_file(openssl/rand.h HAVE_OPENSSL_RAND_H)
check_include_file(openssl/conf.h HAVE_OPENSSL_CONF_H)
check_include_file(openssl/engine.h HAVE_OPENSSL_ENGINE_H)

-set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
+set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES} ${getdns_system_libs})
check_function_exists(DSA_SIG_set0 HAVE_DSA_SIG_SET0)
check_function_exists(DSA_set0_pqg HAVE_DSA_SET0_PQG)
check_function_exists(DSA_set0_key HAVE_DSA_SET0_KEY)
45 changes: 45 additions & 0 deletions ports/getdns/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
vcpkg_fail_port_install(ON_TARGET "uwp")

set(GETDNS_VERSION 1.6.0)
set(GETDNS_HASH 4d3a67cd76e7ce53a31c9b92607d7768381a1f916e7950fe4e69368fa585d38dbfc04975630fbe8d8bd14f4bebf83a3516e063b5b54e0922548edc0952ee7b4e)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" GETDNS_ENABLE_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" GETDNS_ENABLE_SHARED)

vcpkg_download_distfile(ARCHIVE
URLS "https://getdnsapi.net/dist/getdns-${GETDNS_VERSION}.tar.gz"
FILENAME "getdns-${GETDNS_VERSION}.tar.gz"
SHA512 ${GETDNS_HASH}
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${GETDNS_VERSION}
PATCHES
"openssl_depend_libs.patch"
"ignore_copying.patch"
"install_dlls.patch"
)

vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
libevent BUILD_LIBEVENT2
libuv BUILD_LIBUV
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_GETDNS_QUERY=OFF
-DBUILD_GETDNS_SERVER_MON=OFF
-DENABLE_STATIC=${GETDNS_ENABLE_STATIC}
-DENABLE_SHARED=${GETDNS_ENABLE_SHARED}
${FEATURE_OPTIONS}
)
vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

0 comments on commit e1285b4

Please sign in to comment.