Skip to content

Commit

Permalink
Merge branch 'main' into renan/fix-short-params
Browse files Browse the repository at this point in the history
  • Loading branch information
renanmav authored Nov 20, 2024
2 parents e2c6d50 + b7bd5a4 commit 1302eaf
Show file tree
Hide file tree
Showing 282 changed files with 18,023 additions and 11,264 deletions.
829 changes: 612 additions & 217 deletions .buildkite/ci.mjs
100644 → 100755

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion .buildkite/scripts/upload-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ function upload_s3_file() {

function send_bench_webhook() {
if [ -z "$BENCHMARK_URL" ]; then
return 1
echo "error: \$BENCHMARK_URL is not set"
# exit 1 # TODO: this isn't live yet
return
fi

local tag="$1"
Expand Down Expand Up @@ -200,6 +202,12 @@ function create_release() {
bun-linux-x64-profile.zip
bun-linux-x64-baseline.zip
bun-linux-x64-baseline-profile.zip
bun-linux-aarch64-musl.zip
bun-linux-aarch64-musl-profile.zip
bun-linux-x64-musl.zip
bun-linux-x64-musl-profile.zip
bun-linux-x64-musl-baseline.zip
bun-linux-x64-musl-baseline-profile.zip
bun-windows-x64.zip
bun-windows-x64-profile.zip
bun-windows-x64-baseline.zip
Expand Down
16 changes: 11 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Bun currently requires `glibc >=2.32` in development which means if you're on Ub

Using your system's package manager, install Bun's dependencies:

{% codetabs %}
{% codetabs group="os" %}

```bash#macOS (Homebrew)
$ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby
Expand Down Expand Up @@ -60,7 +60,7 @@ $ brew install bun

Bun requires LLVM 16 (`clang` is part of LLVM). This version requirement is to match WebKit (precompiled), as mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:

{% codetabs %}
{% codetabs group="os" %}

```bash#macOS (Homebrew)
$ brew install llvm@18
Expand Down Expand Up @@ -97,7 +97,7 @@ $ which clang-16

If not, run this to manually add it:

{% codetabs %}
{% codetabs group="os" %}

```bash#macOS (Homebrew)
# use fish_add_path if you're using fish
Expand Down Expand Up @@ -285,7 +285,7 @@ If you see this error when compiling, run:
$ xcode-select --install
```

## Cannot find `libatomic.a`
### Cannot find `libatomic.a`

Bun defaults to linking `libatomic` statically, as not all systems have it. If you are building on a distro that does not have a static libatomic available, you can run the following command to enable dynamic linking:

Expand All @@ -295,11 +295,17 @@ $ bun run build -DUSE_STATIC_LIBATOMIC=OFF

The built version of Bun may not work on other systems if compiled this way.

## ccache conflicts with building TinyCC on macOS
### ccache conflicts with building TinyCC on macOS

If you run into issues with `ccache` when building TinyCC, try reinstalling ccache

```bash
brew uninstall ccache
brew install ccache
```

## Using bun-debug

- Disable logging: `BUN_DEBUG_QUIET_LOGS=1 bun-debug ...` (to disable all debug logging)
- Enable logging for a specific zig scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`)
- Bun transpiles every file it runs, to see the actual executed source in a debug build find it in `/tmp/bun-debug-src/...path/to/file`, for example the transpiled version of `/home/bun/index.ts` would be in `/tmp/bun-debug-src/home/bun/index.ts`
2 changes: 1 addition & 1 deletion LATEST
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.34
1.1.36
18 changes: 18 additions & 0 deletions ci/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ARG IMAGE=debian:11
FROM $IMAGE
COPY ./scripts/bootstrap.sh /tmp/bootstrap.sh
ENV CI=true
RUN sh /tmp/bootstrap.sh && rm -rf /tmp/*
WORKDIR /workspace/bun
COPY bunfig.toml bunfig.toml
COPY package.json package.json
COPY CMakeLists.txt CMakeLists.txt
COPY cmake/ cmake/
COPY scripts/ scripts/
COPY patches/ patches/
COPY *.zig ./
COPY src/ src/
COPY packages/ packages/
COPY test/ test/
RUN bun i
RUN bun run build:ci
27 changes: 27 additions & 0 deletions ci/linux/scripts/set-hostname.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

# This script sets the hostname of the current machine.

execute() {
echo "$ $@" >&2
if ! "$@"; then
echo "Command failed: $@" >&2
exit 1
fi
}

main() {
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <hostname>" >&2
exit 1
fi

if [ -f "$(which hostnamectl)" ]; then
execute hostnamectl set-hostname "$1"
else
echo "Error: hostnamectl is not installed." >&2
exit 1
fi
}

main "$@"
22 changes: 22 additions & 0 deletions ci/linux/scripts/start-tailscale.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# This script starts tailscale on the current machine.

execute() {
echo "$ $@" >&2
if ! "$@"; then
echo "Command failed: $@" >&2
exit 1
fi
}

main() {
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <auth-key>" >&2
exit 1
fi

execute tailscale up --reset --ssh --accept-risk=lose-ssh --auth-key="$1"
}

main "$@"
2 changes: 1 addition & 1 deletion ci/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"scripts": {
"bootstrap": "brew install gh jq cirruslabs/cli/tart cirruslabs/cli/sshpass hashicorp/tap/packer && packer init darwin",
"login": "gh auth token | tart login ghcr.io --username $(gh api user --jq .login) --password-stdin",
"login": "token=$(gh auth token); username=$(gh api user --jq .login); echo \"Login as $username...\"; echo \"$token\" | tart login ghcr.io --username \"$username\" --password-stdin; echo \"$token\" | docker login ghcr.io --username \"$username\" --password-stdin",
"fetch:image-name": "echo ghcr.io/oven-sh/bun-vm",
"fetch:darwin-version": "echo 1",
"fetch:macos-version": "sw_vers -productVersion | cut -d. -f1",
Expand Down
2 changes: 1 addition & 1 deletion cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ if(ENABLE_LTO)
endif()

# --- Remapping ---
if(UNIX)
if(UNIX AND CI)
register_compiler_flags(
DESCRIPTION "Remap source files"
-ffile-prefix-map=${CWD}=.
Expand Down
18 changes: 10 additions & 8 deletions cmake/Globals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ else()
unsupported(CMAKE_HOST_SYSTEM_NAME)
endif()

if(EXISTS "/lib/ld-musl-aarch64.so.1")
set(IS_MUSL ON)
elseif(EXISTS "/lib/ld-musl-x86_64.so.1")
set(IS_MUSL ON)
else()
set(IS_MUSL OFF)
endif()

if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64|ARM64|aarch64|AARCH64")
set(HOST_OS "aarch64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64|X86_64|x64|X64|amd64|AMD64")
Expand Down Expand Up @@ -144,6 +136,16 @@ else()
set(WARNING WARNING)
endif()

if(LINUX)
if(EXISTS "/etc/alpine-release")
set(DEFAULT_ABI "musl")
else()
set(DEFAULT_ABI "gnu")
endif()

optionx(ABI "musl|gnu" "The ABI to use (e.g. musl, gnu)" DEFAULT ${DEFAULT_ABI})
endif()

# TODO: This causes flaky zig builds in CI, so temporarily disable it.
# if(CI)
# set(DEFAULT_VENDOR_PATH ${CACHE_PATH}/vendor)
Expand Down
Loading

0 comments on commit 1302eaf

Please sign in to comment.