aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-11 20:15:15 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-11 20:15:15 -0700
commit24c567086fd6a549a12fc7cfe60ba5b6abbb921c (patch)
tree6898f74ec0e8ad2c15c35afbf91e9deeedd15207
parent05b1696df732ab7931017ebafd0fe05fa7c0f3e7 (diff)
downloadbun-24c567086fd6a549a12fc7cfe60ba5b6abbb921c.tar.gz
bun-24c567086fd6a549a12fc7cfe60ba5b6abbb921c.tar.zst
bun-24c567086fd6a549a12fc7cfe60ba5b6abbb921c.zip
Add OpenSSL :cry:
-rw-r--r--.gitmodules3
-rw-r--r--Makefile11
-rw-r--r--README.md1
-rw-r--r--build.zig31
m---------src/deps/openssl0
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
diff --git a/Makefile b/Makefile
index ffe5db44e..8fe328abb 100644
--- a/Makefile
+++ b/Makefile
@@ -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) \
diff --git a/README.md b/README.md
index 1e47b79c0..f0b8df9d6 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/build.zig b/build.zig
index 04c9f9231..01f8b780c 100644
--- a/build.zig
+++ b/build.zig
@@ -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