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.

79 lines
2.1 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. # Build options
  24. BASE="/build"
  25. PREFIX="$BASE/stage"
  26. SRC="$BASE/src"
  27. DIST="$BASE/dist"
  28. # Project URL
  29. PROJ_SITE=$REPO # Change REPO in Makefile
  30. PROJ_REV=$REV # Change REV in Makefile
  31. PROJ_URL=https://github.com/${PROJ_SITE}/shadowsocks-libev.git
  32. # Libraries from project
  33. ## libev for MinGW
  34. LIBEV_VER=mingw
  35. LIBEV_SRC=libev-${LIBEV_VER}
  36. LIBEV_URL=https://github.com/${PROJ_SITE}/libev/archive/${LIBEV_VER}.tar.gz
  37. # Public libraries
  38. ## mbedTLS
  39. MBEDTLS_VER=2.16.5
  40. MBEDTLS_SRC=mbedtls-${MBEDTLS_VER}
  41. MBEDTLS_URL=https://tls.mbed.org/download/mbedtls-${MBEDTLS_VER}-apache.tgz
  42. ## Sodium
  43. SODIUM_VER=1.0.18
  44. SODIUM_SRC=libsodium-stable
  45. SODIUM_URL=https://download.libsodium.org/libsodium/releases/libsodium-${SODIUM_VER}-stable.tar.gz
  46. ## PCRE
  47. PCRE_VER=8.44
  48. PCRE_SRC=pcre-${PCRE_VER}
  49. PCRE_URL=https://ftp.pcre.org/pub/pcre/${PCRE_SRC}.tar.gz
  50. ## c-ares
  51. CARES_VER=1.16.0
  52. CARES_SRC=c-ares-${CARES_VER}
  53. CARES_URL=https://c-ares.haxx.se/download/${CARES_SRC}.tar.gz
  54. # Build steps
  55. dk_download() {
  56. mkdir -p "${SRC}"
  57. cd "${SRC}"
  58. DOWN="aria2c --file-allocation=trunc -s10 -x10 -j10 -c"
  59. for pkg in LIBEV SODIUM MBEDTLS PCRE CARES; do
  60. src=${pkg}_SRC
  61. url=${pkg}_URL
  62. out="${!src}".tar.gz
  63. $DOWN ${!url} -o "${out}"
  64. echo "Unpacking ${out}..."
  65. tar zxf ${out}
  66. done
  67. }