Skip to content

Commit f41f6e5

Browse files
committed
Add c-ares port
1 parent 6467f79 commit f41f6e5

File tree

6 files changed

+111
-6
lines changed

6 files changed

+111
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| [brotli](https://github.com/google/brotli) | 1.0.9 | 2020-08-27 |
2121
| [libressl](https://www.libressl.org) | 3.2.2 | 2020-10-18 |
2222
| [nghttp2](https://nghttp2.org) | 1.41.0 | 2020-06-02 |
23+
| [c-ares](https://c-ares.haxx.se) | 1.16.1 | 2020-05-11 |
2324
| [curl](https://curl.haxx.se) | 7.73.0 | 2020-10-14 |
2425
| [libxml2](http://xmlsoft.org/) | 2.9.10 | 2019-10-30 |
2526
| [libxslt](http://xmlsoft.org/libxslt) | 1.1.34 | 2019-10-30 |

ports/c-ares/CONTROL

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Source: c-ares
2+
Version: 1.16.1
3+
Homepage: https://github.com/c-ares/c-ares
4+
Description: A C library for asynchronous DNS requests
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 943edd340786181a2911103f9b203b255320e95f Mon Sep 17 00:00:00 2001
2+
From: Don <[email protected]>
3+
Date: Tue, 20 Oct 2020 16:42:08 -0700
4+
Subject: [PATCH] Adjust CMake for vcpkg
5+
6+
---
7+
CMakeLists.txt | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/CMakeLists.txt b/CMakeLists.txt
11+
index b8e91c2..8a2bd42 100644
12+
--- a/CMakeLists.txt
13+
+++ b/CMakeLists.txt
14+
@@ -707,7 +707,7 @@ ENDIF ()
15+
16+
# Export targets
17+
IF (CARES_INSTALL)
18+
- SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
19+
+ SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake")
20+
INCLUDE (CMakePackageConfigHelpers)
21+
CONFIGURE_PACKAGE_CONFIG_FILE (${PROJECT_NAME}-config.cmake.in ${PROJECT_NAME}-config.cmake
22+
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
23+
--
24+
2.26.2.windows.1
25+

ports/c-ares/portfile.cmake

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
include(vcpkg_common_functions)
2+
3+
set(VERSION 1.16.1)
4+
string(REPLACE "." "_" TAG ${VERSION})
5+
6+
# Get archive
7+
vcpkg_download_distfile(ARCHIVE
8+
URLS "https://github.com/c-ares/c-ares/releases/download/cares-${TAG}/c-ares-${VERSION}.tar.gz"
9+
FILENAME "c-ares-${VERSION}.tar.gz"
10+
SHA512 4ac2a5d5c6da74eb1d6155c4eadc7127ab1b53a8d13caec41bd6172db5417a79f3ab022e77ba37d8b13da6893d7ced5fd8baf5cc3950a4154b4de8743ad31471
11+
)
12+
13+
# Patches
14+
set(PATCHES
15+
${CMAKE_CURRENT_LIST_DIR}/patches/0001-Adjust-CMake-for-vcpkg.patch
16+
)
17+
18+
# Extract archive
19+
vcpkg_extract_source_archive_ex(
20+
OUT_SOURCE_PATH SOURCE_PATH
21+
ARCHIVE ${ARCHIVE}
22+
REF ${VERSION}
23+
PATCHES ${PATCHES}
24+
)
25+
26+
# Run CMake build
27+
set(BUILD_OPTIONS
28+
-DCARES_INSTALL=ON
29+
-DCARES_BUILD_TESTS=OFF
30+
-DCARES_BUILD_CONTAINER_TESTS=OFF
31+
-DCARES_BUILD_TOOLS=OFF
32+
)
33+
34+
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
35+
set(CARES_STATIC ON)
36+
set(CARES_SHARED OFF)
37+
else ()
38+
set(CARES_STATIC OFF)
39+
set(CARES_SHARED ON)
40+
endif ()
41+
42+
vcpkg_configure_cmake(
43+
SOURCE_PATH ${SOURCE_PATH}
44+
PREFER_NINJA
45+
OPTIONS
46+
${BUILD_OPTIONS}
47+
-DCARES_STATIC=${CARES_STATIC}
48+
-DCARES_SHARED=${CARES_SHARED}
49+
)
50+
51+
vcpkg_install_cmake()
52+
vcpkg_copy_pdbs()
53+
54+
# Prepare distribution
55+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
56+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
57+
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/c-ares RENAME copyright)
58+
file(WRITE ${CURRENT_PACKAGES_DIR}/share/c-ares/version ${VERSION})
59+
60+
# The static build creates empty bin directories
61+
if (CARES_STATIC)
62+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
63+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
64+
endif ()

ports/curl/CONTROL

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ Version: 7.73.0
33
Build-Depends: zlib, brotli, nghttp2
44
Description: A library for transferring data with URLs
55

6+
Feature: ares
7+
Build-Depends: c-ares
8+
Description: |
9+
Enable c-ares for asynchronous DNS requests.
10+
611
Feature: ca-bundle
712
Description: |
813
Use the provided certificate bundle.
914

15+
Feature: ipv6
16+
Description: |
17+
Enable IPV6 support.
18+
1019
Feature: ssl
1120
Build-Depends: libressl
1221
Description: |
1322
SSL support through libressl. If not specified then the system SSL library
1423
will be used.
15-
16-
Feature: ipv6
17-
Description: |
18-
Enable IPV6 support.

ports/curl/portfile.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,21 @@ set(BUILD_OPTIONS
5454
-DCURL_DISABLE_TFTP=ON
5555
-DCURL_ENABLE_MQTT=OFF
5656
# ENABLE options
57-
-DENABLE_ARES=OFF
5857
-DENABLE_MANUAL=OFF
59-
-DENABLE_THREADED_RESOLVER=ON
6058
-DENABLE_UNIX_SOCKETS=OFF
6159
# USE options
6260
-DUSE_NGHTTP2=ON
6361
-DUSE_WIN32_LDAP=OFF
6462
)
6563

64+
# Check for ares feature
65+
if (ares IN_LIST FEATURES)
66+
message(STATUS "Enabling c-ares")
67+
set(BUILD_OPTIONS ${BUILD_OPTIONS} -DENABLE_ARES=ON -DENABLE_THREADED_RESOLVER=OFF)
68+
else ()
69+
set(BUILD_OPTIONS ${BUILD_OPTIONS} -DENABLE_ARES=OFF -DENABLE_THREADED_RESOLVER=ON)
70+
endif ()
71+
6672
# Check for ca-bundle feature
6773
if (ca-bundle IN_LIST FEATURES)
6874
message(STATUS "Enabling CA bundle")

0 commit comments

Comments
 (0)