-
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolves #170 build v8go for musl libc
- Loading branch information
1 parent
1f00b50
commit 4219ad1
Showing
18 changed files
with
421 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
deps/v8 | ||
deps/depot_tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: GN Alpine Build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-alpine: | ||
name: Build GN for Alpine x86_64 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
fetch-depth: 1 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build container images | ||
run: docker buildx build --platform=linux/amd64 --output=type=docker -t gn-builder-alpine -f deps/alpine-gn-builder.Dockerfile deps | ||
- name: Copy files | ||
run: | | ||
id=$(docker create gn-builder-alpine) | ||
docker cp $id:/usr/local/bin/gn deps/alpine_x86_64/gn | ||
docker rm -v $id | ||
- name: Create PR | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
commit-message: Update GN static library for Alpine x86_64 | ||
branch-suffix: random | ||
delete-branch: true | ||
title: GN static library for Alpine x86_64 | ||
body: Auto-generated pull request to build GN for Alpine x86_64 | ||
base: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ deps/darwin-x86_64/libv8_debug.a | |
c.out | ||
|
||
/v8go.test | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ARG GOLANG_IMAGE=golang:1.19.3-alpine3.16 | ||
FROM $GOLANG_IMAGE | ||
|
||
RUN apk add --update \ | ||
alpine-sdk \ | ||
g++ \ | ||
gcc \ | ||
git \ | ||
libc-dev \ | ||
glib-dev \ | ||
libstdc++ | ||
|
||
ENV CGO_CXXFLAGS="-Werror" | ||
WORKDIR v8go | ||
COPY . ./ | ||
|
||
CMD go test --tags muslgcc -v -coverprofile c.out ./... && go tool cover -html=c.out -o /dev/stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2019 Roger Chapman and the v8go contributors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
//go:build !muslgcc || glibc | ||
// +build !muslgcc glibc | ||
|
||
package v8go | ||
|
||
// #cgo linux,amd64 LDFLAGS: -L${SRCDIR}/deps/linux_x86_64 -ldl | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2019 Roger Chapman and the v8go contributors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
//go:build muslgcc && !glibc | ||
// +build muslgcc,!glibc | ||
|
||
package v8go | ||
|
||
// #cgo linux,amd64 LDFLAGS: -L${SRCDIR}/deps/alpine_x86_64 -ldl | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# Build GN for alpine (this is a build dependency) | ||
# | ||
FROM alpine:3.16.3 as gn-builder | ||
|
||
# This is the GN commit that we want to build. | ||
# Most commits will probably build just fine but this happened to be the latest commit when I did this. | ||
ARG GN_COMMIT=1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41 | ||
|
||
RUN \ | ||
apk add --update --virtual .gn-build-dependencies \ | ||
alpine-sdk \ | ||
binutils-gold \ | ||
clang \ | ||
curl \ | ||
git \ | ||
llvm12 \ | ||
ninja \ | ||
python3 \ | ||
tar \ | ||
xz \ | ||
# Quick fixes: we need the LLVM tooling in $PATH, and we also have to use gold instead of ld. | ||
&& PATH=$PATH:/usr/lib/llvm12/bin \ | ||
&& cp -f /usr/bin/ld.gold /usr/bin/ld \ | ||
# Clone and build gn | ||
&& git clone https://gn.googlesource.com/gn /tmp/gn \ | ||
&& git -C /tmp/gn checkout ${GN_COMMIT} \ | ||
&& cd /tmp/gn \ | ||
&& python3 build/gen.py \ | ||
&& ninja -C out \ | ||
&& cp -f /tmp/gn/out/gn /usr/local/bin/gn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Building V8 for alpine | ||
# | ||
FROM alpine:3.16.3 as v8 | ||
|
||
COPY depot_tools ./depot_tools | ||
COPY include ./include | ||
COPY v8 ./v8 | ||
COPY .gclient compile_v8.py ./ | ||
COPY alpine_x86_64 ./alpine_x86_64 | ||
|
||
RUN \ | ||
apk add --update --virtual .v8-build-dependencies \ | ||
bash \ | ||
curl \ | ||
g++ \ | ||
gcc \ | ||
glib-dev \ | ||
icu-dev \ | ||
libstdc++ \ | ||
linux-headers \ | ||
make \ | ||
ninja \ | ||
python3 \ | ||
tar \ | ||
xz \ | ||
&& cp alpine_x86_64/gn depot_tools/gn \ | ||
&& ln -s /usr/bin/python3 /usr/bin/python \ | ||
# Compile V8 | ||
&& ./compile_v8.py --no-clang --arch x86_64 |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Package alpine_x86_64 is required to provide support for vendoring modules | ||
// DO NOT REMOVE | ||
package alpine_x86_64 |
Oops, something went wrong.