[go: up one dir, main page]

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:

  1. Forked the library
  2. Checkout v0.16.4
  3. Cherry-picked the commit from https://github.com/janestreet/base/pull/177
  4. 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.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports

Loading