Skip to content

Commit

Permalink
Merge pull request #5 from aryx/stdcompat
Browse files Browse the repository at this point in the history
Use stdcompat so we can compile with 3.10.0
  • Loading branch information
aryx authored Apr 19, 2024
2 parents 069a285 + ecd708f commit 789a054
Show file tree
Hide file tree
Showing 30 changed files with 80 additions and 12 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build-and-test.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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)
],
}
},
Expand All @@ -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 .
|||,
},
{
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -20,7 +21,7 @@ jobs:
strategy:
matrix:
ocaml-compiler:
- 4.02.1
- 3.10.0
- 4.04.1
os:
- ubuntu-latest
Expand Down
12 changes: 10 additions & 2 deletions bootstrap-mk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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`

Expand Down
6 changes: 5 additions & 1 deletion changes.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions lib_core/commons/IO.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand Down
1 change: 1 addition & 0 deletions lib_core/commons/IO.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion lib_core/commons/common.ml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib_core/commons/common.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

type byte = char
type bytes = string
(* type bytes = string *)

type filename = string
type dirname = string
Expand Down
1 change: 1 addition & 0 deletions lib_core/commons/common2.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open Stdcompat

let rec join_gen a = function
| [] -> []
Expand Down
1 change: 1 addition & 0 deletions lib_core/commons/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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

(*****************************************************************************)
Expand Down
1 change: 1 addition & 0 deletions mk/env.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

(*****************************************************************************)
Expand Down
1 change: 1 addition & 0 deletions mk/eval.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

module A = Ast
Expand Down
1 change: 1 addition & 0 deletions mk/graph.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

module A = Ast
Expand Down
1 change: 1 addition & 0 deletions mk/main.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016, 2018 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

module G = Graph
Expand Down
1 change: 1 addition & 0 deletions mk/outofdate.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

module G = Graph
Expand Down
1 change: 1 addition & 0 deletions mk/parse.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

let parse file =
Expand Down
1 change: 1 addition & 0 deletions mk/parser.mly
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
%{
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

open Ast
Expand Down
1 change: 1 addition & 0 deletions mk/percent.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

(*****************************************************************************)
Expand Down
1 change: 1 addition & 0 deletions mk/scheduler.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

module J = Job
Expand Down
1 change: 1 addition & 0 deletions mk/shell.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016, 2018 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

(*****************************************************************************)
Expand Down
1 change: 1 addition & 0 deletions mk/shellenv.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

type t = (string * string list) list
Expand Down
1 change: 1 addition & 0 deletions shell/compile.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open Stdcompat (* for |> *)
open Common

module A = Ast
Expand Down
1 change: 1 addition & 0 deletions shell/interpreter.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open Stdcompat (* for |> *)
open Common

module O = Opcode
Expand Down
1 change: 1 addition & 0 deletions shell/main.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

module R = Runtime
Expand Down
1 change: 1 addition & 0 deletions shell/op_process.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open Stdcompat (* for |> *)
open Common

module R = Runtime
Expand Down
1 change: 1 addition & 0 deletions shell/parse.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

module R = Runtime
Expand Down
1 change: 1 addition & 0 deletions shell/parser.mly
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
%{
(* Copyright 2016 Yoann Padioleau, see copyright.txt *)
open Stdcompat (* for |> *)
open Common

open Ast
Expand Down
1 change: 1 addition & 0 deletions shell/process.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open Stdcompat (* for |> *)
open Common

module R = Runtime
Expand Down
1 change: 1 addition & 0 deletions shell/runtime.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open Stdcompat (* for |> *)
open Common

(*****************************************************************************)
Expand Down
26 changes: 26 additions & 0 deletions xix.opam
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
authors: ["Yoann Padioleau <[email protected]>"]
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"

0 comments on commit 789a054

Please sign in to comment.