Skip to content

Commit

Permalink
Use Dune to generate OPAM package definitions (#1191)
Browse files Browse the repository at this point in the history
This patch moves the definitions of our OPAM packages into the file `dune-project`. The OPAM package definitions are automatically generated from this file. This approach offers some advantages:

* Less redundancy: package descriptions are now shared.
* Dune integration: OPAM package definitions are kept in sync with dune.
* Versioning: `dune-release` automatically versions the OPAM package definitions.

Our build rules for the `links` package are a little more complicated than `dune` supports out-of-the-box. The steps required to build this package are defined in the `links.opam.template` file, which `dune` automatically pastes into the generated `links.opam` file.

I fixed the minimum required version of OCaml to `4.14.0`, as that seems to be the minimum version with which Links compiles at the moment.
  • Loading branch information
dhil authored Nov 27, 2023
1 parent 2c8d8ce commit 11652c2
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 56 deletions.
106 changes: 103 additions & 3 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,104 @@
(lang dune 2.7)
(using menhir 2.0)
(name links)
(implicit_transitive_deps false)
;; dune language version (NOTE this comment applies to the above line; it is intentionally placed here!)
(using menhir 2.0) ;; enable use of menhir
(name links) ;; package name
(implicit_transitive_deps false) ;; hides transitive dependencies in libraries/executables/tests
(generate_opam_files true) ;; generate .opam package files using the descriptions defined in this file


;;
;; Project metainformation
;;

(source
(github links-lang/links))
(homepage
https://links-lang.org)
(authors
"The Links Team <[email protected]>")
(maintainers
"Daniel Hillerström <[email protected]>")
(license
GPL-3.0-only)
(documentation
"https://links-lang.org/quick-help.html")

;;
;; The Links Programmming System
;;

(package
(name links)
(synopsis "The Links Programming Language")
(description "Links is a functional programming language designed to make web programming easier.")
(depends (ocaml (>= : 4.14.0))
(dune-configurator (>= : 3.8))
ppx_deriving
(ppx_deriving_yojson (>= 3.3))
base64
linenoise
ANSITerminal
(lwt (>= 5.0.0))
cohttp
cohttp-lwt
cohttp-lwt-unix
conduit-lwt-unix
uri
tls
websocket
websocket-lwt-unix
safepass
result
ocamlfind
(menhir (>= 20210419))
(ppx_sexp_conv (>= v0.16.0))
(calendar (>= 2.0.4))
(rdf_lwt (>= 0.13.0)))
(tags
("web programming" "tierless" "multi-tier" "effect handlers" "effect typing" "session types"
"concurrency" "webpage" "extensible data types" "language-integrated queries")))

;;
;; Links PostgreSQL driver
;;

(package
(name links-postgresql)
(synopsis "Postgresql database driver for the Links Programming Language")
(description "Postgresql database driver for the Links Programming Language")
(depends (links (= :version))
postgresql)
(tags
("postgresql" "database")))

;;
;; Links SQLite3 driver
;;

(package
(name links-sqlite3)
(synopsis "SQLite database driver for the Links Programming Language")
(description "SQLite database driver for the Links Programming Language")
(depends (links (= :version))
sqlite3)
(tags
("sqlite" "database")))

;;
;; Links MySQL driver
;;

(package
(name links-mysql)
(synopsis "MySQL database driver for the Links Programming Language")
(description "MySQL database driver for the Links Programming Language")
(depends (links (= :version))
conf-mysql
mysql8)
(tags
("mysql" "database")))



; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

37 changes: 24 additions & 13 deletions links-mysql.opam
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "James Cheney <[email protected]>"
authors: "The Links Team <[email protected]>"
synopsis: "MySQL database driver for the Links Programming Language"
description: "MySQL database driver for the Links Programming Language"
homepage: "https://github.com/links-lang/links"
dev-repo: "git+https://github.com/links-lang/links.git"
bug-reports: "https://github.com/links-lang/links/issues"
maintainer: ["Daniel Hillerström <[email protected]>"]
authors: ["The Links Team <[email protected]>"]
license: "GPL-3.0-only"

build: [
[ "dune" "subst" ] {dev}
[ "dune" "build" "-p" name "-j" jobs ]
]

tags: ["mysql" "database"]
homepage: "https://links-lang.org"
doc: "https://links-lang.org/quick-help.html"
bug-reports: "https://github.com/links-lang/links/issues"
depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "2.7"}
"links" {= version}
"conf-mysql"
"mysql8"
"links" {= version}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/links-lang/links.git"
38 changes: 24 additions & 14 deletions links-postgresql.opam
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "Daniel Hillerström <[email protected]>"
authors: "The Links Team <[email protected]>"
synopsis: "Postgresql database driver for the Links Programming Language"
description: "Postgresql database driver for the Links Programming Language"
homepage: "https://github.com/links-lang/links"
dev-repo: "git+https://github.com/links-lang/links.git"
bug-reports: "https://github.com/links-lang/links/issues"
maintainer: ["Daniel Hillerström <[email protected]>"]
authors: ["The Links Team <[email protected]>"]
license: "GPL-3.0-only"


build: [
[ "dune" "subst" ] {dev}
[ "dune" "build" "-p" name "-j" jobs ]
]

tags: ["postgresql" "database"]
homepage: "https://links-lang.org"
doc: "https://links-lang.org/quick-help.html"
bug-reports: "https://github.com/links-lang/links/issues"
depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "2.7"}
"postgresql"
"links" {= version}
"postgresql"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/links-lang/links.git"
37 changes: 24 additions & 13 deletions links-sqlite3.opam
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "Daniel Hillerström <[email protected]>"
authors: "The Links Team <[email protected]>"
synopsis: "SQLite database driver for the Links Programming Language"
description: "SQLite database driver for the Links Programming Language"
homepage: "https://github.com/links-lang/links"
dev-repo: "git+https://github.com/links-lang/links.git"
bug-reports: "https://github.com/links-lang/links/issues"
maintainer: ["Daniel Hillerström <[email protected]>"]
authors: ["The Links Team <[email protected]>"]
license: "GPL-3.0-only"

