BUILD 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #
  5. # Installs Carbon to /usr/bin and /usr/lib/carbon.
  6. #
  7. # To install to /usr, run:
  8. # bazel run -c opt //installers/local:install
  9. #
  10. # To use a custom install path, run:
  11. # bazel run -c opt //installers/local:install
  12. # --//installers/local:install_path=/my/path
  13. #
  14. # To uninstall, run:
  15. # bazel //installers/local:uninstall
  16. #
  17. # The build mode is important for installs, as debug versions may be installed.
  18. # It is not relevant for uninstalls.
  19. #
  20. # If a custom install path is passed to :install, the same should be passed to
  21. # :uninstall.
  22. load("install.bzl", "install_path_rule")
  23. # Turns `--//installers/local:install_path=arg` into `$(INSTALL_PATH)`.
  24. install_path_rule(
  25. name = "install_path",
  26. build_setting_default = "/usr",
  27. )
  28. sh_binary(
  29. name = "install",
  30. srcs = ["install.sh"],
  31. args = [
  32. "--install_path",
  33. "$(INSTALL_PATH)",
  34. "--carbon",
  35. "$(location :carbon)",
  36. "$(locations //explorer:standard_libraries)",
  37. ],
  38. data = [
  39. ":carbon",
  40. "//explorer:standard_libraries",
  41. ],
  42. toolchains = [":install_path"],
  43. )
  44. sh_binary(
  45. name = "uninstall",
  46. srcs = ["uninstall.sh"],
  47. args = [
  48. "--install_path",
  49. "$(INSTALL_PATH)",
  50. ],
  51. toolchains = [":install_path"],
  52. )
  53. # A busybox-like binary for Carbon tools; multiple tools are part of this binary
  54. # so that shared code is deduplicated.
  55. cc_binary(
  56. name = "carbon",
  57. srcs = ["carbon.cpp"],
  58. visibility = ["//bazel/check_deps:__pkg__"],
  59. deps = [
  60. "//explorer:main",
  61. "@llvm-project//llvm:Support",
  62. ],
  63. )