Skip to content

Commit bcfd2d6

Browse files
authored
Support for go mod vendor (#60)
* Support for go mod vendor * Update changelog * make sure build uses underscore rather than dash
1 parent 186af62 commit bcfd2d6

File tree

11 files changed

+30
-3
lines changed

11 files changed

+30
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Value methods for checking value kind (is string, number, array etc)
1111
- C formatting via `clang-format` to aid future development
12+
- Support of vendoring with `go mod vendor`
1213

1314
### Changed
1415
- Use g++ (default for cgo) for linux builds of the static v8 lib

cgo.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ package v8go
66
// #cgo darwin linux CXXFLAGS: -I${SRCDIR}/deps/include
77
// #cgo LDFLAGS: -pthread -lv8
88
// #cgo windows LDFLAGS: -lv8_libplatform
9-
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/darwin-x86_64
10-
// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux-x86_64
9+
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/darwin_x86_64
10+
// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux_x86_64
1111
import "C"
12+
13+
// These imports forces `go mod vendor` to pull in all the folders that
14+
// contain V8 libraries and headers which otherwise would be ignored.
15+
// DO NOT REMOVE
16+
import (
17+
_ "rogchap.com/v8go/deps/darwin_x86_64"
18+
_ "rogchap.com/v8go/deps/include"
19+
_ "rogchap.com/v8go/deps/include/cppgc"
20+
_ "rogchap.com/v8go/deps/include/libplatform"
21+
_ "rogchap.com/v8go/deps/linux_x86_64"
22+
)

deps/build.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def v8deps():
7171

7272
def os_arch():
7373
u = platform.uname()
74-
return (u[0] + "-" + u[4]).lower()
74+
return (u[0] + "_" + u[4]).lower()
7575

7676
def main():
7777
v8deps()
File renamed without changes.

deps/darwin_x86_64/vendor.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package darwin_x86_64 is required to provide support for vendoring modules
2+
// DO NOT REMOVE
3+
package darwin_x86_64

deps/include/cppgc/vendor.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package cppgc is required to provide support for vendoring modules
2+
// DO NOT REMOVE
3+
package cppgc

deps/include/libplatform/vendor.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package libplatform is required to provide support for vendoring modules
2+
// DO NOT REMOVE
3+
package libplatform

deps/include/vendor.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package include is required to provide support for vendoring modules
2+
// DO NOT REMOVE
3+
package include
File renamed without changes.

deps/linux_x86_64/vendor.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package linux_x86_64 is required to provide support for vendoring modules
2+
// DO NOT REMOVE
3+
package linux_x86_64

go.sum

Whitespace-only changes.

0 commit comments

Comments
 (0)