Commit: 8a637d418f8362bf98a064c258ba4c1ab23f9dbe
Parent: f13028b8ddcb2dd8e2cd46309b9fde8c3a233e63
Author: Randy Palamar
Date: Wed, 27 Sep 2023 20:58:21 -0600
add curl from oasis
Diffstat:
13 files changed, 601 insertions(+), 0 deletions(-)
diff --git a/pkg/gen.lua b/pkg/gen.lua
@@ -4,4 +4,5 @@ subgen('devel')
subgen('editors')
subgen('lang')
subgen('libs')
+subgen('net')
subgen('sys')
diff --git a/pkg/net/curl/.gitignore b/pkg/net/curl/.gitignore
@@ -0,0 +1,2 @@
+/curl-7.85.0.tar.gz
+/src
diff --git a/pkg/net/curl/README.md b/pkg/net/curl/README.md
@@ -0,0 +1,26 @@
+# curl
+
+## curl_config.h
+Generated with
+
+ ./configure \
+ --disable-pop3 \
+ --disable-smb \
+ --with-ca-bundle=/etc/ssl/cert.pem \
+ --with-bearssl \
+ CPPFLAGS='-I/src/oasis/out/pkg/bearssl/include -I/src/oasis/out/pkg/zlib/include' \
+ LDFLAGS='-L/src/oasis/out/pkg/bearssl -L/src/oasis/out/pkg/zlib'
+
+There are a number of non-standard definitions, but they don't seem to be
+architecture-specific except for
+
+- `SIZEOF_CURL_OFF_T`
+- `SIZEOF_INT`
+- `SIZEOF_LONG`
+- `SIZEOF_LONG_LONG`
+- `SIZEOF_OFF_T`
+- `SIZEOF_SHORT`
+- `SIZEOF_SIZE_T`
+- `SIZEOF_TIME_T`
+
+Perhaps all or most of these can eliminated using standard C99 features.
diff --git a/pkg/net/curl/curl_config.h b/pkg/net/curl/curl_config.h
@@ -0,0 +1,342 @@
+/* #undef CURLDEBUG */
+#define CURL_CA_BUNDLE "/etc/ssl/cert.pem"
+/* #undef CURL_CA_FALLBACK */
+/* #undef CURL_CA_PATH */
+/* #undef CURL_DEFAULT_SSL_BACKEND */
+/* #undef CURL_DISABLE_ALTSVC */
+/* #undef CURL_DISABLE_COOKIES */
+/* #undef CURL_DISABLE_CRYPTO_AUTH */
+/* #undef CURL_DISABLE_DICT */
+/* #undef CURL_DISABLE_DOH */
+/* #undef CURL_DISABLE_FILE */
+/* #undef CURL_DISABLE_FTP */
+/* #undef CURL_DISABLE_GETOPTIONS */
+/* #undef CURL_DISABLE_GOPHER */
+/* #undef CURL_DISABLE_HEADERS_API */
+/* #undef CURL_DISABLE_HSTS */
+/* #undef CURL_DISABLE_HTTP */
+/* #undef CURL_DISABLE_HTTP_AUTH */
+/* #undef CURL_DISABLE_IMAP */
+#define CURL_DISABLE_LDAP 1
+#define CURL_DISABLE_LDAPS 1
+/* #undef CURL_DISABLE_LIBCURL_OPTION */
+/* #undef CURL_DISABLE_MIME */
+/* #undef CURL_DISABLE_MQTT */
+/* #undef CURL_DISABLE_NETRC */
+/* #undef CURL_DISABLE_NTLM */
+/* #undef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG */
+/* #undef CURL_DISABLE_PARSEDATE */
+#define CURL_DISABLE_POP3 1
+/* #undef CURL_DISABLE_PROGRESS_METER */
+/* #undef CURL_DISABLE_PROXY */
+/* #undef CURL_DISABLE_RTSP */
+/* #undef CURL_DISABLE_SHUFFLE_DNS */
+#define CURL_DISABLE_SMB 1
+/* #undef CURL_DISABLE_SMTP */
+/* #undef CURL_DISABLE_SOCKETPAIR */
+/* #undef CURL_DISABLE_TELNET */
+/* #undef CURL_DISABLE_TFTP */
+/* #undef CURL_DISABLE_VERBOSE_STRINGS */
+#define CURL_EXTERN_SYMBOL __attribute__ ((__visibility__ ("default")))
+#define CURL_SA_FAMILY_T sa_family_t
+/* #undef CURL_WITH_MULTI_SSL */
+/* #undef DEBUGBUILD */
+/* #undef EGD_SOCKET */
+#define ENABLE_IPV6 1
+#define GETHOSTNAME_TYPE_ARG2 size_t
+#define HAVE_ALARM 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_ARPA_TFTP_H 1
+#define HAVE_ASSERT_H 1
+#define HAVE_ATOMIC 1
+#define HAVE_BASENAME 1
+#define HAVE_BOOL_T 1
+/* #undef HAVE_BORINGSSL */
+/* #undef HAVE_BROTLI */
+/* #undef HAVE_BROTLI_DECODE_H */
+/* #undef HAVE_BUILTIN_AVAILABLE */
+#define HAVE_CLOCK_GETTIME_MONOTONIC 1
+/* #undef HAVE_CLOSESOCKET */
+/* #undef HAVE_CLOSESOCKET_CAMEL */
+#define HAVE_CONNECT 1
+/* #undef HAVE_CRYPTO_H */
+#define HAVE_DECL_GETPWUID_R 1
+/* #undef HAVE_DECL_GETPWUID_R_MISSING */
+#define HAVE_DLFCN_H 1
+#define HAVE_ERRNO_H 1
+/* #undef HAVE_ERR_H */
+#define HAVE_FCHMOD 1
+#define HAVE_FCNTL 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FCNTL_O_NONBLOCK 1
+#define HAVE_FNMATCH 1
+#define HAVE_FREEADDRINFO 1
+#define HAVE_FSETXATTR 1
+#define HAVE_FSETXATTR_5 1
+/* #undef HAVE_FSETXATTR_6 */
+#define HAVE_FTRUNCATE 1
+#define HAVE_GETADDRINFO 1
+#define HAVE_GETADDRINFO_THREADSAFE 1
+#define HAVE_GETEUID 1
+#define HAVE_GETHOSTBYNAME 1
+#define HAVE_GETHOSTBYNAME_R 1
+/* #undef HAVE_GETHOSTBYNAME_R_3 */
+/* #undef HAVE_GETHOSTBYNAME_R_5 */
+#define HAVE_GETHOSTBYNAME_R_6 1
+#define HAVE_GETHOSTNAME 1
+#define HAVE_GETIFADDRS 1
+/* #undef HAVE_GETPASS_R */
+#define HAVE_GETPEERNAME 1
+#define HAVE_GETPPID 1
+#define HAVE_GETPWUID 1
+#define HAVE_GETPWUID_R 1
+#define HAVE_GETRLIMIT 1
+#define HAVE_GETSOCKNAME 1
+#define HAVE_GETTIMEOFDAY 1
+/* #undef HAVE_GLIBC_STRERROR_R */
+#define HAVE_GMTIME_R 1
+/* #undef HAVE_GNUTLS_SRP */
+/* #undef HAVE_GSSAPI */
+/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */
+/* #undef HAVE_GSSAPI_GSSAPI_H */
+/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */
+/* #undef HAVE_GSSGNU */
+/* #undef HAVE_GSSHEIMDAL */
+/* #undef HAVE_GSSMIT */
+/* #undef HAVE_HYPER_H */
+/* #undef HAVE_IDN2_H */
+#define HAVE_IFADDRS_H 1
+#define HAVE_IF_NAMETOINDEX 1
+#define HAVE_INET_NTOP 1
+#define HAVE_INET_PTON 1
+#define HAVE_INTTYPES_H 1
+/* #undef HAVE_IOCTLSOCKET */
+/* #undef HAVE_IOCTLSOCKET_CAMEL */
+/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */
+/* #undef HAVE_IOCTLSOCKET_FIONBIO */
+/* #undef HAVE_IO_H */
+/* #undef HAVE_LBER_H */
+/* #undef HAVE_LDAP_H */
+#define HAVE_LDAP_SSL 1
+/* #undef HAVE_LDAP_SSL_H */
+/* #undef HAVE_LDAP_URL_PARSE */
+/* #undef HAVE_LIBBROTLIDEC */
+#define HAVE_LIBGEN_H 1
+/* #undef HAVE_LIBIDN2 */
+/* #undef HAVE_LIBRESSL */
+/* #undef HAVE_LIBRTMP_RTMP_H */
+/* #undef HAVE_LIBSSH */
+/* #undef HAVE_LIBSSH2 */
+/* #undef HAVE_LIBSSH2_H */
+/* #undef HAVE_LIBSSH_LIBSSH_H */
+/* #undef HAVE_LIBSSL */
+/* #undef HAVE_LIBWOLFSSH */
+#define HAVE_LIBZ 1
+/* #undef HAVE_LIBZSTD */
+#define HAVE_LINUX_TCP_H 1
+#define HAVE_LOCALE_H 1
+#define HAVE_LONGLONG 1
+/* #undef HAVE_MACH_ABSOLUTE_TIME */
+/* #undef HAVE_MEMRCHR */
+#define HAVE_MSG_NOSIGNAL 1
+/* #undef HAVE_MSH3_H */
+#define HAVE_NETDB_H 1
+/* #undef HAVE_NETINET_IN6_H */
+#define HAVE_NETINET_IN_H 1
+#define HAVE_NETINET_TCP_H 1
+#define HAVE_NETINET_UDP_H 1
+#define HAVE_NET_IF_H 1
+/* #undef HAVE_NGHTTP2_NGHTTP2_H */
+/* #undef HAVE_NGHTTP3_NGHTTP3_H */
+/* #undef HAVE_NGTCP2_NGTCP2_CRYPTO_H */
+/* #undef HAVE_NGTCP2_NGTCP2_H */
+/* #undef HAVE_OLD_GSSMIT */
+/* #undef HAVE_OPENSSL3 */
+/* #undef HAVE_OPENSSL_CRYPTO_H */
+/* #undef HAVE_OPENSSL_ERR_H */
+/* #undef HAVE_OPENSSL_PEM_H */
+/* #undef HAVE_OPENSSL_RSA_H */
+/* #undef HAVE_OPENSSL_SRP */
+/* #undef HAVE_OPENSSL_SSL_H */
+/* #undef HAVE_OPENSSL_X509_H */
+/* #undef HAVE_PEM_H */
+#define HAVE_PIPE 1
+/* #undef HAVE_PK11_CREATEMANAGEDGENERICOBJECT */
+#define HAVE_POLL_FINE 1
+#define HAVE_POLL_H 1
+#define HAVE_POSIX_STRERROR_R 1
+/* #undef HAVE_PROTO_BSDSOCKET_H */
+#define HAVE_PTHREAD_H 1
+#define HAVE_PWD_H 1
+/* #undef HAVE_QUICHE_CONN_SET_QLOG_FD */
+/* #undef HAVE_QUICHE_H */
+/* #undef HAVE_RAND_EGD */
+#define HAVE_RECV 1
+/* #undef HAVE_RSA_H */
+#define HAVE_SCHED_YIELD 1
+#define HAVE_SELECT 1
+#define HAVE_SEND 1
+#define HAVE_SENDMSG 1
+#define HAVE_SETJMP_H 1
+#define HAVE_SETLOCALE 1
+/* #undef HAVE_SETMODE */
+#define HAVE_SETRLIMIT 1
+#define HAVE_SIGACTION 1
+#define HAVE_SIGINTERRUPT 1
+#define HAVE_SIGNAL 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_SIGSETJMP 1
+#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
+#define HAVE_SOCKET 1
+#define HAVE_SOCKETPAIR 1
+/* #undef HAVE_SOCKET_H */
+/* #undef HAVE_SSL_GET_ECH_STATUS */
+/* #undef HAVE_SSL_H */
+#define HAVE_STDATOMIC_H 1
+#define HAVE_STDBOOL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRCASECMP 1
+/* #undef HAVE_STRCMPI */
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR_R 1
+/* #undef HAVE_STRICMP */
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRTOK_R 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRUCT_SOCKADDR_STORAGE 1
+#define HAVE_STRUCT_TIMEVAL 1
+#define HAVE_SUSECONDS_T 1
+/* #undef HAVE_SYS_FILIO_H */
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_POLL_H 1
+#define HAVE_SYS_RESOURCE_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_SOCKET_H 1
+/* #undef HAVE_SYS_SOCKIO_H */
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_UIO_H 1
+#define HAVE_SYS_UN_H 1
+/* #undef HAVE_SYS_UTIME_H */
+#define HAVE_SYS_WAIT_H 1
+#define HAVE_SYS_XATTR_H 1
+#define HAVE_TERMIOS_H 1
+/* #undef HAVE_TERMIO_H */
+/* #undef HAVE_TIME_T_UNSIGNED */
+#define HAVE_UNISTD_H 1
+#define HAVE_UTIME 1
+#define HAVE_UTIMES 1
+#define HAVE_UTIME_H 1
+#define HAVE_VARIADIC_MACROS_C99 1
+#define HAVE_VARIADIC_MACROS_GCC 1
+/* #undef HAVE_WINCRYPT_H */
+/* #undef HAVE_WINDOWS_H */
+/* #undef HAVE_WINLDAP_H */
+/* #undef HAVE_WINSOCK2_H */
+/* #undef HAVE_WOLFSSH_SSH_H */
+/* #undef HAVE_WOLFSSL_DES_ECB_ENCRYPT */
+/* #undef HAVE_WOLFSSL_GET_PEER_CERTIFICATE */
+/* #undef HAVE_WOLFSSL_USEALPN */
+#define HAVE_WRITABLE_ARGV 1
+/* #undef HAVE_WS2TCPIP_H */
+/* #undef HAVE_X509_H */
+#define HAVE_ZLIB_H 1
+/* #undef HAVE_ZSTD */
+/* #undef HAVE_ZSTD_H */
+#define LT_OBJDIR ".libs/"
+/* #undef NEED_LBER_H */
+/* #undef NEED_REENTRANT */
+/* #undef NEED_THREAD_SAFE */
+#define NTLM_WB_ENABLED 1
+#define NTLM_WB_FILE "/usr/bin/ntlm_auth"
+#define OS "oasis"
+#define PACKAGE "curl"
+#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"
+#define PACKAGE_NAME "curl"
+#define PACKAGE_STRING "curl -"
+#define PACKAGE_TARNAME "curl"
+#define PACKAGE_URL ""
+#define PACKAGE_VERSION "-"
+/* #undef RANDOM_FILE */
+#define RECV_TYPE_ARG1 int
+#define RECV_TYPE_ARG2 void *
+#define RECV_TYPE_ARG3 size_t
+#define RECV_TYPE_ARG4 int
+#define RECV_TYPE_RETV ssize_t
+#define SELECT_QUAL_ARG5
+#define SELECT_TYPE_ARG1 int
+#define SELECT_TYPE_ARG234 fd_set *
+#define SELECT_TYPE_ARG5 struct timeval *
+#define SELECT_TYPE_RETV int
+#define SEND_QUAL_ARG2 const
+#define SEND_TYPE_ARG1 int
+#define SEND_TYPE_ARG2 void *
+#define SEND_TYPE_ARG3 size_t
+#define SEND_TYPE_ARG4 int
+#define SEND_TYPE_RETV ssize_t
+#define SIZEOF_CURL_OFF_T 8
+#define SIZEOF_INT 4
+/* probe SIZEOF_LONG */
+/* #undef SIZEOF_LONG_LONG */
+#define SIZEOF_OFF_T 8
+/* probe SIZEOF_SIZE_T */
+/* probe SIZEOF_TIME_T */
+#define STDC_HEADERS 1
+/* #undef USE_AMISSL */
+/* #undef USE_ARES */
+#define USE_BEARSSL 1
+/* #undef USE_ECH */
+/* #undef USE_GNUTLS */
+/* #undef USE_GSASL */
+/* #undef USE_HYPER */
+/* #undef USE_LIBPSL */
+/* #undef USE_LIBRTMP */
+/* #undef USE_LIBSSH */
+/* #undef USE_LIBSSH2 */
+/* #undef USE_MANUAL */
+/* #undef USE_MBEDTLS */
+/* #undef USE_MSH3 */
+/* #undef USE_NGHTTP2 */
+/* #undef USE_NGHTTP3 */
+/* #undef USE_NGTCP2 */
+/* #undef USE_NGTCP2_CRYPTO_GNUTLS */
+/* #undef USE_NGTCP2_CRYPTO_OPENSSL */
+/* #undef USE_NGTCP2_CRYPTO_WOLFSSL */
+/* #undef USE_NSS */
+/* #undef USE_OPENLDAP */
+/* #undef USE_OPENSSL */
+/* #undef USE_QUICHE */
+/* #undef USE_RUSTLS */
+/* #undef USE_SCHANNEL */
+/* #undef USE_SECTRANSP */
+#define USE_THREADS_POSIX 1
+/* #undef USE_THREADS_WIN32 */
+/* #undef USE_TLS_SRP */
+#define USE_UNIX_SOCKETS 1
+/* #undef USE_WIN32_CRYPTO */
+/* #undef USE_WIN32_IDN */
+/* #undef USE_WIN32_LARGE_FILES */
+/* #undef USE_WIN32_LDAP */
+/* #undef USE_WIN32_SMALL_FILES */
+/* #undef USE_WINDOWS_SSPI */
+/* #undef USE_WOLFSSH */
+/* #undef USE_WOLFSSL */
+#define VERSION "-"
+/* #undef WANT_IDN_PROTOTYPES */
+#ifndef _ALL_SOURCE
+/* # undef _ALL_SOURCE */
+#endif
+/* #undef _FILE_OFFSET_BITS */
+/* #undef _LARGE_FILES */
+/* #undef const */
+/* #undef in_addr_t */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+/* #undef size_t */
+/* #undef ssize_t */
diff --git a/pkg/net/curl/gen.lua b/pkg/net/curl/gen.lua
@@ -0,0 +1,143 @@
+cflags({
+ '-std=c99', '-Wall', '-Wpedantic', '-Wno-maybe-uninitialized',
+ '-D _DEFAULT_SOURCE',
+ '-D HAVE_CONFIG_H',
+ '-D BUILDING_LIBCURL',
+ '-D CURL_STATICLIB',
+ '-I $outdir',
+ '-I $outdir/include/curl',
+ '-I $outdir/include',
+ '-I $srcdir/lib',
+ '-I $srcdir/src',
+ '-isystem $builddir/pkg/libs/bearssl/include',
+ '-isystem $builddir/pkg/devel/linux-headers/include',
+ '-isystem $builddir/pkg/libs/zlib/include',
+})
+
+build('cat', '$outdir/curl_config.h', {
+ '$dir/curl_config.h',
+ '$builddir/probe/SIZEOF_LONG',
+ '$builddir/probe/SIZEOF_SIZE_T',
+ '$builddir/probe/SIZEOF_TIME_T',
+})
+
+pkg.hdrs = copy('$outdir/include/curl', '$srcdir/include/curl', {
+ 'curl.h',
+ 'curlver.h',
+ 'easy.h',
+ 'mprintf.h',
+ 'stdcheaders.h',
+ 'multi.h',
+ 'typecheck-gcc.h',
+ 'system.h',
+ 'urlapi.h',
+ 'options.h',
+ 'header.h',
+})
+pkg.deps = {
+ '$outdir/curl_config.h',
+ '$gendir/headers',
+ 'pkg/libs/bearssl/headers',
+ 'pkg/devel/linux-headers/headers',
+ 'pkg/libs/zlib/headers',
+}
+
+-- src/lib/Makefile.inc:/^CSOURCES
+lib('libcurl.a', [[
+ lib/(
+ altsvc.c amigaos.c asyn-ares.c asyn-thread.c base64.c bufref.c
+ c-hyper.c conncache.c connect.c content_encoding.c cookie.c
+ curl_addrinfo.c curl_ctype.c curl_des.c curl_endian.c
+ curl_fnmatch.c curl_get_line.c curl_gethostname.c curl_gssapi.c
+ curl_memrchr.c curl_multibyte.c curl_ntlm_core.c curl_ntlm_wb.c
+ curl_path.c curl_range.c curl_rtmp.c curl_sasl.c curl_sspi.c
+ curl_threads.c dict.c doh.c dotdot.c dynbuf.c easy.c
+ easygetopt.c easyoptions.c escape.c file.c fileinfo.c fopen.c
+ formdata.c ftp.c ftplistparser.c getenv.c getinfo.c gopher.c
+ h2h3.c hash.c headers.c hmac.c hostasyn.c hostip.c hostip4.c
+ hostip6.c hostsyn.c hsts.c http.c http2.c http_chunks.c
+ http_digest.c http_negotiate.c http_ntlm.c http_proxy.c
+ http_aws_sigv4.c idn_win32.c if2ip.c imap.c inet_ntop.c
+ inet_pton.c krb5.c ldap.c llist.c md4.c md5.c memdebug.c mime.c
+ mprintf.c mqtt.c multi.c netrc.c nonblock.c openldap.c
+ parsedate.c pingpong.c pop3.c progress.c psl.c rand.c rename.c
+ rtsp.c select.c sendf.c setopt.c sha256.c share.c slist.c smb.c
+ smtp.c socketpair.c socks.c socks_gssapi.c socks_sspi.c
+ speedcheck.c splay.c strcase.c strdup.c strerror.c strtok.c
+ strtoofft.c system_win32.c telnet.c tftp.c timediff.c timeval.c
+ transfer.c url.c urlapi.c version.c version_win32.c warnless.c
+ wildcard.c
+ vauth/(
+ cleartext.c cram.c digest.c digest_sspi.c
+ gsasl.c krb5_gssapi.c krb5_sspi.c ntlm.c
+ ntlm_sspi.c oauth2.c spnego_gssapi.c
+ spnego_sspi.c vauth.c
+ )
+ vtls/(
+ bearssl.c gskit.c gtls.c hostcheck.c keylog.c mbedtls.c
+ mbedtls_threadlock.c nss.c openssl.c rustls.c schannel.c
+ schannel_verify.c sectransp.c vtls.c wolfssl.c
+ x509asn1.c
+ )
+ vquic/(msh3.c ngtcp2.c quiche.c vquic.c)
+ vssh/(libssh.c libssh2.c wolfssh.c)
+ )
+ $builddir/pkg/libs/bearssl/libbearssl.a
+ $builddir/pkg/libs/zlib/libz.a
+]])
+
+build('cc', '$outdir/tool_hugehelp.c.o', {
+ '$dir/tool_hugehelp.c', '||', '$gendir/deps', '$srcdir/src/tool_hugehelp.h',
+})
+
+-- src/src/Makefile.inc:/^CURL_CFILES
+exe('curl', [[
+ src/(
+ slist_wc.c
+ tool_binmode.c
+ tool_bname.c
+ tool_cb_dbg.c
+ tool_cb_hdr.c
+ tool_cb_prg.c
+ tool_cb_rea.c
+ tool_cb_see.c
+ tool_cb_wrt.c
+ tool_cfgable.c
+ tool_dirhie.c
+ tool_doswin.c
+ tool_easysrc.c
+ tool_filetime.c
+ tool_findfile.c
+ tool_formparse.c
+ tool_getparam.c
+ tool_getpass.c
+ tool_help.c
+ tool_helpers.c
+ tool_libinfo.c
+ tool_listhelp.c
+ tool_main.c
+ tool_msgs.c
+ tool_operate.c
+ tool_operhlp.c
+ tool_panykey.c
+ tool_paramhlp.c
+ tool_parsecfg.c
+ tool_progress.c
+ tool_strdup.c
+ tool_setopt.c
+ tool_sleep.c
+ tool_urlglob.c
+ tool_util.c
+ tool_vms.c
+ tool_writeout.c
+ tool_writeout_json.c
+ tool_xattr.c
+ )
+ tool_hugehelp.c.o
+ libcurl.a.d
+]])
+
+file('bin/curl', '755', '$outdir/curl')
+man({'docs/curl.1'})
+
+fetch('curl')
diff --git a/pkg/net/curl/patch/0001-Reuse-dynbuf-symbols-for-curl-tool.patch b/pkg/net/curl/patch/0001-Reuse-dynbuf-symbols-for-curl-tool.patch
@@ -0,0 +1,50 @@
+From 04afba4813f504cafb717c48c50de4395fb3ea71 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 16 Oct 2020 19:09:50 -0700
+Subject: [PATCH] Reuse dynbuf symbols for curl tool
+
+---
+ lib/dynbuf.h | 24 +++++++++++-------------
+ 1 file changed, 11 insertions(+), 13 deletions(-)
+
+diff --git a/lib/dynbuf.h b/lib/dynbuf.h
+index c1e97235d..8b9158051 100644
+--- a/lib/dynbuf.h
++++ b/lib/dynbuf.h
+@@ -24,22 +24,20 @@
+ *
+ ***************************************************************************/
+
+-#ifndef BUILDING_LIBCURL
+ /* this renames the functions so that the tool code can use the same code
+ without getting symbol collisions */
+-#define Curl_dyn_init(a,b) curlx_dyn_init(a,b)
+-#define Curl_dyn_add(a,b) curlx_dyn_add(a,b)
+-#define Curl_dyn_addn(a,b,c) curlx_dyn_addn(a,b,c)
+-#define Curl_dyn_addf curlx_dyn_addf
+-#define Curl_dyn_vaddf curlx_dyn_vaddf
+-#define Curl_dyn_free(a) curlx_dyn_free(a)
+-#define Curl_dyn_ptr(a) curlx_dyn_ptr(a)
+-#define Curl_dyn_uptr(a) curlx_dyn_uptr(a)
+-#define Curl_dyn_len(a) curlx_dyn_len(a)
+-#define Curl_dyn_reset(a) curlx_dyn_reset(a)
+-#define Curl_dyn_tail(a,b) curlx_dyn_tail(a,b)
++#define curlx_dyn_init(a,b) Curl_dyn_init(a,b)
++#define curlx_dyn_add(a,b) Curl_dyn_add(a,b)
++#define curlx_dyn_addn(a,b,c) Curl_dyn_addn(a,b,c)
++#define curlx_dyn_addf Curl_dyn_addf
++#define curlx_dyn_vaddf Curl_dyn_vaddf
++#define curlx_dyn_free(a) Curl_dyn_free(a)
++#define curlx_dyn_ptr(a) Curl_dyn_ptr(a)
++#define curlx_dyn_uptr(a) Curl_dyn_uptr(a)
++#define curlx_dyn_len(a) Curl_dyn_len(a)
++#define curlx_dyn_reset(a) Curl_dyn_reset(a)
++#define curlx_dyn_tail(a,b) Curl_dyn_tail(a,b)
+ #define curlx_dynbuf dynbuf /* for the struct name */
+-#endif
+
+ struct dynbuf {
+ char *bufr; /* point to a null-terminated allocated buffer */
+--
+2.35.1
+
diff --git a/pkg/net/curl/patch/0002-bearssl-Remove-unnecessary-CA-blob-length-check.patch b/pkg/net/curl/patch/0002-bearssl-Remove-unnecessary-CA-blob-length-check.patch
@@ -0,0 +1,29 @@
+From 643bad651c570c0e2b5889df4d0cb0803fa58b1e Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 15 Nov 2021 13:10:02 -0800
+Subject: [PATCH] bearssl: Remove unnecessary CA blob length check
+
+BearSSL APIs take a size_t length parameter, so unlike OpenSSL,
+there is no conversion to int and no reason to check that it's less
+than INT_MAX.
+---
+ lib/vtls/bearssl.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/lib/vtls/bearssl.c b/lib/vtls/bearssl.c
+index f14eb66a2..ffa7c1166 100644
+--- a/lib/vtls/bearssl.c
++++ b/lib/vtls/bearssl.c
+@@ -129,9 +129,6 @@ static CURLcode load_cafile(struct cafile_source *source,
+ return CURLE_SSL_CACERT_BADFILE;
+ }
+
+- if(source->type == CAFILE_SOURCE_BLOB && source->len > (size_t)INT_MAX)
+- return CURLE_SSL_CACERT_BADFILE;
+-
+ ca.err = CURLE_OK;
+ ca.in_cert = FALSE;
+ ca.anchors = NULL;
+--
+2.35.1
+
diff --git a/pkg/net/curl/sha256 b/pkg/net/curl/sha256
@@ -0,0 +1 @@
+78a06f918bd5fde3c4573ef4f9806f56372b32ec1829c9ec474799eeee641c27 curl-7.85.0.tar.gz
diff --git a/pkg/net/curl/tool_hugehelp.c b/pkg/net/curl/tool_hugehelp.c
@@ -0,0 +1,3 @@
+/* built-in manual is disabled, blank function */
+#include "tool_hugehelp.h"
+void hugehelp(void) {}
diff --git a/pkg/net/curl/url b/pkg/net/curl/url
@@ -0,0 +1 @@
+url = "https://curl.se/download/curl-7.85.0.tar.gz"
diff --git a/pkg/net/curl/ver b/pkg/net/curl/ver
@@ -0,0 +1 @@
+7.85.0 r0
diff --git a/pkg/net/gen.lua b/pkg/net/gen.lua
@@ -0,0 +1 @@
+subgen('curl')
diff --git a/sets.lua b/sets.lua
@@ -2,6 +2,7 @@ local S = {}
S.bin = {
'awk',
+ 'curl',
'hyx',
'openbsd',
'pwgen',