diff options
Diffstat (limited to 'go')
-rw-r--r-- | go/Makefile | 2 | ||||
-rwxr-xr-x | go/cgo-required.sh | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/go/Makefile b/go/Makefile index 363b664..31906fc 100644 --- a/go/Makefile +++ b/go/Makefile @@ -48,7 +48,7 @@ compare-cap: compare-cap.go $(CAPGOPACKAGE) CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(realpath .) go build $< web: web.go $(CAPGOPACKAGE) - CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(realpath .) go build $< + CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(realpath .) go build $< clean: GOPATH=$(realpath .) go clean -x -i libcap/cap 2> /dev/null || exit 0 diff --git a/go/cgo-required.sh b/go/cgo-required.sh new file mode 100755 index 0000000..8f22d43 --- /dev/null +++ b/go/cgo-required.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Runtime check for whether or not syscall.PosixSyscall is available to +# the working go runtime or not. If it isn't we always have to use +# libcap/psx to get POSIX semantics for syscalls that change security +# state. + +if [ -z "$(go doc syscall 2>/dev/null|grep PosixSyscall)" ]; then + echo "1" +else + echo "0" +fi |