frp/package.sh

75 lines
2.0 KiB
Bash
Raw Permalink Normal View History

2024-03-12 18:07:55 +08:00
#!/bin/sh
set -e
2016-04-11 17:27:14 +08:00
# compile for version
2020-04-03 01:24:37 +08:00
make
2016-04-11 17:27:14 +08:00
if [ $? -ne 0 ]; then
echo "make error"
exit 1
fi
frp_version=`./bin/frps --version`
echo "build version: $frp_version"
# cross_compiles
2020-04-03 01:24:37 +08:00
make -f ./Makefile.cross-compiles
2016-04-11 17:27:14 +08:00
2020-04-03 00:59:47 +08:00
rm -rf ./release/packages
mkdir -p ./release/packages
2016-04-11 17:27:14 +08:00
2024-03-21 19:38:18 +08:00
os_all='linux windows darwin freebsd android'
2022-08-23 10:10:04 +08:00
arch_all='386 amd64 arm arm64 mips64 mips64le mips mipsle riscv64'
extra_all='_ hf'
2016-04-11 17:27:14 +08:00
2020-04-03 00:59:47 +08:00
cd ./release
2016-04-11 17:27:14 +08:00
for os in $os_all; do
for arch in $arch_all; do
2024-04-12 21:21:28 +08:00
for extra in $extra_all; do
suffix="${os}_${arch}"
if [ "x${extra}" != x"_" ]; then
suffix="${os}_${arch}_${extra}"
2016-05-15 13:30:14 +08:00
fi
2024-04-12 21:21:28 +08:00
frp_dir_name="frp_${frp_version}_${suffix}"
frp_path="./packages/frp_${frp_version}_${suffix}"
if [ "x${os}" = x"windows" ]; then
if [ ! -f "./frpc_${os}_${arch}.exe" ]; then
continue
fi
if [ ! -f "./frps_${os}_${arch}.exe" ]; then
continue
fi
mkdir ${frp_path}
mv ./frpc_${os}_${arch}.exe ${frp_path}/frpc.exe
mv ./frps_${os}_${arch}.exe ${frp_path}/frps.exe
else
if [ ! -f "./frpc_${suffix}" ]; then
continue
fi
if [ ! -f "./frps_${suffix}" ]; then
continue
fi
mkdir ${frp_path}
mv ./frpc_${suffix} ${frp_path}/frpc
mv ./frps_${suffix} ${frp_path}/frps
fi
cp ../LICENSE ${frp_path}
cp -f ../conf/frpc.toml ${frp_path}
cp -f ../conf/frps.toml ${frp_path}
2016-04-11 17:27:14 +08:00
2024-04-12 21:21:28 +08:00
# packages
cd ./packages
if [ "x${os}" = x"windows" ]; then
zip -rq ${frp_dir_name}.zip ${frp_dir_name}
else
tar -zcf ${frp_dir_name}.tar.gz ${frp_dir_name}
fi
cd ..
rm -rf ${frp_path}
done
2016-04-11 17:27:14 +08:00
done
done
2020-04-03 00:59:47 +08:00
cd -