build.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env bash
  2. set -e
  3. if [ $# -lt 1 ]; then
  4. echo
  5. echo "Usage: $0 VERSION [PLATFORM]"
  6. echo "Build shared libraries for libvips and its dependencies via containers"
  7. echo
  8. echo "Please specify the libvips VERSION, e.g. 8.9.2"
  9. echo
  10. echo "Optionally build for only one PLATFORM, defaults to building for all"
  11. echo
  12. echo "Possible values for PLATFORM are:"
  13. echo "- win32-ia32"
  14. echo "- win32-x64"
  15. echo "- win32-arm64v8"
  16. echo "- linux-x64"
  17. echo "- linuxmusl-x64"
  18. echo "- linux-armv6"
  19. echo "- linux-armv7"
  20. echo "- linux-arm64v8"
  21. echo "- darwin-x64"
  22. echo
  23. exit 1
  24. fi
  25. VERSION_VIPS="$1"
  26. PLATFORM="${2:-all}"
  27. # macOS
  28. # Note: we intentionally don't build these binaries inside a Docker container
  29. if [ $PLATFORM = "darwin-x64" ] && [ "$(uname)" == "Darwin" ]; then
  30. # Use Clang provided by XCode
  31. export CC="clang"
  32. export CXX="clang++"
  33. export VERSION_VIPS
  34. export PLATFORM
  35. # 10.9 should be a good minimal release target
  36. export MACOSX_DEPLOYMENT_TARGET="10.9"
  37. # Added -fno-stack-check to workaround a stack misalignment bug on macOS 10.15
  38. # See:
  39. # https://forums.developer.apple.com/thread/121887
  40. # https://trac.ffmpeg.org/ticket/8073#comment:12
  41. export FLAGS="-O3 -fPIC -fno-stack-check"
  42. . $PWD/build/mac.sh
  43. exit 0
  44. fi
  45. # Is docker available?
  46. if ! [ -x "$(command -v docker)" ]; then
  47. echo "Please install docker"
  48. exit 1
  49. fi
  50. # Update base images
  51. for baseimage in centos:7 debian:buster debian:bullseye alpine:3.11; do
  52. docker pull $baseimage
  53. done
  54. # Windows
  55. # Linux (x64, ARMv6, ARMv7, ARM64v8)
  56. for flavour in linux-x64 linuxmusl-x64 linux-armv6 linux-armv7 linux-arm64v8; do
  57. if [ $PLATFORM = "all" ] || [ $PLATFORM = $flavour ]; then
  58. echo "Building $flavour..."
  59. docker build -t vips-dev-$flavour $flavour
  60. docker run --rm -e "VERSION_VIPS=${VERSION_VIPS}" -v $PWD:/packaging vips-dev-$flavour sh -c "/packaging/build/lin.sh"
  61. fi
  62. done
  63. # Display checksums
  64. sha256sum *.tar.{br,gz}