Skip to content

Commit

Permalink
Add --enable-native-toplevel
Browse files Browse the repository at this point in the history
When configured with --enable-native-toplevel, ocamlnat is linked and
installed as part of the build. This is enabled for the main CI job only
- all the others will continue to build the native toplevel library as
part of the previous commit.
  • Loading branch information
dra27 committed Oct 11, 2021
1 parent a598018 commit ad125ba
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 5 deletions.
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
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,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 building and
installing ocamlnat as part of the main build (default is not to)
(David Allsopp, review by ???)

OCaml 4.13 maintenance branch
-----------------------------

Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ endif
$(MAKE) otherlibrariesopt
$(MAKE) ocamllex.opt ocamltoolsopt ocamltoolsopt.opt $(OCAMLDOC_OPT) \
$(OCAMLTEST_OPT) $(ocamlnat_dependencies)
ifeq "$(INSTALL_OCAMLNAT)" "true"
$(MAKE) ocamlnat
endif
ifeq "$(WITH_OCAMLDOC)-$(STDLIB_MANPAGES)" "ocamldoc-true"
$(MAKE) manpages
endif
Expand Down Expand Up @@ -582,9 +585,9 @@ endif
$(OPTSTART:.cmo=.cmx) $(OPTSTART:.cmo=.$(O)) \
$(TOPLEVELSTART:.cmo=.$(O)) \
"$(INSTALL_COMPLIBDIR)"
if test -f ocamlnat$(EXE) ; then \
$(INSTALL_PROG) ocamlnat$(EXE) "$(INSTALL_BINDIR)"; \
fi
ifeq "$(INSTALL_OCAMLNAT)" "true"
$(INSTALL_PROG) ocamlnat$(EXE) "$(INSTALL_BINDIR)"
endif
cd "$(INSTALL_COMPLIBDIR)" && \
$(RANLIB) ocamlcommon.$(A) ocamlbytecomp.$(A) ocamloptcomp.$(A)

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 @@ -151,6 +151,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 @@ -279,6 +280,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 @@ -1011,6 +1016,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([
Native toplevel cannot be built without native dynlink]))],
[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

0 comments on commit ad125ba

Please sign in to comment.