mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
Fixed GOOS=windows MSYSTEM=MSYS install
Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
parent
57b71e7925
commit
1addd18806
6 changed files with 43 additions and 43 deletions
63
Makefile
63
Makefile
|
@ -1,5 +1,5 @@
|
||||||
VERSION := 0.8.22
|
VERSION := 0.8.22
|
||||||
.PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall
|
.PHONY: lint vis clean common client server subpkgs install uninstall reinstall
|
||||||
|
|
||||||
## Tag version of binaries with build info wrt.
|
## Tag version of binaries with build info wrt.
|
||||||
## GO111MODULE(=on) and vendor/ setup vs. $GOPATH pkg builds
|
## GO111MODULE(=on) and vendor/ setup vs. $GOPATH pkg builds
|
||||||
|
@ -26,12 +26,23 @@ BUILDOPTS :=$(BUILDOPTS)"$(GOBUILDOPTS) -ldflags \"-X main.version=$(VERSION)$(M
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SUBPKGS = logger spinsult xsnet
|
SUBPKGS = logger spinsult xsnet
|
||||||
TOOLS = xspasswd xs xsd
|
TOOLS = xs xsd
|
||||||
SUBDIRS = $(LIBS) $(TOOLS)
|
SUBDIRS = $(LIBS) $(TOOLS)
|
||||||
|
|
||||||
|
ifeq ($(GOOS),)
|
||||||
|
GOOS=$(shell go env GOOS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(GOOS),windows)
|
||||||
|
ifeq ($(MSYSTEM),MSYS)
|
||||||
|
WIN_MSYS=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
INSTPREFIX = /usr/local
|
INSTPREFIX = /usr/local
|
||||||
|
|
||||||
all: common client server passwd
|
all: common client server
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "Make: $(MAKE)"
|
@echo "Make: $(MAKE)"
|
||||||
|
@ -60,21 +71,11 @@ client: common
|
||||||
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xs
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xs
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(MSYSTEM),)
|
|
||||||
ifneq ($(GOOS),windows)
|
|
||||||
server: common
|
server: common
|
||||||
|
ifdef WIN_MSYS
|
||||||
|
echo "Build of xsd server for Windows not yet supported"
|
||||||
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xsd
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xsd
|
||||||
else
|
|
||||||
echo "Cross-build of xsd server for Windows not yet supported"
|
|
||||||
endif
|
endif
|
||||||
else
|
|
||||||
server: common
|
|
||||||
echo "xsd server not (yet) supported on Windows"
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
passwd: common
|
|
||||||
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xspasswd
|
|
||||||
|
|
||||||
vis:
|
vis:
|
||||||
@which go-callvis >/dev/null 2>&1; \
|
@which go-callvis >/dev/null 2>&1; \
|
||||||
|
@ -83,38 +84,30 @@ vis:
|
||||||
else \
|
else \
|
||||||
$(MAKE) -C xs vis;\
|
$(MAKE) -C xs vis;\
|
||||||
$(MAKE) -C xsd vis;\
|
$(MAKE) -C xsd vis;\
|
||||||
$(MAKE) -C xspasswd vis; \
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
$(MAKE) -C xspasswd lint
|
|
||||||
$(MAKE) -C xsd lint
|
$(MAKE) -C xsd lint
|
||||||
$(MAKE) -C xs lint
|
$(MAKE) -C xs lint
|
||||||
|
|
||||||
reinstall: uninstall install
|
reinstall: uninstall install
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cp xs/xs $(INSTPREFIX)/bin
|
echo "WIN_MSYS:" $(WIN_MSYS)
|
||||||
ifeq ($(MSYSTEM),)
|
ifdef WIN_MSYS
|
||||||
ifneq ($(GOOS),windows)
|
|
||||||
cp xsd/xsd xspasswd/xspasswd $(INSTPREFIX)/sbin
|
|
||||||
else
|
|
||||||
mv $(INSTPREFIX)/bin/xs $(INSTPREFIX)/bin/_xs
|
|
||||||
cp xs/mintty_wrapper.sh $(INSTPREFIX)/bin/xs
|
cp xs/mintty_wrapper.sh $(INSTPREFIX)/bin/xs
|
||||||
echo "Cross-build of xsd server for Windows not yet supported"
|
cp xs/mintty_wrapper.sh $(INSTPREFIX)/bin/xc
|
||||||
endif
|
cp xs/xs $(INSTPREFIX)/bin/_xs
|
||||||
|
cp xs/xs $(INSTPREFIX)/bin/_xc
|
||||||
|
echo "Install of xsd server for Windows not yet supported"
|
||||||
else
|
else
|
||||||
echo "Cross-build of xsd server for Windows not yet supported"
|
cp xs/xs $(INSTPREFIX)/bin
|
||||||
endif
|
|
||||||
cd $(INSTPREFIX)/bin && ln -s xs xc && cd -
|
cd $(INSTPREFIX)/bin && ln -s xs xc && cd -
|
||||||
|
endif
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(INSTPREFIX)/bin/xs $(INSTPREFIX)/bin/xc $(INSTPREFIX)/bin/_xs
|
rm -f $(INSTPREFIX)/bin/xs $(INSTPREFIX)/bin/xc \
|
||||||
ifeq ($(MSYSTEM),)
|
$(INSTPREFIX)/bin/_xs $(INSTPREFIX)/bin/_xc
|
||||||
ifneq ($(GOOS),windows)
|
ifndef $(WIN_MSYS)
|
||||||
rm -f $(INSTPREFIX)/sbin/xsd $(INSTPREFIX)/sbin/xspasswd
|
rm -f $(INSTPREFIX)/sbin/xsd
|
||||||
else
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
endif
|
endif
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -18,7 +18,7 @@ require (
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
|
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
|
||||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
|
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
|
||||||
github.com/tjfoc/gmsm v1.3.0 // indirect
|
github.com/tjfoc/gmsm v1.3.1 // indirect
|
||||||
github.com/xtaci/kcp-go v5.4.20+incompatible
|
github.com/xtaci/kcp-go v5.4.20+incompatible
|
||||||
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5
|
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5
|
||||||
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f
|
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -42,6 +42,8 @@ github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b h1:fj5tQ8acgNUr6O8LE
|
||||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
|
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
|
||||||
github.com/tjfoc/gmsm v1.3.0 h1:i7c6Za/IlgBvnGxYpfD7L3TGuaS+v6oGcgq+J9/ecEA=
|
github.com/tjfoc/gmsm v1.3.0 h1:i7c6Za/IlgBvnGxYpfD7L3TGuaS+v6oGcgq+J9/ecEA=
|
||||||
github.com/tjfoc/gmsm v1.3.0/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
github.com/tjfoc/gmsm v1.3.0/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
||||||
|
github.com/tjfoc/gmsm v1.3.1 h1:+k3IAlF81c31/TllJmIfuCYnjl8ziMdTWGWJcP9J1uo=
|
||||||
|
github.com/tjfoc/gmsm v1.3.1/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
||||||
github.com/xtaci/kcp-go v1.0.1 h1:SEZn2Iick6ualQpV8yY9cXdDTgbfBHPIwJl7UvxfxLQ=
|
github.com/xtaci/kcp-go v1.0.1 h1:SEZn2Iick6ualQpV8yY9cXdDTgbfBHPIwJl7UvxfxLQ=
|
||||||
github.com/xtaci/kcp-go v5.4.20+incompatible h1:TN1uey3Raw0sTz0Fg8GkfM0uH3YwzhnZWQ1bABv5xAg=
|
github.com/xtaci/kcp-go v5.4.20+incompatible h1:TN1uey3Raw0sTz0Fg8GkfM0uH3YwzhnZWQ1bABv5xAg=
|
||||||
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
|
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
|
||||||
|
|
|
@ -27,7 +27,7 @@ type State struct {
|
||||||
// MakeRaw put the terminal connected to the given file descriptor into raw
|
// MakeRaw put the terminal connected to the given file descriptor into raw
|
||||||
// mode and returns the previous state of the terminal so that it can be
|
// mode and returns the previous state of the terminal so that it can be
|
||||||
// restored.
|
// restored.
|
||||||
func MakeRaw(fd int) (*State, error) {
|
func MakeRaw(fd uintptr) (*State, error) {
|
||||||
// This doesn't really work. The exec.Command() runs a sub-shell
|
// This doesn't really work. The exec.Command() runs a sub-shell
|
||||||
// so the stty mods don't affect the client process.
|
// so the stty mods don't affect the client process.
|
||||||
cmd := exec.Command("stty", "-echo raw")
|
cmd := exec.Command("stty", "-echo raw")
|
||||||
|
@ -37,13 +37,13 @@ func MakeRaw(fd int) (*State, error) {
|
||||||
|
|
||||||
// GetState returns the current state of a terminal which may be useful to
|
// GetState returns the current state of a terminal which may be useful to
|
||||||
// restore the terminal after a signal.
|
// restore the terminal after a signal.
|
||||||
func GetState(fd int) (*State, error) {
|
func GetState(fd uintptr) (*State, error) {
|
||||||
return &State{}, nil
|
return &State{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore restores the terminal connected to the given file descriptor to a
|
// Restore restores the terminal connected to the given file descriptor to a
|
||||||
// previous state.
|
// previous state.
|
||||||
func Restore(fd int, state *State) error {
|
func Restore(fd uintptr, state *State) error {
|
||||||
cmd := exec.Command("stty", "echo cooked")
|
cmd := exec.Command("stty", "echo cooked")
|
||||||
cmd.Run()
|
cmd.Run()
|
||||||
return nil
|
return nil
|
||||||
|
@ -52,7 +52,7 @@ func Restore(fd int, state *State) error {
|
||||||
// ReadPassword reads a line of input from a terminal without local echo. This
|
// ReadPassword reads a line of input from a terminal without local echo. This
|
||||||
// is commonly used for inputting passwords and other sensitive data. The slice
|
// is commonly used for inputting passwords and other sensitive data. The slice
|
||||||
// returned does not include the \n.
|
// returned does not include the \n.
|
||||||
func ReadPassword(fd int) ([]byte, error) {
|
func ReadPassword(fd uintptr) ([]byte, error) {
|
||||||
return readPasswordLine(passwordReader(fd))
|
return readPasswordLine(passwordReader(fd))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,12 @@ cleanup() {
|
||||||
stty sane
|
stty sane
|
||||||
}
|
}
|
||||||
|
|
||||||
|
me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
|
||||||
|
|
||||||
if [ ${1}x == "-hx" ]; then
|
if [ ${1}x == "-hx" ]; then
|
||||||
./hkexsh -h
|
_${me} -h
|
||||||
else
|
else
|
||||||
stty -echo raw icrnl
|
stty -echo raw icrnl
|
||||||
./hkexsh $@
|
_${me} $@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
5
xs/xs.go
5
xs/xs.go
|
@ -722,7 +722,10 @@ func main() {
|
||||||
|
|
||||||
// Find out what program we are (shell or copier)
|
// Find out what program we are (shell or copier)
|
||||||
myPath := strings.Split(os.Args[0], string(os.PathSeparator))
|
myPath := strings.Split(os.Args[0], string(os.PathSeparator))
|
||||||
if myPath[len(myPath)-1] != "xc" && myPath[len(myPath)-1] != "xc.exe" {
|
if myPath[len(myPath)-1] != "xc" &&
|
||||||
|
myPath[len(myPath)-1] != "_xc" &&
|
||||||
|
myPath[len(myPath)-1] != "xc.exe" &&
|
||||||
|
myPath[len(myPath)-1] != "_xc.exe" {
|
||||||
// xs accepts a command (-x) but not
|
// xs accepts a command (-x) but not
|
||||||
// a srcpath (-r) or dstpath (-t)
|
// a srcpath (-r) or dstpath (-t)
|
||||||
flag.StringVar(&cmdStr, "x", "", "run <`command`> (if not specified, run interactive shell)")
|
flag.StringVar(&cmdStr, "x", "", "run <`command`> (if not specified, run interactive shell)")
|
||||||
|
|
Loading…
Reference in a new issue