You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.8 KiB

4 years ago
  1. #!/bin/bash
  2. #
  3. # Functions for building MinGW port in Docker
  4. #
  5. # This file is part of the shadowsocks-libev.
  6. #
  7. # shadowsocks-libev is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # shadowsocks-libev is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with shadowsocks-libev; see the file COPYING. If not, see
  19. # <http://www.gnu.org/licenses/>.
  20. #
  21. # Exit on error
  22. set -e
  23. . /prepare.sh
  24. build_proj() {
  25. arch=$1
  26. host=$arch-w64-mingw32
  27. prefix=${DIST}/$arch
  28. dep=${PREFIX}/$arch
  29. cpu="$(nproc --all)"
  30. cd "$SRC"
  31. cd proj
  32. ./autogen.sh
  33. ./configure --host=${host} --prefix=${prefix} \
  34. --disable-documentation \
  35. --with-ev="$dep" \
  36. --with-mbedtls="$dep" \
  37. --with-sodium="$dep" \
  38. --with-pcre="$dep" \
  39. --with-cares="$dep" \
  40. CFLAGS="-DCARES_STATICLIB -DPCRE_STATIC"
  41. make clean
  42. make -j$cpu LDFLAGS="-all-static -L${dep}/lib"
  43. make install
  44. }
  45. dk_build() {
  46. for arch in i686 x86_64; do
  47. build_proj $arch
  48. done
  49. }
  50. dk_package() {
  51. rm -rf "$BASE/pack"
  52. mkdir -p "$BASE/pack"
  53. cd "$BASE/pack"
  54. mkdir -p ss-libev-${PROJ_REV}
  55. cd ss-libev-${PROJ_REV}
  56. for bin in local server tunnel; do
  57. cp ${DIST}/i686/bin/ss-${bin}.exe ss-${bin}-x86.exe
  58. cp ${DIST}/x86_64/bin/ss-${bin}.exe ss-${bin}-x64.exe
  59. done
  60. cd ..
  61. tar zcf /bin.tgz ss-libev-${PROJ_REV}
  62. }