aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile8
-rw-r--r--build.bat3
-rw-r--r--resources.rc14
-rw-r--r--ui/iconprovider.go4
4 files changed, 16 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index a11bafbc..15309004 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,10 @@ export CGO_LDFLAGS := -Wl,--dynamicbase -Wl,--nxcompat -Wl,--export-all-symbols
export GOOS := windows
VERSION := $(shell sed -n 's/^\s*Number\s*=\s*"\([0-9.]\+\)"$$/\1/p' version/version.go)
+empty :=
+space := $(empty) $(empty)
comma := ,
-RCFLAGS := -DWIREGUARD_WINDOWS_VERSION_ARRAY=$(subst .,$(comma),$(VERSION)) -DWIREGUARD_WINDOWS_VERSION_STR=$(VERSION) -O coff
+RCFLAGS := -DWIREGUARD_VERSION_ARRAY=$(subst $(space),$(comma),$(wordlist 1,4,$(subst .,$(space),$(VERSION)) 0 0 0 0)) -DWIREGUARD_VERSION_STR=$(VERSION) -O coff
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
SOURCE_FILES := $(call rwildcard,,*.go *.c *.h) .deps/goroot/prepared go.mod go.sum
@@ -42,7 +44,7 @@ resources_386.syso: $(RESOURCE_FILES)
i686-w64-mingw32-windres $(RCFLAGS) -I .deps/wintun/bin/x86 -i $< -o $@
resources_arm.syso: $(RESOURCE_FILES)
- arm-w64-mingw32-windres $(RCFLAGS) -I .deps/wintun/bin/arm -i $< -o $@
+ armv7-w64-mingw32-windres $(RCFLAGS) -I .deps/wintun/bin/arm -i $< -o $@
amd64/wireguard.exe: export CC := x86_64-w64-mingw32-gcc
amd64/wireguard.exe: export GOARCH := amd64
@@ -55,7 +57,7 @@ x86/wireguard.exe: export GOARCH := 386
x86/wireguard.exe: resources_386.syso $(SOURCE_FILES)
GOROOT="$(CURDIR)/.deps/goroot" go build $(GOFLAGS) -o $@
-arm/wireguard.exe: export CC := arm-w64-mingw32-gcc
+arm/wireguard.exe: export CC := armv7-w64-mingw32-gcc
arm/wireguard.exe: export GOARCH := arm
arm/wireguard.exe: export GOARM := 7
arm/wireguard.exe: resources_arm.syso $(SOURCE_FILES)
diff --git a/build.bat b/build.bat
index 7bf73f98..de7bd799 100644
--- a/build.bat
+++ b/build.bat
@@ -38,6 +38,7 @@ if exist .deps\prepared goto :render
:build
for /f "tokens=3" %%a in ('findstr /r "Number.*=.*[0-9.]*" .\version\version.go') do set WIREGUARD_VERSION=%%a
set WIREGUARD_VERSION=%WIREGUARD_VERSION:"=%
+ for /f "tokens=1-4" %%a in ("%WIREGUARD_VERSION:.= % 0 0 0") do set WIREGUARD_VERSION_ARRAY=%%a,%%b,%%c,%%d
set GOOS=windows
set GOPATH=%BUILDDIR%.deps\gopath
set GOROOT=%BUILDDIR%.deps\go
@@ -84,7 +85,7 @@ if exist .deps\prepared goto :render
set GOARCH=%~3
mkdir %1 >NUL 2>&1
echo [+] Assembling resources %1
- windres -I ".deps\wintun\bin\%~1" -DWIREGUARD_WINDOWS_VERSION_ARRAY=%WIREGUARD_VERSION:.=,% -DWIREGUARD_WINDOWS_VERSION_STR=%WIREGUARD_VERSION% -i resources.rc -o "resources_%~3.syso" -O coff || exit /b %errorlevel%
+ windres -I ".deps\wintun\bin\%~1" -DWIREGUARD_VERSION_ARRAY=%WIREGUARD_VERSION_ARRAY% -DWIREGUARD_VERSION_STR=%WIREGUARD_VERSION% -i resources.rc -o "resources_%~3.syso" -O coff || exit /b %errorlevel%
echo [+] Building program %1
go build -ldflags="-H windowsgui -s -w" -tags walk_use_cgo -trimpath -v -o "%~1\wireguard.exe" || exit /b 1
if not exist "%~1\wg.exe" (
diff --git a/resources.rc b/resources.rc
index 1299f62f..05214dbd 100644
--- a/resources.rc
+++ b/resources.rc
@@ -12,14 +12,14 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest.xml
-$wireguard.ico ICON ui/icon/wireguard.ico
-dot-gray.ico ICON ui/icon/dot-gray.ico
+7 ICON ui/icon/wireguard.ico
+8 ICON ui/icon/dot-gray.ico
wintun.dll RCDATA wintun.dll
#define VERSIONINFO_TEMPLATE(block_id, lang_id, codepage_id, file_desc, comments) \
VS_VERSION_INFO VERSIONINFO \
-FILEVERSION WIREGUARD_WINDOWS_VERSION_ARRAY \
-PRODUCTVERSION WIREGUARD_WINDOWS_VERSION_ARRAY \
+FILEVERSION WIREGUARD_VERSION_ARRAY \
+PRODUCTVERSION WIREGUARD_VERSION_ARRAY \
FILEOS VOS_NT_WINDOWS32 \
FILETYPE VFT_APP \
FILESUBTYPE VFT2_UNKNOWN \
@@ -30,12 +30,12 @@ BEGIN \
BEGIN \
VALUE "CompanyName", "WireGuard LLC" \
VALUE "FileDescription", file_desc \
- VALUE "FileVersion", EXPAND(WIREGUARD_WINDOWS_VERSION_STR) \
+ VALUE "FileVersion", EXPAND(WIREGUARD_VERSION_STR) \
VALUE "InternalName", "wireguard-windows" \
VALUE "LegalCopyright", "Copyright © 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved." \
VALUE "OriginalFilename", "wireguard.exe" \
VALUE "ProductName", "WireGuard" \
- VALUE "ProductVersion", EXPAND(WIREGUARD_WINDOWS_VERSION_STR) \
+ VALUE "ProductVersion", EXPAND(WIREGUARD_VERSION_STR) \
VALUE "Comments", comments \
END \
END \
@@ -85,4 +85,4 @@ VERSIONINFO_TEMPLATE(
"040404b0", 0x404, 0x4b0,
"WireGuard:快速、現代、安全的 VPN 隧道",
"https://www.wireguard.com/"
-) \ No newline at end of file
+)
diff --git a/ui/iconprovider.go b/ui/iconprovider.go
index 8db841c5..8a5a8265 100644
--- a/ui/iconprovider.go
+++ b/ui/iconprovider.go
@@ -75,7 +75,7 @@ func iconForState(state manager.TunnelState, size int) (icon *walk.Icon, err err
case manager.TunnelStarted:
icon, err = loadSystemIcon("imageres", 101, size)
case manager.TunnelStopped:
- icon, err = walk.NewIconFromResourceWithSize("dot-gray.ico", walk.Size{size, size}) // TODO: replace with real icon
+ icon, err = walk.NewIconFromResourceIdWithSize(8, walk.Size{size, size}) // TODO: replace with real icon from imageres/shell32
default:
icon, err = loadSystemIcon("shell32", 238, size) // TODO: this doesn't look that great overlayed on the app icon
}
@@ -128,7 +128,7 @@ func loadLogoIcon(size int) (icon *walk.Icon, err error) {
if icon != nil {
return
}
- icon, err = walk.NewIconFromResourceWithSize("$wireguard.ico", walk.Size{size, size})
+ icon, err = walk.NewIconFromResourceIdWithSize(7, walk.Size{size, size})
if err == nil {
cachedLogoIconsForWidth[size] = icon
}