ocamlPackages.ocamlscript: 2.0.3 → 3.0.0

This commit is contained in:
Vincent Laporte 2022-03-15 08:12:41 +01:00 committed by Vincent Laporte
parent 56251d43f8
commit 5dbd4b2b27
2 changed files with 52 additions and 49 deletions

View File

@ -1,42 +1,23 @@
--- a/Makefile 2012-02-04 01:24:21.000000000 +0000 diff --git a/Makefile b/Makefile
+++ b/Makefile 2014-10-29 14:42:08.690188302 +0000 index 894e94d..9adc44b 100644
@@ -4,6 +4,8 @@ --- a/Makefile
version.ml pipeline.mli pipeline.ml common.mli common.ml \ +++ b/Makefile
utils.mli utils.ml ocaml.mli ocaml.ml @@ -17,7 +17,7 @@ ifndef BINDIR
+CAMLP4 := $(shell ocamlfind query camlp4)
+
STDBIN = $(shell dirname `which ocamlfind`)
ifndef PREFIX
PREFIX = $(shell dirname $(STDBIN))
@@ -15,7 +17,7 @@
endif endif
export BINDIR export BINDIR
-PACKS = unix str -PACKS = unix str
+PACKS = unix str findlib +PACKS = unix str findlib
PP = camlp4o -I . -parser pa_tryfinally.cmo -parser pa_opt.cmo # PP = camlp4o -I . -parser pa_opt.cmo
export PP # export PP
@@ -36,11 +38,11 @@ diff --git a/main.ml b/main.ml
index 288526a..b67c5e9 100644
common: version.ml --- a/main.ml
ocamlc -pp 'camlp4orf -loc _loc' -c \ +++ b/main.ml
- -I +camlp4 pa_opt310.ml && \ @@ -247,6 +247,11 @@ let write_header ~pos ~source ~source_option ~verbose ~prog_file lines =
+ -I $(CAMLP4) pa_opt310.ml && \ Sys.getcwd ())
cp pa_opt310.cmo pa_opt.cmo && \ | `File script_name -> "", get_dir script_name in
cp pa_opt310.cmi pa_opt.cmi
ocamlc -pp 'camlp4orf -loc _loc' -c \
- -I +camlp4 pa_tryfinally310.ml && \
+ -I $(CAMLP4) pa_tryfinally310.ml && \
cp pa_tryfinally310.cmo pa_tryfinally.cmo && \
cp pa_tryfinally310.cmi pa_tryfinally.cmi
--- a/main.ml 2014-11-08 09:05:12.516401313 +0000
+++ b/main.ml 2014-11-08 09:09:59.801311230 +0000
@@ -250,9 +250,15 @@
Sys.getcwd ())
| `File script_name -> "", get_dir script_name in
+ let findlibdir = + let findlibdir =
+ Filename.( + Filename.(
@ -46,20 +27,24 @@
let file, oc = Filename.open_temp_file "meta" ".ml" in let file, oc = Filename.open_temp_file "meta" ".ml" in
fprintf oc "\ fprintf oc "\
#%i %S;; #%i %S;;
@@ -255,6 +260,7 @@ let () =
try Topdirs.dir_directory (Sys.getenv \"OCAML_TOPLEVEL_PATH\")
with Not_found -> ()
;;
+#directory \"%s\";; +#directory \"%s\";;
#use \"topfind\";; #use \"topfind\";;
#require \"ocamlscript\";; #require \"ocamlscript\";;
Ocamlscript.Common.verbose := %s;; Ocamlscript.Common.verbose := %s;;
@@ -261,7 +267,7 @@ @@ -263,7 +269,7 @@ Ocamlscript.Common.script_dir := %S;;
open Ocamlscript;; open Ocamlscript;;
open Utils;; open Utils;;
#%i %S;;\n" #%i %S;;\n"
- pos source verbose script_dir extra_args trash pos source; - pos source verbose script_dir extra_args trash pos source;
+ pos source findlibdir verbose script_dir extra_args trash pos source; + pos source findlibdir verbose script_dir extra_args trash pos source;
List.iter (output_line oc) lines; List.iter (output_line oc) lines;
@@ -544,6 +550,7 @@ @@ -550,6 +556,7 @@ let main () =
exit compilation_status exit compilation_status
let _ = let _ =
@ -67,4 +52,16 @@
try main () try main ()
with Failure s -> with Failure s ->
eprintf "ocamlscript: %s\n%!" s; eprintf "ocamlscript: %s\n%!" s;
diff --git a/ocaml.ml b/ocaml.ml
index a1824c6..b8f287e 100644
--- a/ocaml.ml
+++ b/ocaml.ml
@@ -14,7 +14,7 @@ let ocamlfind = ref "ocamlfind"
let packs = ref [] (* findlib packages *)
let sources = ref [] (* extra sources *)
let use_ocamllex = ref false (* preprocess with ocamllex before camlp4 *)
-let use_camlp4 = ref true (* by default camlp4 is used *)
+let use_camlp4 = ref false (* by default camlp4 is not used *)
let use_ocamlc = ref false (* by default we want native code *)
let use_ocamlfind = ref false (* used only if necessary *)
let revised = ref false (* use this to use the revised syntax *)

View File

@ -1,26 +1,32 @@
{lib, stdenv, fetchurl, ocaml, findlib, camlp4}: { lib, stdenv, fetchFromGitHub, ocaml, findlib }:
lib.throwIfNot (lib.versionAtLeast ocaml.version "4.08")
"ocamlscript is not available for OCaml ${ocaml.version}"
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "ocamlscript"; pname = "ocaml${ocaml.version}-ocamlscript";
version = "2.0.3"; version = "3.0.0";
src = fetchurl { src = fetchFromGitHub {
url = "https://mjambon.com/releases/${pname}/${pname}-${version}.tar.gz"; owner = "mjambon";
sha256 = "1v1i24gijxwris8w4hi95r9swld6dm7jbry0zp72767a3g5ivlrd"; repo = "ocamlscript";
rev = "v${version}";
sha256 = "sha256:10xz8jknlmcgnf233nahd04q98ijnxpijhpvb8hl7sv94dgkvpql";
}; };
propagatedBuildInputs = [ ocaml findlib camlp4 ]; propagatedBuildInputs = [ ocaml findlib ];
patches = [ ./Makefile.patch ]; patches = [ ./Makefile.patch ];
buildFlags = [ "PREFIX=$(out)" ]; buildFlags = [ "PREFIX=$(out)" ];
installFlags = [ "PREFIX=$(out)" ]; installFlags = [ "PREFIX=$(out)" ];
preInstall = "mkdir $out/bin"; preInstall = "mkdir -p $out/bin";
createFindlibDestdir = true; createFindlibDestdir = true;
meta = with lib; { meta = with lib; {
homepage = "http://martin.jambon.free.fr/ocamlscript.html"; inherit (src.meta) homepage;
license = licenses.boost; license = licenses.boost;
platforms = ocaml.meta.platforms or []; inherit (ocaml.meta) platforms;
description = "Natively-compiled OCaml scripts"; description = "Natively-compiled OCaml scripts";
maintainers = [ maintainers.vbgl ]; maintainers = [ maintainers.vbgl ];
}; };