Deps: pin base compatible with Mac
What
Pins a custom version of base.v0.16.4
Why
This is a bit complicated. janestreet/base has a piece of code to check if the flag -mpopcnt is supported on the architecture it's building, i.e.
let () =
let output = ref "" in
main
~name:"discover"
~args:[ "-o", Set_string output, "FILENAME output file" ]
(fun _c ->
let f,oc = Filename.open_temp_file "baseconf" ".c" in
let has_popcnt =
Fun.protect ~finally:(fun () -> close_out oc; Sys.remove f)
(fun () -> Out_channel.(output_string oc program; flush oc);
Sys.command (Printf.sprintf "cc %s -mpopcnt -o /dev/null >/dev/null 2>&1" f) = 0) in
Flags.write_sexp !output (if has_popcnt then [ "-mpopcnt" ] else []))
;;
In general it works, but when you compile with the Homebrew formula it uses a weird cc that apparently doesn't raise an error when it does cc -mpopcnt toto.c but fails later on the real world compilation.
However, they have an open pull request that improves this flag detection https://github.com/janestreet/base/pull/177.
How
Therefore, I have:
- Forked the library
- Checkout v0.16.4
- Cherry-picked the commit from https://github.com/janestreet/base/pull/177
- Pinned this version
Manually testing the MR
Really, check my branch https://github.com/vch9/base/tree/v0.16.4-mpopcnt and make sure it makes sense. Otherwise if you're able to do make build-deps that should be enough.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR