Skip to content

Commit

Permalink
ocaml compiler distribution: use parallel build for OCaml 4.07 and above
Browse files Browse the repository at this point in the history
In the old days, the OCaml compiler distribution did not support
parallel build. This support has been contributed over time, and while
the dependencies are still not 100% reliable (in particular, parallel
rebuild from a partial build often fails with cmi inconsistencies),
builds from a clean state are now very robust: they are routinely used
by developers and tested daily on our CI machines, and we haven't seen
a failure in a long while.

Enabling parallel build improves build times for everyone, at the cost
of a very low risk of breaking the build. Some context:

- On my machine, a recent sequential build took 5m15s, and a parallel
  build from the same sources took 2m53s: we can save 2m20s for every
  new switch creation for users with similar hardware. When creating
  a switch with a small number of packages, the compiler build time
  may dominate the total installation time.

- New switches are created much more often now that opam2 makes local
  switches easy. It is typical for users to create a switch for each
  project to isolate their dependencies, ending up with dozens of
  switches. The install time quickly builds up.

If a user was to find a build failure due to parallel build,
a workaround is to pass `-j 1` to opam to force sequential switch
creation:

    opam switch create <switch-name> <compiler-version> -j 1

setting the environment variable OPAMJOBS=1 would also work.

This commit was semi-automatically generated
using the following script run from the `packages/` directory:

```
for f in ocaml-base-compiler/*4.07.*/opam ocaml-variants/*4.0[789].*/opam ocaml-variants/*4.10.*/opam; do
    echo $f
    sed 's/  \[make "world.opt"\]/  [make "-j%{jobs%}" "world.opt"] {os != "cygwin"}/' -i $f
    sed 's/  \[make "world"\]/  [make "world.opt"] {os = "cygwin"}/' -i $f
done
```
  • Loading branch information
gasche committed Jun 8, 2019
1 parent a8800e0 commit dc1917c
Show file tree
Hide file tree
Showing 100 changed files with 198 additions and 198 deletions.
4 changes: 2 additions & 2 deletions packages/ocaml-base-compiler/ocaml-base-compiler.4.07.0/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-base-compiler/ocaml-base-compiler.4.07.1/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+32bit/opam
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ build: [
"-host"
"i386-apple-darwin13.2.0"
] {os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+afl/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+beta2+afl/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+beta2+fp/opam
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+beta2/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"] {os = "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+flambda/opam
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+fp+flambda/opam
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+fp/opam
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+rc1+afl/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+rc1+fp/opam
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+rc1/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+rc2+afl/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+rc2+fp/opam
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+rc2/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+spacetime/opam
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
4 changes: 2 additions & 2 deletions packages/ocaml-variants/ocaml-variants.4.07.0+trunk+afl/opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ build: [
"-aspp"
"cc -c"
] {os = "openbsd" | os = "freebsd" | os = "macos"}
[make "world"]
[make "world.opt"]
[make "world.opt"] {os = "cygwin"}
[make "-j%{jobs%}" "world.opt"] {os != "cygwin"}
]
install: [make "install"]
url {
Expand Down
Loading

0 comments on commit dc1917c

Please sign in to comment.