sysroot.bash 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env bash
  2. set -e
  3. arch="$1"
  4. readonly arch
  5. case "$arch" in
  6. x86_64)
  7. tarball="sysroot-x86_64-pc-solaris2.10-sunos5.10-1.tar.xz"
  8. sha256sum="bea632b3ae755f89a1c0e64775437a9b29001a3fc3a3c2c6247b921776059231"
  9. ;;
  10. sparc64)
  11. tarball="sysroot-sparc64-sun-solaris2.10-sunos5.10-1.tar.xz"
  12. sha256sum="fd60cc1be951ae314ff2b4246ac055c8e5b21c39b4cd41b23ebcec709451d90f"
  13. ;;
  14. *)
  15. echo >&2 "Unknown architecture: $arch"
  16. exit 1
  17. ;;
  18. esac
  19. # To build externally, provide a Solaris sysroot tarball:
  20. # --build-arg SYSROOT_URL=...
  21. # --build-arg SYSROOT_SHA256SUM=...
  22. # The tarball must contain one of:
  23. # sysroot/x86_64-pc-solaris2.10/{lib,usr/lib,usr/include}
  24. # sysroot/sparc64-sun-solaris2.10/{lib,usr/lib,usr/include}
  25. # The content may be retrieved from a real Solaris host.
  26. if test -n "$SYSROOT_URL"; then
  27. url="$SYSROOT_URL"
  28. if test -n "$SYSROOT_SHA256SUM"; then
  29. sha256sum="$SYSROOT_SHA256SUM"
  30. else
  31. sha256sum=""
  32. fi
  33. tarball=$(basename "$url")
  34. else
  35. # This URL is only visible inside of Kitware's network.
  36. url="https://cmake.org/files/dependencies/internal/sunos/$tarball"
  37. fi
  38. readonly url
  39. readonly tarball
  40. readonly sha256sum
  41. cd /tmp
  42. curl -OL "$url"
  43. if test -n "$sha256sum"; then
  44. echo "$sha256sum $tarball" > sysroot.sha256sum
  45. sha256sum --check sysroot.sha256sum
  46. fi
  47. tar xf "$tarball" -C /opt/cross