Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
(macOS) Possibility to build without WiFi functionality
Browse files Browse the repository at this point in the history
The output binary will not have additional dependencies from wifi-related libraries
  • Loading branch information
stenya committed Nov 12, 2020
1 parent da64552 commit 49783b7
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"args": ["-logging"],
//"buildFlags": "-tags debug"
"buildFlags": ""
//"buildFlags": "-tags nowifi"
}
]
}
24 changes: 20 additions & 4 deletions References/macOS/scripts/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,29 @@ echo "Commit : $COMMIT"

cd ../../../

BUILDTAGS_DEBUG=""
BUILDTAGS_NOWIFI=""

if [[ "$@" == *"-debug"* ]]
then
echo "Compiling in DEBUG mode"
go build -tags debug -o "IVPN Agent" -o "IVPN Agent" -ldflags "-X github.com/ivpn/desktop-app-daemon/version._version=$VERSION -X github.com/ivpn/desktop-app-daemon/version._commit=$COMMIT -X github.com/ivpn/desktop-app-daemon/version._time=$DATE"
else
go build -o "IVPN Agent" -ldflags "-X github.com/ivpn/desktop-app-daemon/version._version=$VERSION -X github.com/ivpn/desktop-app-daemon/version._commit=$COMMIT -X github.com/ivpn/desktop-app-daemon/version._time=$DATE"
BUILDTAGS_DEBUG="-tags debug"
fi

echo ""
echo "Enable WIFI support?"
echo "(this will lead to some additional library dependencies for the final binary)"
read -p "[y\n]? (n - default): " yn
case $yn in
[Yy]* )
;;
[Nn]* )
BUILDTAGS_NOWIFI="-tags nowifi"
;;
* )
BUILDTAGS_NOWIFI="-tags nowifi"
;;
esac

go build $BUILDTAGS_NOWIFI $BUILDTAGS_DEBUG -o "IVPN Agent" -ldflags "-X github.com/ivpn/desktop-app-daemon/version._version=$VERSION -X github.com/ivpn/desktop-app-daemon/version._commit=$COMMIT -X github.com/ivpn/desktop-app-daemon/version._time=$DATE"

echo "Cpmpiled daemon binary: '$(pwd)/IVPN Agent'"
2 changes: 1 addition & 1 deletion wifiNotifier/wifiNotifier_darwin.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build darwin
// +build darwin,!nowifi

package wifiNotifier

Expand Down
25 changes: 25 additions & 0 deletions wifiNotifier/wifiNotifier_darwin_nowifi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// +build darwin,nowifi

package wifiNotifier

import "github.com/ivpn/desktop-app-daemon/logger"

// GetAvailableSSIDs returns the list of the names of available Wi-Fi networks
func GetAvailableSSIDs() []string {
return nil
}

// GetCurrentSSID returns current WiFi SSID
func GetCurrentSSID() string {
return ""
}

// GetCurrentNetworkSecurity returns current security mode
func GetCurrentNetworkSecurity() WiFiSecurity {
return WiFiSecurityUnknown
}

// SetWifiNotifier initializes a handler method 'OnWifiChanged'
func SetWifiNotifier(cb func(string)) {
logger.Debug("WiFi functionality disabled in this build")
}

0 comments on commit 49783b7

Please sign in to comment.