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

Build and install ocamltoplevel.cmxa by default #10690

Merged
merged 3 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
MAKE_ARG=-j make distclean
- name: configure tree
run: |
MAKE_ARG=-j XARCH=x64 CONFIG_ARG='--enable-flambda --enable-cmm-invariants --enable-dependency-generation' OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh configure
MAKE_ARG=-j XARCH=x64 CONFIG_ARG='--enable-flambda --enable-cmm-invariants --enable-dependency-generation --enable-native-toplevel' OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh configure
- name: Build
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh build
Expand Down
7 changes: 7 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ Working version
- #10678: Expose descriptions in Warnings module
(Leo White, review by Gabriel Scherer and Alain Frisch)

- #10690: Always build ocamltoplevel.cmxa
(David Allsopp, review by Gabriel Scherer)

- #10692: Expose Parse.module_type and Parse.module_expr
(Guillaume Petiot, review by Gabriel Scherer)

Expand Down Expand Up @@ -278,6 +281,10 @@ Working version
rather than a basename.
(David Allsopp, report by Fabian @copy, review by Gabriel Scherer)

- #10690: Add --enable-native-toplevel to configure to enable installing
ocamlnat as part of the main build (default is not to install it)
(David Allsopp, review by Gabriel Scherer)

- #10693: Fix ident collision in includemod
(Leo White, review by Matthew Ryan)

Expand Down
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ endif
$(MAKE) ocamlopt.opt
$(MAKE) otherlibrariesopt
$(MAKE) ocamllex.opt ocamltoolsopt ocamltoolsopt.opt $(OCAMLDOC_OPT) \
$(OCAMLTEST_OPT)
$(OCAMLTEST_OPT) ocamlnat
ifeq "$(WITH_OCAMLDOC)-$(STDLIB_MANPAGES)" "ocamldoc-true"
$(MAKE) manpages
endif
Expand Down Expand Up @@ -566,6 +566,7 @@ ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true"
endif
$(INSTALL_DATA) \
utils/*.cmx parsing/*.cmx typing/*.cmx bytecomp/*.cmx \
toplevel/*.cmx toplevel/native/*.cmx \
file_formats/*.cmx \
lambda/*.cmx \
driver/*.cmx asmcomp/*.cmx middle_end/*.cmx \
Expand All @@ -579,15 +580,11 @@ endif
$(INSTALL_DATA) \
$(BYTESTART:.cmo=.cmx) $(BYTESTART:.cmo=.$(O)) \
$(OPTSTART:.cmo=.cmx) $(OPTSTART:.cmo=.$(O)) \
$(TOPLEVELSTART:.cmo=.$(O)) \
"$(INSTALL_COMPLIBDIR)"
if test -f ocamlnat$(EXE) ; then \
$(INSTALL_PROG) ocamlnat$(EXE) "$(INSTALL_BINDIR)"; \
$(INSTALL_DATA) \
toplevel/*.cmx \
toplevel/native/*.cmx \
$(TOPLEVELSTART:.cmo=.$(O)) \
"$(INSTALL_COMPLIBDIR)"; \
fi
ifeq "$(INSTALL_OCAMLNAT)" "true"
$(INSTALL_PROG) ocamlnat$(EXE) "$(INSTALL_BINDIR)"
endif
cd "$(INSTALL_COMPLIBDIR)" && \
$(RANLIB) ocamlcommon.$(A) ocamlbytecomp.$(A) ocamloptcomp.$(A)

Expand Down Expand Up @@ -1074,13 +1071,16 @@ endif

# The native toplevel

ocamlnat$(EXE): compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \
compilerlibs/ocamlbytecomp.cmxa \
otherlibs/dynlink/dynlink.cmxa \
compilerlibs/ocamltoplevel.cmxa \
$(TOPLEVELSTART:.cmo=.cmx)
$(CAMLOPT_CMD) $(LINKFLAGS) -linkall -I toplevel/native -o $@ $^
ocamlnat_dependencies := \
compilerlibs/ocamlcommon.cmxa \
compilerlibs/ocamloptcomp.cmxa \
compilerlibs/ocamlbytecomp.cmxa \
otherlibs/dynlink/dynlink.cmxa \
compilerlibs/ocamltoplevel.cmxa \
$(TOPLEVELSTART:.cmo=.cmx)

ocamlnat$(EXE): $(ocamlnat_dependencies)
$(CAMLOPT_CMD) $(LINKFLAGS) -linkall -I toplevel/native -o $@ $^

toplevel/topdirs.cmx: toplevel/topdirs.ml
$(CAMLOPT_CMD) $(COMPFLAGS) $(OPTCOMPFLAGS) -I toplevel/native -c $<
Expand Down
3 changes: 3 additions & 0 deletions Makefile.build_config.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ INSTALL ?= @INSTALL@
INSTALL_DATA ?= @INSTALL_DATA@
INSTALL_PROG ?= @INSTALL_PROGRAM@

# Whether to install the native toplevel (ocamlnat)
INSTALL_OCAMLNAT = @install_ocamlnat@

# The command to generate C dependency information
DEP_CC=@DEP_CC@ -MM
COMPUTE_DEPS=@compute_deps@
Expand Down
20 changes: 20 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ AC_SUBST([mkmaindll])
AC_SUBST([mksharedlibrpath])
AC_SUBST([install_bytecode_programs])
AC_SUBST([install_source_artifacts])
AC_SUBST([install_ocamlnat])
AC_SUBST([profinfo])
AC_SUBST([profinfo_width])
AC_SUBST([frame_pointers])
Expand Down Expand Up @@ -299,6 +300,10 @@ AC_ARG_ENABLE([ocamltest],
[AS_HELP_STRING([--disable-ocamltest],
[do not build the ocamltest driver])])

AC_ARG_ENABLE([native-toplevel],
[AS_HELP_STRING([--enable-native-toplevel],
[build the native toplevel])])

AC_ARG_ENABLE([frame-pointers],
[AS_HELP_STRING([--enable-frame-pointers],
[use frame pointers in runtime and generated code])])
Expand Down Expand Up @@ -1031,6 +1036,14 @@ AS_IF([test x"$supports_shared_libraries" = 'xtrue'],
[aarch64-*-freebsd*], [natdynlink=true],
[riscv*-*-linux*], [natdynlink=true])])

AS_CASE([$enable_native_toplevel,$natdynlink],
[yes,false],
[AC_MSG_ERROR(m4_normalize([
The native toplevel requires native dynlink support]))],
[yes,*],
[install_ocamlnat=true],
[install_ocamlnat=false])

# Try to work around the Skylake/Kaby Lake processor bug.
AS_CASE(["$cc_basename,$host"],
[*gcc*,x86_64-*|*gcc*,i686-*],
Expand Down
1 change: 0 additions & 1 deletion tools/ci/actions/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ EOF

Build () {
script --return --command "$MAKE_WARN world.opt" build.log
script --return --append --command "$MAKE_WARN ocamlnat" build.log
echo Ensuring that all names are prefixed in the runtime
./tools/check-symbol-names runtime/*.a
}
Expand Down