diff --git a/Makefile b/Makefile index cc59923..2870dc9 100644 --- a/Makefile +++ b/Makefile @@ -57,9 +57,12 @@ build/qbolt-${VERSION}-debian12-x86_64.tar.xz: build/qbolt # Windows release (docker) build/qbolt.exe: $(SOURCES) - ( $(DOCKER) image ls | fgrep qbolt-win64-cross ) || ( cd docker && $(DOCKER) build -t qbolt-win64-cross:latest -f win64-cross.Dockerfile . ) - $(DOCKER) run --rm -v $(CURDIR):/qbolt -w /qbolt qbolt-win64-cross:latest /bin/sh -c "go build $(GOFLAGS_W) -o build/qbolt.exe" - upx --force build/qbolt.exe + # -flto causes internal compiler error + $(DOCKER) run --rm --id $$(id -u):$$(id -g) -v $(CURDIR):/src -w /src miqt/winqt6static:latest /bin/sh -c "CGO_CFLAGS='-Os -ffunction-sections -fdata-sections' CGO_CXXFLAGS='-Os -ffunction-sections -fdata-sections' CGO_LDFLAGS='-Wl,--gc-sections -fwhole-program' go build $(GOFLAGS_W) -o build/qbolt.exe" + # Must be stripped before upx'ing - @ref https://github.com/msys2/MSYS2-packages/issues/454 + # However this removes the rsrc, loses the icon and causes a Defender detection + # strip build/qbolt.exe + # upx build/qbolt.exe build/qbolt-${VERSION}-windows-x86_64.zip: build/qbolt.exe zip -9 -j build/qbolt-${VERSION}-windows-x86_64.zip build/qbolt.exe diff --git a/docker/win64-cross.Dockerfile b/docker/win64-cross.Dockerfile deleted file mode 100644 index f94aa46..0000000 --- a/docker/win64-cross.Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM golang:1.23-bookworm - -RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - apt-get install -qyy gnupg2 ca-certificates - -RUN DEBIAN_FRONTEND=noninteractive \ - echo "deb https://pkg.mxe.cc/repos/apt buster main" >/etc/apt/sources.list.d/mxeapt.list && \ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9 && \ - apt-get update && \ - apt-get install -qyy mxe-x86-64-w64-mingw32.static-qt5 && \ - apt-get clean - -ENV PATH=/usr/lib/mxe/usr/bin:$PATH - -ENV CXX=x86_64-w64-mingw32.static-g++ -ENV CC=x86_64-w64-mingw32.static-gcc -ENV PKG_CONFIG=x86_64-w64-mingw32.static-pkg-config -ENV GOOS=windows -ENV CGO_ENABLED=1 -