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.

78 lines
2.0 KiB

  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_deps() {
  25. arch=$1
  26. host=$arch-w64-mingw32
  27. prefix=${PREFIX}/$arch
  28. args="--host=${host} --prefix=${prefix} --disable-shared --enable-static"
  29. cpu="$(nproc --all)"
  30. # libev
  31. cd "$SRC/$LIBEV_SRC"
  32. ./configure $args
  33. make clean
  34. make -j$cpu install
  35. # mbedtls
  36. cd "$SRC/$MBEDTLS_SRC"
  37. make clean
  38. make -j$cpu lib WINDOWS=1 CC="${host}-gcc" AR="${host}-ar"
  39. ## "make install" command from mbedtls
  40. DESTDIR="${prefix}"
  41. mkdir -p "${DESTDIR}"/include/mbedtls
  42. cp -r include/mbedtls "${DESTDIR}"/include
  43. mkdir -p "${DESTDIR}"/lib
  44. cp -RP library/libmbedtls.* "${DESTDIR}"/lib
  45. cp -RP library/libmbedx509.* "${DESTDIR}"/lib
  46. cp -RP library/libmbedcrypto.* "${DESTDIR}"/lib
  47. unset DESTDIR
  48. # sodium
  49. cd "$SRC/$SODIUM_SRC"
  50. ./configure $args
  51. make clean
  52. make -j$cpu install
  53. # pcre
  54. cd "$SRC/$PCRE_SRC"
  55. ./configure $args --disable-cpp \
  56. --enable-unicode-properties
  57. make clean
  58. make -j$cpu install
  59. # c-ares
  60. cd "$SRC/$CARES_SRC"
  61. ./configure $args
  62. make clean
  63. make -j$cpu install
  64. }
  65. dk_deps() {
  66. for arch in i686 x86_64; do
  67. build_deps $arch
  68. done
  69. }