diff --git a/net/httping/Portfile b/net/httping/Portfile index 80ea7f09ae7..97bdd088bb7 100644 --- a/net/httping/Portfile +++ b/net/httping/Portfile @@ -5,11 +5,11 @@ PortGroup cmake 1.1 PortGroup github 1.0 PortGroup openssl 1.0 -github.setup folkertvanheusden HTTPing 3.6 v -revision 1 -checksums rmd160 8b6bc14a6d09461ef7dea606d7a2059ea6b12284 \ - sha256 d332fc5436bcf8290bcb4fe75b7019b90facfb64264dc3c7bc3407da27c18d77 \ - size 83122 +github.setup folkertvanheusden HTTPing 4.4.0 v +revision 0 +checksums rmd160 1b313b818b6dddff42dbb57ea20ca8ec00758ffc \ + sha256 87fa2da5ac83c4a0edf4086161815a632df38e1cc230e1e8a24a8114c09da8fd \ + size 82454 name httping categories net www @@ -37,13 +37,13 @@ depends_lib port:fftw-3 \ installs_libs no +# Remove these patches in the next release patchfiles patch-tcp.c.diff +patchfiles-append define-no-tfo.diff -configure.args -DCMAKE_EXE_LINKER_FLAGS="-lintl" - -destroot { - copy ${workpath}/build/httping ${destroot}${prefix}/bin/ - copy ${worksrcpath}/httping.1 ${destroot}${prefix}/share/man/man1/ -} - -github.livecheck.regex {(\d\.\d)} +configure.args-append \ + -DUSE_SSL=ON \ + -DUSE_GETTEXT=ON \ + -DUSE_TUI=ON \ + -DUSE_FFTW3=ON \ + -DCMAKE_INSTALL_MANDIR="${prefix}/share/man/man1/" diff --git a/net/httping/files/define-no-tfo.diff b/net/httping/files/define-no-tfo.diff new file mode 100644 index 00000000000..e915be1fb7c --- /dev/null +++ b/net/httping/files/define-no-tfo.diff @@ -0,0 +1,98 @@ +# Define NO_TFO on macOS < 10.11 +# See: https://github.com/folkertvanheusden/HTTPing/pull/22 + +--- gen.h.orig ++++ gen.h +@@ -34,6 +34,13 @@ + #define gettext(x) (x) + #endif + ++#ifdef __APPLE__ ++#include ++#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100 ++#define NO_TFO ++#endif ++#endif ++ + typedef struct + { + double cur, min, avg, max, sd, med; +--- help.c.orig ++++ help.c +@@ -71,7 +71,9 @@ void version(void) + #endif + #endif + ++#ifndef NO_TFO + fprintf(stderr, gettext(" * TFO (TCP fast open) support included (-F)\n")); ++#endif + fprintf(stderr, gettext("\n")); + } + +@@ -207,7 +209,9 @@ void usage(const char *me) + format_help("-r", "--resolve-once", gettext("resolve hostname only once (useful when pinging roundrobin DNS: also takes the first DNS lookup out of the loop so that the first measurement is also correct)")); + format_help("-W", NULL, gettext("do not abort the program if resolving failed: keep retrying")); + format_help("-y x", "--bind-to", gettext("bind to an ip-address (and thus interface) with an optional port")); ++#ifndef NO_TFO + format_help("-F", "--tcp-fast-open", gettext("\"TCP fast open\" (TFO), reduces the latency of TCP connects")); ++#endif + #ifdef linux + format_help(NULL, "--priority", gettext("set priority of packets")); + #endif +--- main.c.orig ++++ main.c +@@ -1396,7 +1396,11 @@ int main(int argc, char *argv[]) + break; + + case 'F': ++#ifdef NO_TFO ++ fprintf(stderr, gettext("Warning: TCP TFO is not supported. Disabling.\n")); ++#else + use_tfo = 1; ++#endif + break; + + case 22: +@@ -2157,7 +2161,7 @@ int main(int argc, char *argv[]) + #if defined(linux) || defined(__FreeBSD__) + if (getsockopt(fd, IPPROTO_TCP, TCP_INFO, &info, &info_len) == 0) + { +-#ifdef TCPI_OPT_SYN_DATA ++#if defined(TCPI_OPT_SYN_DATA) && !defined(NO_TFO) + if (info.tcpi_options & TCPI_OPT_SYN_DATA) + tfo_success = 1; + #endif +@@ -2345,8 +2349,10 @@ int main(int argc, char *argv[]) + #endif + } + ++#ifndef NO_TFO + if (tfo_success) + str_add(&line, " F"); ++#endif + + #if HAVE_NCURSES + if (ncurses_mode) +--- tcp.c.orig ++++ tcp.c +@@ -159,6 +159,12 @@ int connect_to(int fd, struct addrinfo *ai, double timeout, char *tfo, char *msg + to.tv_usec = (long)(timeout * 1000.0) % 1000000; + + /* connect to peer */ ++#ifdef NO_TFO ++ (void)tfo; ++ (void)msg; ++ (void)msg_len; ++ (void)msg_accepted; ++#else + if (tfo && *tfo) + { + #if defined(__FreeBSD__) +@@ -182,6 +188,7 @@ int connect_to(int fd, struct addrinfo *ai, double timeout, char *tfo, char *msg + } + } + else ++#endif + { + int rc = -1; + diff --git a/net/httping/files/patch-tcp.c.diff b/net/httping/files/patch-tcp.c.diff index dae5b57d87d..64be503c787 100644 --- a/net/httping/files/patch-tcp.c.diff +++ b/net/httping/files/patch-tcp.c.diff @@ -1,20 +1,26 @@ +# Enable TCP Fast Open on macOS +# See: https://github.com/folkertvanheusden/HTTPing/pull/48 + --- tcp.c.orig 2024-05-08 01:54:44 +++ tcp.c 2024-05-10 16:16:28 -@@ -161,14 +161,14 @@ +@@ -161,15 +161,15 @@ /* connect to peer */ if (tfo && *tfo) { -#if defined(__FreeBSD__) -+/* #if defined(__FreeBSD__) */ - int enable = 1; - setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &enable, sizeof(enable)); +- int enable = 1; +- setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &enable, sizeof(enable)); ++#if defined(__FreeBSD__) || defined(__APPLE__) ++ int enable = 1; ++ setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &enable, sizeof(enable)); - rc = sendto(fd, msg, msg_len, 0, ai->ai_addr, ai->ai_addrlen); --#else -+/* #else +- rc = sendto(fd, msg, msg_len, 0, ai->ai_addr, ai->ai_addrlen); ++ rc = sendto(fd, msg, msg_len, 0, ai->ai_addr, ai->ai_addrlen); + #else rc = sendto(fd, msg, msg_len, MSG_FASTOPEN, ai -> ai_addr, ai -> ai_addrlen); --#endif -+#endif */ - + #endif +- ++ if (rc == msg_len) *msg_accepted = 1; + if (errno == 0)