mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
musl patches [v2] (#15028)
This commit is contained in:
@@ -11,5 +11,8 @@ packages/**/bun-profile
|
||||
src/bun.js/WebKit
|
||||
src/bun.js/WebKit/LayoutTests
|
||||
zig-build
|
||||
zig-cache
|
||||
.zig-cache
|
||||
zig-out
|
||||
build
|
||||
vendor
|
||||
node_modules
|
||||
|
||||
@@ -236,9 +236,10 @@ pub fn build(b: *Build) !void {
|
||||
),
|
||||
|
||||
.sha = sha: {
|
||||
const sha = b.option([]const u8, "sha", "Force the git sha") orelse
|
||||
b.graph.env_map.get("GITHUB_SHA") orelse
|
||||
b.graph.env_map.get("GIT_SHA") orelse fetch_sha: {
|
||||
const sha_buildoption = b.option([]const u8, "sha", "Force the git sha");
|
||||
const sha_github = b.graph.env_map.get("GITHUB_SHA");
|
||||
const sha_env = b.graph.env_map.get("GIT_SHA");
|
||||
const sha = sha_buildoption orelse sha_github orelse sha_env orelse fetch_sha: {
|
||||
const result = std.process.Child.run(.{
|
||||
.allocator = b.allocator,
|
||||
.argv = &.{
|
||||
|
||||
23
ci/alpine/build.Dockerfile
Normal file
23
ci/alpine/build.Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM alpine:edge AS build
|
||||
ARG GIT_SHA
|
||||
ENV GIT_SHA=${GIT_SHA}
|
||||
WORKDIR /app/bun
|
||||
ENV HOME=/root
|
||||
|
||||
COPY . .
|
||||
RUN touch $HOME/.bashrc
|
||||
RUN ./scripts/bootstrap.sh
|
||||
RUN . $HOME/.bashrc && bun run build:release
|
||||
|
||||
RUN apk add file
|
||||
RUN file ./build/release/bun
|
||||
RUN ldd ./build/release/bun
|
||||
RUN ./build/release/bun
|
||||
|
||||
WORKDIR /output
|
||||
RUN cp -R /app/bun/build/* .
|
||||
|
||||
FROM scratch AS artifact
|
||||
COPY --from=build /output /
|
||||
|
||||
# docker build -f ./ci/alpine/build.Dockerfile --progress=plain --build-arg GIT_SHA="$(git rev-parse HEAD)" --target=artifact --output type=local,dest=./build-alpine .
|
||||
20
ci/alpine/test.Dockerfile
Normal file
20
ci/alpine/test.Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM alpine:edge
|
||||
ENV HOME=/root
|
||||
WORKDIR /root
|
||||
COPY ./build-alpine/release/bun .
|
||||
COPY ./test ./test
|
||||
COPY ./scripts ./scripts
|
||||
COPY ./package.json ./package.json
|
||||
COPY ./packages ./packages
|
||||
|
||||
RUN apk update
|
||||
RUN apk add nodejs lsb-release-minimal git python3 npm make g++
|
||||
RUN apk add file
|
||||
|
||||
RUN file /root/bun
|
||||
RUN ldd /root/bun
|
||||
RUN /root/bun
|
||||
|
||||
RUN ./scripts/runner.node.mjs --exec-path /root/bun
|
||||
|
||||
# docker build -f ./ci/alpine/test.Dockerfile --progress=plain .
|
||||
@@ -108,7 +108,7 @@ else()
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(NOT DEFAULT_REVISION)
|
||||
if(NOT DEFAULT_REVISION AND NOT DEFINED ENV{GIT_SHA} AND NOT DEFINED ENV{GITHUB_SHA})
|
||||
set(DEFAULT_REVISION "unknown")
|
||||
endif()
|
||||
endif()
|
||||
@@ -156,4 +156,3 @@ optionx(USE_WEBKIT_ICU BOOL "Use the ICU libraries from WebKit" DEFAULT ${DEFAUL
|
||||
optionx(ERROR_LIMIT STRING "Maximum number of errors to show when compiling C++ code" DEFAULT "100")
|
||||
|
||||
list(APPEND CMAKE_ARGS -DCMAKE_EXPORT_COMPILE_COMMANDS=ON)
|
||||
|
||||
|
||||
@@ -501,6 +501,11 @@ else()
|
||||
unsupported(CMAKE_SYSTEM_PROCESSOR)
|
||||
endif()
|
||||
|
||||
set(ZIG_FLAGS_BUN)
|
||||
if(NOT "${REVISION}" STREQUAL "")
|
||||
set(ZIG_FLAGS_BUN ${ZIG_FLAGS_BUN} -Dsha=${REVISION})
|
||||
endif()
|
||||
|
||||
register_command(
|
||||
TARGET
|
||||
bun-zig
|
||||
@@ -519,11 +524,11 @@ register_command(
|
||||
-Dcpu=${ZIG_CPU}
|
||||
-Denable_logs=$<IF:$<BOOL:${ENABLE_LOGS}>,true,false>
|
||||
-Dversion=${VERSION}
|
||||
-Dsha=${REVISION}
|
||||
-Dreported_nodejs_version=${NODEJS_VERSION}
|
||||
-Dcanary=${CANARY_REVISION}
|
||||
-Dcodegen_path=${CODEGEN_PATH}
|
||||
-Dcodegen_embed=$<IF:$<BOOL:${CODEGEN_EMBED}>,true,false>
|
||||
${ZIG_FLAGS_BUN}
|
||||
ARTIFACTS
|
||||
${BUN_ZIG_OUTPUT}
|
||||
TARGETS
|
||||
|
||||
@@ -124,8 +124,8 @@ append_to_path() {
|
||||
error "Could not find directory: \"$path\""
|
||||
fi
|
||||
|
||||
append_to_profile "export PATH=\"$path:\$PATH\""
|
||||
export PATH="$path:$PATH"
|
||||
append_to_profile "export PATH=\"\$PATH\":$path"
|
||||
export PATH="$PATH:$path"
|
||||
}
|
||||
|
||||
check_system() {
|
||||
@@ -468,7 +468,7 @@ install_build_essentials() {
|
||||
install_packages ninja pkg-config golang
|
||||
;;
|
||||
apk)
|
||||
install_packages ninja xz
|
||||
install_packages musl-dev ninja xz
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -517,6 +517,7 @@ install_llvm() {
|
||||
;;
|
||||
apk)
|
||||
install_packages "llvm$(llvm_version)-dev" "clang$(llvm_version)-dev" "lld$(llvm_version)-dev"
|
||||
append_to_path "/usr/lib/llvm$(llvm_version)/bin"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -531,7 +532,9 @@ install_ccache() {
|
||||
|
||||
install_rust() {
|
||||
if [ "$os" = "linux" ] && [ "$distro" = "alpine" ]; then
|
||||
install_packages rust
|
||||
install_packages rust cargo
|
||||
mkdir -p "$HOME/.cargo/bin"
|
||||
append_to_path "$HOME/.cargo/bin"
|
||||
return
|
||||
fi
|
||||
sh="$(require sh)"
|
||||
@@ -547,6 +550,9 @@ install_docker() {
|
||||
package_manager install docker --cask
|
||||
fi
|
||||
;;
|
||||
apk)
|
||||
install_packages docker
|
||||
;;
|
||||
*)
|
||||
case "$distro-$release" in
|
||||
amzn-2 | amzn-1)
|
||||
|
||||
Reference in New Issue
Block a user