Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float_u stdlib module #1572

Merged
merged 5 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix build system for Float_u stdlib module
  • Loading branch information
ccasin committed Jul 26, 2023
commit 77cd93c7687cf60cf142b9709ceaf3b6006b956f
9 changes: 8 additions & 1 deletion ocaml/Makefile.common-jst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ dune_config_targets = \
duneconf/main.ws \
$(ocamldir)/duneconf/dirs-to-ignore.inc \
$(ocamldir)/duneconf/jst-extra.inc \
dune-project
dune-project \
$(ocamldir)/stdlib/ocaml_compiler_internal_params

_build/_bootinstall: Makefile.config $(dune_config_targets)
echo -n '$(NATDYNLINKOPTS)' > $(ocamldir)/otherlibs/dynlink/natdynlinkops
Expand Down Expand Up @@ -172,6 +173,12 @@ _install: compiler
install: _install
mkdir -p '$(prefix)'
rsync --chmod=u+rw,go+r -rl _install/ '$(prefix)'
rm '$(prefix)/lib/ocaml/ocaml_compiler_internal_params'
ccasin marked this conversation as resolved.
Show resolved Hide resolved
# rm `ocaml_compiler_internal_params`, which is used to compile the
# stdlib `Float_u` module with `-extension layouts_alpha`, because we
# don't want user programs that happened to be named
# `ocaml/stdlib/float_u.ml` to get the flag automatically.


# Same as above, but relies on a successfull earlier _install
install_for_opam:
Expand Down
2 changes: 1 addition & 1 deletion ocaml/driver/compenv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ type file_option = {
}

let scan_line ic =
Scanf.bscanf ic "%[0-9a-zA-Z_.*] : %[a-zA-Z_-] = %s "
Scanf.bscanf ic "%[0-9a-zA-Z/_.*] : %[a-zA-Z_-] = %s "
(fun pattern name value ->
let pattern =
match pattern with
Expand Down
2 changes: 2 additions & 0 deletions ocaml/ocamldoc/odoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

module M = Odoc_messages

let () = Language_extension.enable_maximal ()

(* we check if we must load a module given on the command line *)
let arg_list = Array.to_list Sys.argv
let (plugins, paths) =
Expand Down
10 changes: 10 additions & 0 deletions ocaml/stdlib/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,16 @@ stdlib__Float.cmx : float.ml \
stdlib__Float.cmi : float.mli \
stdlib.cmi \
stdlib__Seq.cmi
stdlib__Float_u.cmo : float_u.ml \
stdlib.cmi \
stdlib__Float.cmi \
stdlib__Float_u.cmi
stdlib__Float_u.cmx : float_u.ml \
stdlib.cmx \
stdlib__Float.cmx \
stdlib__Float_u.cmi
stdlib__Float_u.cmi : float_u.mli \
stdlib.cmi
stdlib__Format.cmo : format.ml \
stdlib__String.cmi \
stdlib.cmi \
Expand Down
23 changes: 23 additions & 0 deletions ocaml/stdlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,29 @@ stdlib.cmx: stdlib.ml
-pp "$(AWK) -f ./expand_module_aliases.awk" -c $<


# special cases to add the extension flag when compiling float_u
# CR layouts: eventually these can be just [-extension layouts]
stdlib__Float_u.cmi:
$(CAMLC) $(COMPFLAGS) -extension layouts_alpha \
-o $@ -c $(filter %.mli, $^)

stdlib__Float_u.cmo:
$(CAMLC) $(COMPFLAGS) -extension layouts_alpha \
-o $@ -c $(filter %.ml, $^)

stdlib__Float_u.cmx:
$(CAMLOPT) $(COMPFLAGS) $(OPTCOMPFLAGS) -extension layouts_alpha \
-o $@ -c $(filter %.ml, $^)

float_u.cmi: %.mli
$(CAMLC) $(COMPFLAGS) -extension layouts_alpha -c $<

float_u.cmo: %.ml
$(CAMLC) $(COMPFLAGS) -extension layouts_alpha -c $<

float_u.cmx: %.ml
$(CAMLOPT) $(COMPFLAGS) $(OPTCOMPFLAGS) -extension layouts_alpha -c $<

%.cmi: %.mli
$(CAMLC) $(COMPFLAGS) -c $<

Expand Down
2 changes: 1 addition & 1 deletion ocaml/stdlib/StdlibModules
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ STDLIB_MODULE_BASENAMES = \
stdlib pervasives either \
sys obj camlinternalLazy lazy \
seq option result bool char uchar \
list int bytes string unit marshal array iarray float int32 int64 nativeint \
list int bytes string unit marshal array iarray float float_u int32 int64 nativeint \
lexing parsing set map stack queue stream buffer \
camlinternalFormat printf arg atomic \
printexc fun gc digest random hashtbl weak \
Expand Down
7 changes: 7 additions & 0 deletions ocaml/stdlib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
(install
(files
Makefile.config
ocaml_compiler_internal_params

camlheader
camlheaderd
Expand Down Expand Up @@ -104,6 +105,8 @@
filename.mli
float.ml
float.mli
float_u.ml
float_u.mli
format.ml
format.mli
fun.ml
Expand Down Expand Up @@ -240,6 +243,9 @@
.stdlib.objs/byte/stdlib__Float.cmi
.stdlib.objs/byte/stdlib__Float.cmt
.stdlib.objs/byte/stdlib__Float.cmti
.stdlib.objs/byte/stdlib__Float_u.cmi
.stdlib.objs/byte/stdlib__Float_u.cmt
.stdlib.objs/byte/stdlib__Float_u.cmti
.stdlib.objs/byte/stdlib__Format.cmi
.stdlib.objs/byte/stdlib__Format.cmt
.stdlib.objs/byte/stdlib__Format.cmti
Expand Down Expand Up @@ -413,6 +419,7 @@
.stdlib.objs/native/stdlib__StdLabels.cmx
.stdlib.objs/native/stdlib__Weak.cmx
.stdlib.objs/native/stdlib__Float.cmx
.stdlib.objs/native/stdlib__Float_u.cmx
.stdlib.objs/native/stdlib__Pervasives.cmx
.stdlib.objs/native/stdlib__Fun.cmx
.stdlib.objs/native/stdlib__Bigarray.cmx
Expand Down
2 changes: 2 additions & 0 deletions ocaml/stdlib/ocaml_compiler_internal_params
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ocaml/stdlib/float_u.mli : extension = layouts_alpha
ocaml/stdlib/float_u.ml : extension = layouts_alpha