win.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env bash
  2. set -e
  3. VERSION_VIPS_SHORT=${VERSION_VIPS%.[[:digit:]]*}
  4. # Common options for curl
  5. CURL="curl --silent --location --retry 3 --retry-max-time 30"
  6. # Fetch and unzip
  7. mkdir /vips
  8. cd /vips
  9. case ${PLATFORM} in
  10. *arm64v8)
  11. ARCH=arm64
  12. ;;
  13. *x64)
  14. ARCH=w64
  15. ;;
  16. *ia32)
  17. ARCH=w32
  18. ;;
  19. esac
  20. FILENAME="vips-dev-${ARCH}-web-${VERSION_VIPS}-static.zip"
  21. URL="https://github.com/libvips/build-win64-mxe/releases/download/v${VERSION_VIPS}-build2/${FILENAME}"
  22. echo "Downloading $URL"
  23. $CURL -O $URL
  24. unzip $FILENAME
  25. # Clean and zip
  26. cd /vips/vips-dev-${VERSION_VIPS_SHORT}
  27. rm bin/libvips-cpp-42.dll
  28. cp bin/*.dll lib/
  29. # Create platform.json
  30. printf "\"${PLATFORM}\"" >platform.json
  31. # Add third-party notices
  32. $CURL -O https://raw.githubusercontent.com/lovell/sharp-libvips/master/THIRD-PARTY-NOTICES.md
  33. echo "Creating tarball"
  34. tar czf /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz \
  35. include \
  36. lib/glib-2.0 \
  37. lib/libvips.lib \
  38. lib/libglib-2.0.lib \
  39. lib/libgobject-2.0.lib \
  40. lib/*.dll \
  41. *.json \
  42. THIRD-PARTY-NOTICES.md
  43. # Recompress using AdvanceCOMP, ~5% smaller
  44. advdef --recompress --shrink-insane /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz
  45. # Recompress using Brotli, ~15% smaller
  46. gunzip -c /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz | brotli -o /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.br
  47. # Allow tarballs to be read outside container
  48. chmod 644 /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.*
  49. # Remove working directories
  50. rm -rf lib include *.json THIRD-PARTY-NOTICES.md