diff --git a/.github/workflows/build-and-test.jsonnet b/.github/workflows/build-and-test.jsonnet index 70ea5301..11d4b37f 100644 --- a/.github/workflows/build-and-test.jsonnet +++ b/.github/workflows/build-and-test.jsonnet @@ -22,11 +22,14 @@ local job = { //TODO: 'windows-latest' ], 'ocaml-compiler': [ - // Old version with |> builtin but ideally we would like even before - '4.02.1', - // first version with valid ocamlformat + // Old OCaml version where I ported ocamlrun to plan9 + // This needs stdcompat so we can use |> and bytes type without issues. + // The |> operator was introduced in 4.02.0, that we could add in + // the matrix, but stdcompat does not compile with it. + '3.10.0', + // First OCaml version with a working ocamlformat OPAM package '4.04.1', - //TODO: 3.10.0, but pb with |> + //TODO: Ideally 4.14.1 and ocaml latest (5.2.0) ], } }, @@ -37,12 +40,14 @@ local job = { uses: "ocaml/setup-ocaml@v2", with: { 'ocaml-compiler': '${{ matrix.ocaml-compiler }}', + // available only for OCaml >= 4.0.0 and we want also 3.10.0 + 'opam-depext': false, } }, { name: 'Install dependencies', run: ||| - echo No dependencies! This is xix! It does not need anything! + opam install --deps-only . |||, }, { diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index b8c66755..8294057f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -7,9 +7,10 @@ jobs: - uses: ocaml/setup-ocaml@v2 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} + opam-depext: false - name: Install dependencies run: | - echo No dependencies! This is xix! It does not need anything! + opam install --deps-only . - name: Build mk/rc run: | eval $(opam env) @@ -20,7 +21,7 @@ jobs: strategy: matrix: ocaml-compiler: - - 4.02.1 + - 3.10.0 - 4.04.1 os: - ubuntu-latest diff --git a/bootstrap-mk.sh b/bootstrap-mk.sh index bd7874c4..ccd636c0 100755 --- a/bootstrap-mk.sh +++ b/bootstrap-mk.sh @@ -6,6 +6,7 @@ # # Note that right now to boostrap Xix we still need: # - OCaml (which itself requires to bootstrap ocamllex, ocamlyacc and C) +# - the ocamlfind tool and stdcompat library # - a C compiler # - /bin/sh # @@ -20,11 +21,18 @@ set -e # for showing the executed commands (verbose) set -x +# Limit to just stdcompat! This is Xix! +EXTERNAL_LIB=`ocamlfind query stdcompat` + #TODO? -bin-annot -absname -dtypes -g -OCAMLCFLAGS= +OCAMLCFLAGS="-I $EXTERNAL_LIB" +# We need -custom below because of dllstdcompat__stubs, otherwise +# we would need to set CAML_LD_LIBRARY_PATH before running the programs. +# LATER: would be good to remove if one day we want to store +# a BOOTSTRAP/mk and we want a really portable bytecode across platforms. #TODO? for windows under cygwin might need -custom -EXTRALINKFLAGS= +EXTRALINKFLAGS="-I $EXTERNAL_LIB stdcompat.cma -custom" TOP=`pwd` diff --git a/changes.txt b/changes.txt index 1ecf28a4..842c8e34 100644 --- a/changes.txt +++ b/changes.txt @@ -1,9 +1,13 @@ # -*- org -*- -* 0.13 (Q2 2024) () +* 0.13 (Q2 2024) (GHA and semgrep checks (devops)) # resume after long hiatus (2019-2023) due to our move to Italy, # the birth of Nathalie, and especially my work for Semgrep. +** internals +Started to use stdcompat for backward compatibility with +old versions of OCaml. + ** devops Github actions (GHA) checks to make sure xix compiles. At least it compiles with 4.02.1 (use of |> so harder to compile diff --git a/lib_core/commons/IO.ml b/lib_core/commons/IO.ml index f3e9732f..51d18ba9 100644 --- a/lib_core/commons/IO.ml +++ b/lib_core/commons/IO.ml @@ -16,6 +16,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) +open Stdcompat (* for bytes *) (*****************************************************************************) (* Prelude *) diff --git a/lib_core/commons/IO.mli b/lib_core/commons/IO.mli index 0db9d387..7d0b86e1 100644 --- a/lib_core/commons/IO.mli +++ b/lib_core/commons/IO.mli @@ -17,6 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) +open Stdcompat (* for bytes type *) (** High-order abstract I/O. diff --git a/lib_core/commons/common.ml b/lib_core/commons/common.ml index ca4dfb98..ab48adf2 100644 --- a/lib_core/commons/common.ml +++ b/lib_core/commons/common.ml @@ -1,9 +1,10 @@ (* Copyright 2015, 2016, 2017 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) type byte = char -type bytes = string (* builtin since OCaml 4.02 (bytes are mutable strings) *) +(* type bytes = string *) type filename = string type dirname = string diff --git a/lib_core/commons/common.mli b/lib_core/commons/common.mli index 54544ad6..f67f737f 100644 --- a/lib_core/commons/common.mli +++ b/lib_core/commons/common.mli @@ -1,6 +1,6 @@ type byte = char -type bytes = string +(* type bytes = string *) type filename = string type dirname = string diff --git a/lib_core/commons/common2.ml b/lib_core/commons/common2.ml index ef4d8ad5..175f5555 100644 --- a/lib_core/commons/common2.ml +++ b/lib_core/commons/common2.ml @@ -1,3 +1,4 @@ +open Stdcompat let rec join_gen a = function | [] -> [] diff --git a/lib_core/commons/ocaml.ml b/lib_core/commons/ocaml.ml index 6025f147..7ce82875 100644 --- a/lib_core/commons/ocaml.ml +++ b/lib_core/commons/ocaml.ml @@ -20,6 +20,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) +open Stdcompat (* for |> *) open Common (*****************************************************************************) diff --git a/mk/env.ml b/mk/env.ml index 897bc63b..993c654f 100644 --- a/mk/env.ml +++ b/mk/env.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common (*****************************************************************************) diff --git a/mk/eval.ml b/mk/eval.ml index 12ce50fb..ee3e77a7 100644 --- a/mk/eval.ml +++ b/mk/eval.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common module A = Ast diff --git a/mk/graph.ml b/mk/graph.ml index 8a672ed4..cf35d5e7 100644 --- a/mk/graph.ml +++ b/mk/graph.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common module A = Ast diff --git a/mk/main.ml b/mk/main.ml index 2b957852..1aa524c0 100644 --- a/mk/main.ml +++ b/mk/main.ml @@ -1,4 +1,5 @@ (* Copyright 2016, 2018 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common module G = Graph diff --git a/mk/outofdate.ml b/mk/outofdate.ml index d02a178e..61083e40 100644 --- a/mk/outofdate.ml +++ b/mk/outofdate.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common module G = Graph diff --git a/mk/parse.ml b/mk/parse.ml index 62c90ce6..b892bec0 100644 --- a/mk/parse.ml +++ b/mk/parse.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common let parse file = diff --git a/mk/parser.mly b/mk/parser.mly index 96f39e16..d0319d35 100644 --- a/mk/parser.mly +++ b/mk/parser.mly @@ -1,5 +1,6 @@ %{ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common open Ast diff --git a/mk/percent.ml b/mk/percent.ml index fd6399b3..88c996e7 100644 --- a/mk/percent.ml +++ b/mk/percent.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common (*****************************************************************************) diff --git a/mk/scheduler.ml b/mk/scheduler.ml index 4acc1437..b763b848 100644 --- a/mk/scheduler.ml +++ b/mk/scheduler.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common module J = Job diff --git a/mk/shell.ml b/mk/shell.ml index 8d52be62..43984b7b 100644 --- a/mk/shell.ml +++ b/mk/shell.ml @@ -1,4 +1,5 @@ (* Copyright 2016, 2018 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common (*****************************************************************************) diff --git a/mk/shellenv.ml b/mk/shellenv.ml index 23663829..c3a66f00 100644 --- a/mk/shellenv.ml +++ b/mk/shellenv.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common type t = (string * string list) list diff --git a/shell/compile.ml b/shell/compile.ml index 20285226..40293fff 100644 --- a/shell/compile.ml +++ b/shell/compile.ml @@ -1,3 +1,4 @@ +open Stdcompat (* for |> *) open Common module A = Ast diff --git a/shell/interpreter.ml b/shell/interpreter.ml index 255ef735..4840d8ac 100644 --- a/shell/interpreter.ml +++ b/shell/interpreter.ml @@ -1,3 +1,4 @@ +open Stdcompat (* for |> *) open Common module O = Opcode diff --git a/shell/main.ml b/shell/main.ml index 8582a0ea..2b0beb43 100644 --- a/shell/main.ml +++ b/shell/main.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common module R = Runtime diff --git a/shell/op_process.ml b/shell/op_process.ml index b44bb7d5..f01344cc 100644 --- a/shell/op_process.ml +++ b/shell/op_process.ml @@ -1,3 +1,4 @@ +open Stdcompat (* for |> *) open Common module R = Runtime diff --git a/shell/parse.ml b/shell/parse.ml index 0cd32feb..15d1d9b7 100644 --- a/shell/parse.ml +++ b/shell/parse.ml @@ -1,4 +1,5 @@ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common module R = Runtime diff --git a/shell/parser.mly b/shell/parser.mly index f3d10af9..fa883a73 100644 --- a/shell/parser.mly +++ b/shell/parser.mly @@ -1,5 +1,6 @@ %{ (* Copyright 2016 Yoann Padioleau, see copyright.txt *) +open Stdcompat (* for |> *) open Common open Ast diff --git a/shell/process.ml b/shell/process.ml index 61ae6fed..0db4225a 100644 --- a/shell/process.ml +++ b/shell/process.ml @@ -1,3 +1,4 @@ +open Stdcompat (* for |> *) open Common module R = Runtime diff --git a/shell/runtime.ml b/shell/runtime.ml index fae02fb8..c1619e67 100644 --- a/shell/runtime.ml +++ b/shell/runtime.ml @@ -1,3 +1,4 @@ +open Stdcompat (* for |> *) open Common (*****************************************************************************) diff --git a/xix.opam b/xix.opam new file mode 100644 index 00000000..baa6a468 --- /dev/null +++ b/xix.opam @@ -0,0 +1,26 @@ +opam-version: "2.0" +version: "0.13" +synopsis: + "Xix is Xix" +description: """ +Xix is Xix + +For more information see https://github.com/aryx/xix +""" +maintainer: ["Yoann Padioleau "] +authors: ["Yoann Padioleau "] +license: "LGPL-2.1" +homepage: "https://github.com/aryx/xix" +bug-reports: "https://github.com/aryx/xix/issues" +depends: [ + "ocaml" {>= "3.10.0"} + # Do not depend on anything except those 2! Xix should limit + # its external dependencies as much as possible, so it + # can boostrap itself more easily. + "stdcompat" + "ocamlfind" +] +build: [ + "echo todo" +] +dev-repo: "git+https://github.com/aryx/xix.git"