mirror of
https://github.com/mjl-/mox.git
synced 2024-12-25 16:03:48 +03:00
get rid of some more gnulinuxisms
to get builds on openbsd going
This commit is contained in:
parent
661e77c622
commit
0977b7a6d3
8 changed files with 125 additions and 46 deletions
66
Makefile
66
Makefile
|
@ -43,7 +43,7 @@ test-upgrade: build
|
||||||
|
|
||||||
# needed for "check" target
|
# needed for "check" target
|
||||||
install-staticcheck:
|
install-staticcheck:
|
||||||
go install honnef.co/go/tools/cmd/staticcheck@latest
|
CGO_ENABLED=0 go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||||
|
|
||||||
check:
|
check:
|
||||||
CGO_ENABLED=0 go vet -tags integration
|
CGO_ENABLED=0 go vet -tags integration
|
||||||
|
@ -52,25 +52,25 @@ check:
|
||||||
CGO_ENABLED=0 go vet -tags errata rfc/errata.go
|
CGO_ENABLED=0 go vet -tags errata rfc/errata.go
|
||||||
CGO_ENABLED=0 go vet -tags xr rfc/xr.go
|
CGO_ENABLED=0 go vet -tags xr rfc/xr.go
|
||||||
GOARCH=386 CGO_ENABLED=0 go vet ./...
|
GOARCH=386 CGO_ENABLED=0 go vet ./...
|
||||||
staticcheck ./...
|
CGO_ENABLED=0 staticcheck ./...
|
||||||
staticcheck -tags integration
|
CGO_ENABLED=0 staticcheck -tags integration
|
||||||
staticcheck -tags website website/website.go
|
CGO_ENABLED=0 staticcheck -tags website website/website.go
|
||||||
staticcheck -tags link rfc/link.go
|
CGO_ENABLED=0 staticcheck -tags link rfc/link.go
|
||||||
staticcheck -tags errata rfc/errata.go
|
CGO_ENABLED=0 staticcheck -tags errata rfc/errata.go
|
||||||
staticcheck -tags xr rfc/xr.go
|
CGO_ENABLED=0 staticcheck -tags xr rfc/xr.go
|
||||||
|
|
||||||
# needed for check-shadow
|
# needed for check-shadow
|
||||||
install-shadow:
|
install-shadow:
|
||||||
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
|
CGO_ENABLED=0 go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
|
||||||
|
|
||||||
# having "err" shadowed is common, best to not have others
|
# having "err" shadowed is common, best to not have others
|
||||||
check-shadow:
|
check-shadow:
|
||||||
go vet -vettool=$$(which shadow) ./... 2>&1 | grep -v '"err"'
|
CGO_ENABLED=0 go vet -vettool=$$(which shadow) ./... 2>&1 | grep -v '"err"'
|
||||||
go vet -tags integration -vettool=$$(which shadow) 2>&1 | grep -v '"err"'
|
CGO_ENABLED=0 go vet -tags integration -vettool=$$(which shadow) 2>&1 | grep -v '"err"'
|
||||||
go vet -tags website -vettool=$$(which shadow) website/website.go 2>&1 | grep -v '"err"'
|
CGO_ENABLED=0 go vet -tags website -vettool=$$(which shadow) website/website.go 2>&1 | grep -v '"err"'
|
||||||
go vet -tags link -vettool=$$(which shadow) rfc/link.go 2>&1 | grep -v '"err"'
|
CGO_ENABLED=0 go vet -tags link -vettool=$$(which shadow) rfc/link.go 2>&1 | grep -v '"err"'
|
||||||
go vet -tags errata -vettool=$$(which shadow) rfc/errata.go 2>&1 | grep -v '"err"'
|
CGO_ENABLED=0 go vet -tags errata -vettool=$$(which shadow) rfc/errata.go 2>&1 | grep -v '"err"'
|
||||||
go vet -tags xr -vettool=$$(which shadow) rfc/xr.go 2>&1 | grep -v '"err"'
|
CGO_ENABLED=0 go vet -tags xr -vettool=$$(which shadow) rfc/xr.go 2>&1 | grep -v '"err"'
|
||||||
|
|
||||||
fuzz:
|
fuzz:
|
||||||
go test -fuzz FuzzParseSignature -fuzztime 5m ./dkim
|
go test -fuzz FuzzParseSignature -fuzztime 5m ./dkim
|
||||||
|
@ -125,24 +125,24 @@ install-js0:
|
||||||
npm install --ignore-scripts --save-dev --save-exact typescript@5.1.6
|
npm install --ignore-scripts --save-dev --save-exact typescript@5.1.6
|
||||||
|
|
||||||
webmail/webmail.js: lib.ts webmail/api.ts webmail/lib.ts webmail/webmail.ts
|
webmail/webmail.js: lib.ts webmail/api.ts webmail/lib.ts webmail/webmail.ts
|
||||||
./tsc.sh $@ $^
|
./tsc.sh $@ lib.ts webmail/api.ts webmail/lib.ts webmail/webmail.ts
|
||||||
|
|
||||||
webmail/msg.js: lib.ts webmail/api.ts webmail/lib.ts webmail/msg.ts
|
webmail/msg.js: lib.ts webmail/api.ts webmail/lib.ts webmail/msg.ts
|
||||||
./tsc.sh $@ $^
|
./tsc.sh $@ lib.ts webmail/api.ts webmail/lib.ts webmail/msg.ts
|
||||||
|
|
||||||
webmail/text.js: lib.ts webmail/api.ts webmail/lib.ts webmail/text.ts
|
webmail/text.js: lib.ts webmail/api.ts webmail/lib.ts webmail/text.ts
|
||||||
./tsc.sh $@ $^
|
./tsc.sh $@ lib.ts webmail/api.ts webmail/lib.ts webmail/text.ts
|
||||||
|
|
||||||
webadmin/admin.js: lib.ts webadmin/api.ts webadmin/admin.ts
|
webadmin/admin.js: lib.ts webadmin/api.ts webadmin/admin.ts
|
||||||
./tsc.sh $@ $^
|
./tsc.sh $@ lib.ts webadmin/api.ts webadmin/admin.ts
|
||||||
|
|
||||||
webaccount/account.js: lib.ts webaccount/api.ts webaccount/account.ts
|
webaccount/account.js: lib.ts webaccount/api.ts webaccount/account.ts
|
||||||
./tsc.sh $@ $^
|
./tsc.sh $@ lib.ts webaccount/api.ts webaccount/account.ts
|
||||||
|
|
||||||
frontend: node_modules/.bin/tsc webadmin/admin.js webaccount/account.js webmail/webmail.js webmail/msg.js webmail/text.js
|
frontend: node_modules/.bin/tsc webadmin/admin.js webaccount/account.js webmail/webmail.js webmail/msg.js webmail/text.js
|
||||||
|
|
||||||
install-apidiff:
|
install-apidiff:
|
||||||
go install golang.org/x/exp/cmd/apidiff@v0.0.0-20231206192017-f3f8817b8deb
|
CGO_ENABLED=0 go install golang.org/x/exp/cmd/apidiff@v0.0.0-20231206192017-f3f8817b8deb
|
||||||
|
|
||||||
genapidiff:
|
genapidiff:
|
||||||
./apidiff.sh
|
./apidiff.sh
|
||||||
|
@ -157,17 +157,17 @@ genwebsite:
|
||||||
./genwebsite.sh
|
./genwebsite.sh
|
||||||
|
|
||||||
buildall:
|
buildall:
|
||||||
GOOS=linux GOARCH=arm go build
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build
|
||||||
GOOS=linux GOARCH=arm64 go build
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build
|
||||||
GOOS=linux GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||||
GOOS=linux GOARCH=386 go build
|
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build
|
||||||
GOOS=openbsd GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 go build
|
||||||
GOOS=freebsd GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build
|
||||||
GOOS=netbsd GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=netbsd GOARCH=amd64 go build
|
||||||
GOOS=darwin GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build
|
||||||
GOOS=dragonfly GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=dragonfly GOARCH=amd64 go build
|
||||||
GOOS=illumos GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=illumos GOARCH=amd64 go build
|
||||||
GOOS=solaris GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=solaris GOARCH=amd64 go build
|
||||||
GOOS=aix GOARCH=ppc64 go build
|
CGO_ENABLED=0 GOOS=aix GOARCH=ppc64 go build
|
||||||
GOOS=windows GOARCH=amd64 go build
|
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build
|
||||||
# no plan9 for now
|
# no plan9 for now
|
||||||
|
|
|
@ -26,7 +26,7 @@ any parameters. Followed by the help and usage information for each command.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
./mox 2>&1 | sed -e 's/^usage: */\t/' -e 's/^ */\t/'
|
./mox 2>&1 | sed -e 's/^usage: */ /' -e 's/^ */ /'
|
||||||
echo
|
echo
|
||||||
./mox helpall 2>&1
|
./mox helpall 2>&1
|
||||||
|
|
||||||
|
@ -80,14 +80,14 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||||
# mox.conf
|
# mox.conf
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
./mox config describe-static | sed 's/^/\t/'
|
./mox config describe-static | sed 's/^/ /'
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
# domains.conf
|
# domains.conf
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
./mox config describe-domains | sed 's/^/\t/'
|
./mox config describe-domains | sed 's/^/ /'
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ EOF
|
||||||
for ex in $(./mox config example); do
|
for ex in $(./mox config example); do
|
||||||
echo '# Example '$ex
|
echo '# Example '$ex
|
||||||
echo
|
echo
|
||||||
./mox config example $ex | sed 's/^/\t/'
|
./mox config example $ex | sed 's/^/ /'
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@ fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
for number in $(sed -n 's/^\([0-9][0-9]*\)[ \t].*$/\1/p' index.txt); do
|
for number in $(sed -n 's/^\([0-9][0-9]*\)[ ].*$/\1/p' index.txt); do
|
||||||
if ! test -f "$number"; then
|
if ! test -f "$number"; then
|
||||||
curl https://www.rfc-editor.org/rfc/rfc$number.txt >$number || rm $number
|
curl https://www.rfc-editor.org/rfc/rfc$number.txt >$number || rm $number
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for name in $(sed -n 's/^\([0-9][0-9]*-eid[0-9][0-9]*\)[ \t].*$/\1/p' index.txt); do
|
for name in $(sed -n 's/^\([0-9][0-9]*-eid[0-9][0-9]*\)[ ].*$/\1/p' index.txt); do
|
||||||
if ! test -f "$name"; then
|
if ! test -f "$name"; then
|
||||||
rfc=$(echo $name | cut -f1 -d-)
|
rfc=$(echo $name | cut -f1 -d-)
|
||||||
eid=$(echo $name | cut -f2 -d-)
|
eid=$(echo $name | cut -f2 -d-)
|
||||||
|
|
2
tsc.sh
2
tsc.sh
|
@ -8,5 +8,5 @@ set -euo pipefail
|
||||||
out=$1
|
out=$1
|
||||||
shift
|
shift
|
||||||
./node_modules/.bin/tsc --noEmitOnError true --pretty false --newLine lf --strict --allowUnreachableCode false --allowUnusedLabels false --noFallthroughCasesInSwitch true --noImplicitReturns true --noUnusedLocals true --noImplicitThis true --noUnusedParameters true --target es2022 --module none --outFile $out.spaces "$@" | sed -E 's/^([^\(]+)\(([0-9]+),([0-9]+)\):/\1:\2:\3: /'
|
./node_modules/.bin/tsc --noEmitOnError true --pretty false --newLine lf --strict --allowUnreachableCode false --allowUnusedLabels false --noFallthroughCasesInSwitch true --noImplicitReturns true --noUnusedLocals true --noImplicitThis true --noUnusedParameters true --target es2022 --module none --outFile $out.spaces "$@" | sed -E 's/^([^\(]+)\(([0-9]+),([0-9]+)\):/\1:\2:\3: /'
|
||||||
unexpand -t4 <$out.spaces >$out
|
CGO_ENABLED=0 go run unexpand.go -t 4 <$out.spaces >$out
|
||||||
rm $out.spaces
|
rm $out.spaces
|
||||||
|
|
79
unexpand.go
Normal file
79
unexpand.go
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
//go:build tools
|
||||||
|
// +build tools
|
||||||
|
|
||||||
|
// For unexpand the 4 spaces that the typescript compiler outputs into tabs.
|
||||||
|
// Not all unexpand commands implement the -t flag (openbsd).
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func xcheckf(err error, format string, args ...any) {
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("%s: %s", fmt.Sprintf(format, args...), err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
log.SetFlags(0)
|
||||||
|
var width int
|
||||||
|
flag.IntVar(&width, "t", 8, "tab width")
|
||||||
|
flag.Parse()
|
||||||
|
flag.Usage = func() {
|
||||||
|
log.Print("usage: unexpand [-t tabwidth] < input.spaces >output.tabs")
|
||||||
|
flag.PrintDefaults()
|
||||||
|
os.Exit(2)
|
||||||
|
}
|
||||||
|
if flag.NArg() != 0 {
|
||||||
|
flag.Usage()
|
||||||
|
}
|
||||||
|
if width <= 0 {
|
||||||
|
flag.Usage()
|
||||||
|
}
|
||||||
|
|
||||||
|
r := bufio.NewReader(os.Stdin)
|
||||||
|
w := bufio.NewWriter(os.Stdout)
|
||||||
|
|
||||||
|
nspace := 0
|
||||||
|
start := true
|
||||||
|
|
||||||
|
flush := func() {
|
||||||
|
for ; nspace > 0; nspace-- {
|
||||||
|
err := w.WriteByte(' ')
|
||||||
|
xcheckf(err, "write")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write := func(b byte) {
|
||||||
|
err := w.WriteByte(b)
|
||||||
|
xcheckf(err, "write")
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
b, err := r.ReadByte()
|
||||||
|
if err == io.EOF {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
xcheckf(err, "read")
|
||||||
|
|
||||||
|
if start && b == ' ' {
|
||||||
|
nspace++
|
||||||
|
if nspace == width {
|
||||||
|
write('\t')
|
||||||
|
nspace = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
flush()
|
||||||
|
write(b)
|
||||||
|
start = b == '\n'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flush()
|
||||||
|
err := w.Flush()
|
||||||
|
xcheckf(err, "flush output")
|
||||||
|
}
|
|
@ -1051,8 +1051,8 @@ var api;
|
||||||
// - To keep the style definitions closer to their use.
|
// - To keep the style definitions closer to their use.
|
||||||
// - To make it easier to provide both light/regular and dark mode colors.
|
// - To make it easier to provide both light/regular and dark mode colors.
|
||||||
// - To use class names for styling, instead of the the many inline styles.
|
// - To use class names for styling, instead of the the many inline styles.
|
||||||
// Makes it easier to look through a DOM, and easier to change the style of all
|
// Makes it easier to look through a DOM, and easier to change the style of all
|
||||||
// instances of a class.
|
// instances of a class.
|
||||||
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
|
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
|
||||||
const cssStyle = dom.style(attr.type('text/css'));
|
const cssStyle = dom.style(attr.type('text/css'));
|
||||||
document.head.appendChild(cssStyle);
|
document.head.appendChild(cssStyle);
|
||||||
|
|
|
@ -1051,8 +1051,8 @@ var api;
|
||||||
// - To keep the style definitions closer to their use.
|
// - To keep the style definitions closer to their use.
|
||||||
// - To make it easier to provide both light/regular and dark mode colors.
|
// - To make it easier to provide both light/regular and dark mode colors.
|
||||||
// - To use class names for styling, instead of the the many inline styles.
|
// - To use class names for styling, instead of the the many inline styles.
|
||||||
// Makes it easier to look through a DOM, and easier to change the style of all
|
// Makes it easier to look through a DOM, and easier to change the style of all
|
||||||
// instances of a class.
|
// instances of a class.
|
||||||
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
|
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
|
||||||
const cssStyle = dom.style(attr.type('text/css'));
|
const cssStyle = dom.style(attr.type('text/css'));
|
||||||
document.head.appendChild(cssStyle);
|
document.head.appendChild(cssStyle);
|
||||||
|
|
|
@ -1051,8 +1051,8 @@ var api;
|
||||||
// - To keep the style definitions closer to their use.
|
// - To keep the style definitions closer to their use.
|
||||||
// - To make it easier to provide both light/regular and dark mode colors.
|
// - To make it easier to provide both light/regular and dark mode colors.
|
||||||
// - To use class names for styling, instead of the the many inline styles.
|
// - To use class names for styling, instead of the the many inline styles.
|
||||||
// Makes it easier to look through a DOM, and easier to change the style of all
|
// Makes it easier to look through a DOM, and easier to change the style of all
|
||||||
// instances of a class.
|
// instances of a class.
|
||||||
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
|
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
|
||||||
const cssStyle = dom.style(attr.type('text/css'));
|
const cssStyle = dom.style(attr.type('text/css'));
|
||||||
document.head.appendChild(cssStyle);
|
document.head.appendChild(cssStyle);
|
||||||
|
|
Loading…
Reference in a new issue