diff --git a/.gitmodules b/.gitmodules index 5462f8f0..cc314b9b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,3 @@ [submodule "tests/wpt"] path = tests/wpt url = https://github.com/lightpanda-io/wpt -[submodule "vendor/nghttp2"] - path = vendor/nghttp2 - url = https://github.com/nghttp2/nghttp2.git -[submodule "vendor/zlib"] - path = vendor/zlib - url = https://github.com/madler/zlib.git -[submodule "vendor/curl"] - path = vendor/curl - url = https://github.com/curl/curl.git -[submodule "vendor/brotli"] - path = vendor/brotli - url = https://github.com/google/brotli diff --git a/build.zig b/build.zig index bcf34bee..394a1ffe 100644 --- a/build.zig +++ b/build.zig @@ -192,8 +192,6 @@ fn addDependencies( .v8_enable_sandbox = is_tsan, }; - mod.addIncludePath(b.path("vendor/lightpanda")); - { // html5ever @@ -244,196 +242,9 @@ fn addDependencies( { //curl - { - const is_linux = target.result.os.tag == .linux; - if (is_linux) { - mod.addCMacro("HAVE_LINUX_TCP_H", "1"); - mod.addCMacro("HAVE_MSG_NOSIGNAL", "1"); - mod.addCMacro("HAVE_GETHOSTBYNAME_R", "1"); - } - mod.addCMacro("_FILE_OFFSET_BITS", "64"); - mod.addCMacro("BUILDING_LIBCURL", "1"); - mod.addCMacro("CURL_DISABLE_AWS", "1"); - mod.addCMacro("CURL_DISABLE_DICT", "1"); - mod.addCMacro("CURL_DISABLE_DOH", "1"); - mod.addCMacro("CURL_DISABLE_FILE", "1"); - mod.addCMacro("CURL_DISABLE_FTP", "1"); - mod.addCMacro("CURL_DISABLE_GOPHER", "1"); - mod.addCMacro("CURL_DISABLE_KERBEROS", "1"); - mod.addCMacro("CURL_DISABLE_IMAP", "1"); - mod.addCMacro("CURL_DISABLE_IPFS", "1"); - mod.addCMacro("CURL_DISABLE_LDAP", "1"); - mod.addCMacro("CURL_DISABLE_LDAPS", "1"); - mod.addCMacro("CURL_DISABLE_MQTT", "1"); - mod.addCMacro("CURL_DISABLE_NTLM", "1"); - mod.addCMacro("CURL_DISABLE_PROGRESS_METER", "1"); - mod.addCMacro("CURL_DISABLE_POP3", "1"); - mod.addCMacro("CURL_DISABLE_RTSP", "1"); - mod.addCMacro("CURL_DISABLE_SMB", "1"); - mod.addCMacro("CURL_DISABLE_SMTP", "1"); - mod.addCMacro("CURL_DISABLE_TELNET", "1"); - mod.addCMacro("CURL_DISABLE_TFTP", "1"); - mod.addCMacro("CURL_EXTERN_SYMBOL", "__attribute__ ((__visibility__ (\"default\"))"); - mod.addCMacro("CURL_OS", if (is_linux) "\"Linux\"" else "\"mac\""); - mod.addCMacro("CURL_STATICLIB", "1"); - mod.addCMacro("ENABLE_IPV6", "1"); - mod.addCMacro("HAVE_ALARM", "1"); - mod.addCMacro("HAVE_ALLOCA_H", "1"); - mod.addCMacro("HAVE_ARPA_INET_H", "1"); - mod.addCMacro("HAVE_ARPA_TFTP_H", "1"); - mod.addCMacro("HAVE_ASSERT_H", "1"); - mod.addCMacro("HAVE_BASENAME", "1"); - mod.addCMacro("HAVE_BOOL_T", "1"); - mod.addCMacro("HAVE_BROTLI", "1"); - mod.addCMacro("HAVE_BUILTIN_AVAILABLE", "1"); - mod.addCMacro("HAVE_CLOCK_GETTIME_MONOTONIC", "1"); - mod.addCMacro("HAVE_DLFCN_H", "1"); - mod.addCMacro("HAVE_ERRNO_H", "1"); - mod.addCMacro("HAVE_FCNTL", "1"); - mod.addCMacro("HAVE_FCNTL_H", "1"); - mod.addCMacro("HAVE_FCNTL_O_NONBLOCK", "1"); - mod.addCMacro("HAVE_FREEADDRINFO", "1"); - mod.addCMacro("HAVE_FSETXATTR", "1"); - mod.addCMacro("HAVE_FSETXATTR_5", "1"); - mod.addCMacro("HAVE_FTRUNCATE", "1"); - mod.addCMacro("HAVE_GETADDRINFO", "1"); - mod.addCMacro("HAVE_GETEUID", "1"); - mod.addCMacro("HAVE_GETHOSTBYNAME", "1"); - mod.addCMacro("HAVE_GETHOSTBYNAME_R_6", "1"); - mod.addCMacro("HAVE_GETHOSTNAME", "1"); - mod.addCMacro("HAVE_GETPEERNAME", "1"); - mod.addCMacro("HAVE_GETPPID", "1"); - mod.addCMacro("HAVE_GETPPID", "1"); - mod.addCMacro("HAVE_GETPROTOBYNAME", "1"); - mod.addCMacro("HAVE_GETPWUID", "1"); - mod.addCMacro("HAVE_GETPWUID_R", "1"); - mod.addCMacro("HAVE_GETRLIMIT", "1"); - mod.addCMacro("HAVE_GETSOCKNAME", "1"); - mod.addCMacro("HAVE_GETTIMEOFDAY", "1"); - mod.addCMacro("HAVE_GMTIME_R", "1"); - mod.addCMacro("HAVE_IDN2_H", "1"); - mod.addCMacro("HAVE_IF_NAMETOINDEX", "1"); - mod.addCMacro("HAVE_IFADDRS_H", "1"); - mod.addCMacro("HAVE_INET_ADDR", "1"); - mod.addCMacro("HAVE_INET_PTON", "1"); - mod.addCMacro("HAVE_INTTYPES_H", "1"); - mod.addCMacro("HAVE_IOCTL", "1"); - mod.addCMacro("HAVE_IOCTL_FIONBIO", "1"); - mod.addCMacro("HAVE_IOCTL_SIOCGIFADDR", "1"); - mod.addCMacro("HAVE_LDAP_URL_PARSE", "1"); - mod.addCMacro("HAVE_LIBGEN_H", "1"); - mod.addCMacro("HAVE_LIBZ", "1"); - mod.addCMacro("HAVE_LL", "1"); - mod.addCMacro("HAVE_LOCALE_H", "1"); - mod.addCMacro("HAVE_LOCALTIME_R", "1"); - mod.addCMacro("HAVE_LONGLONG", "1"); - mod.addCMacro("HAVE_MALLOC_H", "1"); - mod.addCMacro("HAVE_MEMORY_H", "1"); - mod.addCMacro("HAVE_NET_IF_H", "1"); - mod.addCMacro("HAVE_NETDB_H", "1"); - mod.addCMacro("HAVE_NETINET_IN_H", "1"); - mod.addCMacro("HAVE_NETINET_TCP_H", "1"); - mod.addCMacro("HAVE_PIPE", "1"); - mod.addCMacro("HAVE_POLL", "1"); - mod.addCMacro("HAVE_POLL_FINE", "1"); - mod.addCMacro("HAVE_POLL_H", "1"); - mod.addCMacro("HAVE_POSIX_STRERROR_R", "1"); - mod.addCMacro("HAVE_PTHREAD_H", "1"); - mod.addCMacro("HAVE_PWD_H", "1"); - mod.addCMacro("HAVE_RECV", "1"); - mod.addCMacro("HAVE_SA_FAMILY_T", "1"); - mod.addCMacro("HAVE_SELECT", "1"); - mod.addCMacro("HAVE_SEND", "1"); - mod.addCMacro("HAVE_SETJMP_H", "1"); - mod.addCMacro("HAVE_SETLOCALE", "1"); - mod.addCMacro("HAVE_SETRLIMIT", "1"); - mod.addCMacro("HAVE_SETSOCKOPT", "1"); - mod.addCMacro("HAVE_SIGACTION", "1"); - mod.addCMacro("HAVE_SIGINTERRUPT", "1"); - mod.addCMacro("HAVE_SIGNAL", "1"); - mod.addCMacro("HAVE_SIGNAL_H", "1"); - mod.addCMacro("HAVE_SIGSETJMP", "1"); - mod.addCMacro("HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID", "1"); - mod.addCMacro("HAVE_SOCKET", "1"); - mod.addCMacro("HAVE_STDBOOL_H", "1"); - mod.addCMacro("HAVE_STDINT_H", "1"); - mod.addCMacro("HAVE_STDIO_H", "1"); - mod.addCMacro("HAVE_STDLIB_H", "1"); - mod.addCMacro("HAVE_STRCASECMP", "1"); - mod.addCMacro("HAVE_STRDUP", "1"); - mod.addCMacro("HAVE_STRERROR_R", "1"); - mod.addCMacro("HAVE_STRING_H", "1"); - mod.addCMacro("HAVE_STRINGS_H", "1"); - mod.addCMacro("HAVE_STRSTR", "1"); - mod.addCMacro("HAVE_STRTOK_R", "1"); - mod.addCMacro("HAVE_STRTOLL", "1"); - mod.addCMacro("HAVE_STRUCT_SOCKADDR_STORAGE", "1"); - mod.addCMacro("HAVE_STRUCT_TIMEVAL", "1"); - mod.addCMacro("HAVE_SYS_IOCTL_H", "1"); - mod.addCMacro("HAVE_SYS_PARAM_H", "1"); - mod.addCMacro("HAVE_SYS_POLL_H", "1"); - mod.addCMacro("HAVE_SYS_RESOURCE_H", "1"); - mod.addCMacro("HAVE_SYS_SELECT_H", "1"); - mod.addCMacro("HAVE_SYS_SOCKET_H", "1"); - mod.addCMacro("HAVE_SYS_STAT_H", "1"); - mod.addCMacro("HAVE_SYS_TIME_H", "1"); - mod.addCMacro("HAVE_SYS_TYPES_H", "1"); - mod.addCMacro("HAVE_SYS_UIO_H", "1"); - mod.addCMacro("HAVE_SYS_UN_H", "1"); - mod.addCMacro("HAVE_TERMIO_H", "1"); - mod.addCMacro("HAVE_TERMIOS_H", "1"); - mod.addCMacro("HAVE_TIME_H", "1"); - mod.addCMacro("HAVE_UNAME", "1"); - mod.addCMacro("HAVE_UNISTD_H", "1"); - mod.addCMacro("HAVE_UTIME", "1"); - mod.addCMacro("HAVE_UTIME_H", "1"); - mod.addCMacro("HAVE_UTIMES", "1"); - mod.addCMacro("HAVE_VARIADIC_MACROS_C99", "1"); - mod.addCMacro("HAVE_VARIADIC_MACROS_GCC", "1"); - mod.addCMacro("HAVE_ZLIB_H", "1"); - mod.addCMacro("RANDOM_FILE", "\"/dev/urandom\""); - mod.addCMacro("RECV_TYPE_ARG1", "int"); - mod.addCMacro("RECV_TYPE_ARG2", "void *"); - mod.addCMacro("RECV_TYPE_ARG3", "size_t"); - mod.addCMacro("RECV_TYPE_ARG4", "int"); - mod.addCMacro("RECV_TYPE_RETV", "ssize_t"); - mod.addCMacro("SEND_QUAL_ARG2", "const"); - mod.addCMacro("SEND_TYPE_ARG1", "int"); - mod.addCMacro("SEND_TYPE_ARG2", "void *"); - mod.addCMacro("SEND_TYPE_ARG3", "size_t"); - mod.addCMacro("SEND_TYPE_ARG4", "int"); - mod.addCMacro("SEND_TYPE_RETV", "ssize_t"); - mod.addCMacro("SIZEOF_CURL_OFF_T", "8"); - mod.addCMacro("SIZEOF_INT", "4"); - mod.addCMacro("SIZEOF_LONG", "8"); - mod.addCMacro("SIZEOF_OFF_T", "8"); - mod.addCMacro("SIZEOF_SHORT", "2"); - mod.addCMacro("SIZEOF_SIZE_T", "8"); - mod.addCMacro("SIZEOF_TIME_T", "8"); - mod.addCMacro("STDC_HEADERS", "1"); - mod.addCMacro("TIME_WITH_SYS_TIME", "1"); - mod.addCMacro("USE_NGHTTP2", "1"); - mod.addCMacro("USE_OPENSSL", "1"); - mod.addCMacro("OPENSSL_IS_BORINGSSL", "1"); - mod.addCMacro("USE_THREADS_POSIX", "1"); - mod.addCMacro("USE_UNIX_SOCKETS", "1"); - } - try buildZlib(b, mod); try buildBrotli(b, mod); - const boringssl_dep = b.dependency("boringssl-zig", .{ - .target = target, - .optimize = mod.optimize.?, - .force_pic = true, - }); - - const ssl = boringssl_dep.artifact("ssl"); - ssl.bundle_ubsan_rt = false; - const crypto = boringssl_dep.artifact("crypto"); - crypto.bundle_ubsan_rt = false; - - mod.linkLibrary(ssl); - mod.linkLibrary(crypto); + try buildBoringSsl(b, mod); try buildNghttp2(b, mod); try buildCurl(b, mod); @@ -450,280 +261,362 @@ fn addDependencies( } fn buildZlib(b: *Build, m: *Build.Module) !void { - const zlib = b.addLibrary(.{ - .name = "zlib", - .root_module = m, - }); + const dep = b.dependency("zlib", .{}); - const root = "vendor/zlib/"; - zlib.installHeader(b.path(root ++ "zlib.h"), "zlib.h"); - zlib.installHeader(b.path(root ++ "zconf.h"), "zconf.h"); - zlib.addCSourceFiles(.{ .flags = &.{ - "-DHAVE_SYS_TYPES_H", - "-DHAVE_STDINT_H", - "-DHAVE_STDDEF_H", - }, .files = &.{ - root ++ "adler32.c", - root ++ "compress.c", - root ++ "crc32.c", - root ++ "deflate.c", - root ++ "gzclose.c", - root ++ "gzlib.c", - root ++ "gzread.c", - root ++ "gzwrite.c", - root ++ "inflate.c", - root ++ "infback.c", - root ++ "inftrees.c", - root ++ "inffast.c", - root ++ "trees.c", - root ++ "uncompr.c", - root ++ "zutil.c", - } }); + const lib = b.addLibrary(.{ .name = "z", .root_module = m }); + + lib.installHeadersDirectory(dep.path(""), "", .{}); + lib.addCSourceFiles(.{ + .root = dep.path(""), + .flags = &.{ + "-DHAVE_SYS_TYPES_H", + "-DHAVE_STDINT_H", + "-DHAVE_STDDEF_H", + }, + .files = &.{ + "adler32.c", "compress.c", "crc32.c", + "deflate.c", "gzclose.c", "gzlib.c", + "gzread.c", "gzwrite.c", "infback.c", + "inffast.c", "inflate.c", "inftrees.c", + "trees.c", "uncompr.c", "zutil.c", + }, + }); } fn buildBrotli(b: *Build, m: *Build.Module) !void { - const brotli = b.addLibrary(.{ - .name = "brotli", - .root_module = m, + const dep = b.dependency("brotli", .{}); + + const brotlicmn = b.addLibrary(.{ .name = "brotlicommon", .root_module = m }); + const brotlidec = b.addLibrary(.{ .name = "brotlidec", .root_module = m }); + const brotlienc = b.addLibrary(.{ .name = "brotlienc", .root_module = m }); + + brotlicmn.addIncludePath(dep.path("c/include")); + + brotlicmn.addIncludePath(dep.path("c/include")); + brotlidec.addIncludePath(dep.path("c/include")); + brotlienc.addIncludePath(dep.path("c/include")); + + brotlicmn.addCSourceFiles(.{ + .root = dep.path("c/common"), + .files = &.{ + "transform.c", "shared_dictionary.c", "platform.c", + "dictionary.c", "context.c", "constants.c", + }, + }); + brotlidec.addCSourceFiles(.{ + .root = dep.path("c/dec"), + .files = &.{ + "bit_reader.c", "decode.c", "huffman.c", + "prefix.c", "state.c", "static_init.c", + }, + }); + brotlienc.addCSourceFiles(.{ + .root = dep.path("c/enc"), + .files = &.{ + "backward_references.c", "backward_references_hq.c", "bit_cost.c", + "block_splitter.c", "brotli_bit_stream.c", "cluster.c", + "command.c", "compound_dictionary.c", "compress_fragment.c", + "compress_fragment_two_pass.c", "dictionary_hash.c", "encode.c", + "encoder_dict.c", "entropy_encode.c", "fast_log.c", + "histogram.c", "literal_cost.c", "memory.c", + "metablock.c", "static_dict.c", "static_dict_lut.c", + "static_init.c", "utf8_util.c", + }, + }); +} + +fn buildBoringSsl(b: *Build, m: *Build.Module) !void { + const boringssl_dep = b.dependency("boringssl-zig", .{ + .force_pic = true, + .optimize = m.optimize.?, }); - const root = "vendor/brotli/c/"; - brotli.addIncludePath(b.path(root ++ "include")); - brotli.addCSourceFiles(.{ .flags = &.{}, .files = &.{ - root ++ "common/constants.c", - root ++ "common/context.c", - root ++ "common/dictionary.c", - root ++ "common/platform.c", - root ++ "common/shared_dictionary.c", - root ++ "common/transform.c", - root ++ "dec/bit_reader.c", - root ++ "dec/decode.c", - root ++ "dec/huffman.c", - root ++ "dec/prefix.c", - root ++ "dec/state.c", - root ++ "dec/static_init.c", - } }); + const ssl = boringssl_dep.artifact("ssl"); + ssl.bundle_ubsan_rt = false; + + const crypto = boringssl_dep.artifact("crypto"); + crypto.bundle_ubsan_rt = false; + + m.linkLibrary(ssl); + m.linkLibrary(crypto); } fn buildNghttp2(b: *Build, m: *Build.Module) !void { - const nghttp2 = b.addLibrary(.{ - .name = "nghttp2", - .root_module = m, - }); + const dep = b.dependency("nghttp2", .{}); + const lib = b.addLibrary(.{ .name = "nghttp2", .root_module = m }); - const root = "vendor/nghttp2/"; - nghttp2.addIncludePath(b.path(root ++ "lib")); - nghttp2.addIncludePath(b.path(root ++ "lib/includes")); - nghttp2.addCSourceFiles(.{ .flags = &.{ - "-DNGHTTP2_STATICLIB", - "-DHAVE_NETINET_IN", - "-DHAVE_TIME_H", - }, .files = &.{ - root ++ "lib/sfparse.c", - root ++ "lib/nghttp2_alpn.c", - root ++ "lib/nghttp2_buf.c", - root ++ "lib/nghttp2_callbacks.c", - root ++ "lib/nghttp2_debug.c", - root ++ "lib/nghttp2_extpri.c", - root ++ "lib/nghttp2_frame.c", - root ++ "lib/nghttp2_hd.c", - root ++ "lib/nghttp2_hd_huffman.c", - root ++ "lib/nghttp2_hd_huffman_data.c", - root ++ "lib/nghttp2_helper.c", - root ++ "lib/nghttp2_http.c", - root ++ "lib/nghttp2_map.c", - root ++ "lib/nghttp2_mem.c", - root ++ "lib/nghttp2_option.c", - root ++ "lib/nghttp2_outbound_item.c", - root ++ "lib/nghttp2_pq.c", - root ++ "lib/nghttp2_priority_spec.c", - root ++ "lib/nghttp2_queue.c", - root ++ "lib/nghttp2_rcbuf.c", - root ++ "lib/nghttp2_session.c", - root ++ "lib/nghttp2_stream.c", - root ++ "lib/nghttp2_submit.c", - root ++ "lib/nghttp2_version.c", - root ++ "lib/nghttp2_ratelim.c", - root ++ "lib/nghttp2_time.c", - } }); + const config = b.addConfigHeader(.{ + .include_path = "nghttp2ver.h", + .style = .{ .cmake = dep.path("lib/includes/nghttp2/nghttp2ver.h.in") }, + }, .{ + .PACKAGE_VERSION = "1.68.90", + .PACKAGE_VERSION_NUM = 0x016890, + }); + lib.addConfigHeader(config); + + lib.addIncludePath(dep.path("lib/includes")); + lib.addCSourceFiles(.{ + .root = dep.path("lib"), + .flags = &.{ + "-DNGHTTP2_STATICLIB", + "-DHAVE_NETINET_IN", + "-DHAVE_TIME_H", + }, + .files = &.{ + "sfparse.c", "nghttp2_alpn.c", "nghttp2_buf.c", + "nghttp2_callbacks.c", "nghttp2_debug.c", "nghttp2_extpri.c", + "nghttp2_frame.c", "nghttp2_hd.c", "nghttp2_hd_huffman.c", + "nghttp2_hd_huffman_data.c", "nghttp2_helper.c", "nghttp2_http.c", + "nghttp2_map.c", "nghttp2_mem.c", "nghttp2_option.c", + "nghttp2_outbound_item.c", "nghttp2_pq.c", "nghttp2_priority_spec.c", + "nghttp2_queue.c", "nghttp2_rcbuf.c", "nghttp2_session.c", + "nghttp2_stream.c", "nghttp2_submit.c", "nghttp2_version.c", + "nghttp2_ratelim.c", "nghttp2_time.c", + }, + }); } fn buildCurl(b: *Build, m: *Build.Module) !void { - const curl = b.addLibrary(.{ - .name = "curl", - .root_module = m, - }); + const target = m.resolved_target.?; - const root = "vendor/curl/"; + const dep = b.dependency("curl", .{}); + const curl = b.addLibrary(.{ .name = "curl", .root_module = m }); - curl.addIncludePath(b.path(root ++ "lib")); - curl.addIncludePath(b.path(root ++ "include")); - curl.addIncludePath(b.path("vendor/zlib")); + curl.addIncludePath(dep.path("lib")); + curl.addIncludePath(dep.path("include")); + + const is_linux = target.result.os.tag == .linux; + if (is_linux) { + m.addCMacro("HAVE_LINUX_TCP_H", "1"); + m.addCMacro("HAVE_MSG_NOSIGNAL", "1"); + m.addCMacro("HAVE_GETHOSTBYNAME_R", "1"); + } + m.addCMacro("_FILE_OFFSET_BITS", "64"); + m.addCMacro("BUILDING_LIBCURL", "1"); + m.addCMacro("CURL_DISABLE_AWS", "1"); + m.addCMacro("CURL_DISABLE_DICT", "1"); + m.addCMacro("CURL_DISABLE_DOH", "1"); + m.addCMacro("CURL_DISABLE_FILE", "1"); + m.addCMacro("CURL_DISABLE_FTP", "1"); + m.addCMacro("CURL_DISABLE_GOPHER", "1"); + m.addCMacro("CURL_DISABLE_KERBEROS", "1"); + m.addCMacro("CURL_DISABLE_IMAP", "1"); + m.addCMacro("CURL_DISABLE_IPFS", "1"); + m.addCMacro("CURL_DISABLE_LDAP", "1"); + m.addCMacro("CURL_DISABLE_LDAPS", "1"); + m.addCMacro("CURL_DISABLE_MQTT", "1"); + m.addCMacro("CURL_DISABLE_NTLM", "1"); + m.addCMacro("CURL_DISABLE_PROGRESS_METER", "1"); + m.addCMacro("CURL_DISABLE_POP3", "1"); + m.addCMacro("CURL_DISABLE_RTSP", "1"); + m.addCMacro("CURL_DISABLE_SMB", "1"); + m.addCMacro("CURL_DISABLE_SMTP", "1"); + m.addCMacro("CURL_DISABLE_TELNET", "1"); + m.addCMacro("CURL_DISABLE_TFTP", "1"); + m.addCMacro("CURL_EXTERN_SYMBOL", "__attribute__ ((__visibility__ (\"default\"))"); + m.addCMacro("CURL_OS", if (is_linux) "\"Linux\"" else "\"mac\""); + m.addCMacro("CURL_STATICLIB", "1"); + m.addCMacro("ENABLE_IPV6", "1"); + m.addCMacro("HAVE_ALARM", "1"); + m.addCMacro("HAVE_ALLOCA_H", "1"); + m.addCMacro("HAVE_ARPA_INET_H", "1"); + m.addCMacro("HAVE_ARPA_TFTP_H", "1"); + m.addCMacro("HAVE_ASSERT_H", "1"); + m.addCMacro("HAVE_BASENAME", "1"); + m.addCMacro("HAVE_BOOL_T", "1"); + m.addCMacro("HAVE_BROTLI", "1"); + m.addCMacro("HAVE_BUILTIN_AVAILABLE", "1"); + m.addCMacro("HAVE_CLOCK_GETTIME_MONOTONIC", "1"); + m.addCMacro("HAVE_DLFCN_H", "1"); + m.addCMacro("HAVE_ERRNO_H", "1"); + m.addCMacro("HAVE_FCNTL", "1"); + m.addCMacro("HAVE_FCNTL_H", "1"); + m.addCMacro("HAVE_FCNTL_O_NONBLOCK", "1"); + m.addCMacro("HAVE_FREEADDRINFO", "1"); + m.addCMacro("HAVE_FSETXATTR", "1"); + m.addCMacro("HAVE_FSETXATTR_5", "1"); + m.addCMacro("HAVE_FTRUNCATE", "1"); + m.addCMacro("HAVE_GETADDRINFO", "1"); + m.addCMacro("HAVE_GETEUID", "1"); + m.addCMacro("HAVE_GETHOSTBYNAME", "1"); + m.addCMacro("HAVE_GETHOSTBYNAME_R_6", "1"); + m.addCMacro("HAVE_GETHOSTNAME", "1"); + m.addCMacro("HAVE_GETPEERNAME", "1"); + m.addCMacro("HAVE_GETPPID", "1"); + m.addCMacro("HAVE_GETPPID", "1"); + m.addCMacro("HAVE_GETPROTOBYNAME", "1"); + m.addCMacro("HAVE_GETPWUID", "1"); + m.addCMacro("HAVE_GETPWUID_R", "1"); + m.addCMacro("HAVE_GETRLIMIT", "1"); + m.addCMacro("HAVE_GETSOCKNAME", "1"); + m.addCMacro("HAVE_GETTIMEOFDAY", "1"); + m.addCMacro("HAVE_GMTIME_R", "1"); + m.addCMacro("HAVE_IDN2_H", "1"); + m.addCMacro("HAVE_IF_NAMETOINDEX", "1"); + m.addCMacro("HAVE_IFADDRS_H", "1"); + m.addCMacro("HAVE_INET_ADDR", "1"); + m.addCMacro("HAVE_INET_PTON", "1"); + m.addCMacro("HAVE_INTTYPES_H", "1"); + m.addCMacro("HAVE_IOCTL", "1"); + m.addCMacro("HAVE_IOCTL_FIONBIO", "1"); + m.addCMacro("HAVE_IOCTL_SIOCGIFADDR", "1"); + m.addCMacro("HAVE_LDAP_URL_PARSE", "1"); + m.addCMacro("HAVE_LIBGEN_H", "1"); + m.addCMacro("HAVE_LIBZ", "1"); + m.addCMacro("HAVE_LL", "1"); + m.addCMacro("HAVE_LOCALE_H", "1"); + m.addCMacro("HAVE_LOCALTIME_R", "1"); + m.addCMacro("HAVE_LONGLONG", "1"); + m.addCMacro("HAVE_MALLOC_H", "1"); + m.addCMacro("HAVE_MEMORY_H", "1"); + m.addCMacro("HAVE_NET_IF_H", "1"); + m.addCMacro("HAVE_NETDB_H", "1"); + m.addCMacro("HAVE_NETINET_IN_H", "1"); + m.addCMacro("HAVE_NETINET_TCP_H", "1"); + m.addCMacro("HAVE_PIPE", "1"); + m.addCMacro("HAVE_POLL", "1"); + m.addCMacro("HAVE_POLL_FINE", "1"); + m.addCMacro("HAVE_POLL_H", "1"); + m.addCMacro("HAVE_POSIX_STRERROR_R", "1"); + m.addCMacro("HAVE_PTHREAD_H", "1"); + m.addCMacro("HAVE_PWD_H", "1"); + m.addCMacro("HAVE_RECV", "1"); + m.addCMacro("HAVE_SA_FAMILY_T", "1"); + m.addCMacro("HAVE_SELECT", "1"); + m.addCMacro("HAVE_SEND", "1"); + m.addCMacro("HAVE_SETJMP_H", "1"); + m.addCMacro("HAVE_SETLOCALE", "1"); + m.addCMacro("HAVE_SETRLIMIT", "1"); + m.addCMacro("HAVE_SETSOCKOPT", "1"); + m.addCMacro("HAVE_SIGACTION", "1"); + m.addCMacro("HAVE_SIGINTERRUPT", "1"); + m.addCMacro("HAVE_SIGNAL", "1"); + m.addCMacro("HAVE_SIGNAL_H", "1"); + m.addCMacro("HAVE_SIGSETJMP", "1"); + m.addCMacro("HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID", "1"); + m.addCMacro("HAVE_SOCKET", "1"); + m.addCMacro("HAVE_STDBOOL_H", "1"); + m.addCMacro("HAVE_STDINT_H", "1"); + m.addCMacro("HAVE_STDIO_H", "1"); + m.addCMacro("HAVE_STDLIB_H", "1"); + m.addCMacro("HAVE_STRCASECMP", "1"); + m.addCMacro("HAVE_STRDUP", "1"); + m.addCMacro("HAVE_STRERROR_R", "1"); + m.addCMacro("HAVE_STRING_H", "1"); + m.addCMacro("HAVE_STRINGS_H", "1"); + m.addCMacro("HAVE_STRSTR", "1"); + m.addCMacro("HAVE_STRTOK_R", "1"); + m.addCMacro("HAVE_STRTOLL", "1"); + m.addCMacro("HAVE_STRUCT_SOCKADDR_STORAGE", "1"); + m.addCMacro("HAVE_STRUCT_TIMEVAL", "1"); + m.addCMacro("HAVE_SYS_IOCTL_H", "1"); + m.addCMacro("HAVE_SYS_PARAM_H", "1"); + m.addCMacro("HAVE_SYS_POLL_H", "1"); + m.addCMacro("HAVE_SYS_RESOURCE_H", "1"); + m.addCMacro("HAVE_SYS_SELECT_H", "1"); + m.addCMacro("HAVE_SYS_SOCKET_H", "1"); + m.addCMacro("HAVE_SYS_STAT_H", "1"); + m.addCMacro("HAVE_SYS_TIME_H", "1"); + m.addCMacro("HAVE_SYS_TYPES_H", "1"); + m.addCMacro("HAVE_SYS_UIO_H", "1"); + m.addCMacro("HAVE_SYS_UN_H", "1"); + m.addCMacro("HAVE_TERMIO_H", "1"); + m.addCMacro("HAVE_TERMIOS_H", "1"); + m.addCMacro("HAVE_TIME_H", "1"); + m.addCMacro("HAVE_UNAME", "1"); + m.addCMacro("HAVE_UNISTD_H", "1"); + m.addCMacro("HAVE_UTIME", "1"); + m.addCMacro("HAVE_UTIME_H", "1"); + m.addCMacro("HAVE_UTIMES", "1"); + m.addCMacro("HAVE_VARIADIC_MACROS_C99", "1"); + m.addCMacro("HAVE_VARIADIC_MACROS_GCC", "1"); + m.addCMacro("HAVE_ZLIB_H", "1"); + m.addCMacro("RANDOM_FILE", "\"/dev/urandom\""); + m.addCMacro("RECV_TYPE_ARG1", "int"); + m.addCMacro("RECV_TYPE_ARG2", "void *"); + m.addCMacro("RECV_TYPE_ARG3", "size_t"); + m.addCMacro("RECV_TYPE_ARG4", "int"); + m.addCMacro("RECV_TYPE_RETV", "ssize_t"); + m.addCMacro("SEND_QUAL_ARG2", "const"); + m.addCMacro("SEND_TYPE_ARG1", "int"); + m.addCMacro("SEND_TYPE_ARG2", "void *"); + m.addCMacro("SEND_TYPE_ARG3", "size_t"); + m.addCMacro("SEND_TYPE_ARG4", "int"); + m.addCMacro("SEND_TYPE_RETV", "ssize_t"); + m.addCMacro("SIZEOF_CURL_OFF_T", "8"); + m.addCMacro("SIZEOF_INT", "4"); + m.addCMacro("SIZEOF_LONG", "8"); + m.addCMacro("SIZEOF_OFF_T", "8"); + m.addCMacro("SIZEOF_SHORT", "2"); + m.addCMacro("SIZEOF_SIZE_T", "8"); + m.addCMacro("SIZEOF_TIME_T", "8"); + m.addCMacro("STDC_HEADERS", "1"); + m.addCMacro("TIME_WITH_SYS_TIME", "1"); + m.addCMacro("USE_NGHTTP2", "1"); + m.addCMacro("USE_OPENSSL", "1"); + m.addCMacro("OPENSSL_IS_BORINGSSL", "1"); + m.addCMacro("USE_THREADS_POSIX", "1"); + m.addCMacro("USE_UNIX_SOCKETS", "1"); curl.addCSourceFiles(.{ + .root = dep.path("lib"), .flags = &.{}, .files = &.{ - root ++ "lib/altsvc.c", - root ++ "lib/amigaos.c", - root ++ "lib/asyn-ares.c", - root ++ "lib/asyn-base.c", - root ++ "lib/asyn-thrdd.c", - root ++ "lib/bufq.c", - root ++ "lib/bufref.c", - root ++ "lib/cf-h1-proxy.c", - root ++ "lib/cf-h2-proxy.c", - root ++ "lib/cf-haproxy.c", - root ++ "lib/cf-https-connect.c", - root ++ "lib/cf-socket.c", - root ++ "lib/cfilters.c", - root ++ "lib/conncache.c", - root ++ "lib/connect.c", - root ++ "lib/content_encoding.c", - root ++ "lib/cookie.c", - root ++ "lib/cshutdn.c", - root ++ "lib/curl_addrinfo.c", - root ++ "lib/curl_des.c", - root ++ "lib/curl_endian.c", - root ++ "lib/curl_fnmatch.c", - root ++ "lib/curl_get_line.c", - root ++ "lib/curl_gethostname.c", - root ++ "lib/curl_gssapi.c", - root ++ "lib/curl_memrchr.c", - root ++ "lib/curl_ntlm_core.c", - root ++ "lib/curl_range.c", - root ++ "lib/curl_rtmp.c", - root ++ "lib/curl_sasl.c", - root ++ "lib/curl_sha512_256.c", - root ++ "lib/curl_sspi.c", - root ++ "lib/curl_threads.c", - root ++ "lib/curl_trc.c", - root ++ "lib/cw-out.c", - root ++ "lib/cw-pause.c", - root ++ "lib/dict.c", - root ++ "lib/doh.c", - root ++ "lib/dynhds.c", - root ++ "lib/easy.c", - root ++ "lib/easygetopt.c", - root ++ "lib/easyoptions.c", - root ++ "lib/escape.c", - root ++ "lib/fake_addrinfo.c", - root ++ "lib/file.c", - root ++ "lib/fileinfo.c", - root ++ "lib/fopen.c", - root ++ "lib/formdata.c", - root ++ "lib/ftp.c", - root ++ "lib/ftplistparser.c", - root ++ "lib/getenv.c", - root ++ "lib/getinfo.c", - root ++ "lib/gopher.c", - root ++ "lib/hash.c", - root ++ "lib/headers.c", - root ++ "lib/hmac.c", - root ++ "lib/hostip.c", - root ++ "lib/hostip4.c", - root ++ "lib/hostip6.c", - root ++ "lib/hsts.c", - root ++ "lib/http.c", - root ++ "lib/http1.c", - root ++ "lib/http2.c", - root ++ "lib/http_aws_sigv4.c", - root ++ "lib/http_chunks.c", - root ++ "lib/http_digest.c", - root ++ "lib/http_negotiate.c", - root ++ "lib/http_ntlm.c", - root ++ "lib/http_proxy.c", - root ++ "lib/httpsrr.c", - root ++ "lib/idn.c", - root ++ "lib/if2ip.c", - root ++ "lib/imap.c", - root ++ "lib/krb5.c", - root ++ "lib/ldap.c", - root ++ "lib/llist.c", - root ++ "lib/macos.c", - root ++ "lib/md4.c", - root ++ "lib/md5.c", - root ++ "lib/memdebug.c", - root ++ "lib/mime.c", - root ++ "lib/mprintf.c", - root ++ "lib/mqtt.c", - root ++ "lib/multi.c", - root ++ "lib/multi_ev.c", - root ++ "lib/netrc.c", - root ++ "lib/noproxy.c", - root ++ "lib/openldap.c", - root ++ "lib/parsedate.c", - root ++ "lib/pingpong.c", - root ++ "lib/pop3.c", - root ++ "lib/progress.c", - root ++ "lib/psl.c", - root ++ "lib/rand.c", - root ++ "lib/rename.c", - root ++ "lib/request.c", - root ++ "lib/rtsp.c", - root ++ "lib/select.c", - root ++ "lib/sendf.c", - root ++ "lib/setopt.c", - root ++ "lib/sha256.c", - root ++ "lib/share.c", - root ++ "lib/slist.c", - root ++ "lib/smb.c", - root ++ "lib/smtp.c", - root ++ "lib/socketpair.c", - root ++ "lib/socks.c", - root ++ "lib/socks_gssapi.c", - root ++ "lib/socks_sspi.c", - root ++ "lib/speedcheck.c", - root ++ "lib/splay.c", - root ++ "lib/strcase.c", - root ++ "lib/strdup.c", - root ++ "lib/strequal.c", - root ++ "lib/strerror.c", - root ++ "lib/system_win32.c", - root ++ "lib/telnet.c", - root ++ "lib/tftp.c", - root ++ "lib/transfer.c", - root ++ "lib/uint-bset.c", - root ++ "lib/uint-hash.c", - root ++ "lib/uint-spbset.c", - root ++ "lib/uint-table.c", - root ++ "lib/url.c", - root ++ "lib/urlapi.c", - root ++ "lib/version.c", - root ++ "lib/ws.c", - root ++ "lib/curlx/base64.c", - root ++ "lib/curlx/dynbuf.c", - root ++ "lib/curlx/inet_ntop.c", - root ++ "lib/curlx/nonblock.c", - root ++ "lib/curlx/strparse.c", - root ++ "lib/curlx/timediff.c", - root ++ "lib/curlx/timeval.c", - root ++ "lib/curlx/wait.c", - root ++ "lib/curlx/warnless.c", - root ++ "lib/vquic/curl_ngtcp2.c", - root ++ "lib/vquic/curl_osslq.c", - root ++ "lib/vquic/curl_quiche.c", - root ++ "lib/vquic/vquic.c", - root ++ "lib/vquic/vquic-tls.c", - root ++ "lib/vauth/cleartext.c", - root ++ "lib/vauth/cram.c", - root ++ "lib/vauth/digest.c", - root ++ "lib/vauth/digest_sspi.c", - root ++ "lib/vauth/gsasl.c", - root ++ "lib/vauth/krb5_gssapi.c", - root ++ "lib/vauth/krb5_sspi.c", - root ++ "lib/vauth/ntlm.c", - root ++ "lib/vauth/ntlm_sspi.c", - root ++ "lib/vauth/oauth2.c", - root ++ "lib/vauth/spnego_gssapi.c", - root ++ "lib/vauth/spnego_sspi.c", - root ++ "lib/vauth/vauth.c", - root ++ "lib/vtls/cipher_suite.c", - root ++ "lib/vtls/openssl.c", - root ++ "lib/vtls/hostcheck.c", - root ++ "lib/vtls/keylog.c", - root ++ "lib/vtls/vtls.c", - root ++ "lib/vtls/vtls_scache.c", - root ++ "lib/vtls/x509asn1.c", + // You can include all files from lib, libcurl uses an #ifdef-guards to exclude code for disabled functions + "altsvc.c", "amigaos.c", "asyn-ares.c", + "asyn-base.c", "asyn-thrdd.c", "bufq.c", + "bufref.c", "cf-h1-proxy.c", "cf-h2-proxy.c", + "cf-haproxy.c", "cf-https-connect.c", "cf-socket.c", + "cfilters.c", "conncache.c", "connect.c", + "content_encoding.c", "cookie.c", "cshutdn.c", + "curl_addrinfo.c", "curl_des.c", "curl_endian.c", + "curl_fnmatch.c", "curl_get_line.c", "curl_gethostname.c", + "curl_gssapi.c", "curl_memrchr.c", "curl_ntlm_core.c", + "curl_range.c", "curl_rtmp.c", "curl_sasl.c", + "curl_sha512_256.c", "curl_sspi.c", "curl_threads.c", + "curl_trc.c", "curlx/base64.c", "curlx/dynbuf.c", + "curlx/inet_ntop.c", "curlx/nonblock.c", "curlx/strparse.c", + "curlx/timediff.c", "curlx/timeval.c", "curlx/wait.c", + "curlx/warnless.c", "cw-out.c", "cw-pause.c", + "dict.c", "doh.c", "dynhds.c", + "easy.c", "easygetopt.c", "easyoptions.c", + "escape.c", "fake_addrinfo.c", "file.c", + "fileinfo.c", "fopen.c", "formdata.c", + "ftp.c", "ftplistparser.c", "getenv.c", + "getinfo.c", "gopher.c", "hash.c", + "headers.c", "hmac.c", "hostip.c", + "hostip4.c", "hostip6.c", "hsts.c", + "http.c", "http1.c", "http2.c", + "http_aws_sigv4.c", "http_chunks.c", "http_digest.c", + "http_negotiate.c", "http_ntlm.c", "http_proxy.c", + "httpsrr.c", "idn.c", "if2ip.c", + "imap.c", "krb5.c", "ldap.c", + "llist.c", "macos.c", "md4.c", + "md5.c", "memdebug.c", "mime.c", + "mprintf.c", "mqtt.c", "multi.c", + "multi_ev.c", "netrc.c", "noproxy.c", + "openldap.c", "parsedate.c", "pingpong.c", + "pop3.c", "progress.c", "psl.c", + "rand.c", "rename.c", "request.c", + "rtsp.c", "select.c", "sendf.c", + "setopt.c", "sha256.c", "share.c", + "slist.c", "smb.c", "smtp.c", + "socketpair.c", "socks.c", "socks_gssapi.c", + "socks_sspi.c", "speedcheck.c", "splay.c", + "strcase.c", "strdup.c", "strequal.c", + "strerror.c", "system_win32.c", "telnet.c", + "tftp.c", "transfer.c", "uint-bset.c", + "uint-hash.c", "uint-spbset.c", "uint-table.c", + "url.c", "urlapi.c", "vauth/cleartext.c", + "vauth/cram.c", "vauth/digest.c", "vauth/digest_sspi.c", + "vauth/gsasl.c", "vauth/krb5_gssapi.c", "vauth/krb5_sspi.c", + "vauth/ntlm.c", "vauth/ntlm_sspi.c", "vauth/oauth2.c", + "vauth/spnego_gssapi.c", "vauth/spnego_sspi.c", "vauth/vauth.c", + "version.c", "vquic/curl_ngtcp2.c", "vquic/curl_osslq.c", + "vquic/curl_quiche.c", "vquic/vquic-tls.c", "vquic/vquic.c", + "vtls/cipher_suite.c", "vtls/hostcheck.c", "vtls/keylog.c", + "vtls/openssl.c", "vtls/vtls.c", "vtls/vtls_scache.c", + "vtls/x509asn1.c", "ws.c", }, }); } diff --git a/build.zig.zon b/build.zig.zon index 0d115d53..b870b779 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,5 @@ .{ .name = .browser, - .paths = .{""}, .version = "0.0.0", .fingerprint = 0xda130f3af836cea0, // Changing this has security and trust implications. .minimum_zig_version = "0.15.2", @@ -10,9 +9,27 @@ .hash = "v8-0.0.0-xddH69R6BADRXsnhjA8wNnfKfLQACF1I7CSTZvsMAvp8", }, //.v8 = .{ .path = "../zig-v8-fork" }, + .brotli = .{ + // v1.2.0 + .url = "https://github.com/google/brotli/archive/028fb5a23661f123017c060daa546b55cf4bde29.tar.gz", + .hash = "N-V-__8AAJudKgCQCuIiH6MJjAiIJHfg_tT_Ew-0vZwVkCo_", + }, + .zlib = .{ + .url = "https://github.com/madler/zlib/releases/download/v1.3.2/zlib-1.3.2.tar.gz", + .hash = "N-V-__8AAJ2cNgAgfBtAw33Bxfu1IWISDeKKSr3DAqoAysIJ", + }, + .nghttp2 = .{ + .url = "https://github.com/nghttp2/nghttp2/releases/download/v1.68.0/nghttp2-1.68.0.tar.gz", + .hash = "N-V-__8AAL15vQCI63ZL6Zaz5hJg6JTEgYXGbLnMFSnf7FT3", + }, .@"boringssl-zig" = .{ .url = "git+https://github.com/Syndica/boringssl-zig.git#c53df00d06b02b755ad88bbf4d1202ed9687b096", .hash = "boringssl-0.1.0-VtJeWehMAAA4RNnwRnzEvKcS9rjsR1QVRw1uJrwXxmVK", }, + .curl = .{ + .url = "https://curl.se/download/curl-8.15.0.tar.gz", + .hash = "N-V-__8AAHGgPwH1XE5mB7bNofrDyBE5VWADWmBRlFQaVXWU", + }, }, + .paths = .{""}, } diff --git a/vendor/brotli b/vendor/brotli deleted file mode 160000 index f1c80224..00000000 --- a/vendor/brotli +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f1c80224e824f8c0e935b994a776b0d7455282f8 diff --git a/vendor/curl b/vendor/curl deleted file mode 160000 index 6845533e..00000000 --- a/vendor/curl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6845533e24f6febc7a006224b8991de5da328667 diff --git a/vendor/lightpanda/nghttp2/nghttp2ver.h b/vendor/lightpanda/nghttp2/nghttp2ver.h deleted file mode 100644 index 3dbb2ea8..00000000 --- a/vendor/lightpanda/nghttp2/nghttp2ver.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef NGHTTP2VER_H -#define NGHTTP2VER_H -#define NGHTTP2_VERSION "1.66" -#define NGHTTP2_VERSION_NUM 0x014300 -#endif /* NGHTTP2VER_H */ diff --git a/vendor/nghttp2 b/vendor/nghttp2 deleted file mode 160000 index ac22e0ef..00000000 --- a/vendor/nghttp2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ac22e0efe3f82f43c1366961c89a50ee821cfba3 diff --git a/vendor/zlib b/vendor/zlib deleted file mode 160000 index 51b7f2ab..00000000 --- a/vendor/zlib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf