-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from ferrouswheel/xgo
Support cross compilation with xgo
- Loading branch information
Showing
5 changed files
with
63 additions
and
5 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
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,29 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) | ||
pushd $PARENT_PATH | ||
|
||
# Make sure we have xgo | ||
go get -u github.com/karalabe/xgo | ||
|
||
# Apply patch for OSX, Go 1.10 and old notify version | ||
# https://stackoverflow.com/questions/54064293/cannot-use-nil-as-type-ctype-cfallocatorref-in-argument-to-func-literal | ||
# Can be removed if we upgrade notify (which probably requires upgrading go-ethereum etc.) | ||
pushd vendor/github.com/rjeczalik/notify | ||
patch -N < $PARENT_PATH/scripts/watcher_fsevents_cgo.go.patch || true | ||
popd | ||
|
||
mkdir -p build | ||
|
||
# Stuck on Go 1.10.x until https://github.com/singnet/snet-daemon/issues/201 is resolved. | ||
GO_VERSION=1.10.x | ||
|
||
# All targets compiled when Joel tried (2019-March), but we probably don't want to build them all! | ||
#TARGETS=*/* | ||
|
||
# See here for details | ||
# https://github.com/karalabe/xgo#limit-build-targets | ||
TARGETS=linux/amd64,linux/arm-6,darwin-10.6/amd64,windows/amd64 | ||
xgo -dest build -go $GO_VERSION -targets=$TARGETS ./snetd |
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,22 @@ | ||
--- /home/joel/Downloads/watcher_fsevents_cgo.go 2019-03-20 13:14:12.643748593 +1300 | ||
+++ watcher_fsevents_cgo.go 2019-03-20 12:49:33.489170174 +1300 | ||
@@ -48,7 +48,7 @@ | ||
// started and is ready via the wg. It also serves purpose of a dummy source, | ||
// thanks to it the runloop does not return as it also has at least one source | ||
// registered. | ||
-var source = C.CFRunLoopSourceCreate(nil, 0, &C.CFRunLoopSourceContext{ | ||
+var source = C.CFRunLoopSourceCreate(C.kCFAllocatorDefault, 0, &C.CFRunLoopSourceContext{ | ||
perform: (C.CFRunLoopPerformCallBack)(C.gosource), | ||
}) | ||
|
||
@@ -162,8 +162,8 @@ | ||
return nil | ||
} | ||
wg.Wait() | ||
- p := C.CFStringCreateWithCStringNoCopy(nil, C.CString(s.path), C.kCFStringEncodingUTF8, nil) | ||
- path := C.CFArrayCreate(nil, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil) | ||
+ p := C.CFStringCreateWithCStringNoCopy(C.kCFAllocatorDefault, C.CString(s.path), C.kCFStringEncodingUTF8, C.kCFAllocatorDefault) | ||
+ path := C.CFArrayCreate(C.kCFAllocatorDefault, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil) | ||
ctx := C.FSEventStreamContext{} | ||
ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags) | ||
if ref == nilstream { |
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