diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | build.zig | 31 | ||||
m--------- | src/deps/openssl | 0 |
5 files changed, 24 insertions, 22 deletions
diff --git a/.gitmodules b/.gitmodules index 71065a4f2..76ee9b296 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,3 +21,6 @@ path = src/deps/libarchive url = https://github.com/libarchive/libarchive.git ignore = dirty +[submodule "src/deps/openssl"] + path = src/deps/openssl + url = git@github.com:openssl/openssl.git @@ -48,6 +48,8 @@ endif JSC_LIB ?= $(DEFAULT_JSC_LIB) JSC_INCLUDE_DIR ?= $(JSC_BASE_DIR)/include +ZLIB_INCLUDE_DIR ?= $(DEPS_DIR)/zlib +ZLIB_LIB_DIR ?= $(DEPS_DIR)/zlib JSC_FILES := $(JSC_LIB)/libJavaScriptCore.a $(JSC_LIB)/libWTF.a $(JSC_LIB)/libbmalloc.a @@ -69,7 +71,7 @@ endif bun: vendor build-obj bun-link-lld-release -vendor-without-check: api analytics node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib +vendor-without-check: api analytics node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib openssl libarchive: cd src/deps/libarchive; \ @@ -83,6 +85,11 @@ vendor: require init-submodules vendor-without-check zlib: cd src/deps/zlib; cmake .; make; +openssl: + cd src/deps/zlib; \ + ./configure --with-zlib-lib=$(ZLIB_LIB_DIR) --with-zlib-include=$(ZLIB_INCLUDE_DIR); \ + make -j${shell nproc}; + require: @echo "Checking if the required utilities are available..." @realpath --version >/dev/null 2>&1 || (echo "ERROR: realpath is required."; exit 1) @@ -330,6 +337,8 @@ BUN_LLD_FLAGS := $(OBJ_FILES) \ src/deps/mimalloc/libmimalloc.a \ src/deps/zlib/libz.a \ src/deps/libarchive.a \ + src/deps/openssl/libssl.a \ + src/deps/openssl/libcrypto.a \ $(CLANG_FLAGS) \ @@ -558,6 +558,7 @@ Bun also statically links these libraries: - [`picohttp`](https://github.com/h2o/picohttpparser), which is dual-licensed under the Perl License or the MIT License - [`mimalloc`](https://github.com/microsoft/mimalloc), which is MIT licensed - [`zlib-cloudflare`](https://github.com/cloudflare/zlib), which is zlib licensed +- [`openssl`](https://github.com/openssl/openssl) 3.0.0, which is Apache 2.0 licensed For compatibiltiy reasons, these NPM packages are embedded into Bun's binary and injected if imported. @@ -133,16 +133,6 @@ pub fn build(b: *std.build.Builder) !void { exe.setOutputDir(output_dir); var cwd_dir = std.fs.cwd(); - if (std.builtin.is_test) { - var walker = cwd_dir.walk(std.heap.c_allocator) catch unreachable; - - while (walker.next() catch unreachable) |entry| { - if (std.mem.endsWith(u8, entry.basename, "_test.zig")) { - std.debug.print("[test] Added {s}", .{entry.basename}); - _ = b.addTest(entry.path); - } - } - } const runtime_hash = std.hash.Wyhash.hash(0, @embedFile("./src/runtime.out.js")); const runtime_version_file = std.fs.cwd().openFile("src/runtime.version", .{ .write = true }) catch unreachable; @@ -237,13 +227,14 @@ pub fn build(b: *std.build.Builder) !void { true, ); - step.addObjectFile("src/deps/libJavaScriptCore.a"); step.addObjectFile("src/deps/libWTF.a"); - if (target.getOs().tag != .linux) { - step.addObjectFile("src/deps/libbmalloc.a"); - } + step.addObjectFile("src/deps/libbmalloc.a"); + step.addObjectFile("src/deps/libarchive.a"); + step.addObjectFile("src/deps/zlib/libz.a"); + step.addObjectFile("src/deps/openssl/libssl.a"); + step.addObjectFile("src/deps/openssl/libcrypto.a"); step.addObjectFile("src/deps/mimalloc/libmimalloc.a"); step.addLibPath("src/deps/mimalloc"); @@ -295,13 +286,11 @@ pub fn build(b: *std.build.Builder) !void { obj.bundle_compiler_rt = true; - if (target.getOsTag() == .linux) { - // obj.want_lto = tar; - obj.link_emit_relocs = true; - obj.link_function_sections = true; - } - - + if (target.getOsTag() == .linux) { + // obj.want_lto = tar; + obj.link_emit_relocs = true; + obj.link_function_sections = true; + } } else { b.default_step.dependOn(&exe.step); } diff --git a/src/deps/openssl b/src/deps/openssl new file mode 160000 +Subproject 89cd17a031e022211684eb7eb41190cf1910f9f |