Add configure option to not install ".byte" executables (#1776)

In environments where the executables compiled to native code,
such as ocamlopt.opt, are always used in preference to the bytecode
versions then space can be saved by not installing the latter.
This patch provides a configure option to do such. It is relatively lightly
engineered; in particular, it won't complain if the native code executables
aren't themselves being built; but given this is an option for knowledgeable
users we think that it is reasonable.
master
Mark Shinwell 2018-05-14 09:44:01 +01:00 committed by Gabriel Scherer
parent 83b0ee1b62
commit 8054e4f819
9 changed files with 53 additions and 1 deletions

View File

@ -45,6 +45,10 @@ Working version
### Compiler distribution build system:
- GPR#1776: add -no-install-bytecode-programs and related configure options to
control (non-)installation of ".byte" executables
(Mark Shinwell, review by Sébastien Hinderer and Gabriel Scherer)
- GPR#1777: add -no-install-source-artifacts and related configure options to
control installation of .cmt, .cmti, .mli and .ml files
(Mark Shinwell, review by Nicolas Ojeda Bar and Sébastien Hinderer)

View File

@ -606,9 +606,13 @@ install:
"$(INSTALL_LIBDIR)"
$(MAKE) -C byterun install
$(INSTALL_PROG) ocaml "$(INSTALL_BINDIR)/ocaml$(EXE)"
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
$(INSTALL_PROG) ocamlc "$(INSTALL_BINDIR)/ocamlc.byte$(EXE)"
endif
$(MAKE) -C stdlib install
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
$(INSTALL_PROG) lex/ocamllex "$(INSTALL_BINDIR)/ocamllex.byte$(EXE)"
endif
$(INSTALL_PROG) yacc/ocamlyacc$(EXE) "$(INSTALL_BINDIR)/ocamlyacc$(EXE)"
$(INSTALL_DATA) \
utils/*.cmi \
@ -666,17 +670,23 @@ ifeq "$(UNIX_OR_WIN32)" "win32"
fi
endif
$(INSTALL_DATA) config/Makefile "$(INSTALL_LIBDIR)/Makefile.config"
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
if test -f ocamlopt; then $(MAKE) installopt; else \
cd "$(INSTALL_BINDIR)"; \
$(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
$(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
fi
else
if test -f ocamlopt; then $(MAKE) installopt; fi
endif
# Installation of the native-code compiler
.PHONY: installopt
installopt:
$(MAKE) -C asmrun install
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
$(INSTALL_PROG) ocamlopt "$(INSTALL_BINDIR)/ocamlopt.byte$(EXE)"
endif
$(MAKE) -C stdlib installopt
$(INSTALL_DATA) \
middle_end/*.cmi \
@ -710,12 +720,16 @@ endif
for i in $(OTHERLIBRARIES); do \
$(MAKE) -C otherlibs/$$i installopt || exit $$?; \
done
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
if test -f ocamlopt.opt ; then $(MAKE) installoptopt; else \
cd "$(INSTALL_BINDIR)"; \
$(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
$(LN) ocamlopt.byte$(EXE) ocamlopt$(EXE); \
$(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
fi
else
if test -f ocamlopt.opt ; then $(MAKE) installoptopt; fi
endif
$(MAKE) -C tools installopt
if test -f ocamlopt.opt -a -f flexdll/flexlink.opt ; then \
$(INSTALL_PROG) \

View File

@ -153,6 +153,9 @@ RANLIBCMD=ranlib
# On Solaris:
#ASPP=as -P
### Set to "true" to install ".byte" executables (ocamlc.byte, etc.)
#INSTALL_BYTECODE_PROGRAMS=true
### Extra flags to use for assembling .S files in profiling mode
#ASPPPROFFLAGS=-DPROFILING

View File

@ -190,6 +190,9 @@ OCAMLOPT_CFLAGS=-O -mms-bitfields
### Build partially-linked object file
PACKLD=$(TOOLPREF)ld -r -o # must have a space after '-o'
### Set to "true" to install ".byte" executables (ocamlc.byte, etc.)
INSTALL_BYTECODE_PROGRAMS=true
############# Configuration for the contributed libraries
OTHERLIBRARIES=win32unix str win32graph dynlink bigarray systhreads

View File

@ -190,6 +190,9 @@ OCAMLOPT_CFLAGS=-O -mms-bitfields
### Build partially-linked object file
PACKLD=$(TOOLPREF)ld -r -o # must have a space after '-o'
### Set to "true" to install ".byte" executables (ocamlc.byte, etc.)
INSTALL_BYTECODE_PROGRAMS=true
############# Configuration for the contributed libraries
OTHERLIBRARIES=win32unix str win32graph dynlink bigarray systhreads

View File

@ -186,6 +186,9 @@ OCAMLOPT_CPPFLAGS=-D_CRT_SECURE_NO_DEPRECATE
### Build partially-linked object file
PACKLD=link -lib -nologo -out:# there must be no space after this '-out:'
### Set to "true" to install ".byte" executables (ocamlc.byte, etc.)
INSTALL_BYTECODE_PROGRAMS=true
### Clear this to disable compiling ocamldebug
WITH_DEBUGGER=ocamldebugger

View File

@ -189,6 +189,9 @@ OCAMLOPT_CPPFLAGS=-D_CRT_SECURE_NO_DEPRECATE
### Build partially-linked object file
PACKLD=link -lib -nologo -machine:AMD64 -out:# must have no space after '-out:'
### Set to "true" to install ".byte" executables (ocamlc.byte, etc.)
INSTALL_BYTECODE_PROGRAMS=true
### Clear this to disable compiling ocamldebug
WITH_DEBUGGER=ocamldebugger

10
configure vendored
View File

@ -59,6 +59,7 @@ no_naked_pointers=false
native_compiler=true
TOOLPREF=""
with_cfi=true
install_bytecode_programs=true
install_source_artifacts=true
flambda=false
force_safe_string=false
@ -214,6 +215,10 @@ while : ; do
install_source_artifacts=false;;
-no-native-compiler|--no-native-compiler)
native_compiler=false;;
-install-bytecode-programs|--install-bytecode-programs)
install_bytecode_programs=true;;
-no-install-bytecode-programs|--no-install-bytecode-programs)
install_bytecode_programs=false;;
-flambda|--flambda)
flambda=true;;
-with-flambda-invariants|--with-flambda-invariants)
@ -2055,6 +2060,7 @@ if $flat_float_array; then
echo "#define FLAT_FLOAT_ARRAY" >> m.h
fi
echo "INSTALL_BYTECODE_PROGRAMS=$install_bytecode_programs" >> Makefile
echo "INSTALL_SOURCE_ARTIFACTS=$install_source_artifacts" >> Makefile
# Finish generated files
@ -2306,6 +2312,10 @@ if $with_instrumented_runtime; then
inf "Instrumented runtime will be compiled and installed"
fi
if ! $install_bytecode_programs; then
inf "Bytecode programs will not be installed"
fi
if ! $install_source_artifacts; then
inf ".cmt, .cmti, .ml and .mli files will not be installed"
fi

View File

@ -236,9 +236,10 @@ LN := cp -pf
endif
install::
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
for i in $(install_files); \
do \
$(INSTALL_PROG) "$$i" "$(INSTALL_BINDIR)/$$i.byte$(EXE)" && \
$(INSTALL_PROG) "$$i" "$(INSTALL_BINDIR)/$$i.byte$(EXE)"; \
if test -f "$$i".opt; then \
$(INSTALL_PROG) "$$i.opt" "$(INSTALL_BINDIR)/$$i.opt$(EXE)" && \
(cd "$(INSTALL_BINDIR)/" && $(LN) "$$i.opt$(EXE)" "$$i$(EXE)"); \
@ -246,6 +247,14 @@ install::
(cd "$(INSTALL_BINDIR)/" && $(LN) "$$i.byte$(EXE)" "$$i$(EXE)"); \
fi; \
done
else
for i in $(install_files); \
do \
if test -f "$$i".opt; then \
$(INSTALL_PROG) "$$i.opt" "$(INSTALL_BINDIR)/$$i.opt$(EXE)"; \
fi; \
done
endif
clean::
rm -f addlabels