Skip to content

Commit

Permalink
Support for go mod vendor (#60)
Browse files Browse the repository at this point in the history
* Support for go mod vendor

* Update changelog

* make sure build uses underscore rather than dash
  • Loading branch information
rogchap committed Dec 24, 2020
1 parent 186af62 commit bcfd2d6
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Value methods for checking value kind (is string, number, array etc)
- C formatting via `clang-format` to aid future development
- Support of vendoring with `go mod vendor`

### Changed
- Use g++ (default for cgo) for linux builds of the static v8 lib
Expand Down
15 changes: 13 additions & 2 deletions cgo.go
Expand Up @@ -6,6 +6,17 @@ package v8go
// #cgo darwin linux CXXFLAGS: -I${SRCDIR}/deps/include
// #cgo LDFLAGS: -pthread -lv8
// #cgo windows LDFLAGS: -lv8_libplatform
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/darwin-x86_64
// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux-x86_64
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/darwin_x86_64
// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux_x86_64
import "C"

// These imports forces `go mod vendor` to pull in all the folders that
// contain V8 libraries and headers which otherwise would be ignored.
// DO NOT REMOVE
import (
_ "rogchap.com/v8go/deps/darwin_x86_64"
_ "rogchap.com/v8go/deps/include"
_ "rogchap.com/v8go/deps/include/cppgc"
_ "rogchap.com/v8go/deps/include/libplatform"
_ "rogchap.com/v8go/deps/linux_x86_64"
)
2 changes: 1 addition & 1 deletion deps/build.py
Expand Up @@ -71,7 +71,7 @@ def v8deps():

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

def main():
v8deps()
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions deps/darwin_x86_64/vendor.go
@@ -0,0 +1,3 @@
// Package darwin_x86_64 is required to provide support for vendoring modules
// DO NOT REMOVE
package darwin_x86_64
3 changes: 3 additions & 0 deletions deps/include/cppgc/vendor.go
@@ -0,0 +1,3 @@
// Package cppgc is required to provide support for vendoring modules
// DO NOT REMOVE
package cppgc
3 changes: 3 additions & 0 deletions deps/include/libplatform/vendor.go
@@ -0,0 +1,3 @@
// Package libplatform is required to provide support for vendoring modules
// DO NOT REMOVE
package libplatform
3 changes: 3 additions & 0 deletions deps/include/vendor.go
@@ -0,0 +1,3 @@
// Package include is required to provide support for vendoring modules
// DO NOT REMOVE
package include
File renamed without changes.
3 changes: 3 additions & 0 deletions deps/linux_x86_64/vendor.go
@@ -0,0 +1,3 @@
// Package linux_x86_64 is required to provide support for vendoring modules
// DO NOT REMOVE
package linux_x86_64
Empty file added go.sum
Empty file.

0 comments on commit bcfd2d6

Please sign in to comment.