Some minstr cleanup
[hiphop-php.git] / third-party / rustc / CMakeLists.txt
blobfebc8c98a937e30c408e2b27ea67650ddc67041f
1 # When updating:
2 # - verify the gpg signature (foo.tar.gz.asc) against key with fingerprint
3 #   108F 6620 5EAE B0AA A8DD  5E1C 85AB 96E6 FA1B E5FE
4 #   (link to raw key: https://static.rust-lang.org/rust-key.gpg.ascii)
5 # - generate the sha512 with `openssl dgst -sha512 foo.tar.gz`
7 # We separately store the sha512 to be sure we're getting the exact same
8 # build, not just any tarball.
10 # This also avoids the need to depend on gpg in the installation.
12 include(HPHPFunctions)
14 set(RUST_NIGHTLY_VERSION "2021-10-21")
16 SET_HHVM_THIRD_PARTY_SOURCE_ARGS(
17   RUST_DOWNLOAD_ARGS
18   Linux_URL
19   "https://static.rust-lang.org/dist/${RUST_NIGHTLY_VERSION}/rust-nightly-x86_64-unknown-linux-gnu.tar.gz"
20   Darwin_URL
21   "https://static.rust-lang.org/dist/${RUST_NIGHTLY_VERSION}/rust-nightly-x86_64-apple-darwin.tar.gz"
22   Linux_HASH
23   "SHA512=84b38862809f5ff000a4ed86c8a2738ae255dc0c6ed8c9de68e5a9e8e651d046595a595641b9a8d9a5ac7711f4a04ac9f8a1cbb2723b56da6bbb972d2a844d9c"
24   Darwin_HASH
25   "SHA512=1ecf81b997cd200c9c11689528c507ad87a37918d5b5476129bb83c7f83b38464a9b4bb04f76b841b9a783de31b10623206fd6fdbeeb6a918df8b4d59c1f39a9"
26   # The original filename doesn't contain any version information, so add the version information as a prefix to avoid cache collisions when updating later
27   FILENAME_PREFIX "rustc-${RUST_NIGHTLY_VERSION}-"
30 include(ExternalProject)
31 ExternalProject_Add(
32   bundled_rust
33   ${RUST_DOWNLOAD_ARGS}
34   CONFIGURE_COMMAND ""
35   BUILD_COMMAND ""
36   INSTALL_COMMAND
37   "<SOURCE_DIR>/install.sh" "--prefix=<INSTALL_DIR>"
40 add_executable(rustc IMPORTED GLOBAL)
41 add_executable(cargo IMPORTED GLOBAL)
42 add_dependencies(rustc bundled_rust)
43 add_dependencies(cargo bundled_rust)
45 ExternalProject_Get_Property(bundled_rust INSTALL_DIR)
46 set_property(TARGET rustc PROPERTY IMPORTED_LOCATION "${INSTALL_DIR}/bin/rustc")
47 set_property(TARGET cargo PROPERTY IMPORTED_LOCATION "${INSTALL_DIR}/bin/cargo")