summaryrefslogtreecommitdiffstats
path: root/site/cleopatra/dependencies.org
blob: 5a797414e357a940eab6be688adbfb662932dad5 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#+TITLE: Installing Dependencies

#+SERIES: ../cleopatra.html
#+SERIES_NEXT: ./coq.html

* OCaml and Coq

  #+caption: Dependencies for Coq articles
  #+name: coq-deps
  | Package      | Version |
  |--------------+---------|
  | coq          |  8.13.1 |
  | coq-compcert |     3.8 |

  #+caption: Dependencies for the ~coqffi~ series
  #+name: lp-deps
  | Package       |     Version |
  |---------------+-------------|
  | dune          |       2.8.4 |
  | coq-coqffi    | 1.0.0~beta5 |
  | coq-simple-io |       1.5.0 |

  #+caption: Soupault
  #+name: soupault-deps
  | Package  | Version |
  |----------+---------|
  | soupault |   2.5.0 |

  #+name: deps-listing
  #+begin_src emacs-lisp :noweb yes :var coq-deps=coq-deps :var lp-deps=lp-deps :var soupault-deps=soupault-deps :results value raw :exports none
;; We use this Emacs Lisp snippet to generate the list of dependencies
;; we have to install with Opam
(defun fmt-deps (d)
  (mapconcat (lambda (d) (format "%s" d)) d "."))

(string-join
 (append (mapcar 'fmt-deps lp-deps)
         (mapcar 'fmt-deps soupault-deps)
         (mapcar 'fmt-deps coq-deps))
 " ")
  #+end_src

  #+begin_src makefile :tangle dependencies.mk :noweb yes
OCAML_VERSION := 4.11.2
OCAML := ocaml-base-compiler.${OCAML_VERSION}

_opam/init :
	@cleopatra echo "Creating" "a local Opam switch"
	@opam switch create . ${OCAML} --repos default,coq-released || true
	@cleopatra echo "Installing" "OCaml dependencies"
	@opam install <<deps-listing()>> -y
	@touch $@

CONFIGURE += _opam
  #+end_src

* Frontend

  #+caption: Frontend dependencies
  #+name: frontend-deps
  | Package       | Version |
  |---------------+---------|
  | katex         |  0.13.0 |
  | minify        |   7.0.1 |
  | normalize.css |   8.0.1 |

  #+name: frontend-listing
  #+begin_src emacs-lisp :var frontend-deps=frontend-deps :exports none
;; We use this Emacs Lisp snippet to generate the list of dependencies
;; we have to install with npm
(defun fmt-deps (d)
  (format "  \"%s\": \"^%s\"" (nth 0 d) (nth 1 d)))

(string-join (mapcar 'fmt-deps frontend-deps) ",\n")
  #+end_src

  #+begin_src json :tangle package.json :noweb yes
{
  "dependencies": {
    <<frontend-listing()>>
  }
}
  #+end_src

  #+begin_src makefile :tangle dependencies.mk :noweb yes
package-lock.json : package.json
	@cleopatra echo "Installing" "frontend dependencies"
	@npm install
  #+end_src