Skip to content

Commit

Permalink
chore: upgrade zig to 0.13.0 (#9965)
Browse files Browse the repository at this point in the history
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <[email protected]>
Co-authored-by: Grigory <[email protected]>
Co-authored-by: Dylan Conway <[email protected]>
Co-authored-by: Meghan Denny <[email protected]>
Co-authored-by: Kenta Iwasaki <[email protected]>
Co-authored-by: John-David Dalton <[email protected]>
Co-authored-by: Dale Seo <[email protected]>
Co-authored-by: Zack Radisic <[email protected]>
Co-authored-by: paperdave <[email protected]>
Co-authored-by: Georgijs Vilums <[email protected]>
Co-authored-by: Dylan Conway <[email protected]>
  • Loading branch information
13 people authored Jun 20, 2024
1 parent e58cf69 commit b76376f
Show file tree
Hide file tree
Showing 179 changed files with 3,981 additions and 3,917 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \
-DUSE_LTO=ON \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
-DBUN_ZIG_OBJ_DIR="${{ runner.temp }}/release" \
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
-DBUN_DEPS_OUT_DIR="${{ runner.temp }}/bun-deps" \
-DNO_CONFIGURE_DEPENDS=1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ jobs:
-DBUN_LINK_ONLY=1 `
"-DBUN_DEPS_OUT_DIR=$(Resolve-Path ../bun-deps)" `
"-DBUN_CPP_ARCHIVE=$(Resolve-Path ../bun-cpp/bun-cpp-objects.a)" `
"-DBUN_ZIG_OBJ=$(Resolve-Path ../bun-zig/bun-zig.o)" `
"-DBUN_ZIG_OBJ_DIR=$(Resolve-Path ../bun-zig)" `
${{ contains(inputs.tag, '-baseline') && '-DUSE_BASELINE_BUILD=1' || '' }}
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
ninja -v
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: ./.github/workflows/run-format.yml
secrets: inherit
with:
zig-version: 0.12.0-dev.1828+225fe6ddb
zig-version: 0.13.0
permissions:
contents: write
lint:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
.vs
.vscode/clang*
.vscode/cpp*
.zig-cache
*.a
*.bc
*.big
Expand Down
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ fetchRecurseSubmodules = false
[submodule "zig"]
path = src/deps/zig
url = https://github.com/oven-sh/zig
branch = bun
depth = 1
shallow = true
fetchRecurseSubmodules = false
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@

// Zig
"zig.initialSetupDone": true,
"zig.buildOnSave": false,
"zig.buildOption": "build",
"zig.buildArgs": ["-Dgenerated-code=./build/codegen"],
"zig.zls.buildOnSaveStep": "check",
// "zig.zls.enableBuildOnSave": true,
// "zig.buildOnSave": true,
"zig.buildFilePath": "${workspaceFolder}/build.zig",
"zig.path": "${workspaceFolder}/.cache/zig/zig.exe",
"zig.formattingProvider": "zls",
Expand Down
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,13 @@ file(GLOB ZIG_FILES
"${BUN_SRC}/*/*/*/*/*.zig"
)

if(NOT BUN_ZIG_OBJ)
set(BUN_ZIG_OBJ "${BUN_WORKDIR}/CMakeFiles/bun-zig.o")
if(NOT BUN_ZIG_OBJ_DIR)
set(BUN_ZIG_OBJ_DIR "${BUN_WORKDIR}/CMakeFiles")
endif()

get_filename_component(BUN_ZIG_OBJ "${BUN_ZIG_OBJ}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
get_filename_component(BUN_ZIG_OBJ_DIR "${BUN_ZIG_OBJ_DIR}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")

set(BUN_ZIG_OBJ "${BUN_ZIG_OBJ_DIR}/bun-zig.o")

set(USES_TERMINAL_NOT_IN_CI "")

Expand All @@ -869,7 +871,7 @@ if(NOT BUN_LINK_ONLY AND NOT BUN_CPP_ONLY)
COMMAND
"${ZIG_COMPILER}" "build" "obj"
"--zig-lib-dir" "${ZIG_LIB_DIR}"
"-Doutput-file=${BUN_ZIG_OBJ}"
"--prefix" "${BUN_ZIG_OBJ_DIR}"
"-Dgenerated-code=${BUN_WORKDIR}/codegen"
"-freference-trace=10"
"-Dversion=${Bun_VERSION}"
Expand Down Expand Up @@ -1074,7 +1076,7 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
list(APPEND LTO_LINK_FLAG "/LTCG")
endif()

target_compile_options(${bun} PUBLIC /O2 ${LTO_FLAG} /DEBUG:FULL)
target_compile_options(${bun} PUBLIC /O2 ${LTO_FLAG})
target_link_options(${bun} PUBLIC ${LTO_LINK_FLAG} /DEBUG:FULL)
endif()
endif()
Expand Down Expand Up @@ -1110,7 +1112,7 @@ if(WIN32)
set_property(TARGET ${bun} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")

target_compile_options(${bun} PUBLIC "/EHsc" "/GR-")
target_link_options(${bun} PUBLIC "/STACK:0x1200000,0x100000")
target_link_options(${bun} PUBLIC "/STACK:0x1200000,0x100000" "/DEF:${BUN_SRC}/symbols.def")
else()
target_compile_options(${bun} PUBLIC
-fPIC
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ ARG CMAKE_BUILD_TYPE=Release

ARG NODE_VERSION="20"
ARG LLVM_VERSION="16"
ARG ZIG_VERSION="0.12.0-dev.1828+225fe6ddb"
ARG ZIG_VERSION_SHORT="0.12.0-dev.1828"

ARG ZIG_VERSION="0.13.0"
ARG ZIG_VERSION_SHORT="0.13.0"

ARG SCCACHE_BUCKET
ARG SCCACHE_REGION
Expand Down Expand Up @@ -144,7 +145,7 @@ ARG ZIG_VERSION_SHORT
ARG BUILD_MACHINE_ARCH
ARG ZIG_FOLDERNAME=zig-linux-${BUILD_MACHINE_ARCH}-${ZIG_VERSION}
ARG ZIG_FILENAME=${ZIG_FOLDERNAME}.tar.xz
ARG ZIG_URL=https://github.com/oven-sh/zig/releases/download/${ZIG_VERSION_SHORT}/zig-linux-${BUILD_MACHINE_ARCH}-${ZIG_VERSION}.tar.xz
ARG ZIG_URL="https://ziglang.org/builds/${ZIG_FILENAME}"
ARG ZIG_LOCAL_CACHE_DIR=/zig-cache
ENV ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR}

Expand Down Expand Up @@ -459,7 +460,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
-DWEBKIT_DIR="omit" \
-DNO_CONFIGURE_DEPENDS=1 \
-DNO_CODEGEN=1 \
-DBUN_ZIG_OBJ="/tmp/bun-zig.o" \
-DBUN_ZIG_OBJ_DIR="/tmp" \
-DCANARY="${CANARY}" \
-DZIG_COMPILER=system \
-DZIG_LIB_DIR=$BUN_DIR/src/deps/zig/lib \
Expand Down Expand Up @@ -515,7 +516,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${BUN_DIR}/build/bun-zig.o" \
-DBUN_ZIG_OBJ_DIR="${BUN_DIR}/build" \
-DUSE_LTO=ON \
-DUSE_DEBUG_JSC=${ASSERTIONS} \
-DBUN_CPP_ARCHIVE="${BUN_DIR}/build/bun-cpp-objects.a" \
Expand Down Expand Up @@ -577,7 +578,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${BUN_DIR}/build/bun-zig.o" \
-DBUN_ZIG_OBJ_DIR="${BUN_DIR}/build" \
-DUSE_DEBUG_JSC=ON \
-DBUN_CPP_ARCHIVE="${BUN_DIR}/build/bun-cpp-objects.a" \
-DWEBKIT_DIR="${BUN_DIR}/bun-webkit" \
Expand Down
Loading

0 comments on commit b76376f

Please sign in to comment.