Other changes: - Add LicenseRef-Fedora-Public-Domain to the runtime License field - New ocaml-rpm-macros subpackage - Depend on libzstd-devel for compressed marshaling - Disable LTO
		
			
				
	
	
		
			70 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # Make %files lists from an installed tree of files.
 | |
| # Options:
 | |
| # -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs,
 | |
| #     is placed in its own package.  This option requires the existence of opam
 | |
| #     *.install files in the build tree.
 | |
| # -n: suppress creation of a devel subpackage.
 | |
| %ocaml_files(sn) %{python3} /usr/lib/rpm/redhat/ocaml_files.py %{-s} %{-n} %{buildroot} %{ocamldir}
 | |
| 
 | |
| # Internal macro holding the common parts of ocaml_install and dune_install
 | |
| %ocaml_install_common(sn) %{expand:
 | |
| rm -rf %{buildroot}%{_prefix}/doc
 | |
| mlis=$(find %{buildroot}%{_libdir}/ocaml -name '*.mli')
 | |
| rm -f ${mlis//.mli/.ml}
 | |
| %ocaml_files %{-s} %{-n}}
 | |
| 
 | |
| # Install files listed in opam *.install files.
 | |
| # Options:
 | |
| # -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs,
 | |
| #     is placed in its own package.
 | |
| # -n: suppress creation of a devel subpackage.
 | |
| %ocaml_install(sn) %{expand:
 | |
| %{python3} /usr/lib/rpm/redhat/ocaml_files.py -i %{-s} %{-n} %{buildroot} %{ocamldir}
 | |
| %ocaml_install_common %{-s} %{-n}}
 | |
| 
 | |
| # 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 %*}
 | |
| 
 | |
| # Install with dune
 | |
| # Options:
 | |
| # -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs,
 | |
| #     is placed in its own package.
 | |
| # -n: suppress creation of a devel subpackage.
 | |
| %dune_install(sn) %{expand:
 | |
| dune install --destdir=%{buildroot} %{dune_add_flags %*}
 | |
| if [ -d _build/default/_doc/_html ]; then
 | |
|     find _build/default/_doc/_html -name .dune-keep -delete
 | |
| fi
 | |
| %ocaml_install_common %{-s} %{-n}}
 |