summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2019-02-22 11:52:32 +0100
committerBjörn Gustavsson <bjorn@erlang.org>2019-10-21 15:02:28 +0200
commitc7372a889c186c6b60c54dfcb1a42b335abaa83d (patch)
tree8b59b98b5956601dd75a9a8d955eb755259c1182
parentb6a0d41e45cef776a40b39f38e77863897486836 (diff)
downloaderlang-c7372a889c186c6b60c54dfcb1a42b335abaa83d.tar.gz
otp_build: Add -t option for building a tiny system
Add the `-t` option to `otp_build` for building a tiny system. The tiny system can be used for updating the primary bootstrap or the preloaded modules in erts. On my computer, `./otp_build setup -t` finished the build of the tiny system in 1 min 50 seconds. The small build (`-s` option or no option) finished in 2 min 55 seconds.
-rw-r--r--Makefile.in54
-rw-r--r--lib/Makefile11
-rwxr-xr-xotp_build50
3 files changed, 89 insertions, 26 deletions
diff --git a/Makefile.in b/Makefile.in
index 12ae1d4a82..9c09ef18ed 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -377,10 +377,15 @@ endif
# With all bootstraps we mean all bootstrapping that is done when
# the system is delivered in open source, the primary
# bootstrap is not included, it requires a pre built emulator...
+ifeq ($(OTP_TINY_BUILD),true)
+all_bootstraps: build_erl_interface emulator bootstrap_setup \
+ tiny_secondary_bootstrap_build tiny_secondary_bootstrap_copy
+else
all_bootstraps: build_erl_interface emulator \
bootstrap_setup \
secondary_bootstrap_build secondary_bootstrap_copy \
tertiary_bootstrap_build tertiary_bootstrap_copy
+endif
.PHONY: build_erl_interface
@@ -494,11 +499,17 @@ ifeq ($(OTP_SMALL_BUILD),true)
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
$(MAKE) $(TYPE)
else
+ifeq ($(OTP_TINY_BUILD),true)
+ $(make_verbose)cd lib && \
+ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
+ $(MAKE) opt TINY_BUILD=true
+else
$(make_verbose)cd lib && \
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
$(MAKE) $(TYPE) BUILD_ALL=true
$(V_at)test -f $(ERL_TOP)/make/otp_built || echo "OTP built" > $(ERL_TOP)/make/otp_built
endif
+endif
APPS=$(patsubst $(ERL_TOP)/lib/%/doc,%,$(wildcard $(ERL_TOP)/lib/*/doc))
@@ -573,11 +584,54 @@ bootstrap_setup_target:
test $(TARGET) = `cat $(BOOTSTRAP_ROOT)/bootstrap/target`; } || \
echo $(TARGET) > $(BOOTSTRAP_ROOT)/bootstrap/target
+tiny_secondary_bootstrap_build:
+ $(make_verbose)cd lib && \
+ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
+ $(MAKE) opt SECONDARY_BOOTSTRAP=true TINY_BUILD=true
+
secondary_bootstrap_build:
$(make_verbose)cd lib && \
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
$(MAKE) opt SECONDARY_BOOTSTRAP=true
+tiny_secondary_bootstrap_copy:
+ $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; fi
+ $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; fi
+ $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; fi
+ $(V_at)for x in lib/parsetools/ebin/*.beam; do \
+ BN=`basename $$x`; \
+ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin/$$BN; \
+ test -f $$TF && \
+ test '!' -z "`find $$x -newer $$TF -print`" && \
+ cp $$x $$TF; \
+ test '!' -f $$TF && \
+ cp $$x $$TF; \
+ true; \
+ done
+ $(V_at)for x in lib/parsetools/include/*.hrl; do \
+ BN=`basename $$x`; \
+ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include/$$BN; \
+ test -f $$TF && \
+ test '!' -z "`find $$x -newer $$TF -print`" && \
+ cp $$x $$TF; \
+ test '!' -f $$TF && \
+ cp $$x $$TF; \
+ true; \
+ done
+ $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; fi
+ $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; fi
+ $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; fi
+ $(V_at)for x in lib/sasl/ebin/*.beam; do \
+ BN=`basename $$x`; \
+ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin/$$BN; \
+ test -f $$TF && \
+ test '!' -z "`find $$x -newer $$TF -print`" && \
+ cp $$x $$TF; \
+ test '!' -f $$TF && \
+ cp $$x $$TF; \
+ true; \
+ done
+
secondary_bootstrap_copy:
$(make_verbose)
$(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe ; fi
diff --git a/lib/Makefile b/lib/Makefile
index ea2827bef0..a59532eed7 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -25,7 +25,11 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
ERTS_APPLICATIONS = stdlib sasl kernel compiler
# Then these have to be build
+ifdef TINY_BUILD
+ERLANG_APPLICATIONS = parsetools
+else
ERLANG_APPLICATIONS = tools common_test runtime_tools inets parsetools
+endif
# These are only build if -a is given to otp_build or make is used directly
ALL_ERLANG_APPLICATIONS = xmerl edoc erl_docgen snmp erl_interface \
@@ -36,6 +40,7 @@ ALL_ERLANG_APPLICATIONS = xmerl edoc erl_docgen snmp erl_interface \
et megaco \
eunit ssh eldap dialyzer hipe ftp tftp
+
ifdef BUILD_ALL
ERLANG_APPLICATIONS += $(ALL_ERLANG_APPLICATIONS)
@@ -55,7 +60,11 @@ else
kernel stdlib compiler
else
ifdef SECONDARY_BOOTSTRAP
- SUB_DIRECTORIES = hipe parsetools asn1/src
+ ifdef TINY_BUILD
+ SUB_DIRECTORIES = parsetools sasl
+ else
+ SUB_DIRECTORIES = hipe parsetools asn1/src
+ endif
else
ifdef TERTIARY_BOOTSTRAP
SUB_DIRECTORIES = snmp sasl erl_interface jinterface syntax_tools wx
diff --git a/otp_build b/otp_build
index 3dfe24a299..244f0c3e25 100755
--- a/otp_build
+++ b/otp_build
@@ -39,17 +39,20 @@ DONT_QUOTE="A-Za-z0-9~/=_+-"
# Utility functions
usage ()
{
- echo "Available options (-a switch select all applications):"
- echo " setup [-a] [<configure parameters>] - does autoconf, configure and boot."
- echo " all [-a] <dir> - does autoconf, configure, boot, release"
+ echo "Available commands:"
+ echo " setup [-a|-s|-t] [<configure parameters>] - does autoconf, configure and boot"
+ echo " all [-a|-s|-t] <dir> - does autoconf, configure, boot, release"
echo " autoconf - (re)build the configure scripts"
echo " configure [<configure parameters>] - does the actual configuration"
- echo " boot [-a] - bootstraps and builds the system (after configure)"
+ echo " boot [-a|-s|-t] - bootstraps and builds the system (after configure)"
echo " release <target_dir> - creates a small release to <target_dir>"
- echo " release [-a] <target_dir> - creates full release to <target_dir>"
- echo " smp [-a] - build an Erlang system, smp flavor only"
+ echo " release [-a|-s|-t] <target_dir> - creates full release to <target_dir>"
echo " tests <dir> - Build testsuites to <dir>"
echo ""
+ echo "-a builds all applications"
+ echo "-s builds a small system (default)"
+ echo "-t builds a tiny system"
+ echo ""
echo "These are for cleaning up an open source distribution"
echo "with prebuilt files, so that it resembles the clean developers"
echo "codebase:"
@@ -79,16 +82,7 @@ usage ()
none)
;;
git)
- echo ""
echo "update_primary [--no-commit] - build and maybe commit a new primary bootstrap"
- ;;
- esac
-
- case $version_controller in
- none)
- ;;
- git)
- echo ""
echo "update_preloaded [--no-commit] - build and maybe commit the preloaded modules"
;;
esac
@@ -1172,13 +1166,19 @@ if [ X"$1" = X"" ]; then
fi
if [ X"$2" = X"-a" ]; then
- minus_a_flag=true
+ minus_x_flag=true
OTP_SMALL_BUILD=
+elif [ X"$2" = X"-s" ]; then
+ minus_x_flag=true
+ OTP_SMALL_BUILD=true
+elif [ X"$2" = X"-t" ]; then
+ minus_x_flag=true
+ OTP_TINY_BUILD=true
else
+ minus_x_flag=false
OTP_SMALL_BUILD=true
- minus_a_flag=false
fi
-export OTP_SMALL_BUILD
+export OTP_SMALL_BUILD OTP_TINY_BUILD
TYPE=
case "$1" in
@@ -1186,13 +1186,13 @@ case "$1" in
do_autoconf;
do_configure;
do_boot;
- if [ $minus_a_flag = true ]; then
+ if [ $minus_x_flag = true ]; then
shift
fi;
do_release "$2";;
setup)
shift;
- if [ $minus_a_flag = true ]; then
+ if [ $minus_x_flag = true ]; then
shift
fi;
do_autoconf;
@@ -1206,7 +1206,7 @@ case "$1" in
opt)
do_boot;;
plain|smp)
- if [ $minus_a_flag = false ]; then
+ if [ $minus_x_flag = false ]; then
TYPE=opt
fi;
FLAVOR=$1
@@ -1230,12 +1230,12 @@ case "$1" in
emulator)
do_boot_emu;;
release)
- if [ $minus_a_flag = true ]; then
+ if [ $minus_x_flag = true ]; then
shift
fi;
do_release "$2";;
tests)
- if [ $minus_a_flag = true ]; then
+ if [ $minus_x_flag = true ]; then
shift
fi;
do_tests "$2";;
@@ -1246,12 +1246,12 @@ case "$1" in
copy_primary_bootstrap)
do_copy_primary_bootstrap $2 $3;;
installer_win32)
- if [ $minus_a_flag = true ]; then
+ if [ $minus_x_flag = true ]; then
shift
fi;
do_installer_win32 "$2";;
debuginfo_win32)
- if [ $minus_a_flag = true ]; then
+ if [ $minus_x_flag = true ]; then
shift
fi;
do_debuginfo_win32 "$2";;