summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-02-03 02:44:33 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-02-03 03:19:23 -0500
commit374311b891c587bbeb554057e04b55f69073d1af (patch)
tree9903718c323bfe42bba8e3a6a48d5629029b286e
parent56689b495618d3e8326b0a6c79f15aaf2b029d9c (diff)
Less magic in the build system; don't hide the go workspace.
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules20
-rw-r--r--GNUmakefile3
l---------LICENSE.bsd3.txt2
-rw-r--r--Makefile87
-rw-r--r--go/.gitignore2
m---------go/src/git.lukeshu.com/go/libgnulinux (renamed from go/git.lukeshu.com/go/libgnulinux)0
m---------go/src/git.lukeshu.com/go/libnslcd (renamed from go/git.lukeshu.com/go/libnslcd)0
m---------go/src/git.lukeshu.com/go/libsystemd (renamed from go/git.lukeshu.com/go/libsystemd)0
m---------go/src/golang.org/x/sys (renamed from go/golang.org/x/sys)0
m---------go/src/gopkg.in/yaml.v2 (renamed from go/gopkg.in/yaml.v2)0
-rw-r--r--go/src/nshd/.gitignore (renamed from go/nshd/.gitignore)0
-rw-r--r--go/src/nshd/main.go.in (renamed from go/nshd/main.go.in)0
-rw-r--r--go/src/nshd/nshd_files/.gitignore (renamed from go/nshd/nshd_files/.gitignore)0
-rw-r--r--go/src/nshd/nshd_files/passwords.go.in (renamed from go/nshd/nshd_files/passwords.go.in)0
-rw-r--r--go/src/nshd/nshd_files/users.go.in (renamed from go/nshd/nshd_files/users.go.in)0
-rw-r--r--go/src/nshd/nslcd_backend/db_config.go (renamed from go/nshd/nslcd_backend/db_config.go)0
-rw-r--r--go/src/nshd/nslcd_backend/db_group.go (renamed from go/nshd/nslcd_backend/db_group.go)0
-rw-r--r--go/src/nshd/nslcd_backend/db_pam.go (renamed from go/nshd/nslcd_backend/db_pam.go)0
-rw-r--r--go/src/nshd/nslcd_backend/db_passwd.go (renamed from go/nshd/nslcd_backend/db_passwd.go)0
-rw-r--r--go/src/nshd/nslcd_backend/db_shadow.go (renamed from go/nshd/nslcd_backend/db_shadow.go)0
-rw-r--r--go/src/nshd/nslcd_backend/hackers.go (renamed from go/nshd/nslcd_backend/hackers.go)0
-rw-r--r--go/src/nshd/nslcd_backend/util.go (renamed from go/nshd/nslcd_backend/util.go)0
-rw-r--r--go/src/nshd/util/util.go (renamed from go/nshd/util/util.go)0
24 files changed, 53 insertions, 62 deletions
diff --git a/.gitignore b/.gitignore
index 5c304e4..40f76d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,6 @@
/nshd.service
/nshd.sysusers
-/.gopath
*.o
*~
parabola-keyring-*
diff --git a/.gitmodules b/.gitmodules
index 434287e..5b9a9ba 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,15 +1,15 @@
-[submodule "go/gopkg.in/yaml.v2"]
- path = go/gopkg.in/yaml.v2
+[submodule "go/src/gopkg.in/yaml.v2"]
+ path = go/src/gopkg.in/yaml.v2
url = https://gopkg.in/yaml.v2/
-[submodule "go/git.lukeshu.com/go/libgnulinux"]
- path = go/git.lukeshu.com/go/libgnulinux
+[submodule "go/src/git.lukeshu.com/go/libgnulinux"]
+ path = go/src/git.lukeshu.com/go/libgnulinux
url = https://git.lukeshu.com/go/libgnulinux/
-[submodule "go/git.lukeshu.com/go/libnslcd"]
- path = go/git.lukeshu.com/go/libnslcd
+[submodule "go/src/git.lukeshu.com/go/libnslcd"]
+ path = go/src/git.lukeshu.com/go/libnslcd
url = https://git.lukeshu.com/go/libnslcd/
-[submodule "go/git.lukeshu.com/go/libsystemd"]
- path = go/git.lukeshu.com/go/libsystemd
+[submodule "go/src/git.lukeshu.com/go/libsystemd"]
+ path = go/src/git.lukeshu.com/go/libsystemd
url = https://git.lukeshu.com/go/libsystemd/
-[submodule "go/golang.org/x/sys"]
- path = go/golang.org/x/sys
+[submodule "go/src/golang.org/x/sys"]
+ path = go/src/golang.org/x/sys
url = https://go.googlesource.com/sys
diff --git a/GNUmakefile b/GNUmakefile
index cc5a40d..8b86fb9 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -4,10 +4,9 @@
# Most of the complexity is dancing around to avoid having any
# possibly conflicting identifiers.
-MAKEFLAGS += --no-print-directory
rest = $(wordlist 2,$(words $1),$1)
target = $(or $(firstword $(MAKECMDGOALS)),default)
$(or $(call rest,$(MAKECMDGOALS)),_$(target)): $(target)
@:
$(target):
- @+$(MAKE) -f Makefile --no-builtin-rules --no-builtin-variables $(MAKECMDGOALS)
+ @+$(MAKE) --no-print-directory -f Makefile --no-builtin-rules --no-builtin-variables $(MAKECMDGOALS)
diff --git a/LICENSE.bsd3.txt b/LICENSE.bsd3.txt
index 92d2b94..f33946f 120000
--- a/LICENSE.bsd3.txt
+++ b/LICENSE.bsd3.txt
@@ -1 +1 @@
-go/golang.org/x/sys/LICENSE \ No newline at end of file
+go/src/golang.org/x/sys/LICENSE \ No newline at end of file
diff --git a/Makefile b/Makefile
index f7f51ac..775b42a 100644
--- a/Makefile
+++ b/Makefile
@@ -17,9 +17,12 @@ include config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
files.src.src := $(filter-out go/golang.org/x/sys/plan9/% go/golang.org/x/sys/windows/%,$(files.src.src))
-var = .var.
-programs = nshd nshd-setuid nshd-tester common.rb
-scripts = $(filter-out %.c %.o $(programs) common.rb common.rb.in,$(notdir $(wildcard $(srcdir)/bin/*)))
+
+bins_c = nshd-setuid nshd-tester
+bins_go = nshd
+bins_lib = common.rb
+bins_script = $(filter-out %.c %.o %.in $(bins_c) $(bins_go) $(bins_lib),$(notdir $(wildcard $(srcdir)/bin/*)))
+bins = $(bins_c) $(bins_go) $(bins_lib) $(bins_script)
.PHONY: FORCE
.SECONDARY:
@@ -36,12 +39,6 @@ cgo_variables = CGO_ENABLED CGO_CFLAGS CGO_CPPFLAGS CGO_CXXFLAGS CGO_LDFLAGS CC
$(foreach v,$(cgo_variables),$(eval $v ?=))
export $(cgo_variables)
-$(outdir)/.gopath/src:
- rm -rf -- $(@D)
- mkdir $(@D)
- ln -sr $(srcdir)/go $@
- touch $@
-
#
# Generate (pre-tarball)
@@ -56,58 +53,52 @@ $(srcdir)/LICENSE.apache-2.0.txt: $(NET)
$(srcdir)/LICENSE.wtfpl-2.txt: $(NET)
curl http://www.wtfpl.net/txt/copying/ > $@
-files.generate: go-generate
-go-generate: .gopath/src
- +GOPATH=$(abspath $(outdir)/.gopath) go generate git.lukeshu.com/...
+$(outdir)/$(files.generate): go-generate
+go-generate:
+ +GOPATH=$(abspath $(srcdir)/go) go generate git.lukeshu.com/...
.PHONY: go-generate
-files.src.int += .gopath/ .gopath/*
at.targets += go-generate
#
# Build (post-tarball)
-files.out.all += $(addprefix bin/,$(programs)) nshd.service nshd.sysusers
-files.out.int += bin/*.o .gopath/ .gopath/* .tmp* .var*
+files.out.all += $(addprefix bin/,$(filter-out $(bins_script),$(bins))) nshd.service nshd.sysusers
+files.out.int += go/pkg/ go/bin/ go/bin/*
-# Dependencies
-$(outdir)/bin/nshd-setuid: -ldl
-$(outdir)/nshd.service: $(var)user $(var)bindir
-$(outdir)/nshd.sysusers: $(var)user
-$(outdir)/bin/common.rb: $(var)conf_file
-
-$(outdir)/.gopath/bin/nshd: \
- $(outdir)/go/nshd/main.go \
- $(outdir)/go/nshd/nshd_files/users.go \
- $(outdir)/go/nshd/nshd_files/passwords.go
-$(outdir)/go/nshd/main.go: $(var)conf_file
-$(outdir)/go/nshd/nshd_files/users.go: $(var)bindir
-$(outdir)/go/nshd/nshd_files/passwords.go: $(var)shadow_file
-
-# Go: copy out of .gopath
-$(outdir)/bin/nshd: \
-$(outdir)/bin/%: $(outdir)/.gopath/bin/%
+# Go
+$(addprefix %/bin/,$(bins_go)): %/src
+ GOPATH=$(abspath $*) go install $(bins_go)
+$(outdir)/bin/%: $(outdir)/go/bin/%
cp -T $< $@
-# Go: compile+link
-$(outdir)/.gopath/bin/nshd: \
-$(outdir)/.gopath/bin/%: FORCE go-generate
- GOPATH=$(abspath $(outdir)/.gopath) go install $(@F)
-
-# C: compile
-$(outdir)/%.o: $(srcdir)/%.c $(var)CC $(var)CPPFLAGS $(var)CFLAGS
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(filter-out $(var)%,$^)
-# C: link
-$(outdir)/bin/nshd-tester $(outdir)/bin/nshd-setuid: \
-$(outdir)/%: $(outdir)/%.o $(var)CC $(var)LDFLAGS
- $(CC) $(LDFLAGS) -o $@ $(filter-out $(var)%,$^)
-
+# C
+$(addprefix $(outdir)/bin/,$(bins_c)): \
+$(outdir)/%: $(srcdir)/%.c $(var.)CC $(var.)CPPFLAGS $(var.)CFLAGS
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(filter-out $(var.)%,$^)
# Basic variable substitution
$(outdir)/%: $(srcdir)/%.in
- < $< sed $(foreach v,$(patsubst $(var)%,%,$(filter $(var)%,$^)), -e 's|@$v@|$($v)|g' ) > $@
+ < $< sed $(foreach v,$(patsubst $(var.)%,%,$(filter $(var.)%,$^)), -e 's|@$v@|$($v)|g' ) > $@
+
+# Dependencies
+$(outdir)/bin/nshd-setuid: -ldl
+$(outdir)/nshd.service: $(var.)user $(var.)bindir
+$(outdir)/nshd.sysusers: $(var.)user
+$(outdir)/bin/common.rb: $(var.)conf_file
+
+$(outdir)/go/src/nshd/main.go: $(var.)conf_file
+$(outdir)/go/src/nshd/nshd_files/users.go: $(var.)bindir
+$(outdir)/go/src/nshd/nshd_files/passwords.go: $(var.)shadow_file
+
+goconf = \
+ $(outdir)/go/src/nshd/main.go \
+ $(outdir)/go/src/nshd/nshd_files/users.go \
+ $(outdir)/go/src/nshd/nshd_files/passwords.go
+$(outdir)/go/bin/nshd: $(goconf) $(outdir)/$(files.generate)
+files.out.all += $(goconf)
# Install
-files.sys.all += $(addprefix $(bindir)/,$(programs) $(scripts)) $(systemunitdir)/nshd.socket $(systemunitdir)/nshd.service $(sysusersdir)/nshd.conf $(conf_file) $(shadow_file)
+files.sys.all += $(addprefix $(bindir)/,$(bins)) $(systemunitdir)/nshd.socket $(systemunitdir)/nshd.service $(sysusersdir)/nshd.conf $(conf_file) $(shadow_file)
$(DESTDIR)$(bindir)/%: $(outdir)/bin/%
$(NORMAL_INSTALL)
@@ -129,7 +120,7 @@ $(DESTDIR)$(bindir)/common.rb: $(srcdir)/bin/common.rb
$(DESTDIR)$(conf_file): $(srcdir)/parabola-hackers.yml
$(NORMAL_INSTALL)
install -TDm644 $< $@
-$(DESTDIR)$(shadow_file): $(var)user $(DESTDIR)$(sysusersdir)/nshd.conf
+$(DESTDIR)$(shadow_file): $(var.)user $(DESTDIR)$(sysusersdir)/nshd.conf
$(NORMAL_INSTALL)
install -d $(@D)
touch $@
diff --git a/go/.gitignore b/go/.gitignore
new file mode 100644
index 0000000..4c48abf
--- /dev/null
+++ b/go/.gitignore
@@ -0,0 +1,2 @@
+/pkg/
+/bin/
diff --git a/go/git.lukeshu.com/go/libgnulinux b/go/src/git.lukeshu.com/go/libgnulinux
-Subproject b2bae3c73817740b48a4698c6aa863d70234a64
+Subproject b2bae3c73817740b48a4698c6aa863d70234a64
diff --git a/go/git.lukeshu.com/go/libnslcd b/go/src/git.lukeshu.com/go/libnslcd
-Subproject 939ef442f33dadf17f60ebf9f0c1fbaaa27f0c6
+Subproject 939ef442f33dadf17f60ebf9f0c1fbaaa27f0c6
diff --git a/go/git.lukeshu.com/go/libsystemd b/go/src/git.lukeshu.com/go/libsystemd
-Subproject 1ac9db65fda0693d13336e6471a858914348f2f
+Subproject 1ac9db65fda0693d13336e6471a858914348f2f
diff --git a/go/golang.org/x/sys b/go/src/golang.org/x/sys
-Subproject d75a52659825e75fff6158388dddc6a5b04f9ba
+Subproject d75a52659825e75fff6158388dddc6a5b04f9ba
diff --git a/go/gopkg.in/yaml.v2 b/go/src/gopkg.in/yaml.v2
-Subproject f7716cbe52baa25d2e9b0d0da546fcf909fc16b
+Subproject f7716cbe52baa25d2e9b0d0da546fcf909fc16b
diff --git a/go/nshd/.gitignore b/go/src/nshd/.gitignore
index 00870e2..00870e2 100644
--- a/go/nshd/.gitignore
+++ b/go/src/nshd/.gitignore
diff --git a/go/nshd/main.go.in b/go/src/nshd/main.go.in
index 5564128..5564128 100644
--- a/go/nshd/main.go.in
+++ b/go/src/nshd/main.go.in
diff --git a/go/nshd/nshd_files/.gitignore b/go/src/nshd/nshd_files/.gitignore
index 3be3f08..3be3f08 100644
--- a/go/nshd/nshd_files/.gitignore
+++ b/go/src/nshd/nshd_files/.gitignore
diff --git a/go/nshd/nshd_files/passwords.go.in b/go/src/nshd/nshd_files/passwords.go.in
index 679f7c0..679f7c0 100644
--- a/go/nshd/nshd_files/passwords.go.in
+++ b/go/src/nshd/nshd_files/passwords.go.in
diff --git a/go/nshd/nshd_files/users.go.in b/go/src/nshd/nshd_files/users.go.in
index 51703fd..51703fd 100644
--- a/go/nshd/nshd_files/users.go.in
+++ b/go/src/nshd/nshd_files/users.go.in
diff --git a/go/nshd/nslcd_backend/db_config.go b/go/src/nshd/nslcd_backend/db_config.go
index d00bf02..d00bf02 100644
--- a/go/nshd/nslcd_backend/db_config.go
+++ b/go/src/nshd/nslcd_backend/db_config.go
diff --git a/go/nshd/nslcd_backend/db_group.go b/go/src/nshd/nslcd_backend/db_group.go
index 04c7e3b..04c7e3b 100644
--- a/go/nshd/nslcd_backend/db_group.go
+++ b/go/src/nshd/nslcd_backend/db_group.go
diff --git a/go/nshd/nslcd_backend/db_pam.go b/go/src/nshd/nslcd_backend/db_pam.go
index b704620..b704620 100644
--- a/go/nshd/nslcd_backend/db_pam.go
+++ b/go/src/nshd/nslcd_backend/db_pam.go
diff --git a/go/nshd/nslcd_backend/db_passwd.go b/go/src/nshd/nslcd_backend/db_passwd.go
index ace127e..ace127e 100644
--- a/go/nshd/nslcd_backend/db_passwd.go
+++ b/go/src/nshd/nslcd_backend/db_passwd.go
diff --git a/go/nshd/nslcd_backend/db_shadow.go b/go/src/nshd/nslcd_backend/db_shadow.go
index ab1d68f..ab1d68f 100644
--- a/go/nshd/nslcd_backend/db_shadow.go
+++ b/go/src/nshd/nslcd_backend/db_shadow.go
diff --git a/go/nshd/nslcd_backend/hackers.go b/go/src/nshd/nslcd_backend/hackers.go
index 44107b2..44107b2 100644
--- a/go/nshd/nslcd_backend/hackers.go
+++ b/go/src/nshd/nslcd_backend/hackers.go
diff --git a/go/nshd/nslcd_backend/util.go b/go/src/nshd/nslcd_backend/util.go
index aa29b03..aa29b03 100644
--- a/go/nshd/nslcd_backend/util.go
+++ b/go/src/nshd/nslcd_backend/util.go
diff --git a/go/nshd/util/util.go b/go/src/nshd/util/util.go
index 4d3fd57..4d3fd57 100644
--- a/go/nshd/util/util.go
+++ b/go/src/nshd/util/util.go