aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-03 03:38:59 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-03 03:38:59 -0700
commit16d5325874e40e86c1a7e97163dbccbc41347c9f (patch)
tree2f4d62105a97c6861f61b3f6a5f356c1bb5730e9
parente3362a0fdad959a1fe6b87b9449d7aaee2b7175e (diff)
downloadbun-16d5325874e40e86c1a7e97163dbccbc41347c9f.tar.gz
bun-16d5325874e40e86c1a7e97163dbccbc41347c9f.tar.zst
bun-16d5325874e40e86c1a7e97163dbccbc41347c9f.zip
Add tinycc dependency
Diffstat (limited to '')
-rw-r--r--.gitmodules5
-rw-r--r--Dockerfile21
-rw-r--r--Makefile10
-rw-r--r--README.md8
m---------src/deps/tinycc0
5 files changed, 39 insertions, 5 deletions
diff --git a/.gitmodules b/.gitmodules
index d1396fc93..2620e2dd7 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -46,3 +46,8 @@
url = https://github.com/Jarred-Sumner/uWebSockets
ignore = dirty
depth = 1
+[submodule "src/deps/tinycc"]
+ path = src/deps/tinycc
+ url = https://github.com/Jarred-Sumner/tinycc.git
+ ignore = dirty
+ depth = 1
diff --git a/Dockerfile b/Dockerfile
index c83cdef24..5ea75023a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -71,6 +71,26 @@ WORKDIR $BUN_DIR
RUN cd $BUN_DIR && \
make libarchive && rm -rf src/deps/libarchive Makefile
+FROM bunbunbunbun/bun-base:latest as tinycc
+
+ARG DEBIAN_FRONTEND=noninteractive
+ARG GITHUB_WORKSPACE=/build
+ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
+# Directory extracts to "bun-webkit"
+ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
+ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
+ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
+ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
+
+COPY Makefile ${BUN_DIR}/Makefile
+COPY src/deps/tinycc ${BUN_DIR}/src/deps/tinycc
+
+WORKDIR $BUN_DIR
+
+RUN cd $BUN_DIR && \
+ make tinycc && rm -rf src/deps/tinycc Makefile
+
+
FROM bunbunbunbun/bun-base:latest as libbacktrace
ARG DEBIAN_FRONTEND=noninteractive
@@ -223,6 +243,7 @@ COPY --from=uws ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=uws ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/
COPY --from=libbacktrace ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=zlib ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
+COPY --from=tinycc ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=identifier_cache ${BUN_DIR}/src/js_lexer/*.blob ${BUN_DIR}/src/js_lexer/
COPY --from=node_fallbacks ${BUN_DIR}/src/node-fallbacks/out ${BUN_DIR}/src/node-fallbacks/out
diff --git a/Makefile b/Makefile
index 02353a5b0..8f31741c0 100644
--- a/Makefile
+++ b/Makefile
@@ -304,8 +304,7 @@ ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(MIMALLOC_FILE_PATH) \
-larchive \
-lssl \
-lbase64 \
- -ltcc \
- -L$(TINYCC_DIR)
+ -ltcc
ARCHIVE_FILES = $(ARCHIVE_FILES_WITHOUT_LIBCRYPTO) -lcrypto
@@ -367,7 +366,8 @@ tinycc:
cd $(TINYCC_DIR) && \
make clean && \
AR=$(AR) CC=$(CC) CFLAGS='$(CFLAGS) -emit-llvm $(TINYCC_CFLAGS)' ./configure --enable-static --cc=$(CC) --ar=$(AR) --config-predefs=yes && \
- make -j10
+ make -j10 && \
+ cp $(TINYCC_DIR)/*.a $(BUN_DEPS_OUT_DIR)
generate-builtins:
rm -f src/javascript/jsc/bindings/WebCoreBuiltins.cpp src/javascript/jsc/bindings/WebCoreBuiltins.h src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.cpp src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.h src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.cpp src/javascript/jsc/bindings/WebCore*Builtins* || echo ""
@@ -391,7 +391,7 @@ generate-builtins:
# We will get duplicate symbols if we don't delete it
rm src/javascript/jsc/bindings/WebCoreJSBuiltins.cpp
-vendor-without-check: api analytics node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive libbacktrace lolhtml usockets uws base64
+vendor-without-check: api analytics node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive libbacktrace lolhtml usockets uws base64 tinycc
prepare-types:
BUN_VERSION=$(PACKAGE_JSON_VERSION) $(BUN_RELEASE_BIN) types/bun/bundle.ts packages/bun-types
@@ -810,7 +810,7 @@ ifeq ($(OS_NAME),linux)
release-bin-push-dsym:
endif
-TINYCC_DIR ?= $(realpath $(HOME)/Build/tinycc)
+TINYCC_DIR ?= $(realpath $(BUN_DEPS_DIR)/tinycc)
release-bin-push: release-bin-push-bin release-bin-push-dsym
generate-release-bin-as-zip: release-bin-generate release-bin-codesign
diff --git a/README.md b/README.md
index 7ee116651..241c10b9e 100644
--- a/README.md
+++ b/README.md
@@ -1885,6 +1885,13 @@ var png = new Uint8Array(toArrayBuffer(out));
await Bun.write("out.png", png);
```
+##### Not implemented yet
+
+`bun:ffi` has a few more things planned but not implemented yet:
+
+- callback functions
+- async functions
+
### `Bun.Transpiler`
`Bun.Transpiler` lets you use Bun's transpiler from JavaScript (available in Bun.js)
@@ -2150,6 +2157,7 @@ bun also statically links these libraries:
- [`lol-html`](https://github.com/cloudflare/lol-html/tree/master/c-api), which is MIT licensed
- A fork of [`uWebsockets`](https://github.com/jarred-sumner/uwebsockets), which is MIT licensed
- [`uSockets`](https://github.com/uNetworking/uSockets), which is MIT licensed
+- [`tinycc`](https://github.com/tinycc/tinycc), which is LGPL v2.1 licensed
For compatibiltiy reasons, these NPM packages are embedded into bun’s binary and injected if imported.
diff --git a/src/deps/tinycc b/src/deps/tinycc
new file mode 160000
+Subproject d3e940c71c57449ef5de4c87245a0292be12d8c