windows/MSYS Make install improvements

Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
Russ Magee 2018-12-26 15:36:13 -08:00
parent 0a59bbedc8
commit 3fb66694c6
2 changed files with 43 additions and 26 deletions

View File

@ -4,6 +4,18 @@ SUBPKGS = logger spinsult hkexnet
TOOLS = hkexpasswd hkexsh hkexshd TOOLS = hkexpasswd hkexsh hkexshd
SUBDIRS = $(LIBS) $(TOOLS) SUBDIRS = $(LIBS) $(TOOLS)
ifeq $(MSYSTEM),MSYS)
GOOS=windows
endif
ifeq ($(GOOS),windows)
ifeq ($(MSYSTEM),MSYS)
SBIN=bin
endif
else
SBIN=sbin
endif
INSTPREFIX = /usr/local INSTPREFIX = /usr/local
all: common client server passwd all: common client server passwd
@ -33,21 +45,29 @@ client: common
$(MAKE) -C hkexsh $(MAKE) -C hkexsh
ifeq ($(MSYSTEM),)
ifneq ($(GOOS),windows)
server: common server: common
$(MAKE) -C hkexshd ifeq ($(GOOS),windows)
ifeq ($(MSYSTEM),MSYS)
@echo "(GOOS=windows, MSYSTEM=MSYS):hkexshd server not (yet) supported on Windows"
else else
echo "Cross-build of hkexshd server for Windows not yet supported" @echo "(GOOS=windows, MSYSTEM=?):Cross-build of hkexshd server not (yet) supported"
endif endif
else else
server: common $(MAKE) -C hkexshd
echo "hkexshd server not (yet) supported on Windows"
endif endif
passwd: common passwd: common
ifneq ($(GOOS),windows)
ifeq ($(MSYSTEM),MSYS)
@echo "(GOOS=windows, MSYSTEM=MSYS): Building hkexpasswd, but won't install until hkexshd works on (windows,MSYS)."
$(MAKE) -C hkexpasswd $(MAKE) -C hkexpasswd
else
@echo "(GOOS=windows, MSYSTEM=?): unsupported uninstall config."
endif
else
$(MAKE) -C hkexpasswd
endif
vis: vis:
@which go-callvis >/dev/null 2>&1; \ @which go-callvis >/dev/null 2>&1; \
@ -66,28 +86,23 @@ lint:
reinstall: uninstall install reinstall: uninstall install
install: install: client server passwd
cp hkexsh/hkexsh $(INSTPREFIX)/bin ifeq ($(GOOS),windows)
ifeq ($(MSYSTEM),) ifeq ($(MSYSTEM),MSYS)
ifneq ($(GOOS),windows) cp hkexsh/hkexsh.exe $(INSTPREFIX)/bin/.hkexsh.exe
cp hkexshd/hkexshd hkexpasswd/hkexpasswd $(INSTPREFIX)/sbin cp hkexsh/hkexsh.exe $(INSTPREFIX)/bin/.hkexcp.exe
cp hkexsh/mintty_wrapper.sh $(INSTPREFIX)/bin/hkexsh.exe
cp hkexsh/mintty_wrapper.sh $(INSTPREFIX)/bin/hkexcp.exe
else else
mv $(INSTPREFIX)/bin/hkexsh $(INSTPREFIX)/bin/_hkexsh @echo "(GOOS=windows, MSYSTEM=?):unsupported install config."
cp hkexsh/mintty_wrapper.sh $(INSTPREFIX)/bin/hkexsh
echo "Cross-build of hkexshd server for Windows not yet supported"
endif endif
else else
echo "Cross-build of hkexshd server for Windows not yet supported" cp hkexsh/hkexsh $(INSTPREFIX)/bin/hkexsh
endif cp hkexshd/hkexshd hkexpasswd/hkexpasswd $(INSTPREFIX)/$(SBIN)
cd $(INSTPREFIX)/bin && ln -s hkexsh hkexcp && cd - cd $(INSTPREFIX)/bin && ln -s hkexsh hkexcp && cd -
endif
uninstall: uninstall:
rm -f $(INSTPREFIX)/bin/hkexsh $(INSTPREFIX)/bin/hkexcp $(INSTPREFIX)/bin/_hkexsh rm -f $(INSTPREFIX)/bin/hkexsh* $(INSTPREFIX)/bin/hkexcp* $(INSTPREFIX)/bin/.hkexsh*
ifeq ($(MSYSTEM),) rm -f $(INSTPREFIX)/$(SBIN)/hkexshd* $(INSTPREFIX)/$(SBIN)/hkexpasswd*
ifneq ($(GOOS),windows)
rm -f $(INSTPREFIX)/sbin/hkexshd $(INSTPREFIX)/sbin/hkexpasswd
else
endif
else
endif

View File

@ -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".exe -h
else else
stty -echo raw icrnl stty -echo raw icrnl
./hkexsh $@ ."$me".exe $@
fi fi