Ticket #70446: Portfile.quictls3.3.1

File Portfile.quictls3.3.1, 7.3 KB (added by artkiver (グレェ), 2 months ago)

a preliminary WIP Portfile for QuicTLS (a fork from OpenSSL that is apparently "enabling" QUIC, even though AFAIK, OpenSSL, LibreSSL et al already do that)

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2
3PortSystem          1.0
4PortGroup           compiler_blacklist_versions 1.0
5PortGroup           muniversal 1.0
6PortGroup           legacysupport 1.1
7PortGroup           github 1.0
8
9# Availability.h
10legacysupport.newest_darwin_requires_legacy 8
11
12set major_v         3
13# For former rollback to 3.1.x release where needed. Must now stay.
14epoch               1
15version             ${major_v}.3.1
16revision            0
17
18github.setup        quictls openssl ${version} 
19github.master_sites {https://github.com/quictls/openssl/archive/refs/tags/}
20
21# Please revbump these ports when updating the openssl3 version/revision
22#  - freeradius (#43461)
23#  - openssh (#54990)
24#  - p5-net-ssleay (#67321, for minor version bumps)
25#  - openssl (to rebuild the shim links).
26
27categories          devel security
28license             Apache-2
29maintainers         {larryv @larryv} {cal @neverpanic} openmaintainer
30
31description         QUICTLS SSL/TLS cryptography library
32long_description    This is a fork of OpenSSL to enable QUIC.
33
34depends_lib         port:zlib
35
36distname            openssl-${version}
37
38
39checksums           rmd160  225ffc5ac15fc718aa5a437e3953c98ebb907c02 \
40                    sha256  133bf39b8d1635ac94a8483042cc448251b770a0d12c7af0c05ea895ddd98f1d \
41                    size    18236011
42
43# Old obsolete subport for overriding version holdback
44# Make it explicitly obsolete for now
45#
46if {${os.platform} eq "darwin" && ${os.major} < 18} {
47
48    subport ${name}-devel {
49        PortGroup           obsolete 1.0
50
51        replaced_by         ${name}
52    }
53}
54
55# Use timegm() in crypto/asn1/a_time.c
56# Fixes build on 10.4, and is generally preferable, anyway
57#
58# Since v3.2.0, crypto/asin1/a_time.c has included timezone compensation
59# which uses timegm() in some cases, or localtime() adjusted for the
60# timezone in others.  Since timegm() is considered nonstandard, it uses
61# it in an opt-in basis, which currently includes only FreeBSD and
62# WebAssembly.  On the Mac (at least) the 'timezone' variable which it
63# otherwise relies on is a variable when __DARWIN_UNIX03 is set, and is
64# a function when not, which is incompatible with this use.  By
65# default, __DARWIN_UNIX03 is set on 10.5+ but not on 10.4, leading to a
66# build failure on 10.4.  Meanwhile, timegm() is available on all Mac
67# versions, and is preferable when available.  This fix adds __APPLE__ to
68# the conditions for using timegm(), thereby building successfully on all
69# OS versions with slightly less code.
70#
71patchfiles-append   patch-use-timegm.diff
72
73if {${os.platform} eq "darwin" && ${os.major} < 11} {
74    # Having the stdlib set to libc++ on 10.6 causes a dependency on a
75    # macports-clang compiler to be added, which would be a dep cycle.
76    configure.cxx_stdlib
77}
78
79set my_name         openssl-${major_v}
80set my_prefix       ${prefix}/libexec/${name}
81
82configure.ccache    no
83configure.perl      /usr/bin/perl
84configure.cmd       ./Configure
85configure.pre_args  --prefix=${my_prefix}
86configure.args      -L${prefix}/lib \
87                    --openssldir=${my_prefix}/etc/openssl \
88                    shared \
89                    zlib
90
91# Use SDK if necessary.
92if {${configure.sdkroot} ne ""} {
93    configure.args-append   '-isysroot ${configure.sdkroot}' \
94                            -Wl,-syslibroot,${configure.sdkroot}
95}
96
97set merger_arch_compiler no
98array set merger_configure_args {
99    ppc     darwin-ppc-cc
100    i386    darwin-i386-cc
101    ppc64   darwin64-ppc-cc
102    x86_64  darwin64-x86_64-cc
103    arm64   darwin64-arm64-cc
104}
105platform darwin {
106    # Don't use i386 assembly on Tiger (#38015, #43303).
107    if {${os.major} <= 8} {
108        append merger_configure_args(i386) { no-asm}
109        # https://trac.macports.org/ticket/58992
110        configure.args-append no-async
111    }
112    # Don't use x86-64 assembly on Tiger or Leopard.
113    if {${os.major} <= 9} {
114        append merger_configure_args(x86_64) { no-asm}
115        # OpenSSL requires Perl 5.10.0, while Leopard ships Perl 5.8.8
116        depends_build-append    port:perl5
117        configure.perl          ${prefix}/bin/perl5
118    }
119}
120# Don't pass --host to configure.
121array set merger_host {ppc {} i386 {} ppc64 {} x86_64 {} arm64 {}}
122
123if {(!${universal_possible} || ![variant_isset universal])
124        && [info exists merger_configure_args(${configure.build_arch})]} {
125    configure.args-append $merger_configure_args(${configure.build_arch})
126}
127configure.universal_args-delete --disable-dependency-tracking
128
129# https://github.com/openssl/openssl/issues/16551
130# Fixes "Undefined symbols for architecture i386: ___atomic_is_lock_free"
131if {(${configure.build_arch} eq "i386") || (${universal_possible} && [variant_isset universal] && "i386" in ${configure.universal_archs})} {
132    configure.args-append   -DBROKEN_CLANG_ATOMICS
133}
134
135test.run            yes
136test.target-append  HARNESS_JOBS=${build.jobs}
137
138pre-destroot {
139    if {[variant_exists universal] && [variant_isset universal]} {
140        global merger_dont_diff
141        if {[llength ${universal_archs_to_use}] > 2} {
142            lappend merger_dont_diff ${my_prefix}/include/openssl/configuration.h
143            # Previous version/revisions got this wrong, but this situation
144            # is too obscure to justify revbumping the dependents.
145            notes-append "Universal dependents may need to be rebuilt."
146        }
147    }
148}
149
150post-destroot {
151    # Create some links to main prefix
152    xinstall -d ${destroot}${prefix}/include/${my_name}
153    xinstall -d ${destroot}${prefix}/lib/${my_name}
154    ln -s ${my_prefix}/include/openssl ${destroot}/${prefix}/include/${my_name}/
155    foreach l [glob -tails -directory ${destroot}${my_prefix}/lib *] {
156        ln -s ${my_prefix}/lib/${l} ${destroot}/${prefix}/lib/${my_name}/${l}
157    }
158    foreach b [glob -tails -directory ${destroot}${my_prefix}/bin *] {
159        ln -s ${my_prefix}/bin/${b} ${destroot}/${prefix}/bin/${b}-${major_v}
160    }
161    # shared/man dir seems to still end up in ${prefix} and not libexec...
162    move ${destroot}${prefix}/share/man ${destroot}/${my_prefix}/share/
163    # Create link to certs from curl-ca-bundle in install prefix
164    ln -s ${prefix}/share/curl/curl-ca-bundle.crt ${destroot}${my_prefix}/etc/openssl/cert.pem
165}
166
167destroot.args       MANDIR=${prefix}/share/man MANSUFFIX=ssl
168
169variant rfc3779 description {enable RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers} {
170    configure.args-append   enable-rfc3779
171}
172
173variant fips description {enable FIPS} {
174    configure.args-append   enable-fips
175}
176
177variant legacy description {enable legacy providers by default} {
178    # See https://trac.macports.org/ticket/63857 for context
179    post-destroot {
180        set     cnf [open ${destroot}${my_prefix}/etc/openssl/openssl.cnf a]
181        puts  ${cnf} ""
182        puts  ${cnf} "# MacPorts additions to enable legacy providers by default"
183        puts  ${cnf} "\[openssl_init\]"
184        puts  ${cnf} "providers = provider_sect"
185        puts  ${cnf} "\[provider_sect\]"
186        puts  ${cnf} "default = default_sect"
187        puts  ${cnf} "legacy = legacy_sect"
188        puts  ${cnf} "\[default_sect\]"
189        puts  ${cnf} "activate = 1"
190        puts  ${cnf} "\[legacy_sect\]"
191        puts  ${cnf} "activate = 1"
192        close ${cnf}
193    }
194}
195
196livecheck.type      regex
197livecheck.url       [lindex ${master_sites} 0]
198livecheck.regex     openssl-(${major_v}.\[0-9.\]+\[a-z\]?)\\.tar\\.gz