From aa94617d1c7d8d9474e24b1a253a3a146d39a649 Mon Sep 17 00:00:00 2001
From: Christophe Garion <tofgarion@runbox.com>
Date: Fri, 24 Feb 2023 18:03:33 +0100
Subject: [PATCH] [wp_strategies] generate opam file to ease install

---
 README.md                                     | 47 ++++++++-----------
 lustrec_wp_strategies/dune-project            | 24 +++++++++-
 .../frama-c-lustrec-wp-strategies.opam        | 43 +++++++++++++++++
 3 files changed, 85 insertions(+), 29 deletions(-)
 create mode 100644 lustrec_wp_strategies/frama-c-lustrec-wp-strategies.opam

diff --git a/README.md b/README.md
index 8578ceb2..d5bd5256 100644
--- a/README.md
+++ b/README.md
@@ -43,16 +43,30 @@ If you want to generate ACSL specifications and prove them on the
 generated C code, you will need [Frama-C](https://www.frama-c.com
 "Link to Frama-C homepage") and SMT solvers.
 
-First, install Frama-C through opam (we are currently using version
-26.1 `Iron` of Frama-C):
+LustreC use custom strategies for the Frama-C WP plugin that must be
+installed. Go to the `lustrec_wp_strategies` directory and execute the
+following commands:
+
+```sh
+opam install .
+```
+
+Frama-C should also be installed. Notice that if you have installed a
+local Opam switch, Frama-C should be installed in this local switch.
+
+When starting Frama-C, you should now see the following message:
 
 ```sh
-opam install frama-c
+[lustrec-wp-strategies] LustreC WP strategies available.
+```
+
+You may uninstall the plugin by executing
 
+```sh
+opam uninstall .
 ```
 
-Notice that if you have installed a local Opam switch, Frama-C should
-be installed in this local switch.
+in the `lustrec_wp_strategies` directory.
 
 The [Alt-Ergo](https://alt-ergo.ocamlpro.com/ "Link to Alt-Ergo
 homepage") is installed with Frama-C. We also recommend to use two
@@ -73,29 +87,6 @@ used by Frama-C for deductive verification:
 why3 config detect
 ```
 
-LustreC use custom strategies for the Frama-C WP plugin that must be
-compiled (TODO: add detail here). Go to the `lustrec_wp_strategies`
-directory and execute the following commands:
-
-```sh
-dune build @install
-dune install
-```
-
-When starting Frama-C, you should now see the following message:
-
-```sh
-[lustrec-wp-strategies] LustreC WP strategies available.
-```
-
-You may uninstall the plugin by executing
-
-```sh
-dune uninstall
-```
-
-in the `lustrec_wp_strategies` directory.
-
 ## Usage
 
 To see a summary of options:
diff --git a/lustrec_wp_strategies/dune-project b/lustrec_wp_strategies/dune-project
index 027bd18c..6a9d802c 100644
--- a/lustrec_wp_strategies/dune-project
+++ b/lustrec_wp_strategies/dune-project
@@ -1,10 +1,32 @@
 (lang dune 3.2)
 (using dune_site 0.1)
 
+(generate_opam_files true)
+
 (name frama-c-lustrec-wp-strategies)
-(maintainers "Lélio Brun, Christophe Garion, Pierre-Loïc Garoche, Xavier Thirioux")
+
+(license LGPL-3.0-or-later)
+
+(authors "Lélio Brun <lb@leliobrun.net>"
+         "Pierre-Loic Garoche <ploc@garoche.net>"
+         "Xavier Thirioux <xavier.thirioux@isae-supaero.fr>"
+)
+
+(maintainers "Pierre-Loic Garoche <ploc@garoche.net>"
+             "Xavier Thirioux <xavier.thirioux@isae-supaero.fr>"
+)
+
+(source (uri git+https://gitlab.isae-supaero.fr/lustrec/lustrec.git))
+(bug_reports https://gitlab.isae-supaero.fr/lustrec/lustrec/-/issues)
+(homepage https://gitlab.isae-supaero.fr/lustrec/lustrec)
 
 (package (name frama-c-lustrec-wp-strategies)
+ (synopsis "Strategies to be used with Frama-C WP plugin")
+ (description
+   "This package defines custom strategies to be used with Frama-C WP
+   plugin. They are mainly used to prove ACSL statements generated by
+   LustreC, particularly to unfold complex predicate definitions and
+   to more easily find witnesses for existential quantifiers.")
  (depends
   ("frama-c" (>= 26.1))
  )
diff --git a/lustrec_wp_strategies/frama-c-lustrec-wp-strategies.opam b/lustrec_wp_strategies/frama-c-lustrec-wp-strategies.opam
new file mode 100644
index 00000000..c637f578
--- /dev/null
+++ b/lustrec_wp_strategies/frama-c-lustrec-wp-strategies.opam
@@ -0,0 +1,43 @@
+# This file is generated by dune, edit dune-project instead
+opam-version: "2.0"
+synopsis: "Strategies to be used with Frama-C WP plugin"
+description: """
+This package defines custom strategies to be used with Frama-C WP
+   plugin. They are mainly used to prove ACSL statements generated by
+   LustreC, particularly to unfold complex predicate definitions and
+   to more easily find witnesses for existential quantifiers."""
+maintainer: [
+  "Pierre-Loic Garoche <ploc@garoche.net>"
+  "Xavier Thirioux <xavier.thirioux@isae-supaero.fr>"
+]
+authors: [
+  "Lélio Brun <lb@leliobrun.net>"
+  "Pierre-Loic Garoche <ploc@garoche.net>"
+  "Xavier Thirioux <xavier.thirioux@isae-supaero.fr>"
+]
+license: "LGPL-3.0-or-later"
+tags: ["Frama-C LustreC WP strategies"]
+homepage: "https://gitlab.isae-supaero.fr/lustrec/lustrec"
+bug-reports: "https://gitlab.isae-supaero.fr/lustrec/lustrec/-/issues"
+depends: [
+  "dune" {>= "3.2"}
+  "frama-c" {>= "26.1"}
+  "odoc" {with-doc}
+]
+build: [
+  ["dune" "subst"] {dev}
+  [
+    "dune"
+    "build"
+    "-p"
+    name
+    "-j"
+    jobs
+    "--promote-install-files=false"
+    "@install"
+    "@runtest" {with-test}
+    "@doc" {with-doc}
+  ]
+  ["dune" "install" "-p" name "--create-install-files" name]
+]
+dev-repo: "git+https://gitlab.isae-supaero.fr/lustrec/lustrec.git"
-- 
GitLab