Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use gpatch on openBSD #3444

Merged
merged 2 commits into from
Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/pages/Install.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ cd /usr/ports/sysutils/opam
make install
```

#### FreeBSD

Opam is available in the ports and packages tree on FreeBSD 11 or higher.

```
cd /usr/ports/devel/ocaml-opam
make install
```

#### OSX

Opam packages for [homebrew](http://mxcl.github.com/homebrew/) and
Expand Down
8 changes: 7 additions & 1 deletion src/client/opamInitDefaults.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ let os_filter os =

let linux_filter = os_filter "linux"
let macos_filter = os_filter "macos"
let openbsd_filter = 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 @@ -95,7 +100,8 @@ let required_tools ~sandboxing () =
Some "A download tool is required, check env variables OPAMCURL or OPAMFETCH",
None;
["diff"], None, None;
["patch"], None, None;
["patch"], None, Some patch_filter;
["gpatch"], None, Some gpatch_filter;
["tar"], None, None;
["unzip"], None, None;
] @
Expand Down
8 changes: 7 additions & 1 deletion src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,13 @@ let patch ?(preprocess=true) ~dir p =
else
p
in
make_command ~name:"patch" ~dir "patch" ["-p1"; "-i"; p'] @@> fun r ->
let patch_cmd =
match OpamStd.Sys.os () with
| OpamStd.Sys.OpenBSD
| OpamStd.Sys.FreeBSD -> "gpatch"
| _ -> "patch"
in
make_command ~name:"patch" ~dir patch_cmd ["-p1"; "-i"; p'] @@> fun r ->
if not (OpamConsole.debug ()) then Sys.remove p';
if OpamProcess.is_success r then Done None
else Done (Some (Process_error r))
Expand Down