-
Notifications
You must be signed in to change notification settings - Fork 5
/
package.sh
46 lines (38 loc) · 1.21 KB
/
package.sh
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
# 当前tag版本
version=`git describe --tags $(git rev-list --tags --max-count=1 --branches master)`
binary="lmap"
echo "build version: $version"
# cross_compiles
make all
rm -rf ./release/packages
mkdir -p ./release/packages
os_all='linux windows darwin freebsd'
arch_all='386 amd64 arm arm64 mips64 mips64le mips mipsle'
cd ./release
for os in $os_all; do
for arch in $arch_all; do
binary_dir_name="${binary}_${version}_${os}_${arch}" #压缩包目录
binary_path="./packages/${binary_dir_name}"
if [ "x${os}" = x"windows" ]; then
if [ ! -f "./${binary}_${os}_${arch}.exe" ]; then
continue
fi
mkdir ${binary_path}
mv ./${binary}_${os}_${arch}.exe ${binary_path}/${binary}.exe
else
if [ ! -f "./${binary}_${os}_${arch}" ]; then
continue
fi
mkdir ${binary_path}
mv ${binary}_${os}_${arch} ${binary_path}/${binary}
fi
cp ../LICENSE ${binary_path}
cp ../README.md ${binary_path}
# packages
cd ./packages
tar -zcf ${binary_dir_name}.tar.gz ${binary_dir_name}
cd ..
rm -rf ${binary_path}
done
done
cd -