File: .lake/packages/lean4/src/lean/lake/Lake/Config/InstallPath.lean

full_name: Lake.elanExe
code: /-- Standard path of `elan` in a Elan installation. -/
def elanExe (home : FilePath) 
goal: System.FilePath

full_name: Lake.ElanInstall.toolchainsDir
code: /-- Information about the local Elan setup. -/
structure ElanInstall where
  home : FilePath
  elan := elanExe home
  binDir := home / "bin"
  toolchainsDir := home / "toolchains"
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.ElanInstall
code: /-- Information about the local Elan setup. -/
structure ElanInstall where
  home : FilePath
  elan := elanExe home
  binDir := home / "bin"
  toolchainsDir := home / "toolchains"
  deriving Inhabited, Repr
goal: Type

full_name: Lake.ElanInstall.home
code: /-- Information about the local Elan setup. -/
structure ElanInstall where
  home : FilePath
  elan := elanExe home
  binDir := home / "bin"
  toolchainsDir := home / "toolchains"
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.instReprElanInstall
code: /-- Information about the local Elan setup. -/
structure ElanInstall where
  home : FilePath
  elan := elanExe home
  binDir := home / "bin"
  toolchainsDir := home / "toolchains"
  deriving Inhabited, Repr
goal: Repr Lake.ElanInstall

full_name: Lake.ElanInstall.binDir
code: /-- Information about the local Elan setup. -/
structure ElanInstall where
  home : FilePath
  elan := elanExe home
  binDir := home / "bin"
  toolchainsDir := home / "toolchains"
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.instInhabitedElanInstall
code: /-- Information about the local Elan setup. -/
structure ElanInstall where
  home : FilePath
  elan := elanExe home
  binDir := home / "bin"
  toolchainsDir := home / "toolchains"
  deriving Inhabited, Repr
goal: Inhabited Lake.ElanInstall

full_name: Lake.ElanInstall.elan
code: /-- Information about the local Elan setup. -/
structure ElanInstall where
  home : FilePath
  elan := elanExe home
  binDir := home / "bin"
  toolchainsDir := home / "toolchains"
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.leanExe
code: /-- Standard path of `lean` in a Lean installation. -/
def leanExe (sysroot : FilePath) 
goal: System.FilePath

full_name: Lake.leancExe
code: /-- Standard path of `leanc` in a Lean installation. -/
def leancExe (sysroot : FilePath) 
goal: System.FilePath

full_name: Lake.leanArExe
code: /-- Standard path of `llvm-ar` in a Lean installation. -/
def leanArExe (sysroot : FilePath) 
goal: System.FilePath

full_name: Lake.leanCcExe
code: /-- Standard path of `clang` in a Lean installation. -/
def leanCcExe (sysroot : FilePath) 
goal: System.FilePath

full_name: Lake.leanSharedLibDir
code: /-- Standard path of shared libraries in a Lean installation. -/
def leanSharedLibDir (sysroot : FilePath) 
goal: System.FilePath

full_name: Lake.leanSharedLib
code: /-- `libleanshared` file name. -/
def leanSharedLib  
goal: System.FilePath

full_name: Lake.initSharedLib
code: /-- `Init` shared library file name. -/
def initSharedLib : FilePath 
goal: System.FilePath

full_name: Lake.LeanInstall.srcDir
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.systemLibDir
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.ar
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.instReprLeanInstall
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: Repr Lake.LeanInstall

full_name: Lake.LeanInstall.initSharedLib
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.sysroot
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.binDir
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.instInhabitedLeanInstall
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: Inhabited Lake.LeanInstall

full_name: Lake.LeanInstall.leanc
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: Type

full_name: Lake.LeanInstall.lean
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.cc
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.customCc
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: Bool

full_name: Lake.LeanInstall.leanLibDir
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.sharedLib
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.githash
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: String

