summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorMichel Alexandre Salim <salimma@fedoraproject.org>2021-04-23 18:31:10 -0700
committerMichel Alexandre Salim <salimma@fedoraproject.org>2021-04-23 18:31:10 -0700
commit8660559b74fc14a70e640914e65ea19e182716fe (patch)
tree3ffb42e7be32a33ac7796caa9f6a581de3476dfe /ocaml
parent824551836c95cd3f9d04a7884447b09b067b5fa9 (diff)
downloadspecs-8660559b74fc14a70e640914e65ea19e182716fe.tar.gz
specs-8660559b74fc14a70e640914e65ea19e182716fe.tar.xz
specs-8660559b74fc14a70e640914e65ea19e182716fe.zip
ocaml-atd:
- Create subpackages per OPAM module - Optionally compile and test `atds` - Skip shipping empty META files; known Dune issue https://github.com/ocaml/dune/issues/2353 Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/ocaml-atd.spec242
1 files changed, 228 insertions, 14 deletions
diff --git a/ocaml/ocaml-atd.spec b/ocaml/ocaml-atd.spec
index e8fe141..b56036e 100644
--- a/ocaml/ocaml-atd.spec
+++ b/ocaml/ocaml-atd.spec
@@ -1,11 +1,13 @@
%global project_name atd
%global forgeurl https://github.com/ahrefs/%{project_name}
+# Scala tests are failing
+%bcond_with scala
%bcond_without tests
Name: ocaml-%{project_name}
Version: 2.2.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Static Types for Json APIs
License: BSD
@@ -21,6 +23,9 @@ BuildRequires: ocaml-re-devel
BuildRequires: ocaml-yojson-devel
%if %{with tests}
BuildRequires: java-11-openjdk-devel
+%if %{with scala}
+BuildRequires: scala
+%endif
%endif
%description
@@ -46,11 +51,114 @@ The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.
+%package -n ocaml-atdgen
+Summary: Generates efficient JSON serializers, deserializers and validators
+# Requires:
+
+%description -n ocaml-atdgen
+Atdgen is a command-line program that takes as input type definitions in the ATD
+syntax and produces OCaml code suitable for data serialization and
+deserialization. Two data formats are currently supported, these are biniou and
+JSON. Atdgen-biniou and Atdgen-json will refer to Atdgen used in one context or
+the other. Atdgen was designed with efficiency and durability in mind. Software
+authors are encouraged to use Atdgen directly and to write tools that may reuse
+part of Atdgen’s source code.
+
+
+%package -n ocaml-atdgen-devel
+Summary: Development files for ocaml-atdgen
+Requires: ocaml-atdgen%{?_isa} = %{version}-%{release}
+
+%description -n ocaml-atdgen-devel
+The ocaml-atdgen-devel package contains libraries and signature files for
+developing applications that use ocaml-atdgen.
+
+
+%package -n ocaml-atdj
+Summary: Java code generation for ATD
+# Requires:
+
+%description -n ocaml-atdj
+Atdj is a program that generates a Java interface from type definitions. In
+particular, given a set of ATD type definitions, this tool generates a set of
+Java classes representing those types with built-in JSON serializers and
+deserializers.
+
+The primary benefits of using the generated interface, over manually
+manipulating JSON strings from within Java, are safety and ease of use.
+Specifically, the generated interface offers the following features:
+
+- JSON strings are automatically checked for correctness with respect to the ATD
+ specification.
+
+- Details such as optional fields and their associated default values are
+ automatically handled.
+
+
+%if %{with scala}
+%package -n ocaml-atds
+Summary: ATD Code generator for Scala
+# Requires:
+
+%description -n ocaml-atds
+Atdj is a program that generates a Scala interface from type definitions. In
+particular, given a set of ATD type definitions, this tool generates a set of
+Scala classes representing those types with built-in JSON serializers and
+deserializers.
+
+The primary benefits of using the generated interface, over manually
+manipulating JSON strings from within Scala, are safety and ease of use.
+Specifically, the generated interface offers the following features:
+
+- JSON strings are automatically checked for correctness with respect to the ATD
+ specification.
+
+- Details such as optional fields and their associated default values are
+ automatically handled.
+%endif
+
+
+%package -n ocaml-atdgen-codec-runtime
+Summary: Runtime for atdgen generated bucklescript converters
+# Requires:
+
+%description -n ocaml-atdgen-codec-runtime
+This library contains the types that are used by atdgen's bucklescript backend.
+
+
+%package -n ocaml-atdgen-codec-runtime-devel
+Summary: Development files for ocaml-atdgen-codec-runtime
+Requires: ocaml-atdgen-codec-runtime%{?_isa} = %{version}-%{release}
+
+%description -n ocaml-atdgen-codec-runtime-devel
+The ocaml-atdgen-codec-runtime-devel package contains libraries and signature
+files for developing applications that use ocaml-atdgen-codec-runtime.
+
+
+%package -n ocaml-atdgen-runtime
+Summary: Runtime library for code generated by atdgen
+# Requires:
+
+%description -n ocaml-atdgen-runtime
+This package should be used only in conjunction with the stdgen code generator.
+
+
+%package -n ocaml-atdgen-runtime-devel
+Summary: Development files for ocaml-atdgen-runtime
+Requires: ocaml-atdgen-runtime%{?_isa} = %{version}-%{release}
+
+%description -n ocaml-atdgen-runtime-devel
+The ocaml-atdgen-runtime-devel package contains libraries and signature files
+for developing applications that use ocaml-atdgen-runtime.
+
+
%prep
%autosetup -p1 -n %{project_name}-%{version}
-# No Scala compiler in Fedora
+%if %{with scala}
+%else
rm atds.opam
rm -rf atds
+%endif
%build
@@ -63,6 +171,15 @@ dune install --destdir=%{buildroot} --verbose
# we are already packaging these properly
rm -rf %{buildroot}%{_usr}/doc
+# atdj and atds do not ship libraries
+# dune has a known issue where it generates empty META files
+#
+# we actually don't need to ship devel files at all so remove
+# the directories entirely
+#
+# https://github.com/ocaml/dune/issues/2353
+rm -rf %{buildroot}%{_libdir}/ocaml/atd{j,s}
+
%if %{with tests}
%check
@@ -73,28 +190,125 @@ dune runtest
%files
%license LICENSE.md
%doc CHANGES.md README.md
-%{_bindir}/*
-%{_libdir}/ocaml/*
+%{_bindir}/atdcat
+%{_bindir}/cppo-json
+%{_libdir}/ocaml/atd
+%exclude %{_libdir}/ocaml/atd/dune-package
+%exclude %{_libdir}/ocaml/atd/opam
%ifarch %{ocaml_native_compiler}
-%exclude %{_libdir}/ocaml/*/*.a
-%exclude %{_libdir}/ocaml/*/*.cmxa
-%exclude %{_libdir}/ocaml/*/*.cmx
+%exclude %{_libdir}/ocaml/atd/*.a
+%exclude %{_libdir}/ocaml/atd/*.cmxa
+%exclude %{_libdir}/ocaml/atd/*.cmx
%endif
-%exclude %{_libdir}/ocaml/*/*.ml
-%exclude %{_libdir}/ocaml/*/*.mli
+%exclude %{_libdir}/ocaml/atd/*.ml
+%exclude %{_libdir}/ocaml/atd/*.mli
%files devel
%doc CODEOWNERS
%ifarch %{ocaml_native_compiler}
-%{_libdir}/ocaml/*/*.a
-%{_libdir}/ocaml/*/*.cmxa
-%{_libdir}/ocaml/*/*.cmx
+%{_libdir}/ocaml/atd/dune-package
+%{_libdir}/ocaml/atd/opam
+%{_libdir}/ocaml/atd/*.a
+%{_libdir}/ocaml/atd/*.cmxa
+%{_libdir}/ocaml/atd/*.cmx
+%endif
+%{_libdir}/ocaml/atd/*.ml
+%{_libdir}/ocaml/atd/*.mli
+
+
+%files -n ocaml-atdgen
+%{_bindir}/atdgen
+%{_bindir}/atdgen-cppo
+%{_libdir}/ocaml/atdgen
+%exclude %{_libdir}/ocaml/atdgen/dune-package
+%exclude %{_libdir}/ocaml/atdgen/opam
+%ifarch %{ocaml_native_compiler}
+%exclude %{_libdir}/ocaml/atdgen/*.a
+%exclude %{_libdir}/ocaml/atdgen/*.cmxa
+%exclude %{_libdir}/ocaml/atdgen/*.cmx
+%endif
+%exclude %{_libdir}/ocaml/atdgen/*.ml
+
+
+%files -n ocaml-atdgen-devel
+%ifarch %{ocaml_native_compiler}
+%{_libdir}/ocaml/atdgen/dune-package
+%{_libdir}/ocaml/atdgen/opam
+%{_libdir}/ocaml/atdgen/*.a
+%{_libdir}/ocaml/atdgen/*.cmxa
+%{_libdir}/ocaml/atdgen/*.cmx
+%endif
+%{_libdir}/ocaml/atdgen/*.ml
+
+
+%files -n ocaml-atdj
+%{_bindir}/atdj
+
+
+%if %{with scala}
+%files -n ocaml-atds
+%{_bindir}/atds
+%{_libdir}/ocaml/atds
+%endif
+
+
+%files -n ocaml-atdgen-codec-runtime
+%{_libdir}/ocaml/atdgen-codec-runtime
+%exclude %{_libdir}/ocaml/atdgen-codec-runtime/dune-package
+%exclude %{_libdir}/ocaml/atdgen-codec-runtime/opam
+%ifarch %{ocaml_native_compiler}
+%exclude %{_libdir}/ocaml/atdgen-codec-runtime/*.a
+%exclude %{_libdir}/ocaml/atdgen-codec-runtime/*.cmxa
+%exclude %{_libdir}/ocaml/atdgen-codec-runtime/*.cmx
+%endif
+%exclude %{_libdir}/ocaml/atdgen-codec-runtime/*.ml
+%exclude %{_libdir}/ocaml/atdgen-codec-runtime/*.mli
+
+
+%files -n ocaml-atdgen-codec-runtime-devel
+%{_libdir}/ocaml/atdgen-codec-runtime/dune-package
+%{_libdir}/ocaml/atdgen-codec-runtime/opam
+%ifarch %{ocaml_native_compiler}
+%{_libdir}/ocaml/atdgen-codec-runtime/*.a
+%{_libdir}/ocaml/atdgen-codec-runtime/*.cmxa
+%{_libdir}/ocaml/atdgen-codec-runtime/*.cmx
+%endif
+%{_libdir}/ocaml/atdgen-codec-runtime/*.ml
+%{_libdir}/ocaml/atdgen-codec-runtime/*.mli
+
+
+%files -n ocaml-atdgen-runtime
+%{_libdir}/ocaml/atdgen-runtime
+%exclude %{_libdir}/ocaml/atdgen-runtime/dune-package
+%exclude %{_libdir}/ocaml/atdgen-runtime/opam
+%ifarch %{ocaml_native_compiler}
+%exclude %{_libdir}/ocaml/atdgen-runtime/*.a
+%exclude %{_libdir}/ocaml/atdgen-runtime/*.cmxa
+%exclude %{_libdir}/ocaml/atdgen-runtime/*.cmx
+%endif
+%exclude %{_libdir}/ocaml/atdgen-runtime/*.ml
+%exclude %{_libdir}/ocaml/atdgen-runtime/*.mli
+
+
+%files -n ocaml-atdgen-runtime-devel
+%{_libdir}/ocaml/atdgen-runtime/dune-package
+%{_libdir}/ocaml/atdgen-runtime/opam
+%ifarch %{ocaml_native_compiler}
+%{_libdir}/ocaml/atdgen-runtime/*.a
+%{_libdir}/ocaml/atdgen-runtime/*.cmxa
+%{_libdir}/ocaml/atdgen-runtime/*.cmx
%endif
-%{_libdir}/ocaml/*/*.ml
-%{_libdir}/ocaml/*/*.mli
+%{_libdir}/ocaml/atdgen-runtime/*.ml
+%{_libdir}/ocaml/atdgen-runtime/*.mli
%changelog
+* Fri Apr 23 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 2.2.1-2
+- Create subpackages per OPAM module
+- Optionally compile and test `atds`
+- Skip shipping empty META files; known Dune issue
+ https://github.com/ocaml/dune/issues/2353
+
* Wed Apr 07 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 2.2.1-1
- Initial package