1
0

package.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/sh
  2. set -e
  3. # compile for version
  4. make
  5. if [ $? -ne 0 ]; then
  6. echo "make error"
  7. exit 1
  8. fi
  9. frp_version=`./bin/frps --version`
  10. echo "build version: $frp_version"
  11. # cross_compiles
  12. make -f ./Makefile.cross-compiles
  13. rm -rf ./release/packages
  14. mkdir -p ./release/packages
  15. os_all='linux windows darwin freebsd android'
  16. arch_all='386 amd64 arm arm64 mips64 mips64le mips mipsle riscv64 loong64'
  17. extra_all='_ hf'
  18. cd ./release
  19. for os in $os_all; do
  20. for arch in $arch_all; do
  21. for extra in $extra_all; do
  22. suffix="${os}_${arch}"
  23. if [ "x${extra}" != x"_" ]; then
  24. suffix="${os}_${arch}_${extra}"
  25. fi
  26. frp_dir_name="frp_${frp_version}_${suffix}"
  27. frp_path="./packages/frp_${frp_version}_${suffix}"
  28. if [ "x${os}" = x"windows" ]; then
  29. if [ ! -f "./frpc_${os}_${arch}.exe" ]; then
  30. continue
  31. fi
  32. if [ ! -f "./frps_${os}_${arch}.exe" ]; then
  33. continue
  34. fi
  35. mkdir ${frp_path}
  36. mv ./frpc_${os}_${arch}.exe ${frp_path}/frpc.exe
  37. mv ./frps_${os}_${arch}.exe ${frp_path}/frps.exe
  38. else
  39. if [ ! -f "./frpc_${suffix}" ]; then
  40. continue
  41. fi
  42. if [ ! -f "./frps_${suffix}" ]; then
  43. continue
  44. fi
  45. mkdir ${frp_path}
  46. mv ./frpc_${suffix} ${frp_path}/frpc
  47. mv ./frps_${suffix} ${frp_path}/frps
  48. fi
  49. cp ../LICENSE ${frp_path}
  50. cp -f ../conf/frpc.toml ${frp_path}
  51. cp -f ../conf/frps.toml ${frp_path}
  52. # packages
  53. cd ./packages
  54. if [ "x${os}" = x"windows" ]; then
  55. zip -rq ${frp_dir_name}.zip ${frp_dir_name}
  56. else
  57. tar -zcf ${frp_dir_name}.tar.gz ${frp_dir_name}
  58. fi
  59. cd ..
  60. rm -rf ${frp_path}
  61. done
  62. done
  63. done
  64. cd -