full_name: Lake.LeanInstall.includeDir
code: /-- Path information about the local Lean installation. -/
structure LeanInstall where
  sysroot : FilePath
  githash : String
  srcDir := sysroot / "src" / "lean"
  leanLibDir := sysroot / "lib" / "lean"
  includeDir := sysroot / "include"
  systemLibDir := sysroot / "lib"
  binDir := sysroot / "bin"
  lean := leanExe sysroot
  leanc := leancExe sysroot
  sharedLib := leanSharedLibDir sysroot / leanSharedLib
  initSharedLib := leanSharedLibDir sysroot / initSharedLib
  ar : FilePath
  cc : FilePath
  customCc : Bool
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LeanInstall.sharedLibPath
code: /--
A `SearchPath` including the Lean installation's shared library directories
(i.e., the system library and Lean library directories).
-/
def LeanInstall.sharedLibPath (self : LeanInstall) : SearchPath 
goal: System.SearchPath

full_name: Lake.LeanInstall.leanCc?
code: /-- The `LEAN_CC` of the Lean installation. -/
def LeanInstall.leanCc? (self : LeanInstall) : Option String 
goal: Option String

full_name: Lake.lakeExe
code: /-- Lake executable file name. -/
def lakeExe : FilePath 
goal: System.FilePath

full_name: Lake.LakeInstall.srcDir
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.instReprLakeInstall
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: Repr Lake.LakeInstall

full_name: Lake.LakeInstall.libDir
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LakeInstall.home
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LakeInstall.binDir
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.LakeInstall
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: Type

full_name: Lake.LakeInstall.lake
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: System.FilePath

full_name: Lake.instInhabitedLakeInstall
code: /-- Path information about the local Lake installation. -/
structure LakeInstall where
  home : FilePath
  srcDir := home
  binDir := home / defaultBuildDir / defaultBinDir
  libDir := home / defaultBuildDir / defaultLeanLibDir
  lake := binDir / lakeExe
  deriving Inhabited, Repr
goal: Inhabited Lake.LakeInstall

full_name: Lake.LakeInstall.ofLean
code: /-- Construct a Lake installation co-located with the specified Lean installation. -/
def LakeInstall.ofLean (lean : LeanInstall) : LakeInstall 
goal: Lake.LakeInstall

full_name: Lake.findElanInstall?
code: /--
Attempt to detect a Elan installation by checking the `ELAN_HOME`
environment variable for a installation location.
-/
def findElanInstall? : BaseIO (Option ElanInstall) 
goal: BaseIO (Option Lake.ElanInstall)

full_name: Lake.findLeanSysroot?
code: /--
Attempt to find the sysroot of the given `lean` command (if it exists)
by calling `lean --print-prefix` and returning the path it prints.
Defaults to trying the `lean` in `PATH`.
-/
def findLeanSysroot? (lean := "lean") : BaseIO (Option FilePath) 
goal: BaseIO (Option System.FilePath)

full_name: Lake.LeanInstall.get.findCc
code: /--
Construct the `LeanInstall` object for the given Lean sysroot.

Does the following:
1. Find `lean`'s githash.
2. Finds the  `ar` and `cc` to use with Lean.
3. Computes the sub-paths of the Lean install.

For (1), If `lake` is not-collocated with `lean`, invoke `lean --githash`;
otherwise, use Lake's `Lean.githash`. If the invocation fails, `githash` is
set to the empty string.

For (2), if `LEAN_AR` or `LEAN_CC` are defined, it uses those paths.
Otherwise, if Lean is packaged with an `llvm-ar` and/or `clang`, use them.
If not, use the `ar` and/or `cc` in the system's `PATH`. This last step is
needed because internal builds of Lean do not bundle these tools
(unlike user-facing releases).

