Skip to content
Snippets Groups Projects
Unverified Commit a14b4ac6 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[bug] do not use cross-compiling for the helper in win

- add -H windowsgui to avoid console popping up
parent 3a9f65fb
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ dependsCygwin:
@choco install -y golang python nssm nsis wget 7zip
build:
$(MAKE) _buildparts
echo "XBUILD>", ${XBUILD}
ifeq (${XBUILD}, yes)
$(MAKE) build_cross_win
$(MAKE) build_cross_osx
......@@ -68,11 +68,14 @@ else ifeq (${XBUILD}, win)
else ifeq (${XBUILD}, osx)
$(MAKE) build_cross_osx
$(MAKE) _build_done
else
$(MAKE) _buildparts
endif
_buildparts: $(foreach path,$(wildcard cmd/*),build_$(patsubst cmd/%,%,$(path)))
build_%:
@echo "PLATFORM: ${PLATFORM}"
@mkdir -p build/bin/${PLATFORM}
go build -tags $(TAGS) -ldflags "-s -w -X main.version=`git describe --tags` ${EXTRA_LDFLAGS}" -o build/bin/${PLATFORM}/$* ./cmd/$*
-@rm -rf build/${PROVIDER}/staging/${PLATFORM} && mkdir -p build/${PROVIDER}/staging/${PLATFORM}
......@@ -91,7 +94,11 @@ CROSS_WIN_FLAGS = CGO_ENABLED=1 GOARCH=386 GOOS=windows CC="/usr/bin/i686-w64-mi
PLATFORM_WIN = PLATFORM=windows
EXTRA_LDFLAGS_WIN = EXTRA_LDFLAGS="-H windowsgui"
build_cross_win:
@echo "[+] Cross-building for windows..."
$(CROSS_WIN_FLAGS) $(PLATFORM_WIN) $(EXTRA_LDFLAGS_WIN) $(MAKE) _buildparts
# workaround for helper: we use the go compiler
@echo "[+] Compiling helper with the Go compiler to work around missing stdout bug..."
cd cmd/bitmask-helper && GOOS=windows GOARCH=386 go build -ldflags "-X main.version=`git describe --tags` -H windowsgui" -o ../../build/bin/windows/bitmask-helper-go
CROSS_OSX_FLAGS = MACOSX_DEPLOYMENT_TARGET=10.10 CGO_ENABLED=1 GOOS=darwin CC="o64-clang"
PLATFORM_OSX = PLATFORM=darwin
......
......@@ -37,7 +37,8 @@ else
pkg_win: staging/openvpn/openvpn.exe
echo "[+] building windows"
cp ../bin/windows/bitmask-vpn staging/bitmask-vpn.exe
cp ../bin/windows/bitmask-helper staging/bitmask_helper.exe
#cp ../bin/windows/bitmask-helper staging/bitmask_helper.exe
cp ../bin/windows/bitmask-helper-go staging/helper.exe
makensis windows/$(APPNAME)-installer.nsi
mv dist/$(APPNAME)-$(VERSION).exe ../../deploy/
endif
......
..\staging\bitmask_helper.exe
..\staging\helper.exe
..\staging\bitmask-vpn.exe
..\staging\libcrypto-1_1-x64.dll
..\staging\liblzo2-2.dll
......
icon.ico
openssl.exe
openvpn.exe
ssleay32.dll
libeay32.dll
liblzo2-2.dll
libpkcs11-helper-1.dll
openssl.exe
openvpn.exe
ssleay32.dll
libeay32.dll
liblzo2-2.dll
libpkcs11-helper-1.dll
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
padlock.dll
bitmask-helper.exe
bitmask_helper.exe
bitmask-vpn.exe
tap-windows.exe
helper.exe
......@@ -61,6 +61,11 @@ Section "InstallFiles"
Delete 'C:\Program Files\$applicationName\bitmask_helper.exe'
IfErrors 0 noErrorHelper
DetailPrint "Trying to uninstall new helper..."
ClearErrors
Delete 'C:\Program Files\$applicationName\helper.exe'
IfErrors 0 noErrorHelper
; uninstalling old nssm helper - could fail if it isn't there, or if nssm is not there...
ClearErrors
DetailPrint "Trying to uninstall an old style helper..."
......@@ -77,6 +82,12 @@ Section "InstallFiles"
IfErrors 0 noErrorHelper
DetailPrint "Failed to stop new-style helper, maybe it was not there"
ClearErrors
DetailPrint "Trying to uninstall a new style helper..."
ExecWait '"$INSTDIR\helper.exe" stop'
IfErrors 0 noErrorHelper
DetailPrint "Failed to stop new-style helper, maybe it was not there"
noErrorHelper:
; now we try to delete the systray, locked by the app - just to know if another instance of FoobarVPN is running.
......@@ -120,14 +131,14 @@ SectionEnd
Section "InstallService"
DetailPrint "Trying to uninstall previous versions of the (new) helper..."
ClearErrors
ExecWait '"$INSTDIR\bitmask_helper.exe" stop'
ExecWait '"$INSTDIR\bitmask_helper.exe" remove'
ExecWait '"$INSTDIR\helper.exe" stop'
ExecWait '"$INSTDIR\helper.exe" remove'
IfErrors 0 noError
DetailPrint "Could not uninstall a previous version of the (new) helper!"
noError:
ExecWait '"$INSTDIR\bitmask_helper.exe" install'
ExecWait '"$INSTDIR\bitmask_helper.exe" start'
ExecWait '"$INSTDIR\helper.exe" install'
ExecWait '"$INSTDIR\helper.exe" start'
SectionEnd
Section /o "TAP Virtual Ethernet Adapter" SecTAP
......@@ -147,9 +158,11 @@ Section "Uninstall"
ExecWait '"$INSTDIR\bitmask_helper.exe" stop'
ExecWait '"$INSTDIR\bitmask_helper.exe" remove'
ExecWait '"$INSTDIR\helper.exe" stop'
ExecWait '"$INSTDIR\helper.exe" remove'
; now we (try to) remove everything else. kill it with fire!
Delete $INSTDIR\nssm.exe ; probably does not exist anymore, but just in case
Delete $INSTDIR\bitmask_helper.exe
Delete $INSTDIR\readme.txt
Delete $INSTDIR\helper.log
Delete $INSTDIR\openvpn.log
......
......@@ -14,10 +14,10 @@ package_win:
docker run \
-e XBUILD=win \
-e PROVIDER=riseup \
-v `python3 -c 'import os; print(os.path.abspath(".."))'`:/bitmask-vpn.orig \
-v `python3 -c 'import os; print(os.path.abspath(".."))'`:/bitmask-vpn.host \
--cpus="4" \
-it --rm \
$(REGISTRY)/$(IMAGE):latest \
/builder.sh
shell:
docker run -v `python3 -c 'import os; print(os.path.abspath(".."))'`:/bitmask-vpn.orig -it --rm $(REGISTRY)/$(IMAGE):latest /bin/bash
docker run -v `python3 -c 'import os; print(os.path.abspath(".."))'`:/bitmask-vpn.host -it --rm $(REGISTRY)/$(IMAGE):latest /bin/bash
#!/bin/bash
set -e
export DESTDIR=/bitmask-vpn.orig/deploy/
rm -rf /bitmask-vpn
cp -r /bitmask-vpn.orig /bitmask-vpn
cd /bitmask-vpn
export HOSTDIR=/bitmask-vpn.host
export GUESTDIR=/bitmask-vpn
export DESTDIR="${HOSTDIR}"/deploy/
rm -rf "${GUESTDIR}"
cp -r "${HOSTDIR}" "${GUESTDIR}"
cd "${GUESTDIR}"
make prepare
make build
case $XBUILD in
......@@ -17,4 +19,4 @@ case $XBUILD in
make packages
;;
esac
cp /bitmask-vpn/deploy/* $DESTDIR
cp "${GUESTDIR}"/deploy/* $DESTDIR
......@@ -30,7 +30,7 @@ import (
)
const (
svcName = config.BinaryName + `-helper`
svcName = config.BinaryName + `-helper-v2`
appPath = `C:\Program Files\` + config.ApplicationName + `\`
LogFolder = appPath
openvpnPath = appPath + `openvpn.exe`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment