Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Try a new layout for compiler flags for OCaml 4.12.0 (and add 4.12.0~alpha1) #17541

Merged
merged 22 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ae22a4a
Try a new layout for compiler flags for OCaml 4.12.0
AltGr Oct 30, 2020
2e200d4
ocaml-options packages: add maintainer field
AltGr Nov 2, 2020
8a54959
Rename 'ocaml-options-*-only' to 'ocaml-options-only-*'
AltGr Nov 2, 2020
e215c2e
ocaml-variants: limit restriction to 'ocaml-beta' for opam 2.0
AltGr Nov 2, 2020
8f9d082
ocaml-variants trunk: skip config cache install
AltGr Nov 2, 2020
534193e
Re-add 'ocaml-base-compiler' as the choices for 'ocaml'
AltGr Nov 2, 2020
735a22a
Rename 'ocaml-variants.4.12.0' to '+options' to avoid confusion with …
AltGr Nov 3, 2020
1b05d09
Fix 4.12.0~alpha1 synopsis
AltGr Nov 5, 2020
df40a66
Fix stray 'ocaml-compiler'
AltGr Nov 9, 2020
82dfe31
Add the 'compiler' flag to ocaml-options packages
AltGr Nov 9, 2020
e69ffd5
Update ocaml-config
dra27 Nov 5, 2020
08a6a25
Add ocaml-base-compiler.4.12.0~alpha1
dra27 Nov 5, 2020
fcd7a0d
Fix ocaml-options-vanilla
AltGr Nov 9, 2020
86d7a2e
Remove custom ocaml ./configure for freebsd
AltGr Nov 9, 2020
1c10232
ocaml-config.2: handle backward-compat of the 'ocaml:compiler' variab…
AltGr Nov 10, 2020
b599bec
Spacetime is no longer available on 4.12
AltGr Nov 10, 2020
9453110
Rename 'ocaml-options-*' to 'ocaml-option-*'
AltGr Nov 12, 2020
b917702
Add more 'ocaml-options-only' packages
AltGr Nov 12, 2020
8f59243
Add ocaml-options-only-fp
AltGr Nov 12, 2020
4e8fc98
Apply suggestions from code review
AltGr Nov 12, 2020
00c540c
ocaml-config.2: Fix md5
kit-ty-kate Nov 16, 2020
7cc7d51
Make ocaml-base-compiler pull ocaml-options-vanilla
kit-ty-kate Nov 16, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
share_root: ["config.cache" {"ocaml/config.cache"}]
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
opam-version: "2.0"
synopsis: "latest 4.12 development, with afl-fuzz instrumentation"
synopsis: "First alpha release of OCaml 4.12.0"
maintainer: "platform@lists.ocaml.org"
authors: ["Xavier Leroy" "Damien Doligez" "Alain Frisch" "Jacques Garrigue" "Didier Rémy" "Jérôme Vouillon"]
homepage: "https://ocaml.org"
bug-reports: "https://github.com/ocaml/ocaml/issues"
dev-repo: "git://github.com/ocaml/ocaml#4.12"
depends: [
"ocaml" {= "4.12.0" & post}
"base-unix" {post}
"base-bigarray" {post}
"base-threads" {post}
"ocaml-beta"
"ocaml-beta" {opam-version < "2.1"}
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
]
"ocaml-option-vanilla"
]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note it's remained ocaml-options-vanilla (in plural) - so you depend on "vanilla options" (i.e. no options) rather than "the vanilla option" (which, alas, OCaml does not in fact have 🍦)

I think this is already achieved, though, because of the conflict-class, which prevents ocaml-base-compiler switching to ocaml-variants already, @AltGr?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, do we want to move the remaining ocaml-options-* to their singular counterparts before that? I think it's a bit confusing and potential source of errors to have both.

Apart from that, the request itself isn't a blocker, it's more for the sake of completeness. I don't care about it that much.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, indeed, in the case of ocaml-base-compiler, we have two options:

  • Have ocaml-base-compiler be just an alias for ocaml-variants.x+options & ocaml-options-vanilla
  • Have it stand-alone as before
  • (indeed 3: replace base-compiler by the version with options, not needing the variants.x+options at all. Not right away though)

The two should be equivalent in what you will get in the resulting switch ; my first take was option 1 here, to avoid duplication of the build instruction, but after some thought we decided to be more conservative and keep the stand-alone definition: it's less disruptive to current users of ocaml-base-compiler.

@dra27 yes, ocaml-variants and ocaml-base-compiler are mutually exclusive as before, and all options require variants so this is not needed; I guess @kit-ty-kate wanted the presence of options-vanilla to be a reliable marker that you are on the vanilla case; since the ocaml-options-vanilla package has already been made compatible with ocaml-base-compiler, there would be no harm in adding this dependency here to that purpose I guess.

conflict-class: "ocaml-core-compiler"
flags: compiler
flags: [ compiler hidden-version ]
setenv: CAML_LD_LIBRARY_PATH = "%{lib}%/stublibs"
build: [
[
"./configure"
"--prefix=%{prefix}%"
"-C"
"CC=cc" {os = "openbsd" | os = "macos"}
"ASPP=cc -c" {os = "openbsd" | os = "macos"}
"--with-afl"
"--disable-warn-error"
]
[make "-j%{jobs}%" {os != "cygwin"} "world"]
[make "-j%{jobs}%" {os != "cygwin"} "world.opt"]
]
install: [make "install"]
url {
src: "https://github.com/ocaml/ocaml/archive/4.12.tar.gz"
src: "https://github.com/ocaml/ocaml/archive/4.12.0-alpha1.tar.gz"
checksum: "sha256=bee59cb94067410d02f0bc4e7e47e3e878689aabf61e6d2f0cb4316f8563e55d"
}
extra-files: ["ocaml-base-compiler.install" "md5=3e969b841df1f51ca448e6e6295cb451"]
post-messages: [
"A failure in the middle of the build may be caused by build parallelism
(enabled by default).
See https://github.com/ocaml/opam-repository/pull/14257 for more info."
Please file a bug report at https://github.com/ocaml/ocaml/issues"
{failure & jobs > 1 & os != "cygwin"}
"You can try installing again including --jobs=1
to force a sequential build instead."
Expand Down
56 changes: 56 additions & 0 deletions packages/ocaml-config/ocaml-config.2/files/gen_ocaml_config.ml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
let () =
let ocaml_version =
let v = Sys.ocaml_version in
let l = String.length v in
let plus = try String.index v '+' with Not_found -> l in
(* Introduced in 4.11.0; used from 4.12.0 *)
let tilde = try String.index v '~' with Not_found -> l in
String.sub v 0 (min (min plus tilde) l)
in
if ocaml_version <> Sys.argv.(1) then
(Printf.eprintf
"OCaml version mismatch: %%s, expected %s"
ocaml_version Sys.argv.(1);
exit 1)
else
let oc = open_out (Sys.argv.(2) ^ ".config") in
let exe = ".exe" in
let (ocaml, suffix) =
let s = Sys.executable_name in
if Filename.check_suffix s exe then
(Filename.chop_suffix s exe, exe)
else
(s, "")
in
let ocamlc = ocaml^"c"^suffix in
let libdir =
if Sys.command (ocamlc^" -where > where") = 0 then
(* Must be opened in text mode for Windows *)
let ic = open_in "where" in
let r = input_line ic in
close_in ic; r
else
failwith "Bad return from 'ocamlc -where'"
in
let stubsdir =
let ic = open_in (Filename.concat libdir "ld.conf") in
let rec r acc = try r (input_line ic::acc) with End_of_file -> acc in
let lines = List.rev (r []) in
close_in ic;
String.concat ":" lines
in
let p fmt = Printf.fprintf oc (fmt ^^ "\n") in
p "opam-version: \"2.0\"";
p "variables {";
p " native: %%b"
(Sys.file_exists (ocaml^"opt"^suffix));
p " native-tools: %%b"
(Sys.file_exists (ocamlc^".opt"^suffix));
p " native-dynlink: %%b"
(Sys.file_exists (Filename.concat libdir "dynlink.cmxa"));
p " stubsdir: %%S"
stubsdir;
p " preinstalled: %{ocaml-system:installed}%";
p " compiler: \"%{ocaml-system:installed?system:}%%{ocaml-base-compiler:version}%%{ocaml-variants:version}%%{ocaml-option-32bit:installed?+32bit:}%%{ocaml-option-afl:installed?+afl:}%%{ocaml-option-bytecode-only:installed?+bytecode-only:}%%{ocaml-option-default-unsafe-string:installed?+default-unsafe-string:}%%{ocaml-option-fp:installed?+fp:}%%{ocaml-option-flambda:installed?+flambda:}%%{ocaml-option-musl:installed?+musl:}%%{ocaml-option-nnp:installed?+nnp:}%%{ocaml-option-no-flat-float-array:installed?+no-flat-float-array:}%%{ocaml-option-spacetime:installed?+spacetime:}%%{ocaml-option-static:installed?+static:}%\"";
p "}";
close_out oc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
share: ["gen_ocaml_config.ml"]
21 changes: 21 additions & 0 deletions packages/ocaml-config/ocaml-config.2/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
opam-version: "2.0"
synopsis: "OCaml Switch Configuration"
description: """
This package is used by the OCaml package to set-up its variables."""
maintainer: "platform@lists.ocaml.org"
authors: [
"Louis Gesbert <louis.gesbert@ocamlpro.com>"
"David Allsopp <david.allsopp@metastack.com>"
]
homepage: "https://opam.ocaml.org/"
bug-reports: "https://github.com/ocaml/opam/issues"
depends: [
"ocaml-base-compiler" {>= "4.12.0~"} |
"ocaml-variants" {>= "4.12.0~"} |
"ocaml-system" {>= "4.12.0~"}
]
substs: "gen_ocaml_config.ml"
extra-files: [
["gen_ocaml_config.ml.in" "md5=07afb6231bbcf399f7f7872e25eb23a1"]
kit-ty-kate marked this conversation as resolved.
Show resolved Hide resolved
["ocaml-config.install" "md5=8e50c5e2517d3463b3aad649748cafd7"]
]
11 changes: 11 additions & 0 deletions packages/ocaml-option-32bit/ocaml-option-32bit.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled in 32-bit mode for 64-bit Linux and OS X hosts"
depexts: [
["gcc-multilib" "g++-multilib"] {os-family = "debian"}
]
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
available: [ arch = "x86_64" & (os = "linux" | os = "macos") ]
maintainer: "platform@lists.ocaml.org"
flags: compiler
7 changes: 7 additions & 0 deletions packages/ocaml-option-afl/ocaml-option-afl.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with afl-fuzz instrumentation"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"
synopsis: "Compile OCaml without the native-code compiler"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled without safe strings by default"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
7 changes: 7 additions & 0 deletions packages/ocaml-option-flambda/ocaml-option-flambda.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with flambda activated"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
8 changes: 8 additions & 0 deletions packages/ocaml-option-fp/ocaml-option-fp.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with frame-pointers enabled"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
conflicts: ["ocaml-option-musl"]
maintainer: "platform@lists.ocaml.org"
flags: compiler
13 changes: 13 additions & 0 deletions packages/ocaml-option-musl/ocaml-option-musl.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with musl-gcc"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
depexts: [
["musl-tools"] {os-family = "debian"}
["musl"] {os-distribution = "arch"}
]
conflicts: [ "ocaml-option-32bit" ]
available: [ os = "openbsd" | os = "freebsd" | os = "macos" | os = "linux" ]
maintainer: "platform@lists.ocaml.org"
flags: compiler
7 changes: 7 additions & 0 deletions packages/ocaml-option-nnp/ocaml-option-nnp.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with --disable-naked-pointers"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with --disable-flat-float-array"
depends: [
"ocaml-variants" {post & >= "4.12.0~"}
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
8 changes: 8 additions & 0 deletions packages/ocaml-option-spacetime/ocaml-option-spacetime.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with spacetime activated"
depends: [
# Not available until options are ported to earlier compilers
"ocaml-variants" {post & >= "4.12.0~" & < "4.12"}
dra27 marked this conversation as resolved.
Show resolved Hide resolved
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
15 changes: 15 additions & 0 deletions packages/ocaml-option-static/ocaml-option-static.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
opam-version: "2.0"
synopsis: "Set OCaml to be compiled with musl-gcc -static"
depends: [
"ocaml-option-musl"
"ocaml-variants" {post & >= "4.12.0~"}
]
depexts: [
["musl-tools"] {os-family = "debian"}
["musl"] {os-distribution = "arch"}
["musl-dev"] {os-distribution = "alpine"}
]
conflicts: [ "ocaml-option-32bit" ]
available: [ os = "openbsd" | os = "freebsd" | os = "macos" | os = "linux" ]
maintainer: "platform@lists.ocaml.org"
flags: compiler
17 changes: 17 additions & 0 deletions packages/ocaml-options-only-afl/ocaml-options-only-afl.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
opam-version: "2.0"
synopsis: "Ensure that OCaml is compiled with AFL support enabled, and no other custom options"
depends: ["ocaml-option-afl"]
conflicts: [
"ocaml-option-32bit"
"ocaml-option-bytecode-only"
"ocaml-option-default-unsafe-string"
"ocaml-option-flambda"
"ocaml-option-fp"
"ocaml-option-musl"
"ocaml-option-no-flat-float-array"
"ocaml-option-spacetime"
"ocaml-option-static"
"ocaml-option-nnp"
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
opam-version: "2.0"
synopsis: "Ensure that OCaml is compiled with flambda and frame-pointer enabled, and no other custom options"
depends: ["ocaml-option-flambda" "ocaml-option-fp"]
conflicts: [
"ocaml-option-32bit"
"ocaml-option-afl"
"ocaml-option-bytecode-only"
"ocaml-option-default-unsafe-string"
"ocaml-option-musl"
"ocaml-option-no-flat-float-array"
"ocaml-option-spacetime"
"ocaml-option-static"
"ocaml-option-nnp"
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
opam-version: "2.0"
synopsis: "Ensure that OCaml is compiled with flambda activated, and no other custom options"
depends: ["ocaml-option-flambda"]
conflicts: [
"ocaml-option-32bit"
"ocaml-option-afl"
"ocaml-option-bytecode-only"
"ocaml-option-default-unsafe-string"
"ocaml-option-fp"
"ocaml-option-musl"
"ocaml-option-no-flat-float-array"
"ocaml-option-spacetime"
"ocaml-option-static"
"ocaml-option-nnp"
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
17 changes: 17 additions & 0 deletions packages/ocaml-options-only-fp/ocaml-options-only-fp.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
opam-version: "2.0"
synopsis: "Ensure that OCaml is compiled with only frame-pointer enabled, and no other custom options"
depends: ["ocaml-option-fp"]
conflicts: [
"ocaml-option-32bit"
"ocaml-option-afl"
"ocaml-option-bytecode-only"
"ocaml-option-default-unsafe-string"
"ocaml-option-flambda"
"ocaml-option-musl"
"ocaml-option-no-flat-float-array"
"ocaml-option-spacetime"
"ocaml-option-static"
"ocaml-option-nnp"
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
17 changes: 17 additions & 0 deletions packages/ocaml-options-only-nnp/ocaml-options-only-nnp.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
opam-version: "2.0"
synopsis: "Ensure that OCaml is compiled with no-naked-pointers, and no other custom options"
depends: ["ocaml-option-nnp"]
conflicts: [
"ocaml-option-32bit"
"ocaml-option-afl"
"ocaml-option-bytecode-only"
"ocaml-option-default-unsafe-string"
"ocaml-option-flambda"
"ocaml-option-fp"
"ocaml-option-musl"
"ocaml-option-no-flat-float-array"
"ocaml-option-spacetime"
"ocaml-option-static"
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
opam-version: "2.0"
synopsis: "Ensure that OCaml is compiled with no-flat-float-array, and no other custom options"
depends: ["ocaml-option-no-flat-float-array"]
conflicts: [
"ocaml-option-32bit"
"ocaml-option-afl"
"ocaml-option-bytecode-only"
"ocaml-option-default-unsafe-string"
"ocaml-option-flambda"
"ocaml-option-fp"
"ocaml-option-musl"
"ocaml-option-spacetime"
"ocaml-option-static"
"ocaml-option-nnp"
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
22 changes: 22 additions & 0 deletions packages/ocaml-options-vanilla/ocaml-options-vanilla.1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
opam-version: "2.0"
synopsis: "Ensure that OCaml is compiled with no special options enabled"
depends: [
"ocaml-base-compiler" {post} |
"ocaml-system" {post} |
"ocaml-variants" {post & >= "4.12.0~"}
]
conflicts: [
"ocaml-option-32bit"
"ocaml-option-afl"
"ocaml-option-bytecode-only"
"ocaml-option-default-unsafe-string"
"ocaml-option-flambda"
"ocaml-option-fp"
"ocaml-option-musl"
"ocaml-option-no-flat-float-array"
"ocaml-option-spacetime"
"ocaml-option-static"
"ocaml-option-nnp"
]
maintainer: "platform@lists.ocaml.org"
flags: compiler
Loading