We also track whether `LEAN_CC` was set to determine whether it should
be set in the future for `lake env`. This is because if `LEAN_CC` was not set,
it needs to remain not set for `leanc` to work.
Even setting it to the bundled compiler will break `leanc` -- see
[leanprover/lean4#1281](https://github.com/leanprover/lean4/issues/1281).

For (3), it assumes that the Lean installation is organized the normal way.
That is, with its binaries located in `<lean-sysroot>/bin`, its
Lean libraries in `<lean-sysroot>/lib/lean`, and its system libraries in
`<lean-sysroot>/lib`.
-/
def LeanInstall.get (sysroot : FilePath) (collocated : Bool := false) : BaseIO LeanInstall 
goal: BaseIO (System.FilePath × Bool)

full_name: Lake.LeanInstall.get.getGithash
code: /--
Construct the `LeanInstall` object for the given Lean sysroot.

Does the following:
1. Find `lean`'s githash.
2. Finds the  `ar` and `cc` to use with Lean.
3. Computes the sub-paths of the Lean install.

For (1), If `lake` is not-collocated with `lean`, invoke `lean --githash`;
otherwise, use Lake's `Lean.githash`. If the invocation fails, `githash` is
set to the empty string.

For (2), if `LEAN_AR` or `LEAN_CC` are defined, it uses those paths.
Otherwise, if Lean is packaged with an `llvm-ar` and/or `clang`, use them.
If not, use the `ar` and/or `cc` in the system's `PATH`. This last step is
needed because internal builds of Lean do not bundle these tools
(unlike user-facing releases).

We also track whether `LEAN_CC` was set to determine whether it should
be set in the future for `lake env`. This is because if `LEAN_CC` was not set,
it needs to remain not set for `leanc` to work.
Even setting it to the bundled compiler will break `leanc` -- see
[leanprover/lean4#1281](https://github.com/leanprover/lean4/issues/1281).

For (3), it assumes that the Lean installation is organized the normal way.
That is, with its binaries located in `<lean-sysroot>/bin`, its
Lean libraries in `<lean-sysroot>/lib/lean`, and its system libraries in
`<lean-sysroot>/lib`.
-/
def LeanInstall.get (sysroot : FilePath) (collocated : Bool := false) : BaseIO LeanInstall 
goal: BaseIO String

full_name: Lake.LeanInstall.get.findAr
code: /--
Construct the `LeanInstall` object for the given Lean sysroot.

Does the following:
1. Find `lean`'s githash.
2. Finds the  `ar` and `cc` to use with Lean.
3. Computes the sub-paths of the Lean install.

For (1), If `lake` is not-collocated with `lean`, invoke `lean --githash`;
otherwise, use Lake's `Lean.githash`. If the invocation fails, `githash` is
set to the empty string.

For (2), if `LEAN_AR` or `LEAN_CC` are defined, it uses those paths.
Otherwise, if Lean is packaged with an `llvm-ar` and/or `clang`, use them.
If not, use the `ar` and/or `cc` in the system's `PATH`. This last step is
needed because internal builds of Lean do not bundle these tools
(unlike user-facing releases).

We also track whether `LEAN_CC` was set to determine whether it should
be set in the future for `lake env`. This is because if `LEAN_CC` was not set,
it needs to remain not set for `leanc` to work.
Even setting it to the bundled compiler will break `leanc` -- see
[leanprover/lean4#1281](https://github.com/leanprover/lean4/issues/1281).

For (3), it assumes that the Lean installation is organized the normal way.
That is, with its binaries located in `<lean-sysroot>/bin`, its
Lean libraries in `<lean-sysroot>/lib/lean`, and its system libraries in
`<lean-sysroot>/lib`.
-/
def LeanInstall.get (sysroot : FilePath) (collocated : Bool := false) : BaseIO LeanInstall 
goal: BaseIO System.FilePath

full_name: Lake.LeanInstall.get
code: /--
Construct the `LeanInstall` object for the given Lean sysroot.

Does the following:
1. Find `lean`'s githash.
2. Finds the  `ar` and `cc` to use with Lean.
3. Computes the sub-paths of the Lean install.

For (1), If `lake` is not-collocated with `lean`, invoke `lean --githash`;
otherwise, use Lake's `Lean.githash`. If the invocation fails, `githash` is
set to the empty string.

For (2), if `LEAN_AR` or `LEAN_CC` are defined, it uses those paths.
Otherwise, if Lean is packaged with an `llvm-ar` and/or `clang`, use them.
If not, use the `ar` and/or `cc` in the system's `PATH`. This last step is
needed because internal builds of Lean do not bundle these tools
(unlike user-facing releases).

We also track whether `LEAN_CC` was set to determine whether it should
be set in the future for `lake env`. This is because if `LEAN_CC` was not set,
it needs to remain not set for `leanc` to work.
Even setting it to the bundled compiler will break `leanc` -- see
[leanprover/lean4#1281](https://github.com/leanprover/lean4/issues/1281).

For (3), it assumes that the Lean installation is organized the normal way.
That is, with its binaries located in `<lean-sysroot>/bin`, its
Lean libraries in `<lean-sysroot>/lib/lean`, and its system libraries in
`<lean-sysroot>/lib`.
-/
def LeanInstall.get (sysroot : FilePath) (collocated : Bool := false) : BaseIO LeanInstall 
goal: BaseIO Lake.LeanInstall

full_name: Lake.findLeanCmdInstall?
code: /--
Attempt to detect the installation of the given `lean` command
by calling `findLeanCmdHome?`. See `LeanInstall.get` for how it assumes the
Lean install is organized.
-/
def findLeanCmdInstall? (lean := "lean") : BaseIO (Option LeanInstall) 
goal: BaseIO (Option Lake.LeanInstall)

full_name: Lake.findLakeLeanJointHome?
code: /--
Check if the running Lake's executable is co-located with Lean, and, if so,
try to return their joint home by assuming they are both located at `<home>/bin`.
-/
def findLakeLeanJointHome? : BaseIO (Option FilePath) 
goal: BaseIO (Option System.FilePath)

full_name: Lake.lakeBuildHome?
code: /--
Get the root of Lake's installation by assuming the executable
is located at `<lake-home>/.lake/build/bin/lake`.
-/
def lakeBuildHome? (lake : FilePath) : Option FilePath 
goal: Option System.FilePath

full_name: Lake.getLakeInstall?
code: /--
Heuristically validate that `getLakeBuildHome?` is a proper Lake installation
by check for `Lake.olean` in the installation's `lib` directory.
-/
def getLakeInstall? (lake : FilePath) : BaseIO (Option LakeInstall) 
goal: BaseIO (Option Lake.LakeInstall)

full_name: Lake.findLeanInstall?
code: /--
Attempt to detect Lean's installation by first checking the
`LEAN_SYSROOT` environment variable and then by trying `findLeanCmdHome?`.
See `LeanInstall.get` for how it assumes the Lean install is organized.
-/
def findLeanInstall? : BaseIO (Option LeanInstall) 
goal: BaseIO (Option Lake.LeanInstall)

full_name: Lake.findLakeInstall?
code: /--
Attempt to detect Lake's installation by first checking the `lakeBuildHome?`
of the running executable, then trying the `LAKE_HOME` environment variable.

It assumes that the Lake installation is organized the same way it is built.
That is, with its binary located at `<lake-home>/.lake/build/bin/lake` and its
static library and `.olean` files in `<lake-home>/.lake/build/lib`, and
its source files located directly in `<lake-home>`.
-/
def findLakeInstall? : BaseIO (Option LakeInstall) 
goal: BaseIO (Option Lake.LakeInstall)

full_name: Lake.findInstall?
code: /--
Attempt to automatically detect an Elan, Lake, and Lean installation.

First, it calls `findElanInstall?` to detect a Elan installation.
Then it attempts to detect if Lake and Lean are part of a single installation
where the `lake` executable is co-located with the `lean` executable (i.e., they
are in the same directory). If Lean and Lake are not co-located, Lake will
attempt  to find the their installations separately by calling
`findLeanInstall?` and `findLakeInstall?`.

When co-located, Lake will assume that Lean and Lake's binaries are located in
`<sysroot>/bin`, their Lean libraries  in `<sysroot>/lib/lean`, Lean's source files
in `<sysroot>/src/lean`, and Lake's source files in `<sysroot>/src/lean/lake`,
following the pattern of a regular Lean toolchain.
-/
def findInstall? : BaseIO (Option ElanInstall × Option LeanInstall × Option LakeInstall) 
goal: BaseIO (Option Lake.ElanInstall × Option Lake.LeanInstall × Option Lake.LakeInstall)