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: ### 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 - GPR#1777: add -no-install-source-artifacts and related configure options to
control installation of .cmt, .cmti, .mli and .ml files control installation of .cmt, .cmti, .mli and .ml files
(Mark Shinwell, review by Nicolas Ojeda Bar and Sébastien Hinderer) (Mark Shinwell, review by Nicolas Ojeda Bar and Sébastien Hinderer)

View File

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

View File

@ -153,6 +153,9 @@ RANLIBCMD=ranlib
# On Solaris: # On Solaris:
#ASPP=as -P #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 ### Extra flags to use for assembling .S files in profiling mode
#ASPPPROFFLAGS=-DPROFILING #ASPPPROFFLAGS=-DPROFILING

View File

@ -190,6 +190,9 @@ OCAMLOPT_CFLAGS=-O -mms-bitfields
### Build partially-linked object file ### Build partially-linked object file
PACKLD=$(TOOLPREF)ld -r -o # must have a space after '-o' 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 ############# Configuration for the contributed libraries
OTHERLIBRARIES=win32unix str win32graph dynlink bigarray systhreads OTHERLIBRARIES=win32unix str win32graph dynlink bigarray systhreads

View File

@ -190,6 +190,9 @@ OCAMLOPT_CFLAGS=-O -mms-bitfields
### Build partially-linked object file ### Build partially-linked object file
PACKLD=$(TOOLPREF)ld -r -o # must have a space after '-o' 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 ############# Configuration for the contributed libraries
OTHERLIBRARIES=win32unix str win32graph dynlink bigarray systhreads 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 ### Build partially-linked object file
PACKLD=link -lib -nologo -out:# there must be no space after this '-out:' 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 ### Clear this to disable compiling ocamldebug
WITH_DEBUGGER=ocamldebugger WITH_DEBUGGER=ocamldebugger

View File

@ -189,6 +189,9 @@ OCAMLOPT_CPPFLAGS=-D_CRT_SECURE_NO_DEPRECATE
### Build partially-linked object file ### Build partially-linked object file
PACKLD=link -lib -nologo -machine:AMD64 -out:# must have no space after '-out:' 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 ### Clear this to disable compiling ocamldebug
WITH_DEBUGGER=ocamldebugger WITH_DEBUGGER=ocamldebugger

10
configure vendored
View File

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

View File

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