meson.build (8087B)
1 project('curl', 'c') 2 3 c_compiler = meson.get_compiler('c') 4 5 add_project_arguments('-DHTTP_ONLY', language : 'c') 6 add_project_arguments('-DCURL_DISABLE_LDAP', language : 'c') 7 add_project_arguments('-DCURL_DISABLE_IMAP', language : 'c') 8 add_project_arguments('-DCURL_DISABLE_SMTP', language : 'c') 9 add_project_arguments('-DCURL_DISABLE_POP3', language : 'c') 10 add_project_arguments('-D_GNU_SOURCE', language : 'c') 11 12 basic_headers = [ 13 'sys/types.h', 14 'sys/time.h', 15 'sys/select.h', 16 'sys/socket.h', 17 'sys/ioctl.h', 18 'sys/uio.h', 19 'assert.h', 20 'unistd.h', 21 'stdlib.h', 22 'arpa/inet.h', 23 'net/if.h', 24 'netinet/in.h', 25 'netinet/in6.h', 26 'sys/un.h', 27 'linux/tcp.h', 28 'netinet/tcp.h', 29 'netinet/udp.h', 30 'netdb.h', 31 'sys/sockio.h', 32 'sys/stat.h', 33 'sys/param.h', 34 'termios.h', 35 'termio.h', 36 'fcntl.h', 37 'io.h', 38 'pwd.h', 39 'utime.h', 40 'sys/utime.h', 41 'sys/poll.h', 42 'poll.h', 43 'socket.h', 44 'sys/resource.h', 45 'libgen.h', 46 'locale.h', 47 'errno.h', 48 'stdbool.h', 49 'arpa/tftp.h', 50 'sys/filio.h', 51 'sys/wait.h', 52 'setjmp.h', 53 ] 54 55 foreach bh : basic_headers 56 if c_compiler.check_header(bh) 57 n = bh.to_upper().underscorify() 58 add_project_arguments(f'-DHAVE_@n@', language : 'c') 59 endif 60 endforeach 61 62 curl_inc = include_directories(['include/']) 63 64 sizeof_curl_off_t = c_compiler.sizeof('curl_off_t', 65 prefix : '#include <curl/system.h>', 66 include_directories : curl_inc) 67 add_project_arguments(f'-DSIZEOF_CURL_OFF_T=@sizeof_curl_off_t@', language : 'c') 68 sizeof_long = c_compiler.sizeof('long') 69 add_project_arguments(f'-DSIZEOF_LONG=@sizeof_long@', language : 'c') 70 sizeof_int = c_compiler.sizeof('int') 71 add_project_arguments(f'-DSIZEOF_INT=@sizeof_int@', language : 'c') 72 sizeof_time_t = c_compiler.sizeof('time_t', prefix : '#include <time.h>') 73 add_project_arguments(f'-DSIZEOF_TIME_T=@sizeof_time_t@', language : 'c') 74 sizeof_off_t = c_compiler.sizeof('off_t') 75 add_project_arguments(f'-DSIZEOF_OFF_T=@sizeof_off_t@', language : 'c') 76 77 add_project_arguments('-DHAVE_BOOL_T', language : 'c') 78 add_project_arguments('-DHAVE_STRUCT_TIMEVAL', language : 'c') 79 add_project_arguments('-DHAVE_RECV', language : 'c') 80 add_project_arguments('-DHAVE_SEND', language : 'c') 81 add_project_arguments('-DHAVE_LONGLONG', language : 'c') 82 83 if c_compiler.has_function('exit') 84 add_project_arguments('-DHAVE_EXIT', language : 'c') 85 endif 86 87 if c_compiler.has_function('gethostbyname') 88 add_project_arguments('-DHAVE_GETHOSTBYNAME', language : 'c') 89 endif 90 91 if c_compiler.has_function('signal') 92 add_project_arguments('-DHAVE_SIGNAL', language : 'c') 93 endif 94 95 if c_compiler.has_function('pipe') 96 add_project_arguments('-DHAVE_PIPE', language : 'c') 97 endif 98 99 if c_compiler.has_function('getpeername') 100 add_project_arguments('-DHAVE_GETPEERNAME', language : 'c') 101 endif 102 103 if c_compiler.has_function('getsockname') 104 add_project_arguments('-DHAVE_GETSOCKNAME', language : 'c') 105 endif 106 107 # FIXME: test for this! 108 add_project_arguments('-DHAVE_FCNTL_O_NONBLOCK', language : 'c') 109 add_project_arguments('-DHAVE_SELECT', language : 'c') 110 add_project_arguments('-DHAVE_SOCKET', language : 'c') 111 os = host_machine.system() 112 add_project_arguments(f'-DCURL_OS="@os@"', language : 'c') 113 114 # SSL config 115 add_project_arguments('-DUSE_MBEDTLS', language : 'c') 116 add_project_arguments('-DCURL_DEFAULT_SSL_BACKEND="mbedtls"', language : 'c') 117 118 # DNS resolver conf 119 add_project_arguments('-DUSE_ARES', language : 'c') 120 121 lib_c_src = [ 122 'lib/altsvc.c', 123 'lib/amigaos.c', 124 'lib/asyn-ares.c', 125 'lib/asyn-base.c', 126 'lib/asyn-thrdd.c', 127 'lib/bufq.c', 128 'lib/bufref.c', 129 'lib/cf-h1-proxy.c', 130 'lib/cf-h2-proxy.c', 131 'lib/cf-haproxy.c', 132 'lib/cf-https-connect.c', 133 'lib/cf-socket.c', 134 'lib/cfilters.c', 135 'lib/conncache.c', 136 'lib/connect.c', 137 'lib/content_encoding.c', 138 'lib/cookie.c', 139 'lib/cshutdn.c', 140 'lib/curl_addrinfo.c', 141 'lib/curl_des.c', 142 'lib/curl_endian.c', 143 'lib/curl_fnmatch.c', 144 'lib/curl_get_line.c', 145 'lib/curl_gethostname.c', 146 'lib/curl_gssapi.c', 147 'lib/curl_memrchr.c', 148 'lib/curl_ntlm_core.c', 149 'lib/curl_range.c', 150 'lib/curl_rtmp.c', 151 'lib/curl_sasl.c', 152 'lib/curl_sha512_256.c', 153 'lib/curl_sspi.c', 154 'lib/curl_threads.c', 155 'lib/curl_trc.c', 156 'lib/cw-out.c', 157 'lib/cw-pause.c', 158 'lib/dict.c', 159 'lib/doh.c', 160 'lib/dynhds.c', 161 'lib/easy.c', 162 'lib/easygetopt.c', 163 'lib/easyoptions.c', 164 'lib/escape.c', 165 'lib/fake_addrinfo.c', 166 'lib/file.c', 167 'lib/fileinfo.c', 168 'lib/fopen.c', 169 'lib/formdata.c', 170 'lib/ftp.c', 171 'lib/ftplistparser.c', 172 'lib/getenv.c', 173 'lib/getinfo.c', 174 'lib/gopher.c', 175 'lib/hash.c', 176 'lib/headers.c', 177 'lib/hmac.c', 178 'lib/hostip.c', 179 'lib/hostip4.c', 180 'lib/hostip6.c', 181 'lib/hsts.c', 182 'lib/http.c', 183 'lib/http1.c', 184 'lib/http2.c', 185 'lib/http_aws_sigv4.c', 186 'lib/http_chunks.c', 187 'lib/http_digest.c', 188 'lib/http_negotiate.c', 189 'lib/http_ntlm.c', 190 'lib/http_proxy.c', 191 'lib/httpsrr.c', 192 'lib/idn.c', 193 'lib/if2ip.c', 194 'lib/imap.c', 195 'lib/krb5.c', 196 'lib/ldap.c', 197 'lib/llist.c', 198 'lib/macos.c', 199 'lib/md4.c', 200 'lib/md5.c', 201 'lib/memdebug.c', 202 'lib/mime.c', 203 'lib/mprintf.c', 204 'lib/mqtt.c', 205 'lib/multi.c', 206 'lib/multi_ev.c', 207 'lib/netrc.c', 208 'lib/noproxy.c', 209 'lib/openldap.c', 210 'lib/parsedate.c', 211 'lib/pingpong.c', 212 'lib/pop3.c', 213 'lib/progress.c', 214 'lib/psl.c', 215 'lib/rand.c', 216 'lib/rename.c', 217 'lib/request.c', 218 'lib/rtsp.c', 219 'lib/select.c', 220 'lib/sendf.c', 221 'lib/setopt.c', 222 'lib/sha256.c', 223 'lib/share.c', 224 'lib/slist.c', 225 'lib/smb.c', 226 'lib/smtp.c', 227 'lib/socketpair.c', 228 'lib/socks.c', 229 'lib/socks_gssapi.c', 230 'lib/socks_sspi.c', 231 'lib/speedcheck.c', 232 'lib/splay.c', 233 'lib/strcase.c', 234 'lib/strdup.c', 235 'lib/strequal.c', 236 'lib/strerror.c', 237 'lib/system_win32.c', 238 'lib/telnet.c', 239 'lib/tftp.c', 240 'lib/transfer.c', 241 'lib/uint-bset.c', 242 'lib/uint-hash.c', 243 'lib/uint-spbset.c', 244 'lib/uint-table.c', 245 'lib/url.c', 246 'lib/urlapi.c', 247 'lib/version.c', 248 'lib/ws.c', 249 ] 250 251 lib_curlx_src = [ 252 'lib/curlx/base64.c', 253 'lib/curlx/dynbuf.c', 254 'lib/curlx/inet_ntop.c', 255 'lib/curlx/inet_pton.c', 256 'lib/curlx/multibyte.c', 257 'lib/curlx/nonblock.c', 258 'lib/curlx/strparse.c', 259 'lib/curlx/timediff.c', 260 'lib/curlx/timeval.c', 261 'lib/curlx/version_win32.c', 262 'lib/curlx/wait.c', 263 'lib/curlx/warnless.c', 264 'lib/curlx/winapi.c', 265 ] 266 267 lib_vtls_src = [ 268 'lib/vtls/cipher_suite.c', 269 'lib/vtls/gtls.c', 270 'lib/vtls/hostcheck.c', 271 'lib/vtls/keylog.c', 272 'lib/vtls/mbedtls.c', 273 'lib/vtls/mbedtls_threadlock.c', 274 'lib/vtls/openssl.c', 275 'lib/vtls/rustls.c', 276 'lib/vtls/schannel.c', 277 'lib/vtls/schannel_verify.c', 278 'lib/vtls/vtls.c', 279 'lib/vtls/vtls_scache.c', 280 'lib/vtls/vtls_spack.c', 281 'lib/vtls/wolfssl.c', 282 'lib/vtls/x509asn1.c', 283 ] 284 285 lib_vauth_src = [ 286 'lib/vauth/cleartext.c', 287 'lib/vauth/cram.c', 288 'lib/vauth/digest.c', 289 'lib/vauth/digest_sspi.c', 290 'lib/vauth/gsasl.c', 291 'lib/vauth/krb5_gssapi.c', 292 'lib/vauth/krb5_sspi.c', 293 'lib/vauth/ntlm.c', 294 'lib/vauth/ntlm_sspi.c', 295 'lib/vauth/oauth2.c', 296 'lib/vauth/spnego_gssapi.c', 297 'lib/vauth/spnego_sspi.c', 298 'lib/vauth/vauth.c', 299 ] 300 301 lib_vquic_src = [ 302 'lib/vquic/curl_msh3.c', 303 'lib/vquic/curl_ngtcp2.c', 304 'lib/vquic/curl_osslq.c', 305 'lib/vquic/curl_quiche.c', 306 'lib/vquic/vquic.c', 307 'lib/vquic/vquic-tls.c', 308 ] 309 310 lib_vssh_src = [ 311 'lib/vssh/libssh.c', 312 'lib/vssh/libssh2.c', 313 'lib/vssh/curl_path.c', 314 'lib/vssh/wolfssh.c', 315 ] 316 317 mbedtls_proj = subproject('mbedtls', required : true) 318 #mbedcrypto_dep = cc.find_library('mbedcrypto', required : true) 319 mbedcrypto_dep = mbedtls_proj.get_variable('mbedcrypto_dep') 320 mbedtls_dep = mbedtls_proj.get_variable('mbedtls_dep') 321 mbedx509_dep = mbedtls_proj.get_variable('mbedx509_dep') 322 323 cmake = import('cmake') 324 325 cares_proj = cmake.subproject('c-ares', required : true) 326 cares_dep = cares_proj.dependency('c-ares') 327 328 libcurl = static_library('curl', [lib_c_src, lib_curlx_src, lib_vtls_src, lib_vauth_src, lib_vquic_src, lib_vssh_src], 329 include_directories : ['include', 'lib'], 330 c_args : ['-DBUILDING_LIBCURL'], 331 dependencies : [mbedtls_dep, mbedcrypto_dep, mbedx509_dep, cares_dep]) 332 333 curl_dep = declare_dependency( 334 include_directories : ['include/'], 335 link_with : [libcurl], 336 )