summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Glondu <steph@glondu.net>2021-11-28 10:55:31 +0100
committerStephane Glondu <steph@glondu.net>2021-11-28 10:55:31 +0100
commit54a0bf10a631b6e45d062fc105ebf4b1803dcf02 (patch)
treed522d31c2019bf83b285188a1c14dec17d252a15
parent2a22f1cb9c4ed3694d17aad218a78b5c57bfa187 (diff)
parentc81cd25884e014ce561660e02e3c02893d5b5a5b (diff)
Update upstream source from tag 'upstream/1.6.8'
Update to upstream version '1.6.8' with Debian dir 143c4e9223d20c49a564e189143b373797aeb9ec
-rw-r--r--Changes5
-rw-r--r--INSTALL.md8
-rw-r--r--cppo.opam6
-rw-r--r--cppo_ocamlbuild.opam5
-rw-r--r--src/compat.ml7
-rw-r--r--src/cppo_main.ml14
-rw-r--r--src/dune5
-rw-r--r--test/dune2
-rw-r--r--test/version.cppo2
9 files changed, 36 insertions, 18 deletions
diff --git a/Changes b/Changes
index 2201c10..48581b7 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+## v1.6.7 (2020-12-21)
+- [compat] Treat ~ and - the same in semver in order to parse
+ OCaml 4.12.0 pre-release versions.
+- [compat] Restore 4.02.3 compatibility.
+
## v1.6.6 (2019-05-27)
- [pkg] port build system to dune from jbuilder.
- [pkg] upgrade opam metadata to 2.0 format.
diff --git a/INSTALL.md b/INSTALL.md
index 9888ee2..ce1da13 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -13,11 +13,5 @@ make
Install:
```
-make PREFIX=/some/path install
-```
-
-or
-
-```
-make BINDIR=/some/path/bin install
+make DESTDIR=/some/path install
```
diff --git a/cppo.opam b/cppo.opam
index 5a6b2f7..ca016ff 100644
--- a/cppo.opam
+++ b/cppo.opam
@@ -2,12 +2,12 @@ opam-version: "2.0"
maintainer: "martin@mjambon.com"
authors: "Martin Jambon"
license: "BSD-3-Clause"
-homepage: "http://mjambon.com/cppo.html"
+homepage: "https://github.com/ocaml-community/cppo"
doc: "https://ocaml-community.github.io/cppo/"
bug-reports: "https://github.com/ocaml-community/cppo/issues"
depends: [
- "ocaml" {>= "4.03"}
- "dune" {build & >= "1.0"}
+ "ocaml" {>= "4.02.3"}
+ "dune" {>= "1.0"}
"base-unix"
]
build: [
diff --git a/cppo_ocamlbuild.opam b/cppo_ocamlbuild.opam
index a81a6a8..96f1fdb 100644
--- a/cppo_ocamlbuild.opam
+++ b/cppo_ocamlbuild.opam
@@ -2,13 +2,14 @@ opam-version: "2.0"
maintainer: "martin@mjambon.com"
authors: "Martin Jambon"
license: "BSD-3-Clause"
-homepage: "http://mjambon.com/cppo.html"
+homepage: "https://github.com/ocaml-community/cppo"
doc: "https://ocaml-community.github.io/cppo/"
bug-reports: "https://github.com/ocaml-community/cppo/issues"
depends: [
"ocaml"
- "dune" {build & >= "1.0"}
+ "dune" {>= "1.0"}
"ocamlbuild"
+ "ocamlfind"
]
build: [
["dune" "subst"] {pinned}
diff --git a/src/compat.ml b/src/compat.ml
new file mode 100644
index 0000000..5cd4a1b
--- /dev/null
+++ b/src/compat.ml
@@ -0,0 +1,7 @@
+if Filename.check_suffix Sys.argv.(1) ".ml" &&
+ Scanf.sscanf Sys.ocaml_version "%d.%d" (fun a b -> (a, b)) < (4, 03) then
+ print_endline "\
+module String = struct
+ include String
+ let capitalize_ascii = capitalize
+end"
diff --git a/src/cppo_main.ml b/src/cppo_main.ml
index 22792b3..98e9efb 100644
--- a/src/cppo_main.ml
+++ b/src/cppo_main.ml
@@ -17,8 +17,8 @@ let add_extension tbl s =
let semver_re = Str.regexp "\
\\([0-9]+\\)\
\\.\\([0-9]+\\)\
-\\.\\([0-9]+\\)\
-\\(-\\([^+]*\\)\\)?\
+\\(\\.\\([0-9]+\\)\\)?\
+\\([~-]\\([^+]*\\)\\)?\
\\(\\+\\(.*\\)\\)?\
\r?$"
@@ -28,9 +28,9 @@ let parse_semver s =
else
let major = Str.matched_group 1 s in
let minor = Str.matched_group 2 s in
- let patch = Str.matched_group 3 s in
- let prerelease = try Some (Str.matched_group 5 s) with Not_found -> None in
- let build = try Some (Str.matched_group 7 s) with Not_found -> None in
+ let patch = try (Str.matched_group 4 s) with Not_found -> "0" in
+ let prerelease = try Some (Str.matched_group 6 s) with Not_found -> None in
+ let build = try Some (Str.matched_group 8 s) with Not_found -> None in
Some (major, minor, patch, prerelease, build)
let define var s =
@@ -108,6 +108,10 @@ let main () =
VAR_VERSION_FULL is the original string
Example: cppo -V OCAML:4.02.1
+
+ Note that cppo recognises both '-' and '~' preceding the pre-release
+ meaning -V OCAML:4.11.0+alpha1 sets OCAML_BUILD to alpha1 but
+ -V OCAML:4.12.0~alpha1 sets OCAML_PRERELEASE to alpha1.
";
"-o", Arg.String (fun s -> out_file := Some s),
diff --git a/src/dune b/src/dune
index 38f1809..8cf871b 100644
--- a/src/dune
+++ b/src/dune
@@ -13,4 +13,9 @@
(name cppo_main)
(package cppo)
(public_name cppo)
+ (modules :standard \ compat)
+ (preprocess (per_module
+ ((action (progn
+ (run ocaml %{dep:compat.ml} %{input-file})
+ (cat %{input-file}))) cppo_eval)))
(libraries unix str))
diff --git a/test/dune b/test/dune
index a7fab7b..254e534 100644
--- a/test/dune
+++ b/test/dune
@@ -70,7 +70,7 @@
(action
(with-stdout-to
%{targets}
- (run %{bin:cppo} -V X:123.05.2-alpha.1+foo-2.1 %{<}))))
+ (run %{bin:cppo} -V X:123.05.2-alpha.1+foo-2.1 -V COQ:8.13+beta1 %{<}))))
(alias
(name runtest)
diff --git a/test/version.cppo b/test/version.cppo
index ee4e429..4b13350 100644
--- a/test/version.cppo
+++ b/test/version.cppo
@@ -28,3 +28,5 @@ patch: X_PATCH
#else
#error ""
#endif
+
+Coq: COQ_VERSION