# 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 %{arm64} %{power64} %{riscv64} s390x %{x86_64} # Architectures that support native dynamic linking of OCaml code. %ocaml_natdynlink %{arm64} %{power64} %{riscv64} s390x %{x86_64} # 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 } # Declarative buildsystem for ocaml-dune, requires RPM 4.20+ to work # https://rpm-software-management.github.io/rpm/manual/buildsystem.html %buildsystem_dune_conf() %nil %buildsystem_dune_build() %dune_build %* %buildsystem_dune_install() %dune_install %* %buildsystem_dune_check() %dune_check %* # Declarative buildsystem for ocaml-topkg, requires RPM 4.20+ to work # https://rpm-software-management.github.io/rpm/manual/buildsystem.html %buildsystem_topkg_conf() %nil %buildsystem_topkg_build() ocaml pkg/pkg.ml build %* %buildsystem_topkg_install() %ocaml_install %* %buildsystem_topkg_check() ocaml pkg/pkg.ml test %*