From cd61388aa99286d4382a11a02d8a66f249254e77 Mon Sep 17 00:00:00 2001
From: Sylvain Pogodalla <sylvain.pogodalla@inria.fr>
Date: Fri, 20 Oct 2017 15:02:11 +0000
Subject: [PATCH] Added patch files to opam so that acgtk compiles with
 easy-format:version>1.2.0 and yojson:version>1.3.3

---
 Makefile.in               |  6 ++++++
 TODO                      |  3 +++
 config/configure.ac       |  4 +++-
 configure                 | 10 ++++++++--
 opam-package/opam         | 11 +++++++++++
 src/scripting/Makefile.in |  4 ++--
 6 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index e0cbb973..8d25e662 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -149,6 +149,12 @@ opam-package/url: tar
 test-www-acg:
 	cd $(OPAM_ACG_REPO_DIR) && opam-admin make && scp -r . pogodall@loria.loria.fr:$(OPAM_ACG_REPO_DIR)
 
+opam-meta:
+	cp -rT opam-package $(OPAM_TESTING_DIR)/acgtk/acgtk.$(VERSION_BASENAME)
+	cp -rT opam-package $(OPAM_GIT_REPO_DIR)/acgtk/acgtk.$(VERSION_BASENAME)
+	cp -rT opam-package $(OPAM_ACG_REPO_DIR)/packages/acgtk/acgtk.$(VERSION_BASENAME) && cd $(OPAM_ACG_REPO_DIR) && opam-admin make && scp -r . pogodall@loria.loria.fr:$(OPAM_ACG_REPO_DIR)
+
+
 opam:opam-package/url www
 	cp -rT opam-package $(OPAM_TESTING_DIR)/acgtk/acgtk.$(VERSION_BASENAME)
 	cp -rT opam-package $(OPAM_GIT_REPO_DIR)/acgtk/acgtk.$(VERSION_BASENAME)
diff --git a/TODO b/TODO
index 3a7b7cc2..ceb8c36e 100644
--- a/TODO
+++ b/TODO
@@ -64,6 +64,9 @@ end
 + [X] OPAM: enlever les warnings qui deviennent des erreurs
 + [ ] utiliser UF avec tableaux destructifs, et tester l'amélioration des performances
 + [ ] autoriser l'utilisation de symboles non fonctionnels
++ [ ] enlever les dépendences à yojson.cmo et à eay-format.cmo dans scripting/Makefile.in, les remplacer par .cma
++ [ ] refaire la compilation du projet avec ocamlbuild/oasis/ocamlfind
++ [ ] rajouter l'utf8
 
 ** DONE Faire un Bolt package
 
diff --git a/config/configure.ac b/config/configure.ac
index 5a89c662..e73ae9b4 100644
--- a/config/configure.ac
+++ b/config/configure.ac
@@ -186,11 +186,12 @@ if test "$FOUND_LIB" != "no" ; then
 fi
 
 # Look for Easy-format with ocamlfind
-AC_ARG_VAR(EASY_FORMAT_PATH,[Directory where to find the Yojson library if not in a standard location])
+AC_ARG_VAR(EASY_FORMAT_PATH,[Directory where to find the Easy-format library if not in a standard location])
 AC_LIB_CHECKING(Easy-format,easy-format,easy_format,easy-format,easy-format,Easy_format,"",true,$EASY_FORMAT_PATH)
 
 if test "$FOUND_LIB" != "no" ; then
    AC_SUBST(EASY_FORMAT_PATH,$LIB_PATH)
+   AC_SUBST(EASY_FORMAT_INCLUDE,$LIB_INCLUDE)
 fi
 
 # Look for biniou with ocamlfind
@@ -207,6 +208,7 @@ AC_LIB_CHECKING(Yojson,yojson,yojson,yojson,yojson,Yojson,"",true,$YOJSON_PATH)
 
 if test "$FOUND_LIB" != "no" ; then
    AC_SUBST(YOJSON_PATH,$LIB_PATH)
+   AC_SUBST(YOJSON_INCLUDE,$LIB_INCLUDE)
 fi
 
 # Look for ocf with ocamlfind
diff --git a/configure b/configure
index 4102ee32..0bc7769c 100755
--- a/configure
+++ b/configure
@@ -594,9 +594,11 @@ TYPES
 CAMLP4_LIB
 OCF_INCLUDE
 OCF_PATH
+YOJSON_INCLUDE
 YOJSON_PATH
 BINIOU_INCLUDE
 BINIOU_PATH
+EASY_FORMAT_INCLUDE
 EASY_FORMAT_PATH
 OCamlCairo2_INCLUDE
 OCamlCairo2_PATH
@@ -1322,8 +1324,8 @@ Some influential environment variables:
               Directory where to find the OCaml Cairo bindings if not in a
               standard location
   EASY_FORMAT_PATH
-              Directory where to find the Yojson library if not in a standard
-              location
+              Directory where to find the Easy-format library if not in a
+              standard location
   BINIOU_PATH Directory where to find the biniou library if not in a standard
               location
   YOJSON_PATH Directory where to find the Yojson library if not in a standard
@@ -3429,6 +3431,8 @@ $as_echo "The $NAME library is missing." >&6; }
 if test "$FOUND_LIB" != "no" ; then
    EASY_FORMAT_PATH=$LIB_PATH
 
+   EASY_FORMAT_INCLUDE=$LIB_INCLUDE
+
 fi
 
 # Look for biniou with ocamlfind
@@ -3771,6 +3775,8 @@ $as_echo "The $NAME library is missing." >&6; }
 if test "$FOUND_LIB" != "no" ; then
    YOJSON_PATH=$LIB_PATH
 
+   YOJSON_INCLUDE=$LIB_INCLUDE
+
 fi
 
 # Look for ocf with ocamlfind
diff --git a/opam-package/opam b/opam-package/opam
index e43859df..31ebb643 100644
--- a/opam-package/opam
+++ b/opam-package/opam
@@ -17,11 +17,22 @@ depends: [
   "bolt"
   "ANSITerminal"
   "cairo2"
+  "yojson"
+  "easy-format"
   "ocf"
 ]
 
 available: [ ocaml-version >= "4.03.0" ]
 
+
+patches: [
+  "configure.ac.patch"
+  "configure.patch"
+   "Makefile.in.easy_format.and.yojson.patch" {(easy-format:version >= "1.3.0") & (yojson:version >= "1.4.0")} 
+   "Makefile.in.easy_format.patch" {(easy-format:version >= "1.3.0") & (yojson:version < "1.4.0")} 
+   "Makefile.in.yojson.patch" {(easy-format:version < "1.3.0") & (yojson:version >= "1.4.0")} 
+]
+
 homepage: "http://acg.gforge.inria.fr/"
 license: "CeCILL"
 authors: ["Sylvain Pogodalla"]
diff --git a/src/scripting/Makefile.in b/src/scripting/Makefile.in
index 09af7a59..e730cddf 100644
--- a/src/scripting/Makefile.in
+++ b/src/scripting/Makefile.in
@@ -26,12 +26,12 @@ include ../Makefile.master
 ###############################
 
 # Used libraries
-LIBS += dyp.cma str.cma ANSITerminal.cma bigarray.cma cairo2.cma @EASY_FORMAT_PATH@/easy_format.cmo biniou.cma @YOJSON_PATH@/yojson.cmo ocf.cma
+LIBS += dyp.cma str.cma ANSITerminal.cma bigarray.cma cairo2.cma easy_format.cma biniou.cma yojson.cma ocf.cma
 
 # The corresponding directories
 # (if not in the main ocaml lib directory,
 # ex. -I  +campl4
-LIBDIR += @DYPGEN_INCLUDE@ @ANSITerminal_INCLUDE@ @OCamlCairo2_INCLUDE@ @BINIOU_INCLUDE@ @OCF_INCLUDE@
+LIBDIR += @DYPGEN_INCLUDE@ @ANSITerminal_INCLUDE@ @OCamlCairo2_INCLUDE@ @YOJSON_INCLUDE@ @BINIOU_INCLUDE@ @OCF_INCLUDE@
 
 # Directories to which the current source files depend on
 PREVIOUS_DIRS = ../utils ../datalog.prover ../logic ../acg-data ../grammars
-- 
GitLab