Notification time stamped 2021-04-30 18:07:38 UTC
From b6419ba499dbaa49abacc98ca8afaeae2bf55e81 Mon Sep 17 00:00:00 2001
From: Michel Alexandre Salim <michel(a)michel-slm.name>
Date: Apr 30 2021 18:07:22 +0000
Subject: Initial import
Signed-off-by: Michel Alexandre Salim <michel(a)michel-slm.name>
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9c38ac7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/atd-2.2.1.tar.gz
diff --git a/ocaml-atd.spec b/ocaml-atd.spec
new file mode 100644
index 0000000..c15e61a
--- /dev/null
+++ b/ocaml-atd.spec
@@ -0,0 +1,316 @@
+%global project_name atd
+%global forgeurl https://github.com/ahrefs/%{project_name}
+
+# Scala tests are failing
+# missing atds/test/argonaut_2.13-6.2.2.jar;
+# The tests only work with scala 2.11 or 2.12
+%bcond_with scala
+%bcond_without tests
+
+Name: ocaml-%{project_name}
+Version: 2.2.1
+Release: 2%{?dist}
+Summary: Static Types for Json APIs
+
+License: BSD
+URL: %{forgeurl}
+Source0: %{url}/archive/%{version}/%{project_name}-%{version}.tar.gz
+
+BuildRequires: ocaml
+BuildRequires: ocaml-dune
+BuildRequires: ocaml-menhir
+BuildRequires: ocaml-biniou-devel
+BuildRequires: ocaml-easy-format-devel
+BuildRequires: ocaml-re-devel
+BuildRequires: ocaml-yojson-devel
+%if %{with tests}
+BuildRequires: java-11-openjdk-devel
+%if %{with scala}
+BuildRequires: scala
+%endif
+%endif
+
+%description
+ATD stands for Adaptable Type Definitions. It is a syntax for defining
+cross-language data types. It is used as input to generate efficient and
+type-safe serializers, deserializers and validators. The current target
+languages are OCaml and Java.
+
+The following opam packages are provided by the atd project:
+
+* atdgen: executable that generates OCaml code dealing with json and
+ biniou data formats
+* atdj: executable that generates Java code dealing with json
+* atd: library for parsing atd files used by code generators
+
+
+%package devel
+Summary: Development files for %{name}
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+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}
+%if %{with scala}
+%else
+rm atds.opam
+rm -rf atds
+%endif
+
+
+%build
+dune build %{?_smp_mflags} --verbose
+
+
+%install
+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
+dune runtest
+%endif
+
+
+%files
+%license LICENSE.md
+%doc CHANGES.md README.md
+%{_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/atd/*.a
+%exclude %{_libdir}/ocaml/atd/*.cmxa
+%exclude %{_libdir}/ocaml/atd/*.cmx
+%endif
+%exclude %{_libdir}/ocaml/atd/*.ml
+%exclude %{_libdir}/ocaml/atd/*.mli
+
+
+%files devel
+%doc CODEOWNERS
+%ifarch %{ocaml_native_compiler}
+%{_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/atdgen-runtime/*.ml
+%{_libdir}/ocaml/atdgen-runtime/*.mli
+
+
+%changelog
+* Fri Apr 23 2021 Michel Alexandre Salim <salimma(a)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(a)fedoraproject.org> - 2.2.1-1
+- Initial package
diff --git a/sources b/sources
new file mode 100644
index 0000000..e4ab2e1
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+SHA512 (atd-2.2.1.tar.gz) = c59d9ef820339fec3736aab31647bcb06e5520a957e97850bbcbb6b27bc9ce2b8573decb2f4057e9e451583af8b9255cdea221aa51ec2109584256a5f50df04d
https://src.fedoraproject.org/rpms/ocaml-atd/c/b6419ba499dbaa49abacc98ca8af…