2ad702097a
OCaml 5.1 will add back ppc64le riscv64 s390x. It is unlikely that %{arm}, %{ix86} will ever return in future. We will ExcludeArch %{ix86} for OCaml. https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/SPML7CUBSZNI36NLXGVHEG7DNHU3EWOJ/ The others like ppc and sparc are obsolete.
93 lines
3.1 KiB
Plaintext
93 lines
3.1 KiB
Plaintext
# Note that OCaml is compiled on all architectures. However
|
|
# on some (rare) architectures, only bytecode compilation is
|
|
# available. Use these macros to find out if native code
|
|
# compilation is available on a particular architecture.
|
|
|
|
# Architectures that support the OCaml native code compiler.
|
|
%ocaml_native_compiler aarch64 x86_64
|
|
|
|
# Architectures that support native dynamic linking of OCaml code.
|
|
%ocaml_natdynlink aarch64 x86_64
|
|
|
|
# Architectures that support profiling of native code (ocamlopt -p).
|
|
# This was removed in OCaml 4.09.
|
|
# https://github.com/ocaml/ocaml/pull/2314
|
|
%ocaml_native_profiling %{nil}
|
|
|
|
# Toplevel OCaml directory
|
|
%ocamldir %{_libdir}/ocaml
|
|
|
|
# This macro generates %package and %files definitions for a doc subpackage,
|
|
# containing content generated by odoc.
|
|
# Use on the top-level only, preferably just before %prep.
|
|
#
|
|
# Use the -L option to specify the license file name. Example:
|
|
# %odoc_package -L LICENSE
|
|
%odoc_package(L:) \
|
|
%package doc \
|
|
BuildArch: noarch \
|
|
BuildRequires: ocaml-odoc \
|
|
Summary: Documentation for %{name} \
|
|
%description doc \
|
|
Developer documentation for %{name}. \
|
|
%files doc \
|
|
%doc _build/default/_doc/_html/* \
|
|
%{?-L:%%license %{-L*} %*}
|
|
|
|
# Add smp_mflags to arguments if no -j release option is given.
|
|
# Add --release to arguments if no -p or --release option is given.
|
|
# Add --verbose to arguments if it is not given.
|
|
%dune_add_flags(-) %{lua:
|
|
has_j = false
|
|
has_p = false
|
|
has_v = false
|
|
for _, flag in pairs(arg) do
|
|
if flag:find("^-j") then
|
|
has_j = true
|
|
elseif flag:find("^-p") or flag:find("^--release)") then
|
|
has_p = true
|
|
elseif flag:find("^--verbose") then
|
|
has_v = true
|
|
end
|
|
end
|
|
if not has_j then
|
|
table.insert(arg, 1, rpm.expand("%{?_smp_mflags}"))
|
|
end
|
|
if not has_p then
|
|
table.insert(arg, 1, "--release")
|
|
end
|
|
if not has_v then
|
|
table.insert(arg, 1, "--verbose")
|
|
end
|
|
print(table.concat(arg, " "))
|
|
}
|
|
|
|
# Build with dune
|
|
%dune_build(-) dune build %{dune_add_flags %*}
|
|
|
|
# Run tests with dune
|
|
%dune_check(-) dune runtest %{dune_add_flags %*}
|
|
|
|
# Make %files lists from an installed tree of files.
|
|
# The -s option enables separate packaging; every subdirectory of
|
|
# %{_libdir}/ocaml, except stublibs, is placed in its own package. This option
|
|
# requires the existence of opam *.install files in the build tree.
|
|
# The -n option suppresses creation of a devel subpackage.
|
|
# This macro requires that python3 be installed in the chroot.
|
|
%ocaml_files(sn) /usr/bin/python3 /usr/lib/rpm/redhat/ocaml_files.py %{-s} %{-n} %{buildroot} %{ocamldir}
|
|
|
|
# Install with dune
|
|
# The -s option enables separate packaging; every subdirectory of
|
|
# %{_libdir}/ocaml, except stublibs, is placed in its own package.
|
|
# The -n option suppresses creation of a devel subpackage.
|
|
# This macro requires that python3 be installed in the chroot.
|
|
%dune_install(sn) \
|
|
dune install --destdir=%{buildroot} %{dune_add_flags %*}; \
|
|
if [ -d _build/default/_doc/_html ]; then \
|
|
find _build/default/_doc/_html -name .dune-keep -delete; \
|
|
fi; \
|
|
rm -rf %{buildroot}%{_prefix}/doc; \
|
|
mlis=$(find %{buildroot}%{_libdir}/ocaml -name '*.mli'); \
|
|
rm -f ${mlis//.mli/.ml}; \
|
|
%ocaml_files %{-s} %{-n}
|