Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 37 additions & 21 deletions net/picotls/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ PortGroup cmake 1.1
PortGroup github 1.0
PortGroup legacysupport 1.1
PortGroup openssl 1.0
PortGroup perl5 1.0

# Need O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 10

github.setup h2o picotls 703553c94048ba22987e8529590f4c060c0407f8
version 2024.03.05
github.setup h2o picotls 4e443c11eb48949e597911b1b772a9d2588b4769
version 2025.09.12
revision 0
categories net security
license MIT
Expand All @@ -20,21 +21,26 @@ long_description {*}${description}. &{name} is designed to be fast, tiny and
with the primary user being the H2O HTTP/2 server for serving \
HTTP/1, HTTP/2 and HTTP/3 over QUIC.

set with_fusion OFF
if {${configure.build_arch} in [list i386 x86_64]} {
set with_fusion ON
}

github.tarball_from archive

set picotest_hash 6906d90b39684b8b2c18db5b0c7412128140655d
set picotest_hash a99858e0c33b97b24cd09ceae729f2be33ec01e1

master_sites-append https://github.com/h2o/picotest/archive/${picotest_hash}/:picotest
distfiles-append picotest-${picotest_hash}.tar.gz:picotest

checksums ${distname}${extract.suffix} \
rmd160 a0461de42f2e24063ce2ab3719782860ad0ec2eb \
sha256 01debc1ebd6dabe301cdf82d7f0d8bf7107f915d3ab48ee26d82f288c66d9d8b \
size 641429 \
rmd160 b9c4f9603c5fceb839b841fa5c6e2f81f9739ac9 \
sha256 b9e0c88d03ec93de9b7395f7796e5294e45b92bcc516db441d574bf1abaa839c \
size 655335 \
picotest-${picotest_hash}.tar.gz \
rmd160 934cb89c1683095b5950ece003c5a307c773b058 \
sha256 a297cfd0db85186813622ebffcd8d86d73cd0e590f5fb7fe82ec7d40c88d3677 \
size 1748
rmd160 d0305fe488de16cd68e2919643f4fc9cf60c9025 \
sha256 f3c42d988c8cd1af24dee2e66ce832f3e257bb7766e34167499954c1604c82c0 \
size 1828

extract.only ${distname}${extract.suffix}

Expand All @@ -45,29 +51,39 @@ post-extract {
move ${workpath}/picotest-${picotest_hash} ${worksrcpath}/deps/picotest
}

depends_lib-append port:brotli \
port:mbedtls3
perl5.branches 5.34

depends_lib-append port:brotli

depends_test-append port:p${perl5.major}-scope-guard \
port:p${perl5.major}-test-tcp

patchfiles-append patch-aligned_alloc.diff

# MbedTLS is still WIP as previous PRs have been abandoned
configure.args-append \
-DWITH_AEGIS=OFF \
-DWITH_DTRACE=OFF \
-DWITH_MBEDTLS=ON
-DWITH_FUSION=${with_fusion} \
-DWITH_MBEDTLS=OFF

# https://github.com/h2o/picotls/issues/505
# See net/nss/Portfile for architecture-specific compiler problems
compiler.blacklist-append \
*gcc-4.* {clang < 500}

# FIXME: fails to build with clang on 10.6–10.7:
# error: call to undeclared library function 'aligned_alloc'
# https://github.com/h2o/picotls/issues/514
{*gcc-[34].*} {clang < 800}

destroot {
move ${cmake.build_dir}/cli ${destroot}${prefix}/bin/picotls_cli
copy ${worksrcpath}/include/picotls ${destroot}${prefix}/include
copy ${worksrcpath}/include/picotls.h ${destroot}${prefix}/include
foreach lib {libpicotls-core.a libpicotls-mbedtls.a libpicotls-minicrypto.a libpicotls-openssl.a} {
foreach lib {libpicotls-core.a libpicotls-minicrypto.a libpicotls-openssl.a} {
copy ${cmake.build_dir}/${lib} ${destroot}${prefix}/lib
}
if {${with_fusion} eq "ON"} {
copy ${cmake.build_dir}/libpicotls-fusion.a ${destroot}${prefix}/lib
} else {
delete ${worksrcpath}/include/picotls/fusion.h
}
delete ${worksrcpath}/include/picotls/mbedtls.h
copy ${worksrcpath}/include/picotls ${destroot}${prefix}/include
copy ${worksrcpath}/include/picotls.h ${destroot}${prefix}/include
}

test.run yes
Expand Down
10 changes: 10 additions & 0 deletions net/picotls/files/patch-aligned_alloc.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- lib/fusion.c.orig 2025-09-18 12:51:36.000000000 +0200
+++ lib/fusion.c 2025-09-18 12:51:10.000000000 +0200
@@ -64,6 +64,7 @@
#define aligned_alloc(a, s) _aligned_malloc((s), (a))
#define aligned_free(p) _aligned_free(p)
#else
+#define aligned_alloc(a, s) ({void *res; posix_memalign(&res, a, s) == 0 ? res : NULL;})
#define aligned_free(p) free(p)
#endif