Skip to content

Commit

Permalink
OTP-8323 Cross compilation improvements and other build system
Browse files Browse the repository at this point in the history
          improvements.

          Most notable:

          Lots of cross compilation improvements. The old cross compilation
          support was more or less non-existing as well as broken. Please,
          note that the cross compilation support should still be
          considered as experimental. Also note that old cross compilation
          configurations cannot be used without modifications. For more
          information on cross compiling Erlang/OTP see the
          $ERL_TOP/xcomp/README file.

          Support for staged install using <url
          href="http://www.gnu.org/prep/standards/html_node/DESTDIR.html">D
          ESTDIR</url>. The old broken INSTALL_PREFIX has also been fixed.
          For more information see the $ERL_TOP/README file.

          Documentation of the release target of the top Makefile. For more
          information see the $ERL_TOP/README file.

          make install now by default creates relative symbolic links
          instead of absolute ones. For more information see the
          $ERL_TOP/README file.

          $ERL_TOP/configure --help=recursive now works and prints help for
          all applications with configure scripts.

          Doing make install, or make release directly after make all no
          longer triggers miscellaneous rebuilds.

          Existing bootstrap system is now used when doing make install, or
          make release without a preceding make all.

          The crypto and ssl applications use the same runtime library path
          when dynamically linking against libssl.so and libcrypto.so. The
          runtime library search path has also been extended.

          The configure scripts of erl_interface and odbc now search for
          thread libraries and thread library quirks the same way as erts
          do.

          The configure script of the odbc application now also looks for
          odbc libraries in lib64 and lib/64 directories when building on a
          64-bit system.

          The config.h.in file in the erl_interface application is now
          automatically generated in instead of statically updated which
          reduces the risk of configure tests without any effect.
  • Loading branch information
rickard-green authored and Erlang/OTP committed Feb 3, 2010
1 parent 639e0b2 commit 1b78e85
Show file tree
Hide file tree
Showing 47 changed files with 4,979 additions and 2,310 deletions.
291 changes: 245 additions & 46 deletions Makefile.in

Large diffs are not rendered by default.

86 changes: 82 additions & 4 deletions README
Expand Up @@ -13,7 +13,7 @@ The source code for Erlang/OTP can also be found in a Git repository:

%CopyrightBegin%

Copyright Ericsson AB 1998-2009. All Rights Reserved.
Copyright Ericsson AB 1998-2010. All Rights Reserved.

The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
Expand Down Expand Up @@ -221,9 +221,87 @@ Step 5 builds the Erlang/OTP system. On a fast computer, this will take about
Erlang/OTP system which you can try by typing "bin/erl". This should start
up Erlang/OTP and give you a prompt.

Step 6 is optional. It installs Erlang/OTP (if you change your
mind about where you wish to install you can rerun step 4, without
having to do step 5 again).
Step 6 is optional. It installs Erlang/OTP at a standardized location (if you
change your mind about where you wish to install you can rerun step 4,
without having to do step 5 again).

