summaryrefslogtreecommitdiffstats
path: root/ocaml/ocaml-atd.spec
blob: e47ad561783eae534817cd330f3dd32f33c99eab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%global project_name atd
%global forgeurl https://github.com/ahrefs/%{project_name}

%bcond_without tests

Name:           ocaml-%{project_name}
Version:        2.2.1
Release:        1%{?dist}
Summary:        Static Types for Json APIs

License:        BSD
URL:            %{forgeurl}
Source0:        %{url}/archive/%{version}/%{project_name}-%{version}.tar.gz
# No Scala compiler in Fedora
Patch0:         %{project_name}-2.2.1-no-atds.patch

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
%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}.


%prep
%autosetup -p1 -n %{project_name}-%{version}
rm atds.opam
rm -rf atds


%build
dune build %{?_smp_mflags} --verbose


%install
dune install --destdir=%{buildroot} --verbose

# we are already packaging these properly
rm -rf %{buildroot}%{_usr}/doc


%if %{with tests}
%check
dune runtest
%endif


%files
%license LICENSE.md
%doc CHANGES.md README.md
%{_bindir}/*
%{_libdir}/ocaml/*
%ifarch %{ocaml_native_compiler}
%exclude %{_libdir}/ocaml/*/*.a
%exclude %{_libdir}/ocaml/*/*.cmxa
%exclude %{_libdir}/ocaml/*/*.cmx
%endif
%exclude %{_libdir}/ocaml/*/*.ml
%exclude %{_libdir}/ocaml/*/*.mli


%files devel
%doc CODEOWNERS
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/*/*.a
%{_libdir}/ocaml/*/*.cmxa
%{_libdir}/ocaml/*/*.cmx
%endif
%{_libdir}/ocaml/*/*.ml
%{_libdir}/ocaml/*/*.mli


%changelog
* Wed Apr 07 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 2.2.1-1
- Initial package