10-mingw.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. SCRIPT_REPO="https://git.code.sf.net/p/mingw-w64/mingw-w64.git"
  3. SCRIPT_COMMIT="e3a3dc588a6358bda826934d3adfeaa316792534"
  4. ffbuild_enabled() {
  5. [[ $TARGET == win* ]] || return -1
  6. return 0
  7. }
  8. ffbuild_dockerlayer() {
  9. [[ $TARGET == winarm* ]] && return 0
  10. to_df "COPY --link --from=${SELFLAYER} /opt/mingw/. /"
  11. to_df "COPY --link --from=${SELFLAYER} /opt/mingw/. /opt/mingw"
  12. }
  13. ffbuild_dockerfinal() {
  14. [[ $TARGET == winarm* ]] && return 0
  15. to_df "COPY --from=${PREVLAYER} /opt/mingw/. /"
  16. }
  17. ffbuild_dockerdl() {
  18. echo "retry-tool sh -c \"rm -rf mingw && git clone '$SCRIPT_REPO' mingw\" && cd mingw && git checkout \"$SCRIPT_COMMIT\""
  19. }
  20. ffbuild_dockerbuild() {
  21. [[ $TARGET == winarm* ]] && return 0
  22. cd mingw-w64-headers
  23. unset CFLAGS
  24. unset CXXFLAGS
  25. unset LDFLAGS
  26. unset PKG_CONFIG_LIBDIR
  27. if [[ -z "$COMPILER_SYSROOT" ]]; then
  28. COMPILER_SYSROOT="$(${CC} -print-sysroot)/usr/${FFBUILD_TOOLCHAIN}"
  29. fi
  30. local myconf=(
  31. --prefix="$COMPILER_SYSROOT"
  32. --host="$FFBUILD_TOOLCHAIN"
  33. --with-default-win32-winnt="0x601"
  34. --with-default-msvcrt=ucrt
  35. --enable-idl
  36. )
  37. ./configure "${myconf[@]}"
  38. make -j$(nproc)
  39. make install DESTDIR="/opt/mingw"
  40. cd ../mingw-w64-libraries/winpthreads
  41. local myconf=(
  42. --prefix="$COMPILER_SYSROOT"
  43. --host="$FFBUILD_TOOLCHAIN"
  44. --with-pic
  45. --disable-shared
  46. --enable-static
  47. )
  48. ./configure "${myconf[@]}"
  49. make -j$(nproc)
  50. make install DESTDIR="/opt/mingw"
  51. }
  52. ffbuild_configure() {
  53. echo --disable-w32threads --enable-pthreads
  54. }