This repository was archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlakefile.lean
More file actions
46 lines (37 loc) · 1.67 KB
/
lakefile.lean
File metadata and controls
46 lines (37 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Lake
open Lake DSL System
-- Usually the `tag` will be of the form `nightly-2021-11-22`.
-- If you would like to use an artifact from a PR build,
-- it will be of the form `pr-branchname-sha`.
def tag : String := "port-2023-01-04-9726f59"
def releaseRepo : String := "verified-optimization/mathport-optlib"
def oleanTarName : String := "optlib-binport.tar.gz"
def download (url : String) (to : FilePath) : BuildM PUnit := Lake.proc
{ -- We use `curl -O` to ensure we clobber any existing file.
cmd := "curl",
args := #["-L", "-O", url]
cwd := to }
def untar (file : FilePath) : BuildM PUnit := Lake.proc
{ cmd := "tar",
args := #["-xzf", file.fileName.getD "."] -- really should throw an error if `file.fileName = none`
cwd := file.parent }
def getReleaseArtifact (repo tag artifact : String) (to : FilePath) : BuildM PUnit :=
download s!"https://github.com/{repo}/releases/download/{tag}/{artifact}" to
def untarReleaseArtifact (repo tag artifact : String) (to : FilePath) : BuildM PUnit := do
getReleaseArtifact repo tag artifact to
untar (to / artifact)
package optlibport where
extraDepTargets := #[`fetchOleans]
target fetchOleans (_pkg : Package) : Unit := do
let libDir : FilePath := __dir__ / "build" / "lib"
IO.FS.createDirAll libDir
let oldTrace := Hash.ofString tag
let _ ← buildFileUnlessUpToDate (libDir / oleanTarName) oldTrace do
logInfo "Fetching oleans for Mathbin"
untarReleaseArtifact releaseRepo tag oleanTarName libDir
return .nil
require mathlib3port from git "https://github.com/leanprover-community/mathlib3port.git"@"0ef9b6d2572e49c015c955be6c551ba5d6894fe6"
@[default_target]
lean_lib Optbin where
roots := #[]
globs := #[`Optbin]