From 53db7968627e51426fbdb9119a1c8010e573e114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20BRAMI?= Date: Mon, 1 Jul 2019 23:27:03 +0200 Subject: [PATCH 1/6] add esy config file --- .gitignore | 2 ++ package.json | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 02e21e1..21c5950 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,8 @@ libs/ocaml-compiler-clean/parsing/lexer.ml libs/ocaml-compiler-clean/parsing/linenum.ml libs/ocaml-compiler-clean/parsing/parser.ml libs/ocaml-compiler-clean/parsing/parser.mli +_esy +esy.lock tools/ocp-ide/emacs/ocp-ide.el tools/ocp-ide/emacs/tmp.el autom4te.cache diff --git a/package.json b/package.json new file mode 100644 index 0000000..e1337c9 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "ocp-build", + "version": "1.2.0", + "description": "A build manager for OCaml applications", + "contributors": [ + "Fabrice Le Fessant ", + "Élie BRAMI " + ], + "license": "LicenseRef-LICENSE", + "esy": { + "buildsInSource": true, + "build": [ + "./configure --prefix #{self.target_dir}", + "make" + ], + "install": "make install" + }, + "dependencies": { + "@opam/ocamlfind": "*", + "@opam/cmdliner": ">=1.0", + "@opam/re": ">=1.7.3" + }, + "peerDependencies": { + "ocaml": ">=4.6.0 <4.8.0" + }, + "devDependencies": { + "ocaml": ">=4.6.0 <4.8.0" + } +} From c97662a92ee751dafcb8a8b707df9eb45a7d23bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20BRAMI?= Date: Tue, 2 Jul 2019 11:47:21 +0200 Subject: [PATCH 2/6] Fix build on Windows for OCaml 4.06.0 onwards Windows support for Unix.isatty was added in 4.06.0 which means that the dummy primitives added in ocplib-unix should be based on version. --- libs/ocplib-unix/onlyUnix_c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/ocplib-unix/onlyUnix_c.c b/libs/ocplib-unix/onlyUnix_c.c index 971be01..84cade2 100644 --- a/libs/ocplib-unix/onlyUnix_c.c +++ b/libs/ocplib-unix/onlyUnix_c.c @@ -61,7 +61,9 @@ UNAVAILABLE_PRIM(unix_clear_close_on_exec) UNAVAILABLE_PRIM(unix_closedir) UNAVAILABLE_PRIM(unix_getppid) +#if (OCAML_VERSION < 4060) UNAVAILABLE_PRIM(unix_isatty) +#endif UNAVAILABLE_PRIM(unix_opendir) UNAVAILABLE_PRIM(unix_readdir) UNAVAILABLE_PRIM(unix_rewinddir) From 99d67b437e382b751cd55c46a4f4b9175c0f6ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20BRAMI?= Date: Tue, 2 Jul 2019 11:56:14 +0200 Subject: [PATCH 3/6] Removes trailing whitespace --- libs/ocplib-unix/build.ocp2 | 2 +- libs/ocplib-unix/onlyWin32_c.c | 7 +++---- ocp-autoconf.d/build.ocp2inc | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libs/ocplib-unix/build.ocp2 b/libs/ocplib-unix/build.ocp2 index 80ace02..86b7204 100644 --- a/libs/ocplib-unix/build.ocp2 +++ b/libs/ocplib-unix/build.ocp2 @@ -20,7 +20,7 @@ begin ocaml = ocaml + { bytecomp = []; asmcomp = [] }; ocaml.bytecomp += [ "-w"; "-50" ]; ocaml.asmcomp += [ "-w"; "-50" ]; - + ocaml.version = autoconf.package_version; with_ocp_pp = { pp = ocp_pp; pp_requires = [ "ocp-pp:byte" ]; }; ocaml.files = [ diff --git a/libs/ocplib-unix/onlyWin32_c.c b/libs/ocplib-unix/onlyWin32_c.c index f1af396..1d7d1ec 100644 --- a/libs/ocplib-unix/onlyWin32_c.c +++ b/libs/ocplib-unix/onlyWin32_c.c @@ -225,9 +225,9 @@ value onlyWin32_getFileInformationByHandle_ml(value handle_v) value onlyWin32_getFileInformationByName_ml(value filename_v) { - HANDLE hfile = CreateFile(String_val(filename_v), 0, - FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, - NULL, OPEN_EXISTING, + HANDLE hfile = CreateFile(String_val(filename_v), 0, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); value res; @@ -253,4 +253,3 @@ value onlyWin32_getFileInformationByName_ml(value filename_v) uerror("onlyWin32_getFileInformationByName_ml", Nothing); } #endif - diff --git a/ocp-autoconf.d/build.ocp2inc b/ocp-autoconf.d/build.ocp2inc index 20adde2..d5b028d 100644 --- a/ocp-autoconf.d/build.ocp2inc +++ b/ocp-autoconf.d/build.ocp2inc @@ -25,8 +25,8 @@ List.map (function(pk){ *) ocaml.bytecomp = [ - "-strict-sequence"; - "-principal"; + "-strict-sequence"; + "-principal"; (* "-absname"; *) "-w"; "+a-4-9-41-42-44-45-48-3-33" (* -3 no-deprecated *) ]; From 27aee49d2a1100061ab0d5bbc69ab04ae5c38f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20BRAMI?= Date: Sun, 7 Jul 2019 14:12:55 +0200 Subject: [PATCH 4/6] fix permission file for open_for_pipe on windows --- tools/ocp-build/misc/buildMisc.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/ocp-build/misc/buildMisc.ml b/tools/ocp-build/misc/buildMisc.ml index a2f7c41..e44386f 100755 --- a/tools/ocp-build/misc/buildMisc.ml +++ b/tools/ocp-build/misc/buildMisc.ml @@ -207,8 +207,11 @@ end = struct end let open_for_pipe filename = + MinUnix.openfile filename MinUnix.[O_RDWR; O_APPEND; O_CREAT; O_SHARE_DELETE] 0o777 + (* let oc = open_out_bin filename in MinUnix.descr_of_out_channel oc + *) let create_process cmd maybe_chdir stdin stdout stderr = match cmd with From ae0d7ed2c9a417d3cc004476e8b54a00a283b61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20BRAMI?= Date: Tue, 9 Jul 2019 16:57:46 +0200 Subject: [PATCH 5/6] fix env var package.json --- package.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e1337c9..7a93c5e 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,18 @@ ], "license": "LicenseRef-LICENSE", "esy": { - "buildsInSource": true, "build": [ - "./configure --prefix #{self.target_dir}", + "echo host x86_64-w64-mingw32 can change in future", + "#{self.root}/configure --host=x86_64-w64-mingw32 --prefix #{self.install} --exec-prefix #{self.install} --bindir #{self.install}/bin --libdir #{self.install}/lib --with-ocamldir=#{self.install}/lib/ocaml --datarootdir #{self.install}/share --mandir #{self.install}/share/man", "make" ], - "install": "make install" + "install": "make install", + "exportedEnv": { + "PATH": { + "val": "#{self.bin : $PATH}", + "scope": "global" + } + } }, "dependencies": { "@opam/ocamlfind": "*", From e7e3d83a2e67f4d4463804418bf7e3eda35b28e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20BRAMI?= Date: Tue, 16 Jul 2019 17:28:33 +0200 Subject: [PATCH 6/6] add --host flag only on windows --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a93c5e..dc4b2fa 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "esy": { "build": [ "echo host x86_64-w64-mingw32 can change in future", - "#{self.root}/configure --host=x86_64-w64-mingw32 --prefix #{self.install} --exec-prefix #{self.install} --bindir #{self.install}/bin --libdir #{self.install}/lib --with-ocamldir=#{self.install}/lib/ocaml --datarootdir #{self.install}/share --mandir #{self.install}/share/man", + "#{self.root}/configure #{os == 'windows' ? '--host x86_64-w64-mingw32' : ''} --prefix #{self.install} --exec-prefix #{self.install} --bindir #{self.install}/bin --libdir #{self.install}/lib --with-ocamldir=#{self.install}/lib/ocaml --datarootdir #{self.install}/share --mandir #{self.install}/share/man", "make" ], "install": "make install",