Reorganize source tree and build assets

This commit is contained in:
mixeme
2026-06-14 23:40:37 +03:00
parent 414be2dfe9
commit a9d1d9529e
22 changed files with 84 additions and 59 deletions
-13
View File
@@ -1,13 +0,0 @@
param(
[string]$Output = "dist\linux\pysentry"
)
$ErrorActionPreference = "Stop"
docker build -f Dockerfile.linux -t pysentry-linux-builder .
$containerId = docker create pysentry-linux-builder
New-Item -ItemType Directory -Force -Path (Split-Path $Output) | Out-Null
docker cp "${containerId}:/out/pysentry" $Output
docker rm $containerId | Out-Null
Write-Host "Built $Output"
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
output="${1:-dist/linux/pysentry}"
docker build -f Dockerfile.linux -t pysentry-linux-builder .
container_id="$(docker create pysentry-linux-builder)"
mkdir -p "$(dirname "$output")"
docker cp "${container_id}:/out/pysentry" "$output"
docker rm "$container_id" >/dev/null
rm -rf "$(dirname "$output")/assets"
cp -R assets "$(dirname "$output")/assets"
echo "Built $output"
+2
View File
@@ -9,5 +9,7 @@ export GOOS=linux
export GOARCH=amd64
go build -trimpath -ldflags "-s -w" -o "$output" ./cmd/pysentry
rm -rf "$(dirname "$output")/assets"
cp -R assets "$(dirname "$output")/assets"
echo "Built $output"
+29
View File
@@ -0,0 +1,29 @@
@echo off
setlocal enabledelayedexpansion
set "OUTPUT=%~1"
if "%OUTPUT%"=="" set "OUTPUT=dist\windows\pysentry.exe"
set "GOEXE=%ProgramFiles%\Go\bin\go.exe"
if not exist "%GOEXE%" set "GOEXE=go"
if exist "C:\msys64\ucrt64\bin" set "PATH=C:\msys64\ucrt64\bin;%PATH%"
set "CGO_ENABLED=1"
set "GOOS=windows"
set "GOARCH=amd64"
for %%I in ("%OUTPUT%") do set "OUTDIR=%%~dpI"
if not exist "%OUTDIR%" mkdir "%OUTDIR%"
where windres.exe >nul 2>nul
if %ERRORLEVEL%==0 (
windres.exe -O coff -o cmd\pysentry\rsrc_windows_amd64.syso packaging\windows\pysentry.rc
)
"%GOEXE%" build -trimpath -ldflags "-s -w" -o "%OUTPUT%" .\cmd\pysentry
if errorlevel 1 exit /b 1
xcopy /E /I /Y assets "%OUTDIR%assets" >nul
echo Built %OUTPUT%
-30
View File
@@ -1,30 +0,0 @@
param(
[string]$Output = "dist\windows\pysentry.exe"
)
$ErrorActionPreference = "Stop"
$go = "${env:ProgramFiles}\Go\bin\go.exe"
if (-not (Test-Path $go)) {
$go = "go"
}
$msys2Bin = "C:\msys64\ucrt64\bin"
if (Test-Path $msys2Bin) {
$env:Path = "$msys2Bin;$env:Path"
}
$env:CGO_ENABLED = "1"
$env:GOOS = "windows"
$env:GOARCH = "amd64"
New-Item -ItemType Directory -Force -Path (Split-Path $Output) | Out-Null
$windres = Get-Command windres.exe -ErrorAction SilentlyContinue
if ($windres) {
& $windres.Source -O coff -o .\cmd\pysentry\rsrc_windows_amd64.syso .\packaging\windows\pysentry.rc
}
& $go build -trimpath -ldflags "-s -w" -o $Output .\cmd\pysentry
Write-Host "Built $Output"