From 4f2bf7c0105f6147ebbad2475c564236fe685ec9 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Fri, 7 Jan 2022 11:27:42 -0700 Subject: [PATCH] Initial import. --- .gitignore | 1 + README.md | 16 +++++- ocaml-mdx.spec | 131 +++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 4 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 ocaml-mdx.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2ee64d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/mdx-*.tbz diff --git a/README.md b/README.md index e0d9f19..4123d84 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # ocaml-mdx -The ocaml-mdx package +[mdx](https://realworldocaml.github.io/mdx/) enables execution of code blocks +inside markdown files. There are (currently) two sub-commands, corresponding +to two modes of operation: preprocessing (`ocaml-mdx pp`) and tests +(`ocaml-mdx test`). + +The preprocessor mode enables mixing documentation and code, and the practice +of "literate programming" using markdown and OCaml. + +The test mode enables ensuring that shell scripts and OCaml fragments in the +documentation always stay up-to-date. + +The blocks in markdown files can be parameterized by `mdx`-specific labels, +that will change the way `mdx` interprets the block. The syntax is: +``, where `labels` is a list of valid labels separated by +a comma. This line must immediately precede the block it is attached to. diff --git a/ocaml-mdx.spec b/ocaml-mdx.spec new file mode 100644 index 0000000..877eabb --- /dev/null +++ b/ocaml-mdx.spec @@ -0,0 +1,131 @@ +%ifnarch %{ocaml_native_compiler} +%global debug_package %{nil} +%endif + +%global srcname mdx + +# Break a circular dependency by not building documentation +%bcond_with doc + +Name: ocaml-%{srcname} +Version: 2.0.0 +Release: 1%{?dist} +Summary: Executable code blocks inside markdown files + +License: ISC +URL: https://realworldocaml.github.io/mdx/ +Source0: https://github.com/realworldocaml/mdx/releases/download/%{version}/%{srcname}-%{version}.tbz + +BuildRequires: ocaml >= 4.08.0 +BuildRequires: ocaml-alcotest-devel +BuildRequires: ocaml-astring-devel +BuildRequires: ocaml-cmdliner-devel >= 1.0.0 +BuildRequires: ocaml-cppo +BuildRequires: ocaml-csexp-devel >= 1.3.2 +BuildRequires: ocaml-dune >= 2.7 +BuildRequires: ocaml-fmt-devel >= 0.8.7 +BuildRequires: ocaml-findlib +BuildRequires: ocaml-logs-devel >= 0.7.0 +BuildRequires: ocaml-lwt-devel +BuildRequires: ocaml-odoc-parser-devel >= 0.9.0 +BuildRequires: ocaml-re-devel >= 1.7.2 +BuildRequires: ocaml-result-devel +BuildRequires: ocaml-version-devel >= 2.3.0 + +%if %{with doc} +BuildRequires: ocaml-odoc +%endif + +%description +mdx enables execution of code blocks inside markdown files. There are +(currently) two sub-commands, corresponding to two modes of operation: +preprocessing (`ocaml-mdx pp`) and tests (`ocaml-mdx test`). + +The preprocessor mode enables mixing documentation and code, and the +practice of "literate programming" using markdown and OCaml. + +The test mode enables ensuring that shell scripts and OCaml fragments in +the documentation always stay up-to-date. + +The blocks in markdown files can be parameterized by `mdx`-specific +labels, that will change the way `mdx` interprets the block. The syntax +is: ``, where `labels` is a list of valid labels +separated by a comma. This line must immediately precede the block it +is attached to. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: ocaml-astring-devel%{?_isa} +Requires: ocaml-csexp-devel%{?_isa} +Requires: ocaml-fmt-devel%{?_isa} +Requires: ocaml-logs-devel%{?_isa} +Requires: ocaml-odoc-parser-devel%{?_isa} +Requires: ocaml-re-devel%{?_isa} +Requires: ocaml-result-devel%{?_isa} +Requires: ocaml-version-devel%{?_isa} + +%description devel +The %{name}-devel package contains libraries and signature +files for developing applications that use %{name}. + +%prep +%autosetup -n %{srcname}-%{version} -p1 + +%build +dune build %{?_smp_mflags} --release + +%if %{with doc} +dune build %{?_smp_mflags} @doc +%endif + +%install +dune install --destdir=%{buildroot} + +%if %{with doc} +# We do not want the dune markers +find _build/default/_doc/_html -name .dune-keep -delete +%endif + +# We do not want the ml files +find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete + +# We install the documentation with the doc macro +rm -fr %{buildroot}%{_prefix}/doc + +%check +dune runtest --release + +%files +%doc CHANGES.md README.md +%license LICENSE.md +%{_bindir}/ocaml-mdx +%{_bindir}/ocaml-mdx-test +%dir %{_libdir}/ocaml/%{srcname}/ +%dir %{_libdir}/ocaml/%{srcname}/test/ +%dir %{_libdir}/ocaml/%{srcname}/top/ +%{_libdir}/ocaml/%{srcname}/META +%{_libdir}/ocaml/%{srcname}/{,*/}*.cma +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmi +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmxs +%endif + +%files devel +%if %{with doc} +%doc _build/default/_doc/* +%endif +%{_libdir}/ocaml/%{srcname}/dune-package +%{_libdir}/ocaml/%{srcname}/opam +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/{,*/}*.a +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmx +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmxa +%endif +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmt +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmti +%{_libdir}/ocaml/%{srcname}/{,*/}*.mli + +%changelog +* Fri Dec 31 2021 Jerry James - 2.0.0-1 +- Initial RPM diff --git a/sources b/sources new file mode 100644 index 0000000..24d4dea --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (mdx-2.0.0.tbz) = 676d73dd20586ad5457ad96c9f0b11d88a2caf5763935a317db88076fd611cedd27499bd574a140ed9f6c00d2b80e7e92e2cf66d5aece9e2bbc16ea9ad69fc67