-
Notifications
You must be signed in to change notification settings - Fork 355
/
win_build.bat
56 lines (44 loc) · 1.45 KB
/
win_build.bat
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
@echo off
REM ============= build script for windows ================
REM how to use
REM win_build.bat v0.0.1
REM =======================================================
REM ============= variable definitions ================
set currentDir=%CD%
set output=out
set name=aliyunpan
set version=%1
REM ============= build action ================
call :build_task %name%-%version%-windows-x86 windows 386
call :build_task %name%-%version%-windows-x64 windows amd64
call :build_task %name%-%version%-linux-386 linux 386
call :build_task %name%-%version%-linux-amd64 linux amd64
call :build_task %name%-%version%-darwin-macos-amd64 darwin amd64
goto:EOF
REM ============= build function ================
:build_task
setlocal
set targetName=%1
set GOOS=%2
set GOARCH=%3
set goarm=%4
set GO386=sse2
set CGO_ENABLED=0
set GOARM=%goarm%
echo "Building %targetName% ..."
if %GOOS% == windows (
goversioninfo -o=resource_windows_386.syso
goversioninfo -64 -o=resource_windows_amd64.syso
go build -ldflags "-linkmode internal -X main.Version=%version% -s -w" -o "%output%/%1/%name%.exe"
) ^
else (
go build -ldflags "-X main.Version=%version% -s -w" -o "%output%/%1/%name%"
)
copy README.md %output%\%1
copy docs\manual.md %output%\%1
mkdir %output%\%1\plugin
xcopy /e assets\plugin %output%\%1\plugin
mkdir %output%\%1\sync_drive
xcopy /e assets\sync_drive %output%\%1\sync_drive
xcopy /e assets\scripts %output%\%1
endlocal