-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build-embed.cmd
84 lines (69 loc) · 1.34 KB
/
Build-embed.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@echo off
if not exist go.mod (
echo Initializing go module...
go mod init main 2> nul
)
if not exist go.sum (
echo Tidying go module...
go mod tidy 2> nul
)
echo Configuring file names...
for /f "tokens=*" %%0 in ('dir /b ^| findstr /e .flac') do (
set FLAC=%%0
set WAV=%%~n0.wav
set app=%%~n0
)
echo Writing "embed.go"...
(
echo package main
echo import _ "embed"
echo //go:embed "%FLAC%"
echo var flacRaw []byte
echo var wavName string = "%WAV%"
) > embed.go
timeout /t 3 /nobreak > nul
:Menu
echo.
echo Generate executable for which operating system and architecture?
echo 1.] Windows x86_64
echo 2.] Windows x86
echo 3.] Linux x86_64
echo 4.] Linux x86
echo 5.] Darwin [Mac] x86_64
echo.
echo X.] Exit
choice /c 12345x /n
goto %errorlevel%
:1
set GOARCH=amd64
set GOOS=windows
set file=%app%_%GOOS%_%GOARCH%.exe
goto Build
:2
set GOARCH=386
set GOOS=windows
set file=%app%_%GOOS%_%GOARCH%.exe
goto Build
:3
set GOARCH=amd64
set GOOS=linux
set file=%app%_%GOOS%_%GOARCH%
goto Build
:4
set GOARCH=386
set GOOS=linux
set file=%app%_%GOOS%_%GOARCH%
goto Build
:5
set GOARCH=amd64
set GOOS=darwin
set file=%app%_%GOOS%_%GOARCH%.app
goto Build
:6
exit /b
:Build
echo Building "Release/%file%"...
call go build -ldflags="-s -w" -o "Release/%file%" flacsfx.go embed.go
if %errorlevel%==0 (echo Build successful!
) else echo Build unsuccessful!
goto Menu