build: [
[ "dune" "subst" ] {dev}
[ "dune" "build" "-p" name "-j" jobs ]
]

tags: ["sqlite" "database"]
homepage: "https://links-lang.org"
doc: "https://links-lang.org/quick-help.html"
bug-reports: "https://github.com/links-lang/links/issues"
depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "2.7"}
"sqlite3"
"links" {= version}
"sqlite3"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/links-lang/links.git"
40 changes: 27 additions & 13 deletions links.opam
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: "Daniel Hillerström <[email protected]>"
authors: "The Links Team <[email protected]>"
synopsis: "The Links Programming Language"
description: "Links is a functional programming language designed to make web programming easier."
homepage: "https://github.com/links-lang/links"
dev-repo: "git+https://github.com/links-lang/links.git"
bug-reports: "https://github.com/links-lang/links/issues"
description:
"Links is a functional programming language designed to make web programming easier."
maintainer: ["Daniel Hillerström <[email protected]>"]
authors: ["The Links Team <links-[email protected]>"]
license: "GPL-3.0-only"


build: [
[ "dune" "exec" "preinstall/preinstall.exe" "--" "-libdir" _:lib ]
[ make "opam-build-links.opam" ]
tags: [
"web programming"
"tierless"
"multi-tier"
"effect handlers"
"effect typing"
"session types"
"concurrency"
"webpage"
"extensible data types"
"language-integrated queries"
]

homepage: "https://links-lang.org"
doc: "https://links-lang.org/quick-help.html"
bug-reports: "https://github.com/links-lang/links/issues"
depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "2.7"}
"ocaml" { >= "4.14.0"}
"dune-configurator" { >= "3.8"}
"ppx_deriving"
"ppx_deriving_yojson" {>= "3.3"}
"base64"
Expand All @@ -38,4 +46,10 @@ depends: [
"ppx_sexp_conv" {>= "v0.16.0"}
"calendar" {>= "2.0.4"}
"rdf_lwt" {>= "0.13.0"}
"odoc" {with-doc}
]
dev-repo: "git+https://github.com/links-lang/links.git"
build: [
[ "dune" "exec" "preinstall/preinstall.exe" "--" "-libdir" _:lib ]
[ make "opam-build-links.opam" ]
]
4 changes: 4 additions & 0 deletions links.opam.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build: [
[ "dune" "exec" "preinstall/preinstall.exe" "--" "-libdir" _:lib ]
[ make "opam-build-links.opam" ]
]

0 comments on commit 11652c2

Please sign in to comment.