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.

85 lines
2.2 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. # 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.7.0
  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.16
  44. SODIUM_SRC=libsodium-${SODIUM_VER}
  45. SODIUM_URL=https://download.libsodium.org/libsodium/releases/${SODIUM_SRC}.tar.gz
  46. ## PCRE
  47. PCRE_VER=8.41
  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.14.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_prepare() {
  56. apt-get update -y
  57. apt-get install --no-install-recommends -y \
  58. mingw-w64 aria2 git make automake autoconf libtool ca-certificates
  59. }
  60. dk_download() {
  61. mkdir -p "${SRC}"
  62. cd "${SRC}"
  63. DOWN="aria2c --file-allocation=trunc -s10 -x10 -j10 -c"
  64. for pkg in LIBEV SODIUM MBEDTLS PCRE CARES; do
  65. src=${pkg}_SRC
  66. url=${pkg}_URL
  67. out="${!src}".tar.gz
  68. $DOWN ${!url} -o "${out}"
  69. echo "Unpacking ${out}..."
  70. tar zxf ${out}
  71. done
  72. }