c-ares: add 1.29.0 version (#4345)

* c-ares: add 1.29.0 version

* patch macosx
pull/4350/head
star9029 8 months ago committed by GitHub
parent 9fa3d225a0
commit 7c3c922d99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 135
      packages/c/c-ares/patches/1.29.0/macosx-header.patch
  2. 28
      packages/c/c-ares/xmake.lua

@ -0,0 +1,135 @@
diff --git a/src/lib/thirdparty/apple/dnsinfo.h b/src/lib/thirdparty/apple/dnsinfo.h
new file mode 100644
index 0000000..e6a9ed1
--- /dev/null
+++ b/src/lib/thirdparty/apple/dnsinfo.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015-2018 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef __DNSINFO_H__
+#define __DNSINFO_H__
+
+/*
+ * These routines provide access to the systems DNS configuration
+ */
+
+#include <os/availability.h>
+#include <sys/cdefs.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#define DNSINFO_VERSION 20170629
+
+#define DEFAULT_SEARCH_ORDER 200000 /* search order for the "default" resolver domain name */
+
+#define DNS_PTR(type, name) \
+ union { \
+ type name; \
+ uint64_t _ ## name ## _p; \
+ }
+
+#define DNS_VAR(type, name) \
+ type name
+
+
+#pragma pack(4)
+typedef struct {
+ struct in_addr address;
+ struct in_addr mask;
+} dns_sortaddr_t;
+#pragma pack()
+
+
+#pragma pack(4)
+typedef struct {
+ DNS_PTR(char *, domain); /* domain */
+ DNS_VAR(int32_t, n_nameserver); /* # nameserver */
+ DNS_PTR(struct sockaddr **, nameserver);
+ DNS_VAR(uint16_t, port); /* port (in host byte order) */
+ DNS_VAR(int32_t, n_search); /* # search */
+ DNS_PTR(char **, search);
+ DNS_VAR(int32_t, n_sortaddr); /* # sortaddr */
+ DNS_PTR(dns_sortaddr_t **, sortaddr);
+ DNS_PTR(char *, options); /* options */
+ DNS_VAR(uint32_t, timeout); /* timeout */
+ DNS_VAR(uint32_t, search_order); /* search_order */
+ DNS_VAR(uint32_t, if_index);
+ DNS_VAR(uint32_t, flags);
+ DNS_VAR(uint32_t, reach_flags); /* SCNetworkReachabilityFlags */
+ DNS_VAR(uint32_t, service_identifier);
+ DNS_PTR(char *, cid); /* configuration identifer */
+ DNS_PTR(char *, if_name); /* if_index interface name */
+} dns_resolver_t;
+#pragma pack()
+
+
+#define DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS 0x0002 /* always requesting for A dns records in queries */
+#define DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS 0x0004 /* always requesting for AAAA dns records in queries */
+
+#define DNS_RESOLVER_FLAGS_REQUEST_ALL_RECORDS \
+ (DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS | DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS)
+
+#define DNS_RESOLVER_FLAGS_SCOPED 0x1000 /* configuration is for scoped questions */
+#define DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC 0x2000 /* configuration is service-specific */
+#define DNS_RESOLVER_FLAGS_SUPPLEMENTAL 0x4000 /* supplemental match configuration */
+
+
+#pragma pack(4)
+typedef struct {
+ DNS_VAR(int32_t, n_resolver); /* resolver configurations */
+ DNS_PTR(dns_resolver_t **, resolver);
+ DNS_VAR(int32_t, n_scoped_resolver); /* "scoped" resolver configurations */
+ DNS_PTR(dns_resolver_t **, scoped_resolver);
+ DNS_VAR(uint64_t, generation);
+ DNS_VAR(int32_t, n_service_specific_resolver);
+ DNS_PTR(dns_resolver_t **, service_specific_resolver);
+ DNS_VAR(uint32_t, version);
+} dns_config_t;
+#pragma pack()
+
+
+__BEGIN_DECLS
+
+/*
+ * DNS configuration access APIs
+ */
+const char *
+dns_configuration_notify_key (void) API_AVAILABLE(macos(10.4), ios(2.0));
+
+dns_config_t *
+dns_configuration_copy (void) API_AVAILABLE(macos(10.4), ios(2.0));
+
+void
+dns_configuration_free (dns_config_t *config) API_AVAILABLE(macos(10.4), ios(2.0));
+
+void
+_dns_configuration_ack (dns_config_t *config,
+ const char *bundle_id) API_AVAILABLE(macos(10.8), ios(6.0));
+
+__END_DECLS
+
+#endif /* __DNSINFO_H__ */
\ No newline at end of file

@ -1,12 +1,13 @@
package("c-ares")
set_homepage("https://c-ares.org/")
set_description("A C library for asynchronous DNS requests")
set_license("MIT")
add_urls("https://c-ares.org/download/c-ares-$(version).tar.gz")
add_urls("https://github.com/c-ares/c-ares/releases/download/cares-$(version).tar.gz", {version = function (version)
return version:gsub("%.", "_") .. "/c-ares-" .. version
end})
add_versions("1.29.0", "0b89fa425b825c4c7bc708494f374ae69340e4d1fdc64523bdbb2750bfc02ea7")
add_versions("1.28.1", "675a69fc54ddbf42e6830bc671eeb6cd89eeca43828eb413243fd2c0a760809d")
add_versions("1.27.0", "0a72be66959955c43e2af2fbd03418e82a2bd5464604ec9a62147e37aceb420b")
add_versions("1.16.1", "d08312d0ecc3bd48eee0a4cc0d2137c9f194e0a28de2028928c0f6cae85f86ce")
@ -17,12 +18,11 @@ package("c-ares")
add_versions("1.18.1", "1a7d52a8a84a9fbffb1be9133c0f6e17217d91ea5a6fa61f6b4729cda78ebbcf")
add_versions("1.19.0", "bfceba37e23fd531293829002cac0401ef49a6dc55923f7f92236585b7ad1dd3")
add_patches("1.18.1",
path.join(os.scriptdir(), "patches", "1.18.1", "guard-imported-lib.patch" ),
"3cb03453af9e1477cfe926b1c03b2e3fbb8200a72888b590439e69e2d4253609")
add_patches("1.18.1",
path.join(os.scriptdir(), "patches", "1.18.1", "skip-docs.patch" ),
"bbe389b4aab052c2e6845e87d1f56a8366bf18c944f5e5e6f05a2cf105dbe680")
add_patches("1.29.0", "patches/1.29.0/macosx-header.patch", "389c12e54d82f0e8d5dc38dc15bbade12592509627680498774159a0cb32faf2")
add_patches("1.18.1", "patches/1.18.1/guard-imported-lib.patch", "3cb03453af9e1477cfe926b1c03b2e3fbb8200a72888b590439e69e2d4253609")
add_patches("1.18.1", "patches/1.18.1/skip-docs.patch", "bbe389b4aab052c2e6845e87d1f56a8366bf18c944f5e5e6f05a2cf105dbe680")
add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
if is_plat("macosx") then
add_syslinks("resolv")
@ -30,12 +30,14 @@ package("c-ares")
add_deps("cmake")
on_install("linux", "macosx", "windows", function (package)
local configs = {"-DCARES_BUILD_TESTS=OFF", "-DCARES_BUILD_TOOLS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DCARES_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DCARES_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
if not package:config("shared") then
on_install(function (package)
local shared = package:config("shared")
local configs = {"-DCARES_BUILD_TESTS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DCARES_SHARED=" .. (shared and "ON" or "OFF"))
table.insert(configs, "-DCARES_STATIC=" .. (shared and "OFF" or "ON"))
table.insert(configs, "-DCARES_BUILD_TOOLS=" .. (package:config("tools") and "ON" or "OFF"))
if not shared then
package:add("defines", "CARES_STATICLIB")
end
import("package.tools.cmake").install(package, configs)

Loading…
Cancel
Save