summaryrefslogtreecommitdiff
path: root/packages/net-misc/curl/curl-7.72.0.exheres-0
blob: cd81bc40bc6d941b9539f20de85f0ff76122b6e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Copyright 2008, 2009, 2010, 2011, 2014 Ingmar Vanhassel <ingmar@exherbo.org>
# Based in part upon previous work copyrighted to Gentoo Foundation.
# Distributed under the terms of the GNU General Public License v2

SUMMARY="A Client that groks URLs"
HOMEPAGE="https://${PN}.haxx.se"
DOWNLOADS="${HOMEPAGE}/download/${PNV}.tar.xz"

UPSTREAM_RELEASE_NOTES="${HOMEPAGE}/changes.html"

LICENCES="MIT"
SLOT="0"
PLATFORMS="~amd64 ~arm ~armv7 ~armv8 ~x86"
MYOPTIONS="
    ares [[ description = [ Prefer c-ares posix-threaded DNS resolver over curl's own threaded resolver ] ]]
    brotli [[ description = [ Brotli compression format support ] ]]
    http2
    idn
    kerberos
    ldap
    rtmp
    zsh-completion
    zstd [[ description = [ Zstandard compression format support ] ]]
    kerberos? ( ( providers: heimdal krb5 ) [[ number-selected = exactly-one ]] )
    ( providers: gnutls libressl mbedtls openssl ) [[ number-selected = exactly-one ]]
"

DEPENDENCIES="
    build:
        dev-lang/perl:*
        sys-apps/diffutils
        virtual/pkg-config
    build+run:
        app-misc/ca-certificates
        net-libs/libssh2[>=1.2.8]
        sys-libs/zlib
        ares? ( net-dns/c-ares[>=1.6.0] )
        brotli? ( app-arch/brotli[>=0.6.0] )
        http2? ( net-libs/nghttp2[>=1.12.0] )
        idn? ( net-dns/libidn2:= )
        kerberos? (
            providers:heimdal? ( app-crypt/heimdal )
            providers:krb5? ( app-crypt/krb5 )
        )
        ldap? ( net-directory/openldap )
        rtmp? ( media-video/rtmpdump )
        providers:gnutls? (
            dev-libs/gnutls[>=2.12.14]
            dev-libs/nettle:=
        )
        providers:libressl? ( dev-libs/libressl:= )
        providers:mbedtls? ( dev-libs/mbedtls )
        providers:openssl? ( dev-libs/openssl )
        zstd? ( app-arch/zstd )
    run:
        zsh-completion? ( app-shells/zsh )
"

DEFAULT_SRC_INSTALL_EXTRA_PREFIXES=( docs/ )
DEFAULT_SRC_INSTALL_EXTRA_DOCS=( BINDINGS DISTRO FEATURES INTERNALS MANUAL RESOURCES TheArtOfHttpScripting )

src_prepare() {
    # Reason: Binding to 0.0.0.0 creates access violations under sydbox.
    edo sed -e '/s_addr =/s:INADDR_ANY:htonl(INADDR_LOOPBACK):' -i tests/server/*.c

    # Use `whoami` instead of $USER;
    # sshserver.pl will refuse to run as root (which $USER might claim ever if we're not)
    edo sed -e 's/\$ENV{USER}/`whoami`/' -i tests/*.pl

    default
}

src_configure() {
    econf_params=(
        --enable-cookies
        --enable-crypto-auth
        --enable-dateparse
        --enable-dnsshuffle
        --enable-doh
        --enable-http-auth
        --enable-largefile
        --enable-manual
        --enable-mime
        --enable-netrc
        --enable-progress-meter
        --enable-proxy
        --enable-rt
        --enable-tls-srp
        --enable-pthreads
        --enable-threaded-resolver
        --enable-unix-sockets
        --enable-{dict,file,ftp,gopher,http,ipv6,imap,pop3,rtsp,smb,smtp,telnet,tftp}
        --disable-alt-svc
        --disable-mqtt
        --disable-sspi
        --disable-static
        --disable-werror
        --with-libssh2
        --with-zlib
        --without-amissl
        --without-bearssl
        --without-ca-bundle
        --without-libmetalink
        --without-libpsl
        --without-libssh
        --without-mbedtls
        --without-mesalink
        --without-nghttp3
        --without-ngtcp2
        --without-nss
        --without-quiche
        --without-schannel
        --without-secure-transport
        --without-wolfssl
        --without-default-ssl-backend
        --without-fish-functions-dir
    )

    econf_option_enables=(
        ares
        ldap
        'ldap ldaps'
    )

    econf_option_withs=(
        brotli
        'http2 nghttp2'
        'idn libidn2'
        'kerberos gssapi'
        'rtmp librtmp'
        'zsh-completion zsh-functions-dir /usr/share/zsh/site-functions'
        zstd
    )

    for opt in providers:{gnutls,libressl,mbedtls,openssl};do
        optionq "${opt}" && ssl_provider="${opt##*:}" && break
    done

    case "${ssl_provider}" in
        gnutls)
            econf_params+=(
                --disable-esni
                --with-gnutls --without-mbedtls --without-ssl
                --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
            )
        ;;
        mbedtls)
            econf_params+=(
                --disable-esni
                --with-mbedtls --without-gnutls --without-ssl
                --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
            )
        ;;
        libressl|openssl)
            econf_params+=(
                # https://github.com/openssl/openssl/issues/7482
                --disable-esni
                --enable-openssl-auto-load-config
                --with-ssl --without-mbedtls --without-gnutls
                --with-ca-path=/etc/ssl/certs
            )
        ;;
    esac

    econf \
        "${econf_params[@]}"    \
        $(for opt in "${econf_option_enables[@]}"; do
            option_enable ${opt}
        done) \
        $(for opt in "${econf_option_withs[@]}"; do
            option_with ${opt}
        done)
}

src_test() {
    cat <<-EOF >> tests/data/DISABLED
# Work around broken DNS servers, Exherbo #207
20
507
# Fails with too many open files
537
# Can't open perl script "./manpage-scan.pl": No such file or directory
1139
1140
EOF
    esandbox allow_net --connect "inet:127.0.0.1@9011"
    esandbox allow_net --connect "inet:127.0.0.1@60000"
    esandbox allow_net --connect "inet6:::1@8999"

    # Default TEST_F is -a -p -r; we add -n (no valgrind) -v (verbose) and remove -r (run time statistics)
    local test_args=( -a -p -n -v )
    # SCP/SFTP tests hang/fail
    test_args+=( '!'{582,{600..699}} )
    # Fail (last checked: 7.41.0)
    test_args+=( '!'1135 )
    # Fail (last checked: 7.50.2)
    test_args+=( '!'2032 )
    # Fail (last checked: 7.51.0)
    test_args+=( '!'{165,1034,1035,2046,2047} )
    # Fail (last checked: 7.54.1)
    test_args+=( '!'1446 )
    # Hang/Fail (last checked 7.55.1)
    test_args+=( '!'{1061,1119,1148} )
    # Fail (last checked: 7.56.0)
    test_args+=( '!'1453 )
    # Wants to use 0.0.0.0, last checked 7.60.0
    test_args+=( '!'1455 )
    # Fail (last checked: 7.72.0)
    test_args+=( '!'{320,321,322,324} )

    emake -j1 test-full TEST_F="${test_args[*]}"

    esandbox disallow_net --connect "inet:127.0.0.1@9011"
    esandbox disallow_net --connect "inet:127.0.0.1@60000"
    esandbox disallow_net --connect "inet6:::1@8999"
}

src_install() {
    default

    # curl installs zsh completion file to /_curl if disabled!
    if [[ -f "${IMAGE}"/_curl ]] && ! option zsh-completion;then
        edo rm -f "${IMAGE}"/_curl
    fi

    insinto /usr/share/aclocal
    doins "${WORK}"/docs/libcurl/libcurl.m4
}