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. i386)
  7. tarball="sysroot-i386-pc-solaris2.10-sunos5.10-1.tar.xz"
  8. sha256sum="1b9251699f4e412ba5b0fde9c0fb96ceef6b8a1f47f0c1f2146ba0ba9da458b8"
  9. ;;
  10. sparc)
  11. tarball="sysroot-sparc-sun-solaris2.10-sunos5.10-1.tar.xz"
  12. sha256sum="e6c668a63dc00de443d07cbe2be779335642ffe1b818ba85d23ab543982aaf23"
  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/i386-pc-solaris2.10/{lib,usr/lib,usr/include}
  24. # sysroot/sparc-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