summaryrefslogtreecommitdiff
path: root/Makefile
blob: 88312b5a9492dda9c738c0033f66ffa81acce7bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.PHONY: debian

run: build
	# ./control-panel-dns >/tmp/witgui.log.stderr 2>&1
	cp -f control-panel-dns ~/
	# ./control-panel-dns --tmp-log
	./control-panel-dns

stderr: build
	./control-panel-dns >/tmp/witgui.log.stderr 2>&1

gocui: build
	reset
	# ./gadgetwindow --gui gocui >/tmp/gadgetwindow.stderr 2>&1
	./control-panel-dns --gui gocui --tmp-log

goimports:
	goimports -w *.go

check-git-clean:
	@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)

redomod:
	rm -f go.*
	GO111MODULE= go mod init
	GO111MODULE= go mod tidy

install:
	go install -v go.wit.com/control-panel-dns@latest
	# go install -v go.wit.com/control-panel-dns@latest

build-release:
	reset
	go get -v -u -x .
	go build

# This will update all your git repos to HEAD
goGetUpdate:
	GO111MODULE="off" go get -v -u .

build:
	-mkdir -p resources/
	-cp ~/go/src/go.wit.com/toolkits/*.so resources/
	GO111MODULE="off" go build -v

# ./control-panel-dns.v1: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./control-panel-dns.v1)
# ./control-panel-dns.v1: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./control-panel-dns.v1)
# compiling with CGO disabled means it compiles but then plugins don't load
GLIBC_2.34-error:
	GO111MODULE="off" CGO_ENABLED=0 go build -v -o control-panel-dns

test:
	GO111MODULE="off" go test -v

update:
	GO111MODULE="off" go get -v -u -x .

clean:
	-rm control-panel-dns
	-rm -rf files/
	-rm -f resources/*.so
	-rm *.deb

debian:
	cd debian && make
	-wit mirrors

netlink:
	GO111MODULE="off" go get -v -u github.com/vishvananda/netlink


####### MODULE STUFF DOWN HERE
#
#       What again is the 'right' way to do this?
#       It seems like it changes from year to year. This is better than 'vendor/' (that was a terrible hack)
#       maybe it's settled down finally. Use GO111MODULE="off" when you are developing. (?)
#       When you are ready to release, version this and all the packages correctly. (?)
#
#       At least, that is what I'm going to try to do as of Feb 18 2023.
#


build-with-custom-go.mod:
	go build -modfile=local.go.mod ./...

# module <yourname>
# go 1.18
# require (
#     github.com/versent/saml2aws/v2 v2.35.0
# )
# replace github.com/versent/saml2aws/v2 v2.35.0 => github.com/marcottedan/saml2aws/v2 master
# replace github.com/versent/saml2aws/v2 => /Users/dmarcotte/git/saml2aws/
#
	# https://crt.sh/?q=check.lab.wit.com
	# # https://letsencrypt.org/certificates/
	# openssl s_client -connect check.lab.wit.com:443 -showcerts
	# openssl s_client -CApath /etc/ssl/certs/ -connect check.lab.wit.com:443 -showcerts -trace -debug
	# openssl s_client -CAfile isrgrootx1.pem -connect check.lab.wit.com:443 -showcerts
	# cat isrgrootx1.pem lets-encrypt-r3.pem > full-chain.pem
	# full-chain.pem
	# openssl s_client -CAfile /etc/ssl/certs/wit-full-chain.pem -connect check.lab.wit.com:443 -showcerts
check-cert:
	reset
	openssl s_client -CApath /etc/ssl/certs/ -connect go.wit.com:443 -showcerts

ssl-cert-hash:
	openssl x509 -hash -noout -in wit-full-chain.pem
	# cd /etc/ssl/certs && ln -s wit-full-chain.pem 4042bcee.0
	openssl x509 -hash -noout -in isrgrootx1.pem
	openssl x509 -hash -noout -in lets-encrypt-r3.pem

sudo-cp:
	sudo cp -a lets-encrypt-r3.pem 8d33f237.0 /etc/ssl/certs/

go-get:
	go install -v go.wit.com/gui

log:
	reset
	tail -f /tmp/witgui.* /tmp/guilogfile

# sync repo to the github backup
github:
	-git remote add github [email protected]:wit-go/control-panel-dns.git
	-git branch -M main
	git push origin main
	git push origin devel
	git push origin --tags
	git push github main
	git push github devel
	git push github --tags