Alternative installation procedures:
* Staged install using DESTDIR. You can perform the install phase in a
temporary directory and later move the installation into its correct location
by use of the DESTDIR variable: 'make DESTDIR=<tmp install dir> install'
The installation will be created in a location prefixed by $DESTDIR. It
can, however, not be run from there. It needs to be moved into the correct
location before it can be run. If DESTDIR have not been set but INSTALL_PREFIX
has been set, DESTDIR will be set to INSTALL_PREFIX. Note that INSTALL_PREFIX
in pre R13B04 was buggy and behaved as EXTRA_PREFIX (see below). There are
lots of areas of use for an installation procedure using DESTDIR, e.g. when
creating a package, cross compiling, etc. Here is an example where the
installation should be located under /opt/local:
$ ./configure --prefix=/opt/local
$ make
$ mkdir /tmp/erlang-build
$ make DESTDIR=/tmp/erlang-build install
$ cd /tmp/erlang-build/opt/local
$ # gnu-tar is used in this example
$ tar -zcf /home/me/my-erlang-build.tgz *
$ su -
Password: *****
$ cd /opt/local
$ tar -zxf /home/me/my-erlang-build.tgz
* Test install using EXTRA_PREFIX. Note that EXTRA_PREFIX is similar to
DESTDIR, but it does not have the same effect as DESTDIR. The EXTRA_PREFIX
variable will prefix all installation paths, and the installation can and
have to be run from there. That is, it can be useful if you want to try the
system out, running test suites, etc, before doing the real install without
EXTRA_PREFIX.
* Install using the `release' target. Instead of doing `make install' you can
creat the installation in whatever directory you like using the `release'
target and run the `Install' script yourself. RELEASE_ROOT is used for
specifying the directory where the installation should be created. This is
what by default ends up under `/usr/local/lib/erlang' if you do the install
using `make install'. All installation paths provided in the `configure'
phase are ignored, as well as DESTDIR, and INSTALL_PREFIX. If you want links
from a specific `bin' directory to the installation you have to set those up
yourself. An example where Erlang/OTP should be located at /home/me/OTP:
$ ./configure
$ make
$ make RELEASE_ROOT=/home/me/OTP release
$ cd /home/me/OTP
$ ./Install -minimal /home/me/OTP
$ mkdir -p /home/me/bin
$ cd /home/me/bin
$ ln -s /home/me/OTP/bin/erl erl
$ ln -s /home/me/OTP/bin/erlc erlc
$ ln -s /home/me/OTP/bin/escript escript
...
The `Install' script should currently be invoked as follows in the
directory where it resides:
`./Install [-cross] [-minimal|-sasl] <ERL_ROOT>'
where:
-minimal - Creates an installation that starts up a minimal amount
of applications, i.e., only kernel and stdlib are started.
The minimal system is normally enough.
-sasl - Creates an installation that also starts up the sasl
application.
-cross - For cross compilation. Informs the install script that it
is run on the build machine.
<ERL_ROOT> - The absolute path to the Erlang installation to use at run
time. This is often the same as the current working
directory, but does not have to be. It can follow any other
path through the file system to the same directory.

If neither -minimal, nor -sasl is passed as argument you will be prompted.

When doing `make install' and the default installation prefix is used, relative
symbolic links will be created from /usr/local/bin to all public executables in
the Erlang installation. The installation phase will try to create relative
symbolic links as long as `--bindir' and the Erlang bin directory, located under
`--libdir', both have `--exec-prefix' as prefix. Where `--exec-prefix'
defaults to `--prefix'. `--prefix', `--exec-prefix', `--bindir', and `--libdir'
are all arguments that can be passed to `configure'. One can however force
relative, or absolute links by passing BINDIR_SYMLINKS=relative|absolute
as arguments to make during the install phase. Note that such a request might
cause a failure if the request cannot be satisfied.

The source tree is delivered with a lot of platform independent
build results already pre-built. If you want to remove these pre-built
Expand Down
3 changes: 3 additions & 0 deletions TAR.include
Expand Up @@ -4,12 +4,15 @@ Makefile.in
README
README.win32
configure.in
aclocal.m4
otp_build
lib/Makefile
lib/configure
lib/configure.in
lib/configure.in.src
prebuild.skip
prebuild.delete
erl-build-tool-vars.sh
bootstrap/lib/*/ebin
bootstrap/lib/*/include
bootstrap/bin/start*.script
Expand Down
1 change: 1 addition & 0 deletions aclocal.m4
79 changes: 73 additions & 6 deletions configure.in
@@ -1,8 +1,28 @@
dnl Process this file with autoconf to produce a configure script.

dnl %CopyrightBegin%
dnl
dnl Copyright Ericsson AB 1998-2010. All Rights Reserved.
dnl
dnl The contents of this file are subject to the Erlang Public License,
dnl Version 1.1, (the "License"); you may not use this file except in
dnl compliance with the License. You should have received a copy of the
dnl Erlang Public License along with this software. If not, it can be
dnl retrieved online at http://www.erlang.org/.
dnl
dnl Software distributed under the License is distributed on an "AS IS"
dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
dnl the License for the specific language governing rights and limitations
dnl under the License.
dnl
dnl %CopyrightEnd%

AC_PREREQ(2.8)dnl

AC_INIT()

LM_PRECIOUS_VARS

default_cache_file=./config.cache

if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then
Expand All @@ -19,6 +39,18 @@ if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then
cache_file=/dev/null
fi

case "X$ERL_TOP" in
X)
;;
X/*)
test -f $ERL_TOP/erts/emulator/beam/beam_emu.c || {
AC_MSG_ERROR([Invalid \$ERL_TOP])
}
srcdir="$ERL_TOP";;
*)
AC_MSG_ERROR([\$ERL_TOP needs to be absolute]);;
esac

dnl How to set srcdir absolute is taken from the GNU Emacs distribution
#### Make srcdir absolute, if it isn't already. It's important to
#### avoid running the path through pwd unnecessary, since pwd can
Expand All @@ -43,7 +75,7 @@ esac
#
# Now srcdir is absolute and also the top of Erlang distribution, ERL_TOP.
#
ERL_TOP=${srcdir}
test "X$ERL_TOP" != "X" || ERL_TOP="$srcdir"
AC_SUBST(ERL_TOP)

dnl
Expand All @@ -65,11 +97,35 @@ fi
TARGET=$host
AC_SUBST(TARGET)

if test X$cross_compiling = Xyes; then
CROSS_COMPILING=yes
else
CROSS_COMPILING=no
fi
AC_SUBST(CROSS_COMPILING)


AC_ARG_ENABLE(bootstrap-only,
[ --enable-bootstrap-only enable bootstrap only configuration],
[ if test "X$enableval" = "Xyes"; then
BOOTSTRAP_ONLY=yes
else
BOOTSTRAP_ONLY=no
fi
],
BOOTSTRAP_ONLY=no)

AC_SUBST(BOOTSTRAP_ONLY)

if test $CROSS_COMPILING = yes -a $BOOTSTRAP_ONLY = yes; then
AC_MSG_ERROR([Cannot both cross compile and build a bootstrap system])
fi

dnl Checks for programs.

AC_PROG_CC

AC_PROG_CXX
AC_CHECK_TOOL(LD, [ld])

#
# We need GNU make, complain if we can't find it
Expand Down Expand Up @@ -123,11 +179,17 @@ AC_PROG_LN_S
AC_PROG_RANLIB

#
# Get erts version from erts/vsn.mk
# Get erts version and otp release from erts/vsn.mk
#
[ERTS=erts-`sed -n 's/^VSN[ ]*=[ ]*\([0-9.]\)/\1/p' < erts/vsn.mk`]
AC_MSG_CHECKING([ERTS version])
[ERTS=erts-`sed -n "s/^VSN[ ]*=[ ]*\(.*\)/\1/p" < $ERL_TOP/erts/vsn.mk`]
AC_MSG_RESULT([$ERTS])
AC_SUBST(ERTS)

AC_MSG_CHECKING([OTP release])
[OTP=OTP-`sed -n "s/^SYSTEM_VSN[ ]*=[ ]*\(.*\)/\1/p" < $ERL_TOP/erts/vsn.mk`]
AC_MSG_RESULT([$OTP])
AC_SUBST(OTP)

AC_ARG_ENABLE(threads,
[ --enable-threads enable async thread support
Expand All @@ -147,6 +209,11 @@ AC_ARG_ENABLE(kernel-poll,
AC_ARG_ENABLE(hipe,
[ --enable-hipe enable hipe support
--disable-hipe disable hipe support])

AC_ARG_WITH(javac,
[ --with-javac=JAVAC specify Java compiler to use
--with-javac use a Java compiler if found (default)
--without-javac don't use any Java compiler])

AC_ARG_ENABLE(megaco_flex_scanner_lineno,
[ --enable-megaco-flex-scanner-lineno enable megaco flex scanner lineno
Expand Down Expand Up @@ -176,8 +243,8 @@ AC_ARG_ENABLE(erlang-mandir,
[ --disable-erlang-mandir do not install Erlang man pages in a private directory],
[ case "$enableval" in
no) erl_mandir=$mandir ;;
*) erl_mandir='$(ERLANG_ILIBDIR)/man' ;;
esac ], erl_mandir='$(ERLANG_ILIBDIR)/man')
*) erl_mandir='$(erlang_libdir)/man' ;;
esac ], erl_mandir='$(erlang_libdir)/man')
AC_SUBST(erl_mandir)

AC_ARG_ENABLE(darwin-universal,
Expand Down
28 changes: 28 additions & 0 deletions erl-build-tool-vars.sh
@@ -0,0 +1,28 @@
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2010. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# %CopyrightEnd%
#

#
# erl_build_tool_vars - Build tool configuration variables currently
# reqognized by `configure' scripts in OTP.
#
# NOTE:
# When updating, also update $ERL_TOP/xcomp/{README,erl-xcomp.conf.template},
# and precious variables in $ERL_TOP/erts/aclocal.m4.
#
erl_build_tool_vars="CC CFLAGS STATIC_CFLAGS CFLAG_RUNTIME_LIBRARY_PATH CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH RANLIB AR"

0 comments on commit 1b78e85

Please sign in to comment.