You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocaml-srpm-macros/SOURCES/macros.ocaml-srpm

56 lines
1.9 KiB

# 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 %{power64} riscv64 s390x x86_64
# Architectures that support native dynamic linking of OCaml code.
%ocaml_natdynlink aarch64 %{power64} riscv64 s390x 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
# Common elements for all OCaml packages.
#
# ExcludeArch: OCaml packages have not been built on i686 since OCaml 5 was
# introduced in Fedora 39.
# -d: most OCaml packages have no ELF objects when built on a bytecode-only
# architecture, so debuginfo generation is suppressed. Use this flag to
# enable a debuginfo package on such architectures; i.e., when the package
# contains an ELF object even on bytecode-only architectures.
%ocaml_pkg(d) %{lua:
print("ExcludeArch: %{ix86}\\n")
if not opt.d then
local arch = rpm.expand("%{_target_cpu}")
local native = rpm.expand("%{ocaml_native_compiler}")
if not string.find(native, arch) then
rpm.define('debug_package %{nil}')
end
end
}
# Generate %package and %files definitions for a doc subpackage,
# containing content generated by odoc.
# Use on the top-level only, preferably just before %prep.
#
# Options:
# -L: specify the license file name. Example:
# %odoc_package -L LICENSE
%odoc_package(L:) %{expand:
%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*} %*}}