Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.a binary
11 changes: 9 additions & 2 deletions .github/workflows/build-v8-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ jobs:
# use custom libcxx for all cross-compiles to avoid system header conflicts
USE_SYSROOT="false"
USE_CUSTOM_LIBCXX="false"
IS_CLANG="true"
if [[ "${{ matrix.target_os }}" == "linux" && "${{ matrix.target_arch }}" == "amd64" ]]; then
IS_CLANG="false"
fi
if [[ "${{ matrix.target_os }}" == "linux" && "${{ matrix.target_arch }}" == "arm64" ]]; then
USE_SYSROOT="true"
USE_CUSTOM_LIBCXX="true"
Expand All @@ -111,13 +115,14 @@ jobs:

cat > /tmp/gn_args.txt << EOF
is_debug=false
is_clang=${{ matrix.target_os != 'linux' && 'true' || 'true' }}
is_clang=${IS_CLANG}
target_os="${{ matrix.target_os == 'darwin' && 'mac' || matrix.target_os }}"
target_cpu="${TARGET_CPU}"
v8_target_cpu="${TARGET_CPU}"
clang_use_chrome_plugins=false
use_custom_libcxx=${USE_CUSTOM_LIBCXX}
use_sysroot=${USE_SYSROOT}
use_thin_lto=false
use_glib=false
symbol_level=0
strip_debug_info=true
Expand Down Expand Up @@ -168,7 +173,9 @@ jobs:
import build
build.args = Args()
build.v8_path = os.path.join(os.getcwd(), 'v8')
build.is_clang = True
# Use system ar on Linux to produce GNU-format archives
# compatible with GNU ld (llvm-ar uses SysV64 format that ld rejects)
build.is_clang = ('${{ matrix.target_os }}' != 'linux')

dest_path = os.path.join(os.getcwd(), '${{ matrix.target_os }}_${{ matrix.target_arch }}')
os.makedirs(dest_path, exist_ok=True)
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@ coverage.out
.idea/
.vscode/
.cursor

# V8 local build artifacts (gclient/depot_tools)
deps/.cipd/
deps/.gclient_entries
deps/.gclient_previous_*
deps/.gcs_entries
deps/__pycache__/
deps/_bad_scm/
deps/v8/
deps/depot_tools/
deps/.build/
2 changes: 1 addition & 1 deletion cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package v8go
//go:generate clang-format -i --verbose -style=Chromium v8go.h v8go.cc

// #cgo CXXFLAGS: -fno-rtti -fPIC -std=c++20 -I${SRCDIR}/deps/include -Wall
// #cgo CXXFLAGS: -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX
// #cgo CXXFLAGS: -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH
// #cgo CXXFLAGS: -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS
import "C"
1 change: 1 addition & 0 deletions deps/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def get_custom_deps():
v8_target_cpu="%s"
clang_use_chrome_plugins=false
use_custom_libcxx=false
use_thin_lto=false
use_sysroot=false
use_glib=false
symbol_level=%s
Expand Down
6 changes: 6 additions & 0 deletions deps/darwin_amd64/cgo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package darwin_amd64

// #cgo LDFLAGS: -pthread
// #cgo LDFLAGS: ${SRCDIR}/libv8-0.a ${SRCDIR}/libv8-1.a ${SRCDIR}/libv8-2.a
// #cgo LDFLAGS: -lc++ -framework CoreFoundation
import "C"
3 changes: 3 additions & 0 deletions deps/darwin_amd64/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/tommie/v8go/deps/darwin_amd64

go 1.19
3 changes: 3 additions & 0 deletions deps/darwin_amd64/libmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
libv8-0.a
libv8-1.a
libv8-2.a
Binary file added deps/darwin_amd64/libv8-0.a
Binary file not shown.
Binary file added deps/darwin_amd64/libv8-1.a
Binary file not shown.
Binary file added deps/darwin_amd64/libv8-2.a
Binary file not shown.
1 change: 1 addition & 0 deletions deps/darwin_amd64/vendor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package darwin_amd64
6 changes: 6 additions & 0 deletions deps/darwin_arm64/cgo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package darwin_arm64

// #cgo LDFLAGS: -pthread
// #cgo LDFLAGS: ${SRCDIR}/libv8-0.a ${SRCDIR}/libv8-1.a
// #cgo LDFLAGS: -lc++ -framework CoreFoundation
import "C"
3 changes: 3 additions & 0 deletions deps/darwin_arm64/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/tommie/v8go/deps/darwin_arm64

go 1.19
2 changes: 2 additions & 0 deletions deps/darwin_arm64/libmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
libv8-0.a
libv8-1.a
Binary file added deps/darwin_arm64/libv8-0.a
Binary file not shown.
Binary file added deps/darwin_arm64/libv8-1.a
Binary file not shown.
1 change: 1 addition & 0 deletions deps/darwin_arm64/vendor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package darwin_arm64
6 changes: 6 additions & 0 deletions deps/linux_amd64/cgo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package linux_amd64

// #cgo LDFLAGS: -pthread
// #cgo LDFLAGS: -Wl,--start-group ${SRCDIR}/libv8-0.a ${SRCDIR}/libv8-1.a ${SRCDIR}/libv8-2.a -Wl,--end-group
// #cgo LDFLAGS: -ldl -lm -lstdc++
import "C"
3 changes: 3 additions & 0 deletions deps/linux_amd64/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/tommie/v8go/deps/linux_amd64

go 1.19
Loading
Loading