Skip to content

Commit

Permalink
Use gpatch also for freebsd
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Jul 19, 2018
1 parent cd4d802 commit a0fe4bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/client/opamInitDefaults.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ let os_filter os =
let linux_filter = os_filter "linux"
let macos_filter = os_filter "macos"
let openbsd_filter = os_filter "openbsd"
let not_openbsd_filter = FNot (os_filter "openbsd")
let freebsd_filter = os_filter "freebsd"
let sandbox_filter = FOr (linux_filter, macos_filter)

let gpatch_filter = FOr (openbsd_filter, freebsd_filter)
let patch_filter = FNot gpatch_filter

let wrappers ~sandboxing () =
let cmd t = [
CString "%{hooks}%/sandbox.sh", None;
Expand Down Expand Up @@ -97,8 +100,8 @@ let required_tools ~sandboxing () =
Some "A download tool is required, check env variables OPAMCURL or OPAMFETCH",
None;
["diff"], None, None;
["patch"], None, Some not_openbsd_filter;
["gpatch"], None, Some openbsd_filter;
["patch"], None, Some patch_filter;
["gpatch"], None, Some gpatch_filter;
["tar"], None, None;
["unzip"], None, None;
] @
Expand Down
3 changes: 2 additions & 1 deletion src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,8 @@ let patch ?(preprocess=true) ~dir p =
in
let patch_cmd =
match OpamStd.Sys.os () with
| OpamStd.Sys.OpenBSD -> "gpatch"
| OpamStd.Sys.OpenBSD
| OpamStd.Sys.FreeBSD -> "gpatch"
| _ -> "patch"
in
make_command ~name:"patch" ~dir patch_cmd ["-p1"; "-i"; p'] @@> fun r ->
Expand Down

0 comments on commit a0fe4bd

Please sign in to comment.