Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitadfaa66

Browse files
committed
update buld makefile
1 parent311df38 commitadfaa66

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
run:
22
go run*.go -o ./tmp
33
build:
4-
go build -o image-compressor
4+
go build -o image-compressor

‎build.sh‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
package=$1
3+
4+
if [[-z"$package" ]];then
5+
echo"usage:$0 <package-name>"
6+
exit 1
7+
fi
8+
9+
package_name=$(basename"$package")
10+
11+
platforms=("linux/amd64""linux/arm64")
12+
13+
forplatformin"${platforms[@]}";do
14+
IFS='/'read -ra platform_split<<<"$platform"
15+
GOOS=${platform_split[0]}
16+
GOARCH=${platform_split[1]}
17+
output_name="$package_name"-"$GOOS"-"$GOARCH"
18+
19+
if ["$GOOS"="windows" ];then
20+
output_name+='.exe'
21+
fi
22+
echo"CGO_ENABLE=1 GOOS='$GOOS' GOARCH='$GOARCH' go build -o '$output_name' '$package'"
23+
env CGO_ENABLE=1 GOOS="$GOOS" GOARCH="$GOARCH" go build -o"$output_name""$package"
24+
25+
if [$?-ne 0 ];then
26+
echo'An error has occurred! Aborting the script execution...'
27+
exit 1
28+
fi
29+
done

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp