From e45e55425eeac2e491214bd69666a37805a32d47 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Thu, 5 Nov 2020 18:39:49 +0100
Subject: [PATCH] [MdR] custom META file

---
 .gitignore                              | 1 +
 src/plugins/markdown-report/.gitignore  | 1 -
 src/plugins/markdown-report/META.in     | 7 +++++++
 src/plugins/markdown-report/Makefile.in | 9 +++++++++
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 src/plugins/markdown-report/META.in

diff --git a/.gitignore b/.gitignore
index 007ef76046f..509b46e7ac9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -210,6 +210,7 @@ Makefile.plugin.generated
 /src/plugins/gui/GSourceView2.ml
 /src/plugins/gui/GSourceView2.mli
 /src/plugins/gui/gtk_compat.ml
+/src/plugins/markdown-report/META
 
 # generated tar.gz files
 
diff --git a/src/plugins/markdown-report/.gitignore b/src/plugins/markdown-report/.gitignore
index 6c2faaa71d3..08329726023 100644
--- a/src/plugins/markdown-report/.gitignore
+++ b/src/plugins/markdown-report/.gitignore
@@ -1,5 +1,4 @@
 *.cm*
-META.*
 *.o
 top/
 *.check_mli_exists
diff --git a/src/plugins/markdown-report/META.in b/src/plugins/markdown-report/META.in
new file mode 100644
index 00000000000..75396188206
--- /dev/null
+++ b/src/plugins/markdown-report/META.in
@@ -0,0 +1,7 @@
+description = "Frama-C Markdown_report plug-in"
+version = "@VERSION@"
+requires = "frama-c.kernel ppx_deriving ppx_deriving_yojson yojson"
+archive(byte) = "top/Markdown_report.cmo"
+archive(native) = "top/Markdown_report.cmx"
+plugin(native) = "top/Markdown_report.cmxs"
+plugin(byte) = "top/Markdown_report.cmo"
diff --git a/src/plugins/markdown-report/Makefile.in b/src/plugins/markdown-report/Makefile.in
index 1adec8aa487..833c1113e09 100644
--- a/src/plugins/markdown-report/Makefile.in
+++ b/src/plugins/markdown-report/Makefile.in
@@ -32,6 +32,7 @@ endif
 PLUGIN_DIR ?=.
 PLUGIN_ENABLE:=@ENABLE_MDR@
 PLUGIN_NAME:=Markdown_report
+PLUGIN_HAS_META:=yes
 PLUGIN_GENERATED:=$(PLUGIN_DIR)/Markdown_report.mli
 PLUGIN_CMO:=\
   sarif mdr_params parse_remarks \
@@ -54,6 +55,14 @@ $(Markdown_report_DIR)/Markdown_report.mli: \
 	cat $(Markdown_report_DIR)/md_gen.mli >> $@
 	echo "end" >> $@
 
+VERSION:=$(shell $(CAT) $(FRAMAC_SRC)/VERSION)
+
+$(Markdown_report_DIR)/META: $(Markdown_report_DIR)/META.in $(FRAMAC_SRC)/VERSION
+	$(PRINT_MAKING) $@
+	$(RM) $@
+	$(SED) -e 's|@VERSION@|$(VERSION)|' $< > $@
+	$(CHMOD_RO) $@
+
 ifeq ("$(FRAMAC_INTERNAL)","yes")
 CONFIG_STATUS_DIR=$(FRAMAC_SRC)
 else
-- 
GitLab