Statping compile in Windows
statping's Makefile does not work out-of-the-box in Windows.
Below are the steps extracted from the Makefile to manually compile statping in Windows.
Install mingw-w64
Download and install mingw-w64 from here.
Below it is assumed mingw-w64 is installed at D:\mingw-w64
.
Download the source code
Download the source code of statping from here.
Below it is assumed the source code is decompressed to directory D:\statping-ng\repo
.
Download the dependencies
Run:
pushd D:\statping-ng\repo
go mod download
Install the rice command
Run:
pushd D:\statping-ng\repo
go install github.com/GeertJohan/go.rice
go get github.com/GeertJohan/go.rice/rice@v1.0.3
go install github.com/GeertJohan/go.rice/rice
The rice command is installed at %USERPROFILE%\go\bin\rice.exe
.
Build the frontend files
Run:
pushd D:\statping-ng\repo\frontend
yarn
yarn build
Embed the frontend files into go source code
Run:
pushd D:\statping-ng\repo
rd /s /q source\dist
xcopy /E /H frontend\dist source\
xcopy /E /H frontend\src\assets\scss source\dist\
xcopy frontend\public\robots.txt source\dist\
pushd D:\statping-ng\repo\source
del /F rice-box.go 2>NUL
%USERPROFILE%\go\bin\rice.exe embed-go
Create the output directory
Run:
mkdir D:\statping-ng\repo\releases\statping-windows-amd64
The output directory path follows the convention in the Makefile.
Compile statping executable
Run:
pushd D:\statping-ng\repo
SET PATH=D:\mingw-w64\bin;%PATH%
SET CGO_ENABLED=1
SET CC=x86_64-w64-mingw32-gcc
SET CXX=x86_64-w64-mingw32-g++
SET GO111MODULE=on
SET GOOS=windows
SET GOARCH=amd64
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=0.91.0" -o releases/statping-windows-amd64/statping.exe ./cmd
The result executable file is at D:\statping-ng\repo\releases\statping-windows-amd64\statping.exe
.
Comments: