aboutsummaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2020-07-03 15:27:09 -0700
committerAndrew G. Morgan <morgan@kernel.org>2020-07-03 15:40:58 -0700
commitffa7df01d30b5e4c26eb955d9baf76a7c8e0d1b1 (patch)
tree6f4740f784786289890cedf53521755321defe4a /go
parentb0d13e87db7ac821e6688cb32078cf7393d3f202 (diff)
downloadplatform_external_libcap-ffa7df01d30b5e4c26eb955d9baf76a7c8e0d1b1.tar.gz
platform_external_libcap-ffa7df01d30b5e4c26eb955d9baf76a7c8e0d1b1.tar.bz2
platform_external_libcap-ffa7df01d30b5e4c26eb955d9baf76a7c8e0d1b1.zip
Refactored the psx package to build as a Go module.
Cleaned up the Go module redirection html file, now installed at: https://kernel.org/pub/linux/libs/security/libcap/ Note, I've moved the C source for libpsx.a into the psx/ directory, but the libpsx.a file is still built in the libcap subdirectory as before. I also symlinked the C include files from the psx/ directory. This made the source compile in conjuction with the "psx" Go package automatically. It also substantially simplified the go/Makefile. I feel pretty good about this next version from the perspective of a viable "psx" build. Caveat the need for CGO_LDFLAGS_ALLOW on the command line pre-go1.15. Hopefully, the psx package comment is enough for folk to figure that detail out. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'go')
-rw-r--r--go/Makefile22
-rw-r--r--go/go-mod-index.html16
2 files changed, 27 insertions, 11 deletions
diff --git a/go/Makefile b/go/Makefile
index e8008d0..d01fb05 100644
--- a/go/Makefile
+++ b/go/Makefile
@@ -27,12 +27,12 @@ $(DEPS):
make -C ../progs capsh
src/$(IMPORTDIR)/psx:
- mkdir -p src/$(IMPORTDIR)
- ln -s $(topdir)/psx src/$(IMPORTDIR)
+ mkdir -p "src/$(IMPORTDIR)"
+ ln -s $(topdir)/psx $@
src/$(IMPORTDIR)/cap:
- mkdir -p src/$(IMPORTDIR)
- ln -s $(topdir)/cap src/$(IMPORTDIR)
+ mkdir -p "src/$(IMPORTDIR)"
+ ln -s $(topdir)/cap $@
$(topdir)/libcap/cap_names.h: $(DEPS)
make -C $(topdir)/libcap all
@@ -43,10 +43,10 @@ good-names.go: $(topdir)/libcap/cap_names.h src/$(IMPORTDIR)/cap mknames.go
$(PSXGOPACKAGE): src/$(IMPORTDIR)/psx ../psx/*.go $(DEPS)
mkdir -p pkg
- CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH="$(GOPATH)" $(GO) install $(IMPORTDIR)/psx
+ CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) install $(IMPORTDIR)/psx
$(CAPGOPACKAGE): src/$(IMPORTDIR)/cap ../cap/*.go good-names.go $(PSXGOPACKAGE)
- CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) install $(IMPORTDIR)/cap
+ CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) install $(IMPORTDIR)/cap
# Compiles something with this package to compare it to libcap. This
# tests more when run under sudotest (see ../progs/quicktest.sh for that).
@@ -54,7 +54,7 @@ compare-cap: compare-cap.go $(CAPGOPACKAGE)
CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build $<
web: web.go $(CAPGOPACKAGE)
- CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build $(GOBUILDTAG) $<
+ CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) build $(GOBUILDTAG) $<
ifeq ($(RAISE_GO_FILECAP),yes)
make -C ../progs setcap
sudo ../progs/setcap cap_setpcap,cap_net_bind_service=p web
@@ -65,14 +65,14 @@ ok: ok.go
CGO_ENABLED=0 GOPATH=$(GOPATH) $(GO) build $<
try-launching: try-launching.go $(CAPGOPACKAGE) ok
- CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build $(GOBUILDTAG) $<
+ CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) build $(GOBUILDTAG) $<
ifeq ($(CGO_REQUIRED),0)
- CGO_ENABLED="1" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build -o $@-cgo $<
+ CGO_ENABLED="1" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) build -o $@-cgo $<
endif
test: all ../progs/capsh
- CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/psx
- CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) test $(IMPORTDIR)/cap
+ CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/psx
+ CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/cap
LD_LIBRARY_PATH=../libcap ./compare-cap
./try-launching
ifeq ($(CGO_REQUIRED),0)
diff --git a/go/go-mod-index.html b/go/go-mod-index.html
new file mode 100644
index 0000000..9cfe13f
--- /dev/null
+++ b/go/go-mod-index.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<meta name="go-import" content="kernel.org/pub/linux/libs/security/libcap git https://git.kernel.org/pub/scm/libs/libcap/libcap.git">
+<meta http-equiv="refresh" content="10; url=https://sites.google.com/site/fullycapable">
+</head>
+<body>
+ Redirecting in 10 seconds to
+ the <a href="https://sites.google.com/site/fullycapable">Fully
+ Capable</a> project page, the home of these Go packages:
+ <ul>
+ <li><tt>"kernel.org/pub/linux/libs/security/libcap/psx"</tt></li>
+ <li><tt>"kernel.org/pub/linux/libs/security/libcap/cap"</tt></li>
+</body>
+</html>