mirage / ocaml-solo5

Freestanding OCaml runtime
Other
101 stars 30 forks source link

Make build system more flexible to aid with NixOS packaging #93

Closed sternenseemann closed 2 years ago

sternenseemann commented 3 years ago

This PR contains two patches for the build system I wrote while giving packaging ocaml-freestanding for NixOS a shot. I wanted to make the following things possible:

The commit messages have more details on the reasoning.

I tried to preserve the old default behavior, but can't say for sure I haven't broken anything. Someone with a more “normal” setup testing this would be appreciated!

I don't need a merge desparately, I can also vendor these patches in nixpkgs. If you are switching to dune anyways, it not be worth it to mess with the build system.

sternenseemann commented 3 years ago

Seems like the build failure is the same as on master.

dinosaure commented 3 years ago

I will try to see if we can integrate such great work on #92 which will be merged soon.

sternenseemann commented 3 years ago

Seems like a good idea, I'll try to build that branch and see if there are any issues or what needs to be fixed.

I can imagine a lot would work out of the box already since we actually have dune available at build time and it is generally well-integrated. Packaging ocaml-src is also I think a hit worth taking if it allows for a cleaner dune package.

hannesm commented 2 years ago

Thanks for your work. Since this adds quite a lot of complexity (conditionals) to the build system, and additionally the "use dune to compile MirageOS" is on the horizon, I will not merge this, but instead hope that #92 will integrate the required changes (as @dinosaure pointed out, only small changes are needed).

dinosaure commented 2 years ago

I will keep this PR opens even if we merged #104 to keep in our mind the NixOS support.

hannesm commented 2 years ago

IMHO this can be closed -- in configure.sh ocamlfind is not used anymore, and in Makefile only if ocaml/Makefile is not present, it is copied (from `opam var prefix`/lib/ocaml-src). Please report if packaging for NixOS needs further changes in a separate issue (or PR). Thanks a lot for your patience.