Use %build_ldflags instead of $RPM_LD_FLAGS

This commit is contained in:
Dan Čermák 2020-07-19 22:45:00 +02:00
parent 4f63eea935
commit efff5510a6
No known key found for this signature in database
GPG Key ID: 8F8C178E966641D3
1 changed files with 8 additions and 8 deletions

View File

@ -46,17 +46,17 @@ dune build %{?_smp_mflags}
# TODO: Once odoc is available, BR it and run this to generate documentation:
# dune build %{?_smp_mflags} @doc
# Dune passes RPM_LD_FLAGS to ocamlmklib without -ldopt, resulting in "Unknown
# option" warnings from ocamlmklib and a library that has not been linked with
# the correct flags. We can't add -ldopt ourselves, since that breaks
# compilation of the cmxs files. This seems to be a weakness of dune; linker
# flags and libraries to be linked with have to be specified together, and
# nothing takes care of separating them and adding ldopt as necessary. We
# Dune passes %%build_ldflags to ocamlmklib without -ldopt, resulting in
# "Unknown option" warnings from ocamlmklib and a library that has not been
# linked with the correct flags. We can't add -ldopt ourselves, since that
# breaks compilation of the cmxs files. This seems to be a weakness of dune;
# linker flags and libraries to be linked with have to be specified together,
# and nothing takes care of separating them and adding ldopt as necessary. We
# relink manually to address the problem.
pushd _build/default/src
ocamlmklib -g -ldopt "$RPM_LD_FLAGS" -o base_stubs *.o
ocamlmklib -g -ldopt "%build_ldflags" -o base_stubs *.o
cd ../hash_types/src
ocamlmklib -g -ldopt "$RPM_LD_FLAGS" -o base_internalhash_types_stubs *.o
ocamlmklib -g -ldopt "%build_ldflags" -o base_internalhash_types_stubs *.o
popd
%install